/* ============================================================================
   battle-lab.css — Estilos de página Battle Lab (/simulator).
   Solo lo genuinamente único e irreductible de esta página. Componentes
   reutilizables (stat-card, panel, btn--, badge, skeleton) van en
   components.css. Layout y features complejas de la UI de simulación van acá.
   Todo usa var(--...) — cero hex, cero px de color hardcodeado.
============================================================================ */

/* ── Container ─────────────────────────────────────────────────────────── */
.battle-lab {
    max-width: 1120px;
    margin: 0 auto;
    padding: var(--space-8) var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

/* ── Setup state — flex column so children get consistent gap ───────────── */
.bl-setup {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

/* ── Page header ────────────────────────────────────────────────────────── */
.bl-head {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.bl-head__title {
    font-size: var(--font-size-4xl);
    font-weight: 900;
    color: var(--text);
    line-height: var(--line-tight);
    letter-spacing: -0.02em;
    margin: 0;
}
.bl-head__sub {
    font-size: var(--font-size-lg);
    color: var(--text-muted);
    margin: 0;
}
.bl-head__meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* ── Deck pickers — 2-column desktop, stacked mobile ───────────────────── */
.bl-pickers {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
@media (min-width: 1024px) {
    .bl-pickers {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--space-6);
        align-items: start;
    }
}

.bl-picker {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.bl-picker__label {
    font-size: var(--font-size-xs);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--brand);
}

/* Fixed deck preview (deck-scoped view) */
.bl-picker__fixed {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.bl-picker__deck-name {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text);
}
.bl-picker__deck-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Field helpers */
.field-label {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: var(--space-1);
}
.field-group { display: flex; flex-direction: column; gap: 0; }
.field-group .field { margin-top: var(--space-2); }
.field-group .field:first-of-type { margin-top: 0; }

/* ── Opponent mode radio group ──────────────────────────────────────────── */
.bl-opp-modes {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.bl-opp-mode {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.bl-opp-mode:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
}
.bl-opp-mode__radio {
    margin-top: 2px;
    accent-color: var(--brand);
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.bl-opp-mode__radio:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.bl-opp-mode__body { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.bl-opp-mode__title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.bl-opp-mode__desc {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}
.bl-opp-mode--gated { opacity: 0.6; cursor: not-allowed; }
.bl-opp-mode--gated:hover { border-color: var(--border); background: transparent; }

/* Checked state */
.bl-opp-mode:has(.bl-opp-mode__radio:checked) {
    border-color: var(--brand);
    background: var(--brand-soft);
}

/* Specific deck picker (conditionally shown) */
.bl-opp-specific {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border);
    margin-top: var(--space-1);
}

/* ── Run button area ────────────────────────────────────────────────────── */
.bl-run-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
}
.bl-run-note {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin: 0;
}
.bl-run-note .material-symbols-outlined { font-size: 1em; }

/* ── Error banner ───────────────────────────────────────────────────────── */
.bl-error {
    background: var(--color-danger-soft);
    border: 1px solid rgba(239,68,68,0.35);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
    color: var(--red-400);
    font-size: var(--font-size-sm);
}

/* ── Running state ──────────────────────────────────────────────────────── */
.bl-running {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-6);
    padding: var(--space-10) var(--space-4);
    text-align: center;
}
.bl-running__label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-muted);
}
.bl-running__spin {
    animation: bl-spin 0.9s linear infinite;
    color: var(--brand);
}
@keyframes bl-spin { to { transform: rotate(360deg); } }

.bl-skeletons { width: 100%; max-width: 720px; }
.bl-skel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
    margin-top: var(--space-3);
}

/* ── Result header ──────────────────────────────────────────────────────── */
.bl-result {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}
.bl-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
}
.bl-result-matchup {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    min-width: 0;
}
.bl-result-matchup__deck {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--text);
}
.bl-result-matchup__vs {
    font-size: var(--font-size-sm);
    color: var(--text-faint);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.bl-result-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    flex-shrink: 0;
}
.bl-share-feedback {
    font-size: var(--font-size-sm);
    color: var(--color-success);
    display: none;
}

/* ── Headline — big win rate ────────────────────────────────────────────── */
.bl-headline {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-6);
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
}
@media (max-width: 480px) {
    .bl-headline { grid-template-columns: 1fr; justify-items: center; }
}

/* Win rate ring (SVG) */
.bl-ring-wrap { position: relative; width: 148px; height: 148px; flex-shrink: 0; }
.bl-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.bl-ring__bg  { fill: none; stroke: var(--surface-elevated); stroke-width: 10; }
.bl-ring__fill {
    fill: none; stroke-width: 10; stroke-linecap: round;
    stroke-dasharray: 326.73; stroke-dashoffset: 326.73;
    transition: stroke-dashoffset 0.9s cubic-bezier(0.4,0,0.2,1), stroke 0.3s;
}
.bl-ring__inner {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.bl-ring__pct {
    font-size: var(--font-size-4xl);
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.bl-ring__sub {
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.bl-headline__meta {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-width: 0;
}

/* Verdict banner */
.bl-verdict {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    border: 1px solid transparent;
}
.bl-verdict__icon { font-size: 1.25rem; flex-shrink: 0; line-height: 1; margin-top: 2px; }
.bl-verdict__title {
    font-size: var(--font-size-xs);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-1);
}
.bl-verdict__text { font-size: var(--font-size-sm); color: var(--text); margin: 0; line-height: 1.45; }

.bl-verdict--dominant   { background: var(--color-success-soft); border-color: rgba(34,197,94,0.28); }
.bl-verdict--favorable  { background: var(--brand-soft);          border-color: rgba(102,126,234,0.28); }
.bl-verdict--contested  { background: var(--color-warning-soft);  border-color: rgba(245,158,11,0.28); }
.bl-verdict--unfavorable,
.bl-verdict--bad        { background: var(--color-danger-soft);   border-color: rgba(239,68,68,0.28); }

.bl-verdict--dominant   .bl-verdict__icon,
.bl-verdict--dominant   .bl-verdict__title { color: var(--color-success); }
.bl-verdict--favorable  .bl-verdict__icon,
.bl-verdict--favorable  .bl-verdict__title { color: var(--brand); }
.bl-verdict--contested  .bl-verdict__icon,
.bl-verdict--contested  .bl-verdict__title { color: var(--color-warning); }
.bl-verdict--unfavorable .bl-verdict__icon,
.bl-verdict--unfavorable .bl-verdict__title,
.bl-verdict--bad        .bl-verdict__icon,
.bl-verdict--bad        .bl-verdict__title { color: var(--color-danger); }

.bl-headline__counts {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.bl-headline__sep { margin: 0 var(--space-1); }
.bl-headline__vs { color: var(--text); font-weight: 600; }

/* ── Quick read panel (free) ────────────────────────────────────────────── */
.bl-quick-read .panel__body { display: flex; flex-direction: column; gap: var(--space-3); }
.bl-quick-read__title {
    font-size: var(--font-size-xs);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}
.bl-quick-read__row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}
.bl-quick-read__label {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    font-weight: 600;
}
.bl-best-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--brand-soft);
    border: 1px solid rgba(102,126,234,0.3);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--indigo-300);
}
.bl-best-badge .material-symbols-outlined { font-size: 1rem; color: var(--color-warning); }
.bl-quick-read__desc {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    line-height: 1.5;
}

/* Locked actions inside panel overlay */
.battle-lab .panel--locked {
    min-height: 13rem;
    overflow: hidden;
}
.battle-lab .panel__lock-overlay {
    min-width: 0;
    gap: var(--space-2);
    padding: var(--space-5) var(--space-4);
}
.battle-lab .panel__lock-badge,
.battle-lab .panel__lock-title,
.battle-lab .panel__lock-text,
.battle-lab .panel__lock-overlay > p {
    max-width: 100%;
    overflow-wrap: anywhere;
}
.battle-lab .panel__lock-title,
.battle-lab .panel__lock-text,
.battle-lab .panel__lock-overlay > p {
    margin: 0;
}
.bl-locked-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    justify-content: center;
    min-width: 0;
    max-width: 100%;
}
.bl-locked-actions > * {
    min-width: 0;
    max-width: 100%;
}
.bl-locked-actions .btn--primary,
.bl-locked-actions .btn--secondary,
.bl-locked-actions .btn--ghost {
    white-space: normal;
    text-align: center;
    line-height: 1.25;
}
@media (max-width: 640px) {
    .battle-lab .panel--locked {
        min-height: 15rem;
    }
    .battle-lab .panel__lock-title {
        font-size: var(--font-size-lg);
    }
    .bl-locked-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ── Paid analysis sections ─────────────────────────────────────────────── */
.bl-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.bl-section__head {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--text);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border);
}
.bl-section__helper {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* ① Takeaways grid */
.bl-takeaways {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
}
@media (max-width: 768px) { .bl-takeaways { grid-template-columns: 1fr; } }
@media (min-width: 480px) and (max-width: 768px) { .bl-takeaways { grid-template-columns: 1fr 1fr; } }

/* ② Outcome stats row */
.bl-outcome-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
}
@media (max-width: 768px) { .bl-outcome-stats { grid-template-columns: 1fr; } }
@media (min-width: 480px) and (max-width: 768px) { .bl-outcome-stats { grid-template-columns: 1fr 1fr; } }

/* Tooltip button inside stat-card__label */
.bl-tooltip-btn {
    display: inline-grid;
    place-items: center;
    width: 16px;
    height: 16px;
    border: none;
    background: transparent;
    color: var(--text-faint);
    cursor: help;
    border-radius: var(--radius-full);
    padding: 0;
    position: relative;
    flex-shrink: 0;
}
.bl-tooltip-btn .material-symbols-outlined { font-size: 0.95rem; }
.bl-tooltip-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    z-index: var(--z-tooltip, 600);
    left: 50%; bottom: calc(100% + 8px);
    transform: translateX(-50%);
    width: min(240px, 72vw);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    background: var(--bg);
    border: 1px solid var(--border-strong);
    color: var(--text);
    font-size: var(--font-size-xs);
    font-weight: 500;
    line-height: 1.4;
    text-transform: none;
    letter-spacing: 0;
    white-space: normal;
    box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 0.15s, visibility 0.15s;
}
.bl-tooltip-btn:hover::after,
.bl-tooltip-btn:focus::after {
    opacity: 1; visibility: visible;
}
.bl-tooltip-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-full); }

/* ③ Game Over Time — accordion spacing */
.bl-accordion + .bl-accordion { margin-top: var(--space-3); }

/* ── Turn timeline — legend ─────────────────────────────────────────────── */
/* §5d: leyenda visible obligatoria (recognition over recall; mobile no tiene hover) */
.tt-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-3);
    margin-bottom: var(--space-2);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    padding: var(--space-2) var(--space-1);
}
.tt-legend__item { display: inline-flex; align-items: center; gap: var(--space-1); }
.tt-legend__item--ahead  { color: var(--chart-up); }
.tt-legend__item--behind { color: var(--chart-down); }
.tt-legend__sep { color: var(--border-strong); }

/* ── Turn timeline — desktop strip (≥1024px) ─────────────────────────────── */
.turn-timeline {
    display: flex;
    overflow-x: auto;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
    scrollbar-width: thin;
}
/* Hidden on mobile — vertical list shown instead */
@media (max-width: 1023px) { .turn-timeline { display: none; } }

.tt-col {
    flex-shrink: 0;
    min-width: 64px;
    padding: var(--space-3) var(--space-2);
    border-right: 1px solid var(--border);
    cursor: pointer;
    text-align: center;
    transition: background var(--transition-fast);
    position: relative;
}
.tt-col:last-child { border-right: none; }
.tt-col:hover { background: var(--surface); }
.tt-col.active { background: var(--brand-soft); }
.tt-col:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tt-col.active::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: var(--brand);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ① Turn label */
.tt-label {
    font-size: 0.58rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: var(--space-1);
}
.tt-col.active .tt-label { color: var(--brand); }

/* ② Standing — HEADLINE: valence glyph + shield diff (§5d priority #1) */
.tt-standing {
    font-size: 0.65rem; font-weight: 800; line-height: 1.2;
    margin-bottom: var(--space-1);
    letter-spacing: -0.01em;
}
/* Valence uses chart tokens + glyph (never color alone — DS §2.4b) */
.tt-standing--ahead  { color: var(--chart-up); }
.tt-standing--behind { color: var(--chart-down); }
.tt-standing--even   { color: var(--chart-flat); }

/* ③④ Shield dots — identity neutral (§5d: identity ≠ valence) */
.tt-shields { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; margin-bottom: 2px; }
.tt-dot { width: 5px; height: 5px; border-radius: var(--radius-full); }
/* Your shields: brand (identity, not valence — not green) */
.tt-dot--you { background: var(--brand); }
/* Opponent shields: muted (identity neutral) */
.tt-dot--opp { background: var(--text-muted); opacity: 0.5; }
/* Inactive (lost) */
.tt-dot--dim { background: var(--surface); border: 1px solid var(--border); }

/* ⑤ Units support line */
.tt-units { font-size: 0.62rem; color: var(--text-muted); margin-bottom: var(--space-1); letter-spacing: 0.01em; }
.tt-units__you { color: var(--text); font-weight: 700; }

/* ⑥ AP bar */
.tt-ap-track { height: 3px; background: var(--surface-sunken); border-radius: 2px; overflow: hidden; margin: 0 auto var(--space-1); width: 44px; }
.tt-ap-fill          { height: 100%; border-radius: 2px; }
.tt-ap-fill--ahead   { background: var(--chart-up); }
.tt-ap-fill--behind  { background: var(--chart-down); }

/* END column — colors inherited from tt-standing--ahead/behind valence classes */
.tt-col--end { border-left: 2px solid var(--border-strong); }
.tt-end-icon { font-size: 0.95rem; margin: var(--space-1) 0; display: block; }
.tt-end-pct  { font-size: 0.75rem; font-weight: 800; line-height: 1; }
.tt-end-sub  { font-size: 0.5rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); margin-top: 2px; }
.bs-outcome         { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); padding: var(--space-3) var(--space-1); text-align: center; }
.bs-outcome__icon   { font-size: 1.4rem; }
.bs-outcome__result { font-size: 1rem; font-weight: 800; letter-spacing: -0.02em; }
.bs-outcome__sub    { font-size: var(--font-size-sm); color: var(--text-muted); }

/* ── Turn timeline — mobile vertical list (<1024px) ─────────────────────── */
/* §6: one row per turn, tap to expand board state inline */
.tt-mobile { display: none; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: var(--space-3); }
@media (max-width: 1023px) { .tt-mobile { display: flex; } }

.tt-row {
    border-bottom: 1px solid var(--border);
}
.tt-row:last-child { border-bottom: none; }

.tt-row__summary {
    display: grid;
    grid-template-columns: 2.5rem 1fr auto 1rem;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    list-style: none;
    background: var(--surface-elevated);
    transition: background var(--transition-fast);
    min-height: 44px;
}
.tt-row__summary::-webkit-details-marker { display: none; }
.tt-row__summary:hover { background: var(--surface); }
.tt-row details[open] > .tt-row__summary { background: var(--brand-soft); }

.tt-row__label {
    font-size: var(--font-size-xs); font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--text-muted);
}
.tt-row__standing {
    font-size: var(--font-size-sm); font-weight: 700;
}
.tt-row__standing--ahead  { color: var(--chart-up); }
.tt-row__standing--behind { color: var(--chart-down); }
.tt-row__standing--even   { color: var(--chart-flat); }
.tt-row__shields {
    font-size: var(--font-size-xs); color: var(--text-muted);
    white-space: nowrap;
}
.tt-row__chevron {
    font-size: 0.75rem; color: var(--text-faint);
    transition: transform var(--transition-fast);
}
details.tt-row[open] .tt-row__chevron { transform: rotate(90deg); }

.tt-row__board {
    padding: var(--space-3) var(--space-4) var(--space-4);
    background: var(--surface);
    border-top: 1px solid var(--border);
}
.tt-row__board-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}
@media (max-width: 480px) { .tt-row__board-grid { grid-template-columns: 1fr; } }
.tt-row__board-side-label {
    font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: var(--space-2);
}
.tt-row__board-side-label.opp { color: var(--red-400); opacity: 0.8; }

/* Board-state affordance hint */
.tt-board-hint {
    font-size: var(--font-size-xs);
    color: var(--text-faint);
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}
.tt-board-hint .material-symbols-outlined { font-size: 0.85em; }

/* Card chip color dots — CSS classes instead of inline hex (DS §2.5) */
.card-chip__dot--red       { background: var(--card-red); }
.card-chip__dot--green     { background: var(--card-green); }
.card-chip__dot--blue      { background: var(--card-blue); }
.card-chip__dot--white     { background: var(--color-white-dim); border: 1px solid var(--border); }
.card-chip__dot--purple    { background: var(--card-purple); }
.card-chip__dot--yellow    { background: var(--card-yellow); }
.card-chip__dot--colorless { background: var(--color-colorless); }

/* ── Board state ────────────────────────────────────────────────────────── */
.board-state {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-top: var(--space-3);
    display: none;
}
.board-state__header { display: flex; align-items: baseline; gap: var(--space-3); margin-bottom: var(--space-3); }
.board-state__title {
    font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.09em; color: var(--text-muted);
}
.board-state__title strong { color: var(--brand); }
.board-state__note { font-size: var(--font-size-xs); color: var(--text-faint); }
.board-state__grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 480px) { .board-state__grid { grid-template-columns: 1fr; } }
.bs-side__label {
    font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: var(--space-2);
}
.bs-side__label.opp { color: var(--red-400); opacity: 0.8; }
.board-state__subtitle { font-size: var(--font-size-xs); color: var(--text-muted); margin: 0 0 var(--space-2); }

/* ── Board role lanes (§5e: ⚔ attackers · 🛡 holding back · ⚙ support & base) ── */
.bs-lane { margin-bottom: var(--space-3); }
.bs-lane:last-child { margin-bottom: 0; }
.bs-lane__head {
    display: flex; align-items: center; gap: var(--space-2);
    font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: var(--space-2);
}
.bs-lane__icon { font-size: 0.95em; line-height: 1; }

.card-chips { display: flex; flex-direction: column; gap: var(--space-1); }

/* Chip: header button leads with role + key stat; single expandable detail. */
.card-chip {
    background: var(--surface-elevated); border: 1px solid var(--border);
    border-radius: var(--radius-sm); overflow: hidden;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.card-chip.is-open { border-color: var(--brand); background: var(--brand-soft); }
.card-chip__head {
    display: flex; align-items: center; gap: var(--space-2); width: 100%;
    min-height: 44px; padding: var(--space-2) var(--space-3);
    background: none; border: 0; color: var(--text); text-align: left;
    font: inherit; font-size: var(--font-size-sm); cursor: pointer;
}
button.card-chip__head:hover { background: var(--surface); }
button.card-chip__head:focus-visible { outline: none; box-shadow: var(--focus-ring); }
div.card-chip__head { cursor: default; }
.card-chip__dot { width: 7px; height: 7px; border-radius: var(--radius-full); flex-shrink: 0; }
.card-chip__kind {
    font-size: 0.56rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--text-muted); flex-shrink: 0;
}
.card-chip__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.card-chip__key { font-size: var(--font-size-xs); font-weight: 700; color: var(--text); flex-shrink: 0; }
.card-chip__pct { font-size: var(--font-size-xs); font-weight: 700; color: var(--text-muted); flex-shrink: 0; }
.card-chip__chevron { font-size: 1rem; color: var(--text-faint); flex-shrink: 0; transition: transform var(--transition-fast); }
.card-chip__head[aria-expanded="true"] .card-chip__chevron { transform: rotate(180deg); }

.card-chip__detail {
    display: flex; flex-direction: column; gap: var(--space-2);
    padding: var(--space-2) var(--space-3) var(--space-3);
    border-top: 1px solid var(--border);
}
.card-chip__img-link { align-self: flex-start; line-height: 0; }
.card-chip__img-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.card-chip__img { width: 100px; border-radius: var(--radius-sm); }
.card-chip__summary-lines { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.unit-role-line { font-size: 0.69rem; line-height: 1.35; padding-left: var(--space-3); position: relative; color: var(--text-muted); }
.unit-role-line::before { content: '·'; position: absolute; left: 0; color: var(--border-strong); }
.unit-role-line--atk  { color: var(--red-300); }
.unit-role-line--dmg  { color: var(--orange-400); }
.unit-role-line--hold { color: var(--blue-300); }
.unit-role-line--eff  { color: var(--purple-400); }
.unit-role-line--pair { color: var(--teal-500); }
.unit-role-line--base { color: var(--amber-300); }

/* Situational units (below the "most likely" cutoff): always visible, just de-emphasised. */
.card-chip--situational { opacity: 0.65; }
.card-chip--situational:hover,
.card-chip--situational:focus-within,
.card-chip--situational.is-open { opacity: 1; }

/* Key plays this turn — commands are one-time actions, not permanents */
.bs-key-plays { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px dashed var(--border); }
.bs-key-plays__label {
    font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: var(--space-2);
}
.bs-key-plays__list { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.bs-key-play {
    display: inline-flex; align-items: center; gap: var(--space-2);
    padding: var(--space-1) var(--space-3); min-height: 32px;
    background: var(--surface-elevated); border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: var(--font-size-xs);
    color: var(--text); text-decoration: none;
}
a.bs-key-play:hover { border-color: var(--brand); }
a.bs-key-play:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.bs-key-play__pct { font-weight: 800; color: var(--text-muted); }
.card-chip__hp-bar  { height: 3px; background: var(--surface-sunken); border-radius: 2px; overflow: hidden; }
.card-chip__hp-fill { height: 100%; border-radius: 2px; transition: width 0.3s ease; }
/* HP fill levels via CSS class (no inline hex) */
.card-chip__hp-fill--good { background: var(--chart-up); }
.card-chip__hp-fill--ok   { background: var(--color-warning); }
.card-chip__hp-fill--low  { background: var(--chart-down); }
.card-chip__badges { display: flex; flex-wrap: wrap; gap: 3px; }
.cc-badge {
    font-size: 0.58rem; font-weight: 700; padding: 0.1rem 0.35rem;
    border-radius: 4px; white-space: nowrap; line-height: 1.4;
}
.cc-badge--atk  { background: var(--color-danger-soft);  color: var(--red-400); }
.cc-badge--dmg  { background: rgba(249,115,22,0.15);    color: var(--orange-400); }
.cc-badge--sup  { background: var(--color-success-soft); color: var(--green-400); }
.cc-badge--pair { background: var(--teal-soft);          color: var(--teal-500); }
.cc-badge--lnk  { background: rgba(167,139,250,0.15);   color: var(--purple-400); }
.cc-badge--new  { background: var(--color-info-soft);   color: var(--blue-400); }
.cc-badge--eff  { background: rgba(234,179,8,0.14);     color: var(--amber-400); }
.cc-badge--stat { background: var(--surface-elevated);  color: var(--text-muted); }
.board-state__empty { font-size: var(--font-size-sm); color: var(--text-muted); text-align: center; padding: var(--space-2) 0; }
.bs-action-stats { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-top: var(--space-2); }
.bs-stat {
    display: flex; flex-direction: column; align-items: center;
    background: var(--surface-elevated); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: var(--space-1) var(--space-2); min-width: 48px;
}
.bs-stat__val { font-size: 0.95rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.bs-stat__lbl { font-size: 0.58rem; color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.bs-stat--atk .bs-stat__val { color: var(--red-400); }
.bs-stat--dir .bs-stat__val { color: var(--orange-400); }
.bs-stat--blk .bs-stat__val { color: var(--blue-400); }
.bs-stat--cmd .bs-stat__val { color: var(--purple-400); }
.bs-stat--trs .bs-stat__val { color: var(--text-muted); }
.bs-stat--exl .bs-stat__val { color: var(--purple-500); }

/* ── Deployment forecast ────────────────────────────────────────────────── */
.forecast-chart {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    display: flex;
    gap: 4px;
    height: 138px;
    overflow-x: auto;
    align-items: stretch;
    margin-top: var(--space-3);
    scrollbar-width: thin;
}
.fc-col { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 32px; gap: 0; }
.fc-col:focus-visible { outline: var(--focus-ring); border-radius: var(--radius-sm); }
.fc-col--peak .fc-col__label { color: var(--text); font-weight: 800; }
.fc-col__bars { flex: 1; position: relative; width: 100%; display: flex; align-items: center; justify-content: center; }
.fc-col__center { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border); }
.fc-bar { position: absolute; width: 68%; border-radius: 3px; min-height: 2px; display: flex; align-items: center; justify-content: center; overflow: visible; box-shadow: var(--shadow-sm); }
.fc-bar--p1 { background: var(--brand); bottom: 50%; }
.fc-bar--p2 { background: var(--surface-elevated); top: 50%; border: 1px solid var(--border); }
.fc-bar__val { font-size: 0.6rem; font-weight: 800; color: rgba(255,255,255,0.85); line-height: 1; pointer-events: none; }
.fc-bar__ap { position: absolute; width: 100%; text-align: center; font-size: 0.52rem; font-weight: 700; line-height: 1; pointer-events: none; white-space: nowrap; }
.fc-bar--p1 .fc-bar__ap { bottom: calc(100% + 2px); color: var(--brand); }
.fc-bar--p2 .fc-bar__ap { top: calc(100% + 2px); color: var(--text-muted); }
/* Legend dot modifiers — no inline style="background:..." in template */
.forecast-legend__dot--p1 { background: var(--brand); }
.forecast-legend__dot--p2 { background: var(--surface-elevated); border: 1px solid var(--border-strong); }
.fc-col__label { font-size: 0.6rem; color: var(--text-muted); padding-top: 3px; flex-shrink: 0; }
.forecast-legend { display: flex; flex-wrap: wrap; gap: var(--space-2); font-size: var(--font-size-xs); color: var(--text-muted); }
.forecast-legend__item { display: flex; align-items: center; gap: var(--space-1); padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-elevated); }
.forecast-legend__dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.forecast-summary { display: none; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); margin-bottom: var(--space-2); }
.forecast-summary__item { min-width: 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--surface-elevated); border: 1px solid var(--border); }
.forecast-summary__label { font-size: var(--font-size-xs); font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.forecast-summary__value { margin-top: 2px; font-size: var(--font-size-base); font-weight: 700; color: var(--text); line-height: 1.2; }
@media (max-width: 680px) { .forecast-summary { grid-template-columns: 1fr; } }

/* ── Tactical resources chart ────────────────────────────────────────────── */
.tactical-chart-controls {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: var(--space-2); margin-bottom: var(--space-3);
}
.tactical-chart-filter-label {
    width: 100%;
    font-size: var(--font-size-xs); font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text-muted);
}
.tactical-chart-toggle {
    display: inline-flex; align-items: center; gap: var(--space-2);
    min-height: 32px; padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--surface-elevated); color: var(--text-muted);
    font-size: var(--font-size-xs); font-weight: 700; cursor: pointer; user-select: none;
}
.tactical-chart-toggle input { width: 13px; height: 13px; accent-color: var(--brand); cursor: pointer; }
.tactical-resource-filters { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-bottom: var(--space-3); }
.tactical-resource-chip {
    display: inline-flex; align-items: center; gap: var(--space-1);
    min-height: 28px; padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--surface-elevated); color: var(--text-muted);
    font-size: var(--font-size-xs); font-weight: 700; cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}
.tactical-resource-chip::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--chip-color, var(--text-faint)); flex-shrink: 0; }
.tactical-resource-chip:hover,
.tactical-resource-chip.is-active {
    border-color: color-mix(in srgb, var(--chip-color, var(--text-muted)) 55%, transparent);
    background: color-mix(in srgb, var(--chip-color, var(--text-muted)) 14%, transparent);
    color: var(--text);
}
.tactical-chart-summary { display: none; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); margin-bottom: var(--space-3); }
.tactical-chart-summary__item { min-width: 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--surface-elevated); border: 1px solid var(--border); }
.tactical-chart-summary__label { font-size: var(--font-size-xs); font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.tactical-chart-summary__value { margin-top: 2px; font-size: var(--font-size-base); font-weight: 700; color: var(--text); line-height: 1.2; }
.tactical-chart-canvas { position: relative; height: 210px; min-height: 210px; }
.tactical-chart-canvas canvas { display: block; }
@media (max-width: 680px) { .tactical-chart-summary { grid-template-columns: 1fr; } }

/* ── Meta sweep ─────────────────────────────────────────────────────────── */
.bl-sweep .panel__body { display: flex; flex-direction: column; gap: var(--space-4); }
.bl-sweep__header {
    display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4);
}
.bl-sweep__title { font-size: var(--font-size-base); font-weight: 700; margin-bottom: var(--space-1); }
.bl-sweep__desc { font-size: var(--font-size-sm); color: var(--text-muted); margin: 0; }
.sweep-progress { margin-top: var(--space-2); }
.sweep-progress__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-2); }
.sweep-progress__status { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; }
.sweep-progress__spinner { color: var(--brand); font-size: 1rem; animation: bl-spin 0.9s linear infinite; flex-shrink: 0; }
.sweep-progress__text { font-size: var(--font-size-sm); color: var(--text-muted); }
.sweep-progress__pct { font-size: var(--font-size-sm); font-weight: 700; color: var(--text-muted); }
.sweep-progress__bar { height: 4px; background: var(--surface-elevated); border-radius: 2px; overflow: hidden; }
.sweep-progress__fill { height: 100%; background: var(--brand); border-radius: 2px; transition: width 0.3s ease; width: 0%; }
.sweep-results { margin-top: var(--space-3); }
.sweep-results__empty {
    margin: 0;
    padding: var(--space-3) 0;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}
.sweep-row {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-2) 0; border-bottom: 1px solid var(--border);
    font-size: var(--font-size-sm);
}
.sweep-row:last-of-type { border-bottom: none; }
.sweep-row__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 500; }
.sweep-row__bar-track { width: 80px; height: 5px; background: var(--surface-elevated); border-radius: 3px; overflow: hidden; flex-shrink: 0; }
.sweep-row__bar-fill { height: 100%; border-radius: 3px; }
.sweep-row__pct { width: 38px; text-align: right; font-weight: 700; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.sweep-row__badge {
    font-size: var(--font-size-xs); padding: 0.15rem 0.5rem; border-radius: var(--radius-sm);
    flex-shrink: 0; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}
.sweep-row__badge--dominant   { background: var(--color-success-soft); color: var(--color-success); }
.sweep-row__badge--favorable  { background: var(--brand-soft);          color: var(--brand); }
.sweep-row__badge--contested  { background: var(--color-warning-soft);  color: var(--color-warning); }
.sweep-row__badge--unfavorable,
.sweep-row__badge--bad        { background: var(--color-danger-soft);   color: var(--color-danger); }
.sweep-row__actions { display: flex; align-items: center; gap: var(--space-1); flex-shrink: 0; }
.sweep-row__action {
    display: inline-flex; align-items: center; gap: var(--space-1);
    min-height: 28px; padding: var(--space-1) var(--space-2);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text-muted); text-decoration: none;
    font-size: var(--font-size-xs); font-weight: 700; white-space: nowrap;
    background: var(--surface-elevated);
    transition: border-color var(--transition-fast), color var(--transition-fast);
}
.sweep-row__action:hover { border-color: var(--brand); color: var(--text); }
.sweep-row__action .material-symbols-outlined { font-size: 0.9rem; }
.sweep-summary {
    margin-top: var(--space-4); padding: var(--space-3) var(--space-4);
    background: var(--surface-elevated); border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: space-between;
}
.sweep-summary__left { display: flex; align-items: baseline; gap: var(--space-2); }
.sweep-summary__score { font-size: var(--font-size-3xl); font-weight: 900; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.sweep-summary__label { font-size: var(--font-size-sm); color: var(--text-muted); }
.sweep-summary__tier { font-size: var(--font-size-xs); font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; padding: var(--space-1) var(--space-3); border-radius: var(--radius-sm); }

/* ── Latest simulations table ───────────────────────────────────────────── */
.latest-sims__table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.latest-sims__table th:nth-child(1), .latest-sims__table td:nth-child(1) { width: 50%; }
.latest-sims__table th:nth-child(2), .latest-sims__table td:nth-child(2) { width: 18%; }
.latest-sims__table th:nth-child(3), .latest-sims__table td:nth-child(3) { width: 18%; }
.latest-sims__table th:nth-child(4), .latest-sims__table td:nth-child(4) { width: 14%; }
.latest-sims__table th {
    padding: var(--space-2) var(--space-2);
    color: var(--text-muted); font-size: var(--font-size-xs); font-weight: 800;
    letter-spacing: 0.08em; text-align: left; text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}
.latest-sims__table td {
    padding: var(--space-3) var(--space-2);
    border-bottom: 1px solid var(--border);
    vertical-align: middle; color: var(--text-muted); font-size: var(--font-size-sm);
}
.latest-sims__table tbody tr:last-child td { border-bottom: 0; }
.latest-sims__matchup { display: flex; align-items: center; gap: var(--space-1); min-width: 0; }
.latest-sims__deck-link { color: var(--text); text-decoration: none; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.latest-sims__deck-link:hover { color: var(--brand); }
.latest-sims__vs { color: var(--text-faint); font-size: var(--font-size-xs); font-weight: 800; flex-shrink: 0; }
.latest-sims__result { display: flex; align-items: center; gap: var(--space-2); white-space: nowrap; }
.latest-sims__pct { font-weight: 900; font-variant-numeric: tabular-nums; }
.latest-sims__pct--dominant   { color: var(--color-success); }
.latest-sims__pct--favorable  { color: var(--brand); }
.latest-sims__pct--contested  { color: var(--color-warning); }
.latest-sims__pct--unfavorable,
.latest-sims__pct--bad        { color: var(--color-danger); }
.latest-sims__time { white-space: nowrap; color: var(--text-muted); font-size: var(--font-size-xs); }
@media (max-width: 720px) {
    .latest-sims__table, .latest-sims__table thead, .latest-sims__table tbody,
    .latest-sims__table tr, .latest-sims__table td { display: block; width: 100%; }
    .latest-sims__table thead { display: none; }
    .latest-sims__table tr { padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
    .latest-sims__table tr:last-child { border-bottom: 0; }
    .latest-sims__table th:nth-child(1), .latest-sims__table td:nth-child(1),
    .latest-sims__table th:nth-child(2), .latest-sims__table td:nth-child(2),
    .latest-sims__table th:nth-child(3), .latest-sims__table td:nth-child(3),
    .latest-sims__table th:nth-child(4), .latest-sims__table td:nth-child(4) { width: 100%; }
    .latest-sims__table td { padding: var(--space-1) 0; border-bottom: 0; }
}

/* ── Turn Profile section ─────────────────────────────────────────────── */
.bl-tp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); }
@media (max-width: 700px) { .bl-tp-grid { grid-template-columns: 1fr; } }
.bl-tp-label {
    font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.09em; color: var(--text-muted);
    margin: 0 0 var(--space-3); display: flex; align-items: center; gap: var(--space-1);
}
.bl-tp-label .material-symbols-outlined { font-size: 0.85rem; }

/* ── Mobile overrides ───────────────────────────────────────────────────── */
@media (max-width: 479px) {
    /* §5i: hide Time column on small screens — Matchup + Win rate + Details remain */
    .latest-sims__table th:nth-child(3),
    .latest-sims__table td:nth-child(3) { display: none; }
}
@media (max-width: 480px) {
    .battle-lab { padding: var(--space-4) var(--space-4); }
    .bl-head__title { font-size: var(--font-size-3xl); }
    .bl-headline { gap: var(--space-4); }
    .bl-result-header { flex-direction: column; align-items: flex-start; }
    .bl-run-area .btn--primary { width: 100%; }
    .bl-skel-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .bl-takeaways, .bl-outcome-stats { grid-template-columns: 1fr; }
}
@media (min-width: 480px) and (max-width: 900px) {
    .bl-takeaways, .bl-outcome-stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
    .sweep-row { flex-wrap: wrap; row-gap: var(--space-2); }
    .sweep-row__name { flex-basis: calc(100% - 7rem); }
    .sweep-row__actions { width: 100%; justify-content: flex-end; }
}
