/* ========================================
   UI-KIT — Additive layer sobre styles.css
   No override de variables existentes.
   Solo agrega: fonts display, card hover, AOS-friendly, skeletons.
   ======================================== */

/* ---------- FONT UTILITIES (opt-in via class) ---------- */

.font-display {
    font-family: 'Space Grotesk', 'Inter', -apple-system, sans-serif;
    letter-spacing: -0.02em;
}

.font-pirate {
    font-family: 'Cinzel', 'Space Grotesk', serif;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Heavy weight para títulos impactantes */
h1.font-display, h2.font-display {
    font-weight: 700;
}

/* ---------- CARD PREMIUM HOVER ----------
   Compatible con tus variables --bg-card, --border-soft.
   Aplica a cualquier .card que no tenga .no-hover.
*/
.card:hover,
.bg-card:hover,
[class*="card-hover"]:hover {
    transform: translateY(-2px);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.2s ease,
                box-shadow 0.2s ease;
}

.card,
.bg-card {
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.2s ease,
                box-shadow 0.2s ease;
}

/* Subtle glow lima en hover para cards clickeables */
a.card:hover,
button.card:hover,
[role="button"].card:hover {
    border-color: rgba(191, 255, 0, 0.25) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(191, 255, 0, 0.1) inset;
}

/* ---------- AOS — custom timing cyber-dark ---------- */
[data-aos="fade-up"] {
    transition-property: transform, opacity, filter;
    transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-aos] {
    pointer-events: none;
}

[data-aos].aos-animate {
    pointer-events: auto;
}

/* ---------- ICONIFY defaults ---------- */
iconify-icon {
    display: inline-flex;
    vertical-align: -0.125em;
    line-height: 1;
}

/* ---------- SKELETON LOADER ---------- */
.skeleton {
    background: linear-gradient(90deg,
        var(--bg-elevated) 0%,
        var(--bg-hover) 50%,
        var(--bg-elevated) 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
    display: inline-block;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---------- FOCUS VISIBLE (a11y) ---------- */
*:focus-visible {
    outline: 2px solid var(--accent-lime);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ---------- PREFERS-REDUCED-MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    [data-aos] {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ---------- COUNTER ANIMATION UTILITY ---------- */
.counter {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* ---------- SCHEDULE TOGGLE (Crear Anuncio) ---------- */
.schedule-toggle {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* Preview del "cuándo se va a mandar" */
.schedule-moment-preview {
    margin-top: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--accent-lime-dim);
    border-left: 3px solid var(--accent-lime);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: var(--text-base);
    line-height: 1.5;
}

.schedule-moment-preview strong {
    color: var(--accent-lime);
    font-weight: 600;
}

.schedule-relative {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin-left: var(--space-1);
}

.schedule-option {
    flex: 1 1 200px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-input);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    transition: all 0.15s ease;
    user-select: none;
}

.schedule-option:hover {
    border-color: var(--border-focus);
    background: var(--bg-hover);
}

.schedule-option input[type="radio"] {
    accent-color: var(--accent-lime);
}

.schedule-option:has(input:checked) {
    border-color: var(--accent-lime);
    background: var(--accent-lime-dim);
    box-shadow: 0 0 0 1px var(--accent-lime) inset;
}

.schedule-option span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-base);
}

/* ---------- COLOR PICKER (Crear Anuncio) ---------- */
.color-picker-container {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.color-picker-input {
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    cursor: pointer;
    background: var(--bg-input);
}

.color-picker-input::-webkit-color-swatch-wrapper {
    padding: 4px;
}

.color-picker-input::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.color-preset {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border-medium);
    cursor: pointer;
    padding: 0;
    transition: transform 0.1s ease, border-color 0.15s ease;
}

.color-preset:hover {
    transform: scale(1.12);
    border-color: var(--accent-lime);
}

/* ---------- SUBSECTIONS (Programados, Plantillas, Historial) ---------- */
.announce-subsection {
    margin-top: var(--space-5);
}

.announce-subsection h3 {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    color: var(--text-primary);
    font-size: var(--text-xl);
}

/* ---------- LISTA ITEMS (scheduled/history/templates) ---------- */
.announce-list-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: var(--bg-input);
    margin-bottom: var(--space-2);
    transition: border-color 0.15s ease;
}

.announce-list-item:hover {
    border-color: var(--border-focus);
}

.announce-list-item-body {
    flex: 1;
    min-width: 0;
}

.announce-list-item-title {
    color: var(--text-primary);
    font-weight: 600;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.announce-list-item-meta {
    color: var(--text-muted);
    font-size: var(--text-sm);
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    align-items: center;
}

.announce-list-item-actions {
    display: flex;
    gap: var(--space-2);
}

.announce-status-badge {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.announce-status-badge.sent {
    background: var(--accent-lime-dim);
    color: var(--accent-lime);
}

.announce-status-badge.failed {
    background: var(--state-error-dim);
    color: var(--state-error);
}

.announce-status-badge.canceled {
    background: rgba(154, 154, 154, 0.1);
    color: var(--text-muted);
}

.announce-status-badge.pending {
    background: rgba(245, 192, 0, 0.1);
    color: var(--state-warning);
}

.text-muted {
    color: var(--text-muted);
}

/* ---------- TIMESTAMP INSERTER (HammerTime-like) ---------- */
.timestamp-insert-btn {
    margin-top: var(--space-3);
    padding: 8px 14px;
    font-size: var(--text-sm);
    font-weight: 600;
    background: var(--bg-input);
    border: 1px dashed var(--accent-lime);
    color: var(--accent-lime);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.timestamp-insert-btn:hover {
    background: var(--accent-lime-dim);
    border-style: solid;
    color: var(--accent-lime);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(191, 255, 0, 0.15);
}

.timestamp-insert-btn:active {
    transform: translateY(0);
}

.timestamp-insert-btn .emoji-icon {
    width: 16px;
    height: 16px;
}

/* ---------- ROLE PICKER retry button ---------- */
.role-picker-retry {
    margin-top: var(--space-2);
    width: 100%;
    padding: 6px 12px;
    font-size: var(--text-sm);
    justify-content: center;
}

.role-picker-retry .emoji-icon {
    width: 12px;
    height: 12px;
}

.role-picker-empty {
    color: var(--text-muted);
    padding: var(--space-2);
    text-align: center;
    font-size: var(--text-sm);
    line-height: 1.5;
}

/* ---------- WAR HISTORY detail (slots + signups) ---------- */
.war-history-item {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
}

/* ---------- ACTIVITY COLUMN (Última actividad) ---------- */
/* Por defecto oculto. Solo se muestra si body tiene .can-view-activity. */
.th-activity,
.td-activity {
    display: none;
}
body.can-view-activity .th-activity,
body.can-view-activity .td-activity {
    display: table-cell;
}

.th-activity {
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.activity-cell {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    white-space: nowrap;
}

.activity-cell .activity-line {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.activity-cell .activity-total {
    font-size: 10px;
    color: var(--text-muted);
}

.activity-cell.activity-live {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.activity-live-pulse {
    display: inline-block;
    color: #22c55e;
    animation: activity-pulse 1.5s ease-in-out infinite;
}

@keyframes activity-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.activity-channel {
    color: var(--text-muted);
    font-size: 10px;
    margin-left: 4px;
}

.activity-empty {
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-style: italic;
}

/* Form de Anuncio de Guerra: hereda los 900px del .announcement-creator
   base, igual que Crear Anuncio. Antes tenía max-width:none y se veía estirado. */
#discord-warSection .announcement-preview {
    max-width: 560px;
}

/* (Eliminado el grid de 2 columnas — ahora todo apilado vertical.) */
@media (max-width: 980px) {
    .war-form-grid {
        grid-template-columns: 1fr;
    }
}

.war-history-item .announce-list-item-body {
    width: 100%;
}

.war-history-item .announce-list-item-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    border-top: 1px solid var(--border-subtle);
    padding-top: var(--space-3);
}

#warHistoryList {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

#warHistoryList > .announce-list-item {
    margin-bottom: 0;
}

/* Anuncio desactivado: atenuar todo el item pero dejarlo legible */
.war-history-item.war-history-inactive {
    opacity: 0.72;
    border-left: 3px solid var(--state-warning, #f59e0b);
}

/* Badge "Desactivado" junto al título */
.war-badge {
    display: inline-block;
    padding: 2px 8px;
    margin-left: var(--space-2);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 999px;
    vertical-align: middle;
}
.war-badge-inactive {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Banner de modo edición en el form de guerra */
.war-edit-banner {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-3);
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
    color: #fbbf24;
    font-size: var(--text-sm);
    align-items: center;
}

.war-detail {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-subtle);
    width: 100%;
}

.war-slots-label {
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-weight: 600;
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.war-slot {
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-2);
    background: var(--bg-elevated);
    border-left: 2px solid var(--border-medium);
    border-radius: 4px;
}

.war-slot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.war-slot-name {
    color: var(--text-primary);
    font-weight: 600;
    font-size: var(--text-base);
}

.war-slot-tier {
    color: var(--accent-lime);
    font-size: var(--text-xs);
    background: var(--accent-lime-dim);
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 4px;
}

.war-slot-count {
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
}

.war-slot-users {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.4;
}

.war-slot-users.war-slot-vacant {
    color: var(--text-dim);
    font-style: italic;
}

.war-slot-empty {
    color: var(--text-dim);
    font-size: var(--text-sm);
    font-style: italic;
}

.war-apoyos {
    margin-top: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: rgba(245, 192, 0, 0.06);
    border-left: 2px solid var(--state-warning);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.war-apoyos-label {
    color: var(--state-warning);
    font-weight: 600;
}

.war-summary {
    margin-top: var(--space-3);
    padding: var(--space-2);
    background: var(--bg-input);
    border-radius: 4px;
    color: var(--accent-lime);
    font-size: var(--text-sm);
    font-weight: 600;
    text-align: center;
}

.timestamp-preview {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-input);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    min-height: 60px;
}

.ts-preview-rendered {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--accent-lime);
    margin-bottom: var(--space-1);
}

.ts-preview-token {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin-bottom: var(--space-1);
}

.ts-preview-token code {
    background: var(--bg-elevated);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-soft);
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.ts-preview-hint {
    color: var(--text-muted);
    font-size: var(--text-xs);
    margin-top: var(--space-1);
}

/* ---------- MI FLOTA — assign badge + button ----------
   Additive sobre .ship-card para la sección "Asignar Nuevo Barco".
*/
.ship-assigned-badge {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 999px;
    backdrop-filter: blur(4px);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Botón full-width en el footer de ship-card (sección asignar) */
.ship-card-footer .btn {
    font-size: var(--text-xs);
    padding: 6px 10px;
    justify-content: center;
}

/* ============================================================
   v2 ADDITIVE LAYER — Visual upgrade system
   No override de styles.css. Solo utilidades nuevas.
   ============================================================ */

/* ---------- FACCIÓN — variables y accents ---------- */
:root {
    --faction-espanol: #ef4444;
    --faction-antilia: #22c55e;
    --faction-kai:     #facc15;
    --faction-imperial:#fbbf24;
    --faction-neutral: #94a3b8;
    --faction-espanol-dim: rgba(239, 68, 68, 0.12);
    --faction-antilia-dim: rgba(34, 197, 94, 0.12);
    --faction-kai-dim:     rgba(250, 204, 21, 0.12);
    --faction-imperial-dim:rgba(251, 191, 36, 0.12);
    --faction-neutral-dim: rgba(148, 163, 184, 0.12);

    /* Easing premium */
    --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
    --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Barra lateral coloreada por facción en ship-cards */
.ship-card.faction-espanol  { border-left: 3px solid var(--faction-espanol); }
.ship-card.faction-antilia  { border-left: 3px solid var(--faction-antilia); }
.ship-card.faction-kai      { border-left: 3px solid var(--faction-kai); }
.ship-card.faction-imperial { border-left: 3px solid var(--faction-imperial); }
.ship-card.faction-neutral  { border-left: 3px solid var(--faction-neutral); }

/* ---------- BADGE SYSTEM (unificado) ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: var(--bg-deep);
    color: var(--text-secondary);
    white-space: nowrap;
    line-height: 1.2;
}
.badge-success { background: var(--accent-lime-dim); color: var(--accent-lime); border-color: rgba(191,255,0,0.3); }
.badge-warning { background: rgba(245,192,0,0.12); color: var(--state-warning); border-color: rgba(245,192,0,0.3); }
.badge-danger  { background: var(--state-error-dim); color: var(--state-error); border-color: rgba(255,68,68,0.3); }
.badge-info    { background: rgba(56,189,248,0.12); color: #38bdf8; border-color: rgba(56,189,248,0.3); }
.badge-neutral { background: rgba(154,154,154,0.1); color: var(--text-muted); }

/* Rank chips — usa variables existentes --rank-* */
.rank-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    background: currentColor;
    color: var(--bg-void) !important;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.rank-chip span { color: var(--bg-void); }
.rank-chip[data-rank="Superadmin"] { background: var(--rank-superadmin); color: #fff; }
.rank-chip[data-rank="Superadmin"] span { color: #fff; }
.rank-chip[data-rank="Fundador"]   { background: var(--rank-fundador); color: #fff; }
.rank-chip[data-rank="Fundador"] span { color: #fff; }
.rank-chip[data-rank="Almirante"]  { background: var(--rank-almirante); color: #fff; }
.rank-chip[data-rank="Almirante"] span { color: #fff; }
.rank-chip[data-rank="Comodoro"]   { background: var(--rank-comodoro); color: var(--bg-void); }
.rank-chip[data-rank="Oficial"]    { background: var(--rank-oficial); color: var(--bg-void); }
.rank-chip[data-rank="Guardian"]   { background: var(--rank-guardian); color: var(--bg-void); }
.rank-chip[data-rank="Marinero"]   { background: var(--rank-marinero); color: #fff; }
.rank-chip[data-rank="Marinero"] span { color: #fff; }
.rank-chip[data-rank="Grumete"]    { background: var(--rank-grumete); color: #fff; }
.rank-chip[data-rank="Grumete"] span { color: #fff; }
.rank-chip[data-rank="Recluta"]    { background: var(--rank-recluta); color: #fff; }
.rank-chip[data-rank="Recluta"] span { color: #fff; }

/* ---------- METRIC CARD (stat arriba de tablas) ---------- */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}
.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s var(--ease-smooth), transform 0.2s var(--ease-smooth);
}
.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-lime);
    opacity: 0.4;
    transition: opacity 0.2s ease;
}
.metric-card:hover { border-color: var(--border-focus); transform: translateY(-1px); }
.metric-card:hover::before { opacity: 1; }
.metric-card[data-accent="lime"]::before { background: var(--accent-lime); }
.metric-card[data-accent="warning"]::before { background: var(--state-warning); }
.metric-card[data-accent="info"]::before { background: #38bdf8; }
.metric-card[data-accent="danger"]::before { background: var(--state-error); }
.metric-card-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
    font-weight: 600;
}
.metric-card-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-bright);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    letter-spacing: -0.02em;
}
.metric-card-trend {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: var(--space-1);
    font-family: var(--font-mono);
}
.metric-card-trend.up { color: var(--accent-lime); }
.metric-card-trend.down { color: var(--state-error); }

/* ---------- STAT BAR (visualización de stats de barcos) ---------- */
.stat-bar {
    display: grid;
    grid-template-columns: 16px 1fr 32px;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: var(--text-secondary);
    font-family: var(--font-mono, monospace);
}
.stat-bar-track {
    height: 4px;
    background: var(--bg-deep);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}
.stat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-lime), #84cc16);
    border-radius: 2px;
    transition: width 0.4s var(--ease-smooth);
}
.stat-bar-value {
    text-align: right;
    color: var(--text-primary);
    font-weight: 600;
}

/* Stat grid para cards de barco */
.ship-card-stats-v2 {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: var(--space-2);
    border-top: 1px dashed var(--border-subtle);
}

/* ---------- TIER NAV CHIPS (catálogo / mi-flota) ---------- */
.tier-nav {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: var(--space-5);
    padding: var(--space-2);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}
.tier-nav-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 6px 10px;
    background: var(--bg-deep);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s var(--ease-smooth);
    font-family: var(--font-display);
}
.tier-nav-chip:hover {
    color: var(--accent-lime);
    border-color: var(--accent-lime);
    transform: translateY(-1px);
}
.tier-nav-chip.active {
    background: var(--accent-lime);
    color: var(--bg-void);
    border-color: var(--accent-lime);
}
.tier-nav-chip-count {
    font-size: 9px;
    opacity: 0.7;
    margin-left: 4px;
    font-weight: 500;
}

/* ---------- EMPTY STATE premium ---------- */
.empty-state-premium {
    text-align: center;
    padding: var(--space-8) var(--space-4);
    color: var(--text-secondary);
}
.empty-state-premium .empty-icon-large {
    font-size: 64px;
    opacity: 0.3;
    margin-bottom: var(--space-3);
    filter: grayscale(0.4);
}
.empty-state-premium h3 {
    color: var(--text-primary);
    font-size: var(--text-xl);
    margin: 0 0 var(--space-2) 0;
    font-weight: 700;
}
.empty-state-premium p {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin: 0;
}

/* ---------- SECTION DIVIDER con icono ---------- */
.section-divider {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: var(--space-5) 0 var(--space-3) 0;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}
.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-soft), transparent);
}

/* ---------- PODIUM (Hall of Fame top 3) ---------- */
.podium {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-3);
    align-items: end;
    margin: var(--space-6) 0;
}
.podium-item {
    text-align: center;
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    position: relative;
    transition: transform 0.3s var(--ease-spring);
}
.podium-item:hover { transform: translateY(-4px); }
.podium-item.rank-1 {
    border-color: rgba(251, 191, 36, 0.5);
    background: linear-gradient(180deg, rgba(251,191,36,0.08), var(--bg-card));
    order: 2;
    min-height: 220px;
}
.podium-item.rank-2 {
    border-color: rgba(148, 163, 184, 0.4);
    background: linear-gradient(180deg, rgba(148,163,184,0.06), var(--bg-card));
    order: 1;
    min-height: 190px;
}
.podium-item.rank-3 {
    border-color: rgba(180, 83, 9, 0.4);
    background: linear-gradient(180deg, rgba(180,83,9,0.06), var(--bg-card));
    order: 3;
    min-height: 170px;
}
.podium-medal {
    font-size: 32px;
    margin-bottom: var(--space-2);
    display: block;
}
.podium-rank-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}
.podium-name {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 4px;
    word-break: break-word;
}
.podium-score {
    font-size: var(--text-2xl);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}
.podium-item.rank-1 .podium-score { color: var(--rank-oficial); }
.podium-item.rank-2 .podium-score { color: var(--faction-neutral); }
.podium-item.rank-3 .podium-score { color: #b45309; }

@media (max-width: 768px) {
    .podium { grid-template-columns: 1fr; }
    .podium-item.rank-1 { order: 1; min-height: 0; }
    .podium-item.rank-2 { order: 2; min-height: 0; }
    .podium-item.rank-3 { order: 3; min-height: 0; }
}

/* ---------- TABLA premium hover + zebra ---------- */
.premium-table {
    width: 100%;
    border-collapse: collapse;
}
.premium-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-elevated);
    backdrop-filter: blur(8px);
    z-index: 2;
    border-bottom: 1px solid var(--border-medium);
}
.premium-table tbody tr {
    transition: background 0.1s ease;
    border-bottom: 1px solid var(--border-subtle);
}
.premium-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.015);
}
.premium-table tbody tr:hover {
    background: var(--accent-lime-dim) !important;
}
.premium-table tbody tr:hover td {
    color: var(--text-bright);
}

/* ---------- LIVE PREVIEW (Discord Announce) ---------- */
.live-preview {
    background: #313338;
    border-radius: 8px;
    padding: var(--space-4);
    color: #dbdee1;
    font-family: 'Inter', sans-serif;
    min-height: 200px;
    border: 1px solid #1e1f22;
}
.live-preview-empty {
    color: #80848e;
    text-align: center;
    padding: var(--space-8);
    font-size: var(--text-sm);
}
.live-preview-msg {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
}
.live-preview-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-lime);
    color: var(--bg-void);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}
.live-preview-content { flex: 1; min-width: 0; }
.live-preview-author {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}
.live-preview-name { color: #fff; font-weight: 600; font-size: 14px; }
.live-preview-time { color: #80848e; font-size: 11px; }
.live-preview-embed {
    margin-top: 8px;
    border-left: 4px solid var(--accent-lime);
    background: #2b2d31;
    border-radius: 0 4px 4px 0;
    padding: 12px;
    max-width: 440px;
}
.live-preview-embed-title { color: #fff; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.live-preview-embed-desc { color: #dbdee1; font-size: 13px; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; }

/* ---------- TOOLTIP (ventanas ataque) ---------- */
.tooltip {
    position: relative;
}
.tooltip[data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-deep);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    border: 1px solid var(--border-soft);
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* ---------- PROGRESS BAR global ---------- */
.progress {
    height: 6px;
    background: var(--bg-deep);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--accent-lime);
    border-radius: 3px;
    transition: width 0.4s var(--ease-smooth);
}
.progress-fill.warning { background: var(--state-warning); }
.progress-fill.danger { background: var(--state-error); }

/* ---------- AVATAR circular con initials ---------- */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
    flex-shrink: 0;
    overflow: hidden;
}
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- SAVE STATE indicator ---------- */
.save-state {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}
.save-state::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}
.save-state.saved { color: var(--accent-lime); }
.save-state.saved::before { background: var(--accent-lime); box-shadow: 0 0 8px var(--accent-lime-glow); }
.save-state.pending { color: var(--state-warning); }
.save-state.pending::before { background: var(--state-warning); animation: pulse-soft 1.5s infinite; }
.save-state.error { color: var(--state-error); }
.save-state.error::before { background: var(--state-error); }

@keyframes pulse-soft {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ---------- ENTRADA animada (cards entrance) ---------- */
.fade-in-up {
    animation: fadeInUp 0.4s var(--ease-spring) both;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   BATCH 2 — Torneo + Flota Clan + Historial + Discord polish
   ============================================================ */

/* ---------- TORNEO bracket mejorado ---------- */
.bracket-layout {
    background:
        radial-gradient(ellipse 80% 60% at 50% 50%, rgba(191, 255, 0, 0.03), transparent 70%),
        var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    overflow-x: auto;
}

.match-card {
    background: linear-gradient(180deg, var(--bg-elevated), var(--bg-card));
    backdrop-filter: blur(4px);
    min-width: 200px;
}

.match-card.final-match {
    background: linear-gradient(180deg, rgba(191, 255, 0, 0.05), var(--bg-card));
    border-color: rgba(191, 255, 0, 0.4);
    box-shadow: 0 0 24px rgba(191, 255, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.match-player.winner {
    background: linear-gradient(90deg, rgba(191, 255, 0, 0.18), rgba(191, 255, 0, 0.04));
    border-left: 3px solid var(--accent-lime);
    box-shadow: inset 0 0 0 1px rgba(191, 255, 0, 0.1);
}

.match-player.winner .match-player-name {
    color: var(--accent-lime);
    font-weight: 700;
}

.match-player.loser .match-player-name {
    text-decoration: line-through;
    text-decoration-color: rgba(255, 255, 255, 0.2);
}

/* Avatar del match-player con iniciales reales */
.match-player-avatar.avatar {
    background: linear-gradient(135deg, var(--bg-hover), var(--bg-deep));
    color: var(--text-secondary);
    font-weight: 700;
    border: 1px solid var(--border-medium);
}
.match-player.winner .match-player-avatar.avatar {
    background: linear-gradient(135deg, var(--accent-lime), #84cc16);
    color: var(--bg-void);
    border-color: var(--accent-lime);
}

/* Champion showcase mejorado */
.final-winner {
    text-align: center;
    padding: var(--space-6) var(--space-4);
    background:
        radial-gradient(ellipse at center, rgba(251, 191, 36, 0.15), transparent 60%),
        linear-gradient(180deg, rgba(251, 191, 36, 0.05), var(--bg-card));
    border: 2px solid rgba(251, 191, 36, 0.4);
    border-radius: var(--radius-lg);
    box-shadow: 0 0 40px rgba(251, 191, 36, 0.2);
    min-width: 220px;
}

.trophy-display {
    font-size: 64px;
    margin-bottom: var(--space-3);
    filter: drop-shadow(0 0 16px rgba(251, 191, 36, 0.6));
    animation: trophy-pulse 2s ease-in-out infinite;
}

@keyframes trophy-pulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 16px rgba(251, 191, 36, 0.6)); }
    50% { transform: scale(1.05); filter: drop-shadow(0 0 24px rgba(251, 191, 36, 0.8)); }
}

.winner-announcement {
    font-family: 'Cinzel', serif;
    font-size: 14px;
    font-weight: 900;
    color: var(--rank-oficial);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: var(--space-2);
}

.winner-name {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--text-bright);
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

/* Round titles con progresión visual */
.bracket-round:nth-child(1) .round-title { color: var(--text-muted); }
.bracket-round:nth-child(2) .round-title { color: var(--text-secondary); }
.bracket-round:nth-child(3) .round-title { color: var(--accent-lime); }

/* ---------- HISTORIAL time filters + sparkline ---------- */
.time-filter-row {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}
.time-chip {
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s var(--ease-smooth);
    font-weight: 600;
}
.time-chip:hover {
    border-color: var(--accent-lime);
    color: var(--accent-lime);
}
.time-chip.active {
    background: var(--accent-lime);
    color: var(--bg-void);
    border-color: var(--accent-lime);
}

.sparkline-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-4);
}
.sparkline-svg {
    flex: 1;
    height: 50px;
}
.sparkline-stats {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sparkline-stat-value {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--text-bright);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.sparkline-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
}

/* ---------- FLOTA CLAN heatmap ---------- */
.fleet-matrix {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    overflow-x: auto;
    margin-top: var(--space-4);
}
.fleet-matrix-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 6px;
    min-width: 600px;
}
.fleet-matrix-table th {
    padding: var(--space-2);
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    text-align: center;
}
.fleet-matrix-table td {
    text-align: center;
    padding: 4px;
}
.fleet-matrix-user {
    text-align: left !important;
    color: var(--text-primary);
    font-weight: 600;
    white-space: nowrap;
    min-width: 140px;
}
.fleet-matrix-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-deep);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    transition: transform 0.15s var(--ease-smooth);
    cursor: default;
    position: relative;
}
.fleet-matrix-cell[data-count="0"] {
    color: var(--text-dim);
    background: transparent;
}
.fleet-matrix-cell:not([data-count="0"]):hover {
    transform: scale(1.15);
    z-index: 2;
}
.fleet-matrix-cell[data-tier="I"]    { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.fleet-matrix-cell[data-tier="II"]   { background: rgba(249, 115, 22, 0.2); color: #fdba74; }
.fleet-matrix-cell[data-tier="III"]  { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.fleet-matrix-cell[data-tier="IV"]   { background: rgba(132, 204, 22, 0.2); color: #bef264; }
.fleet-matrix-cell[data-tier="V"]    { background: rgba(34, 197, 94, 0.2); color: #86efac; }
.fleet-matrix-cell[data-tier="VI"]   { background: rgba(20, 184, 166, 0.2); color: #5eead4; }
.fleet-matrix-cell[data-tier="VII"]  { background: rgba(191, 255, 0, 0.25); color: var(--accent-lime); box-shadow: 0 0 8px rgba(191,255,0,0.3); }

/* ---------- DISCORD bot status banner variants ---------- */
.metric-card[data-accent="danger"]::before { background: var(--state-error); }

/* ---------- VENTANAS ATAQUE — timezone cols flex para llenar width ---------- */
.attack-windows-grid {
    /* Override de styles.css: timezone cols a 1fr para llenar hueco derecho */
    grid-template-columns: 150px 100px repeat(19, minmax(60px, auto)) repeat(6, minmax(140px, 1fr)) !important;
    width: 100% !important;
    min-width: max-content;
}
.attack-windows-cell.timezone {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}
.attack-windows-cell.timezone .timezone-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}
.attack-windows-cell.timezone .timezone-offset {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ---------- TORNEO — bracket ocupa todo el alto disponible ---------- */
.bracket-layout {
    min-height: 520px;
    align-items: stretch !important;
}
.bracket-side {
    justify-content: space-around !important;
}
.bracket-round {
    justify-content: space-around !important;
    flex: 1;
    min-height: 480px;
}
.bracket-center {
    min-width: 240px !important;
}
.match-card {
    min-width: 220px;
}
.match-player {
    padding: var(--space-3) var(--space-3) !important;
    min-height: 44px;
}
.match-player-name {
    font-size: var(--text-base) !important;
    font-weight: 600 !important;
}
.match-player-role {
    font-size: 11px !important;
}

/* ---------- TORNEO — participants grid por categorías ---------- */
.participants-grid {
    max-height: none !important;
    overflow-y: visible !important;
    display: flex !important;
    flex-direction: column;
    gap: var(--space-4) !important;
    grid-template-columns: none !important;
}

.participant-category {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-3);
}
.participant-category-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-subtle);
}
.participant-category-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 6px currentColor;
}
.participant-category-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex: 1;
}
.participant-category-count {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    padding: 2px 8px;
    background: var(--bg-deep);
    border-radius: 999px;
    font-weight: 600;
}

.participant-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-2);
}

.participant-item {
    padding: var(--space-2) var(--space-3) !important;
    gap: 4px !important;
    align-items: flex-start !important;
    flex-direction: column !important;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s var(--ease-smooth);
    min-height: 56px;
}
.participant-item:hover {
    border-color: rgba(191, 255, 0, 0.3);
    background: var(--accent-lime-dim);
}
.participant-item:has(input:checked) {
    border-color: var(--accent-lime);
    background: var(--accent-lime-dim);
    box-shadow: 0 0 0 1px rgba(191, 255, 0, 0.2) inset;
}
.participant-item input[type="checkbox"] {
    position: absolute;
    top: 6px;
    right: 6px;
    margin: 0;
    accent-color: var(--accent-lime);
}
.participant-item-name {
    font-size: 13px !important;
    color: var(--text-primary);
    font-weight: 600;
    /* Nombres largos: wrap a 2 líneas máximo */
    white-space: normal !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.25;
    word-break: break-word;
    max-width: 100%;
    padding-right: 18px;
}
.participant-item-role {
    font-size: 10px !important;
    margin-top: auto;
}
.participant-item-role .rank-chip {
    font-size: 9px;
    padding: 2px 6px;
}

/* Sort chip para torneo */
.participant-sort-btn {
    cursor: pointer;
}

/* ============================================================
   MODAL + NOTIFICATION polish
   ============================================================ */

/* Kill browser autocomplete dropdowns globalmente — el usuario los odia */
input[type="text"]:not([autocomplete]),
input[type="search"]:not([autocomplete]),
input[type="url"]:not([autocomplete]),
input[type="email"]:not([autocomplete]),
textarea:not([autocomplete]) {
    /* NO autosuggest, NO autocorrect, NO spellcheck overlay */
}

/* Modal: scale-in entry solamente.
   NO backdrop-filter: blur — causa lag al escribir en modals cuando hay páginas
   pesadas detrás (tabla de 102 miembros con 800+ celdas). styles.css ya lo
   quitó con el mismo rationale. No re-agregar. */
.modal:not(.hidden) {
    animation: modal-fade-in 0.2s var(--ease-spring) both;
}
.modal:not(.hidden) {
    animation: modal-fade-in 0.2s var(--ease-spring) both;
}
.modal:not(.hidden) > .modal-content,
.modal:not(.hidden) > div > .modal-content,
.modal:not(.hidden) > .modal-backdrop + * {
    animation: modal-scale-in 0.25s var(--ease-spring) both;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes modal-scale-in {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Toast notifications: shadow más rico + entrada más fluida */
.toast,
#toastContainer > * {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) inset !important;
    animation: toast-slide-in 0.3s var(--ease-spring) both;
}
@keyframes toast-slide-in {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Inputs focus ring más premium */
.input-field:focus,
.input-field:focus-visible {
    border-color: var(--accent-lime) !important;
    box-shadow: 0 0 0 3px rgba(191, 255, 0, 0.12) !important;
    outline: none !important;
    transition: border-color 0.15s var(--ease-smooth), box-shadow 0.15s var(--ease-smooth);
}

/* Buttons press feedback */
.btn:not(:disabled):active {
    transform: scale(0.97);
    transition: transform 0.08s var(--ease-spring);
}

/* ---------- MAPA ESTRATÉGICO — toolbar v2 ---------- */
#mapCanvas.delete-cursor { cursor: crosshair !important; }

.map-toolbar-v2 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: var(--space-3);
}
.map-tool-v2 {
    background: linear-gradient(180deg, var(--bg-elevated), var(--bg-deep));
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px 4px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.15s var(--ease-spring);
    position: relative;
    overflow: hidden;
}
.map-tool-v2::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-lime);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.2s var(--ease-spring);
}
.map-tool-v2:hover {
    color: var(--accent-lime);
    border-color: rgba(191, 255, 0, 0.4);
    transform: translateY(-1px);
    background: linear-gradient(180deg, var(--bg-hover), var(--bg-elevated));
}
.map-tool-v2:hover::before { transform: scaleX(0.7); }
.map-tool-v2.active {
    color: var(--accent-lime);
    border-color: var(--accent-lime);
    background: linear-gradient(180deg, rgba(191,255,0,0.12), var(--bg-elevated));
    box-shadow: 0 0 0 1px rgba(191, 255, 0, 0.15) inset, 0 4px 12px rgba(191, 255, 0, 0.08);
}
.map-tool-v2.active::before { transform: scaleX(1); }
.map-tool-v2-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.map-tool-v2-danger:hover {
    color: var(--state-error) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
}
.map-tool-v2-danger:hover::before { background: var(--state-error) !important; }
#mapDeleteModeBtn.active {
    background: linear-gradient(180deg, rgba(239,68,68,0.18), var(--bg-elevated)) !important;
    border-color: var(--state-error) !important;
    color: var(--state-error) !important;
    animation: pulse-soft 1.5s infinite;
}
#mapDeleteModeBtn.active::before { background: var(--state-error) !important; transform: scaleX(1) !important; }

/* Size block — más limpio */
.map-size-block {
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: var(--space-2);
    margin-top: var(--space-2);
}
.map-size-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.map-size-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    min-width: 44px;
}
.map-size-slider {
    flex: 1;
    accent-color: var(--accent-lime);
    cursor: pointer;
    height: 4px;
}
.map-size-value {
    font-size: 11px;
    color: var(--accent-lime);
    font-weight: 700;
    min-width: 36px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.map-size-presets {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}
.map-size-presets button {
    padding: 5px 4px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.12s var(--ease-smooth);
    font-variant-numeric: tabular-nums;
}
.map-size-presets button:hover {
    background: var(--accent-lime-dim);
    color: var(--accent-lime);
    border-color: rgba(191, 255, 0, 0.3);
    transform: translateY(-1px);
}

/* ---------- CANALES list pills ---------- */
.channel-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    transition: all 0.15s ease;
    margin: 4px;
}
.channel-pill:hover {
    border-color: var(--accent-lime);
    color: var(--text-primary);
}
.channel-pill-icon {
    font-size: 14px;
    color: var(--text-muted);
}
.channel-pill.connected {
    border-color: rgba(191, 255, 0, 0.3);
    background: var(--accent-lime-dim);
    color: var(--accent-lime);
}

/* ---------- COMANDOS card ---------- */
.command-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    transition: all 0.2s var(--ease-smooth);
}
.command-card:hover {
    border-color: rgba(191, 255, 0, 0.3);
    transform: translateY(-1px);
}
.command-card-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--accent-lime-dim);
    color: var(--accent-lime);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.command-card-body { flex: 1; min-width: 0; }
.command-card-name {
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}
.command-card-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.command-card.disabled {
    opacity: 0.5;
}
.command-card.disabled .command-card-icon {
    background: rgba(154, 154, 154, 0.1);
    color: var(--text-muted);
}

/* ============================================================
   FIXES CRÍTICOS — spinner roto + button loading state unificado
   Additive: no toca styles.css.
   ============================================================ */

/* Fix #1: .spinner-small usaba --gray-100 y --accent-color que NO existen en :root.
   El border-bottom quedaba transparente y el spinner se veía como círculo gris muerto. */
.spinner-small {
    border: 3px solid var(--border-medium) !important;
    border-top: 3px solid var(--accent-lime) !important;
}

/* Fix #2: estado de loading unificado para botones.
   JS solo necesita: btn.setAttribute('aria-busy','true'); btn.disabled = true;
   Al revertir: btn.removeAttribute('aria-busy'); btn.disabled = false; */
.btn[aria-busy="true"] {
    color: transparent !important;
    pointer-events: none !important;
    position: relative;
    opacity: 0.85;
}
.btn[aria-busy="true"] > * {
    visibility: hidden;
}
.btn[aria-busy="true"]::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border: 2px solid var(--accent-lime);
    border-top-color: transparent;
    border-radius: 50%;
    animation: btn-busy-spin 0.7s linear infinite;
}
@keyframes btn-busy-spin {
    to { transform: rotate(360deg); }
}

/* Fix #3: contraste WCAG AA — texto <14px en --text-muted cae a ~3:1 sobre bg dark.
   Audit 2026-06-19: promover a --text-secondary (mantiene jerarquía, sube ratio a ~6:1). */
.metric-card-label,
.bulk-user-points,
.toast-message,
.announce-status-badge,
.sparkline-stat-label {
    color: var(--text-secondary);
}

/* Scroll suave en anchor clicks (skill: interactivity) */
html {
    scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

/* ============================================================
   FIX #4 — Convención de radius (audit 2026-06-19)
   Sistema consistente para evitar mezcla visual entre componentes.
   sm=4px (chips, rows inline) | md=6px (inputs, badges, small cards)
   lg=8px (content cards, tables, list items) | xl=12px (modals, overlays)
   Esta sección solo corrige outliers puntuales. No mas-rewrite.
   ============================================================ */

/* .timestamp-insert-btn era 8px pero es un control (botón), no contenido */
.timestamp-insert-btn { border-radius: var(--radius-md); }

/* .ts-preview-token code era 4px pero es código legible (texto), subir a sm */
.ts-preview-token code { border-radius: var(--radius-sm); }

/* Fix #5 — Badge "Rango Superior" como chip compacto.
   Sin :has() (caro en DOMs grandes como este con 700+ celdas attack grid).
   Solo estiliza el label — el posicionamiento queda a cargo del flex del padre. */
.rank-superior-label {
    display: inline-flex !important;
    align-items: center;
    font-size: 9px !important;
    padding: 2px 6px !important;
    margin-top: 2px;
    border-radius: var(--radius-sm) !important;
    background: rgba(251, 191, 36, 0.12);
    color: var(--accent-gold) !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid rgba(251, 191, 36, 0.25);
    align-self: flex-start;
}

/* ==================== ENCUESTAS (polls nativas de Discord) ====================
   Estilo alineado con la sección "Anuncio de Guerra": dark elevated,
   accent lima (#bfff00), slot rows con index badge y remove btn rojo. */

.poll-panel {
    background: var(--bg-elevated, #111);
    border: 1px solid var(--border-subtle, #1a1a1a);
    border-radius: var(--radius-md, 6px);
    padding: var(--space-3, 12px);
    margin-top: 4px;
    margin-bottom: var(--space-3, 12px);
}

.poll-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: var(--space-2, 8px);
    margin-bottom: var(--space-3, 12px);
    border-bottom: 1px solid var(--border-subtle, #1a1a1a);
}
.poll-panel-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-lime, #bfff00);
}
.poll-panel-meta {
    font-size: 11px;
    color: var(--text-secondary, #9a9a9a);
}

.war-label {
    font-size: var(--text-xs, 11px);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary, #9a9a9a);
}
.poll-options-count {
    text-transform: none;
    font-weight: 400;
    opacity: 0.7;
}

.poll-options-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2, 8px);
    margin-bottom: var(--space-2, 8px);
}

.poll-option-row {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
    padding: var(--space-2, 8px) var(--space-3, 12px);
    background: var(--bg-input, #0f0f0f);
    border: 1px solid var(--border-subtle, #1a1a1a);
    border-radius: var(--radius-md, 6px);
    transition: border-color 0.15s ease;
}
.poll-option-row:focus-within {
    border-color: var(--accent-lime, #bfff00);
}

.poll-option-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 1px 6px;
    background: rgba(191, 255, 0, 0.08);
    color: var(--accent-lime, #bfff00);
    border-radius: var(--radius-sm, 4px);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.poll-option-row .input-field {
    flex: 1;
    background: transparent;
    border: none;
    padding: 4px 0;
}
.poll-option-row .input-field:focus {
    outline: none;
}

.poll-option-remove {
    background: transparent;
    border: 1px solid var(--state-error, #ff4444);
    color: var(--state-error, #ff4444);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm, 4px);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease;
}
.poll-option-remove:hover {
    background: rgba(255, 68, 68, 0.12);
}

.poll-add-btn {
    color: var(--accent-lime, #bfff00) !important;
    border-color: rgba(191, 255, 0, 0.3) !important;
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* Vista previa de la poll dentro del embed en vivo */
.preview-poll {
    margin-top: var(--space-3, 12px);
    padding: var(--space-3, 12px);
    background: #2b2d31;
    border-radius: var(--radius-md, 6px);
    border-left: 4px solid var(--accent-lime, #bfff00);
}
.preview-poll-question {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: var(--space-2, 8px);
    color: #dbdee1;
}
.preview-poll-answers {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.preview-poll-answer {
    display: flex;
    align-items: center;
    gap: var(--space-2, 8px);
    padding: var(--space-2, 8px) var(--space-3, 12px);
    background: #1e1f22;
    border-radius: var(--radius-sm, 4px);
    font-size: 12px;
    color: #dbdee1;
}
.preview-poll-bullet {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-lime, #bfff00);
    flex-shrink: 0;
}
.preview-poll-meta {
    margin-top: var(--space-2, 8px);
    font-size: 11px;
    color: #80848e;
}


