/* Stats: the widgets (combos, responsive grid, mana production, Reliability Diamond, tag cloud, density, vulnerability). Linked right after stats.css; the stats-*.css parts are one sheet in load order. */
/* ============================================
   COMBO WIDGET — redesigned layout
   ============================================ */

.combo-produce-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-2xl);
    font-size: 0.78em;
    font-weight: 600;
    background: rgba(var(--color-accent-rgb), 0.1);
    color: var(--accent-light);
    border: 1px solid rgba(var(--color-accent-rgb), 0.3);
    white-space: nowrap;
}

/* Card images row */
/* Combo pieces share the available width (the more pieces, the narrower each), growing as large
   as the row allows — same responsive sizing approach as the Synergy-tab card previews. */
.combo-images-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2-5);
    justify-content: center;
    width: 100%;
    margin-bottom: var(--space-3);
}

.combo-piece-wrapper {
    flex: 1 1 130px;
    min-width: 0;
    max-width: clamp(130px, 32vw, 320px);
    cursor: pointer;
    text-align: center;
}

.combo-piece-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4.75% / 3.5%;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.combo-piece-wrapper:hover .combo-piece-img {
    transform: translateY(-3px);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.7);
}

.combo-piece-name {
    display: block;
    margin-top: var(--space-2);
    color: var(--text-color);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.2;
}

.combo-piece-placeholder {
    flex: 1 1 130px;
    min-width: 0;
    max-width: clamp(130px, 32vw, 320px);
    aspect-ratio: 488 / 680;
    border-radius: var(--radius-lg);
    background: var(--widget-bg);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2);
    text-align: center;
    font-size: 0.8em;
    color: var(--text-muted);
}

/* Description text */
.combo-description {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin: 0 0 var(--space-2-5);
    line-height: 1.5;
    font-style: italic;
}

/* Steps list */
.combo-steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: combo-step;
    display: flex;
    flex-direction: column;
    gap: var(--space-1-5);
}

.combo-steps > li {
    counter-increment: combo-step;
    display: flex;
    align-items: flex-start;
    gap: var(--space-2-5);
    font-size: 0.85em;
    line-height: 1.55;
    color: var(--text-color);
    position: relative;
    min-height: 28px;
}

.combo-steps > li::before {
    content: counter(combo-step);
    min-width: 22px;
    height: 22px;
    border-radius: var(--radius-round);
    background: var(--accent-gradient);
    color: var(--button-primary-text);
    font-size: 0.8em;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: var(--space-px);
    position: relative;
    z-index: 1;
}

.combo-steps > li:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 23px;
    bottom: -7px;
    left: 10px;
    width: 2px;
    background: color-mix(in srgb, var(--accent-color) 55%, var(--border-color));
}

.synergy-group {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: flex-start;
}

.synergy-group-header {
    width: 100%;
    font-size: 0.85em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--space-1) var(--space-2-5);
    border-radius: var(--radius-sm);
    align-self: flex-start;
}

.pair-card {
    color: var(--text-color);
}

.pair-card.hoverable {
    position: relative;
    cursor: pointer;
    font-weight: 500;
}

.pair-card.hoverable:hover {
    color: var(--accent-color);
}

/* Salt Score Widget */
.salt-score-widget {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: var(--widget-bg);
    border-radius: var(--radius-2xl);
    min-width: 140px;
    min-height: 130px;
}

.salt-score-widget .stat-label {
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
    font-size: 0.85em;
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

/* salt-value: unique sizing for the salt percentage display */
.salt-value {
    font-size: 2em;
    font-weight: 700;
    line-height: 1;
}

/* CMC Widget */
.cmc-widget {
    min-width: 120px;
}

.cmc-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

/* Generic Widget Layout */
.widget-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.widget-extras {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-0-5);
    flex-shrink: 0;
}

.widget-label {
    font-size: 0.9em;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.5px;
}

.widget-flavor {
    font-size: 0.7em;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    max-width: 140px;
}

/* A tile's second figure ("38%", "Total: 12"): muted text beside the first. */
.widget-pct {
    font-size: 0.75em;
    font-weight: 600;
    color: var(--text-secondary);
}

.bracket-counts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-1);
}

/* Sized to match .widget-pct so the Bracket tile lines up with its siblings */
/* Game Changers, extra turns and the like: an icon and a count as a text button that
   opens the list, not a capsule. */
.bracket-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: var(--space-0-5) var(--space-1-5);
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.75em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.bracket-badge:hover,
.bracket-badge:focus-visible {
    background: var(--accent-bg);
    color: var(--accent-color);
}

.bracket-badge-icon {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
}

/* Archetype Radar Chart */
.archetype-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    position: relative;
}

.radar-svg {
    width: 100%;
    max-width: 250px;
    max-height: 250px;
    overflow: visible;
    flex-shrink: 1;
}

.radar-grid {
    fill: none;
    stroke: var(--input-border);
    stroke-width: 1px;
}

.radar-axis {
    stroke: var(--input-border);
    stroke-width: 1px;
}

.radar-data {
    fill: var(--accent-bg);
    fill-opacity: 1;
    stroke: var(--accent-color);
    stroke-width: 2px;
    transition: all 0.5s ease-out;
}

.radar-point {
    fill: var(--accent-color);
    transition: all 0.5s ease-out;
}

.radar-label {
    fill: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Badge Styling */
/* The archetype under the radar: its name in the radar's color, a caption, not a badge. */
.archetype-badge {
    position: relative;
    margin-top: -8px;
    margin-bottom: var(--space-1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    font-weight: 700;
    color: var(--radar-color);
    max-width: 90%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

/* Multi-color gradient border for combined archetypes */
.archetype-badge.multi {
    background: linear-gradient(90deg, var(--color-1), var(--color-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Mobile Overrides */
/* ============================================
   RESPONSIVE GRID LAYOUTS
   ============================================ */

/* Mobile Stack (< 1024px) */
@media (max-width: 1023px) {
    .stats-grid-main {
        display: flex;
        flex-direction: column;
        gap: var(--space-3);
    }
    /* A single column in page order, whatever container layout also
       matches: the fade-in follows the page (stats.css, "Fade-in order"). */
    .stats-panel .grid-item-brk { --reveal-order: 0; }
    .stats-panel .grid-item-arch { --reveal-order: 1; }
    .stats-panel .grid-item-cons { --reveal-order: 2; }
    .stats-panel .grid-item-mana { --reveal-order: 3; }
    .stats-panel .grid-item-type { --reveal-order: 4; }
    .stats-panel .grid-item-color { --reveal-order: 5; }
    .stats-panel .grid-item-prod { --reveal-order: 6; }
    .stats-panel .grid-item-rare { --reveal-order: 7; }
    .stats-panel .grid-item-tags { --reveal-order: 8; }
    .stats-panel .grid-item-actor { --reveal-order: 9; }
    .stats-panel .grid-item-synd { --reveal-order: 10; }
    .stats-panel .grid-item-cog { --reveal-order: 11; }
    .stats-panel .grid-item-pop { --reveal-order: 12; }
    .stats-panel .grid-item-weak { --reveal-order: 13; }
    .stats-panel .grid-item-func { --reveal-order: 14; }

    .stats-score-bar .stat-item {
        width: auto;
        min-height: 110px;
        padding: var(--space-2-5);
    }

    .stats-grid-main .chart-container {
        height: auto;
        min-height: 180px;
        max-height: none;
    }

    /* Radar chart mobile overrides */
    .grid-item-arch .chart-container {
        min-height: 280px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .archetype-radar .archetype-display {
        position: relative;
        height: auto;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .archetype-radar .radar-svg {
        max-width: 220px;
    }

    .weakness-checklist,
    .synergy-cluster-list {
        columns: 1 !important;
    }

    .weakness-row {
        flex-direction: row;
        justify-content: space-between;
        gap: var(--space-1);
    }

    .weakness-info {
        min-width: 0;
        flex: 1;
    }

    .weakness-name {
        font-size: 0.78em;
    }

    .weakness-level {
        font-size: 0.7em;
    }
}

/* Analysis-grid columns respond to the PANEL's width (container query on
   .stats-panel), not the viewport: the builder's panels resize independently
   of the window. Below the two-column minimum the base single-column layout
   applies, so widgets never get squeezed under their usable width. */

/* Standard panel width: two columns */
@container (min-width: 800px) {
    .stats-grid-main {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "brk brk"
            "arch cons"
            "mana type"
            "color prod"
            "rare actor"
            "tags tags"
            "synd cog"
            "pop pop"
            "weak weak"
            "func func"
            "syng syng"
            "comb comb";
    }
    /* The fade-in follows the reading order of the areas above, top down
       and left to right (stats.css, "Fade-in order"). */
    .grid-item-brk { --reveal-order: 0; }
    .grid-item-arch { --reveal-order: 1; }
    .grid-item-cons { --reveal-order: 2; }
    .grid-item-mana { --reveal-order: 3; }
    .grid-item-type { --reveal-order: 4; }
    .grid-item-color { --reveal-order: 5; }
    .grid-item-prod { --reveal-order: 6; }
    .grid-item-rare { --reveal-order: 7; }
    .grid-item-actor { --reveal-order: 8; }
    .grid-item-tags { --reveal-order: 9; }
    .grid-item-synd { --reveal-order: 10; }
    .grid-item-cog { --reveal-order: 11; }
    .grid-item-pop { --reveal-order: 12; }
    .grid-item-weak { --reveal-order: 13; }
    .grid-item-func { --reveal-order: 14; }
}

/* Wide panel: three widgets a row, on six tracks so a pair can split the width
   50/50 (Synergy Density and Cognitive Load). Every row is fully assigned — no
   "." filler cells (they render as visible gaps) and no multi-column spans next
   to a single widget (they read as imbalanced sizing). */
@container (min-width: 1250px) {
    .stats-grid-main {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        grid-template-areas:
            "brk brk brk brk brk brk"
            "arch arch tags tags cons cons"
            "mana mana rare rare type type"
            "color color prod prod actor actor"
            "synd synd synd cog cog cog"
            "pop pop pop pop pop pop"
            "weak weak weak weak weak weak"
            "func func func func func func"
            "syng syng syng syng comb comb";
    }
    /* The fade-in follows the reading order of the areas above, top down
       and left to right (stats.css, "Fade-in order"). */
    .grid-item-brk { --reveal-order: 0; }
    .grid-item-arch { --reveal-order: 1; }
    .grid-item-tags { --reveal-order: 2; }
    .grid-item-cons { --reveal-order: 3; }
    .grid-item-mana { --reveal-order: 4; }
    .grid-item-rare { --reveal-order: 5; }
    .grid-item-type { --reveal-order: 6; }
    .grid-item-color { --reveal-order: 7; }
    .grid-item-prod { --reveal-order: 8; }
    .grid-item-actor { --reveal-order: 9; }
    .grid-item-synd { --reveal-order: 10; }
    .grid-item-cog { --reveal-order: 11; }
    .grid-item-pop { --reveal-order: 12; }
    .grid-item-weak { --reveal-order: 13; }
    .grid-item-func { --reveal-order: 14; }
}

/* ============================================
   NEW STATS INSIGHT ROWS (Rows 4 & 5)
   ============================================ */

/* ============================================
   COGNITIVE LOAD
   One 0-100% bar for the deck, then a small bar per category.
   ============================================ */

.cognitive-load-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    /* Room for the "?" pinned to the corner, so it never sits on the last row's value. */
    padding-bottom: var(--space-6);
}

/* The deck's figure, centred under its scale. */
.cognitive-load-head {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: var(--space-2);
}

.cognitive-load-pct {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--text-color);
    font-variant-numeric: tabular-nums;
}

.cognitive-load-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.load-meter {
    position: relative;
    display: block;
    height: var(--space-1-5);
    background: var(--chart-bar-track);
    border: 1px solid var(--chart-bar-track-border);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

/* The deck's bar: twice a category's. */
.load-meter.is-main {
    height: var(--space-3);
}

/* The deck's bar as a scale: ticks where each band starts, the band names under it. */
.load-scale {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    /* Clear of the title above it. */
    margin-top: var(--space-3);
}

.load-scale-track {
    position: relative;
}

.load-scale-tick {
    position: absolute;
    top: calc(-1 * var(--space-1));
    bottom: calc(-1 * var(--space-1));
    width: 1px;
    background: var(--text-muted);
    pointer-events: none;
}

.load-scale-labels {
    display: grid;
    font-size: 0.7em;
    color: var(--text-muted);
    text-align: center;
}

.load-scale-label.is-current {
    color: var(--text-color);
    font-weight: 600;
}

.load-meter-fill {
    display: block;
    height: 100%;
    background: var(--accent-color);
    border-radius: inherit;
    transition: width 0.4s ease;
}

/* The categories take the height left in the card and sit in the middle of it, so a tall row
   spaces them away from the scale rather than leaving a gap under them. */
.cognitive-load-rows {
    flex: 1;
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-1-5);
}

.cognitive-load-row {
    display: grid;
    grid-template-columns: 6.5em minmax(0, 1fr) 2.5em;
    align-items: center;
    gap: var(--space-2);
}

.cognitive-load-row-label {
    font-size: 0.8em;
    color: var(--text-secondary);
}

.cognitive-load-row-value {
    font-size: 0.8em;
    text-align: right;
    color: var(--text-color);
    font-variant-numeric: tabular-nums;
}

.cognitive-load-note {
    margin: 0;
    font-size: 0.85em;
    color: var(--text-muted);
}

.cognitive-load-section .load-meter {
    margin: var(--space-1) 0;
}

.cognitive-load-notable {
    display: block;
    margin-top: var(--space-2);
    font-size: 0.75em;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
    .load-meter-fill {
        transition: none;
    }
}

/* ============================================
   MANA PRODUCTION CHART
   ============================================ */

.mana-production-container {
    min-height: 240px;
}

.mana-prod-subtitle,
.chart-subtitle {
    font-size: 0.75em;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: var(--space-2-5);
    font-style: italic;
}

.mana-prod-empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85em;
    text-align: center;
    padding: var(--space-4) 0;
}

.mana-prod-bars {
    display: flex;
    flex-direction: column;
    gap: var(--space-1-5);
    flex: 1;
    justify-content: center;
    padding: var(--space-1) 0;
}

/* Each color row: symbol | dual-bar group | warning */
.mana-prod-row {
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
}

.mana-prod-symbol {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mana-sym-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Two-bar group (pips on top, srcs below) */
.mana-prod-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mana-prod-bar-row {
    display: flex;
    align-items: center;
    gap: 5px;
}

.mana-prod-bar-label {
    font-size: 0.62em;
    color: var(--text-muted);
    width: 26px;
    text-align: right;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mana-prod-bar-track {
    flex: 1;
    height: 11px;
    background: var(--chart-bar-track);
    border: 1px solid var(--chart-bar-track-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.mana-prod-bar {
    height: 100%;
    border-radius: var(--radius-sm);
    min-width: 2px;
    box-shadow: inset 0 0 0 1px var(--chart-bar-fill-outline);
    transition: width 0.35s ease;
}

.pip-bar {
    opacity: 1.0;
}

.src-bar {
    filter: brightness(0.78);
}

.mana-prod-bar-count {
    font-size: 0.65em;
    color: var(--text-muted);
    width: 18px;
    text-align: right;
    flex-shrink: 0;
}

/* Warning column */
.mana-prod-warn-col {
    width: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mana-warn-badge {
    font-size: 0.85em;
    color: var(--warning-color);
    cursor: default;
}

/* Legend row at bottom */
.mana-prod-legend {
    display: flex;
    gap: var(--space-2-5);
    justify-content: center;
    margin-top: var(--space-2);
    flex-wrap: wrap;
    font-size: 0.7em;
    color: var(--text-muted);
}

.mana-leg-pip {
    color: var(--accent-color);
    font-weight: 600;
}

.mana-leg-src {
    color: var(--text-secondary);
}

.mana-leg-warn {
    color: var(--warning-color);
}

/* ============================================
   RELIABILITY DIAMOND (Consistency Widget)
   ============================================ */

.reliability-diamond-container {
    min-height: 240px;
}

.reliability-diamond {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
}

/* SVG diamond chart */
.diamond-svg {
    width: 100%;
    max-width: 200px;
    max-height: 200px;
    overflow: visible;
}

.diamond-data {
    fill: var(--accent-bg);
    stroke: var(--accent-color);
    stroke-width: 2px;
    transition: all 0.5s ease-out;
}

.radar-node {
    cursor: help;
    transition: r 0.15s ease-out, opacity 0.15s;
    opacity: 0.9;
}

.radar-node:hover {
    r: 6;
    opacity: 1;
}

/* Label overrides — keep same size as archetype radar labels */
.diamond-label {
    fill: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Numeric score table below the diamond */
.diamond-scores {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-1);
    margin-top: var(--space-1);
}

.diamond-score-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 8px;
    border-radius: var(--radius-md);
    background: var(--entry-bg);
    font-size: 0.78em;
    transition: background 0.15s;
}

.diamond-score-row:hover {
    background: var(--entry-hover-bg);
}

.diamond-axis-name {
    color: var(--text-secondary);
    font-weight: 500;
}

.diamond-axis-score-group {
    display: flex;
    align-items: baseline;
    gap: var(--space-0-5);
}

.diamond-axis-value {
    font-weight: 700;
    font-size: 0.9em;
    text-align: right;
}

.diamond-axis-target {
    color: var(--text-muted);
    font-size: 0.85em;
}

@media (max-width: 768px) {
    .diamond-scores {
        grid-template-columns: 1fr;
    }

    .diamond-score-row {
        gap: var(--space-2-5);
    }

    .diamond-axis-name {
        min-width: 0;
    }

    .diamond-axis-score-group {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

/* Hint list */
.diamond-hints {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-top: var(--space-1);
}

/* Standardized Stat Insights */
.stat-insight {
    font-size: 0.74em;
    margin: 0;
    padding: var(--space-1-5) var(--space-2-5);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    border-left: 3px solid transparent;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: var(--space-1-5);
    width: 100%;
    box-sizing: border-box;
    animation: fadeIn 0.3s ease-out;
}

.stat-insight-icon {
    flex-shrink: 0;
    font-size: 1.1em;
    margin-top: var(--space-0-5);
}

.stat-insight-content {
    min-width: 0;
}

/* An insight with a fix behind it: the whole row opens the fixes modal. */
.stat-insight-fixable {
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}

.stat-insight-fixable:hover,
.stat-insight-fixable:focus-visible {
    background: var(--entry-hover-bg);
    outline: none;
}

/* Inherits the banner's level color (info blue, warning amber, critical red). */
.stat-insight-fix {
    margin-left: auto;
    flex-shrink: 0;
    align-self: center;
    font-size: 0.85em;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: inherit;
    white-space: nowrap;
    padding-left: var(--space-2);
}

.stat-insight-content {
    flex: 1;
    display: inline;
}

.insight-warning {
    color: var(--warning-color);
    background: rgba(255, 215, 0, 0.06);
    border-left-color: var(--warning-color);
}

.insight-critical {
    color: var(--danger-color);
    background: rgba(255, 77, 77, 0.06);
    border-left-color: var(--danger-color);
}

.insight-info {
    color: var(--type-instant);
    background: rgba(52, 152, 219, 0.06);
    border-left-color: var(--type-instant);
}

.insight-success {
    color: var(--success-color);
    background: rgba(76, 175, 80, 0.06);
    border-left-color: var(--success-color);
}

.curve-insights {
    margin-top: var(--space-5);
    border-top: 1px solid color-mix(in srgb, var(--text-color) 5%, transparent);
    padding-top: var(--space-3);
}

.insights-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

/* ============================================
   TAG CLOUD
   One packed cloud of categories (heavier, accent) and specific tags
   (lighter, text color). Hovering, focusing or tapping a word glows it,
   shows the popup, and eases the other words away by --push-x/--push-y,
   which tag_cloud.rs measures once per activation.
   ============================================ */

.tag-cloud-container {
    min-height: 240px;
    display: flex;
    flex-direction: column;
}

.tag-cloud-empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85em;
    text-align: center;
    padding: var(--space-5) 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* The popup is placed against the stage, which the word list fills. */
.tag-cloud-stage {
    position: relative;
    flex: 1;
    display: flex;
}

.tag-cloud-words {
    flex: 1;
    list-style: none;
    margin: 0;
    padding: var(--space-2);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    align-content: center;
    justify-content: center;
    gap: var(--space-1) var(--space-3);
    line-height: 1.15;
}

/* The slot never moves, so its rect is the word's resting place. */
.tag-cloud-slot {
    display: inline-flex;
}

.tag-cloud-words .tag-cloud-word {
    padding: var(--space-0-5) var(--space-1);
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    font-family: inherit;
    letter-spacing: 0.01em;
    white-space: nowrap;
    cursor: pointer;
    transform: translate(var(--push-x, 0px), var(--push-y, 0px));
    transition:
        transform 0.22s cubic-bezier(0.2, 0.7, 0.3, 1),
        opacity 0.25s ease,
        color 0.2s ease,
        text-shadow 0.2s ease,
        background 0.2s ease;
}

.tag-cloud-word--broad {
    color: var(--accent-color);
    font-weight: 700;
}

.tag-cloud-word--specific {
    color: var(--text-color);
    font-weight: 600;
}

/* The shared button hover lifts and scales; the cloud has its own motion. */
.tag-cloud-words .tag-cloud-word:not(:disabled):hover {
    translate: none;
    scale: none;
}

/* While one word is active the others step back. */
.tag-cloud-words.has-active .tag-cloud-word {
    opacity: 0.55;
}

.tag-cloud-words .tag-cloud-word.is-active {
    opacity: 1;
    color: var(--accent-color);
    background: var(--accent-bg);
    text-shadow:
        0 0 6px var(--accent-color),
        0 0 18px var(--accent-glow);
}

.tag-cloud-popup {
    position: absolute;
    z-index: 1;
    transform: translate(-50%, calc(-100% - var(--space-1-5)));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-0-5);
    padding: var(--space-1-5) var(--space-2-5);
    background: var(--popup-bg);
    border: 1px solid var(--accent-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 14px var(--popup-shadow);
    color: var(--text-color);
    font-size: 0.75rem;
    line-height: 1.25;
    white-space: nowrap;
    pointer-events: none;
    animation: tag-cloud-popup-in 0.16s ease-out;
}

.tag-cloud-popup--below {
    transform: translate(-50%, var(--space-1-5));
}

.tag-cloud-popup-label {
    font-weight: 700;
}

.tag-cloud-popup-count strong {
    color: var(--accent-color);
}

.tag-cloud-popup-kind {
    color: var(--text-muted);
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

@keyframes tag-cloud-popup-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tag-cloud-legend {
    margin: var(--space-1) 0 0;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.tag-cloud-legend-broad {
    color: var(--accent-color);
    font-weight: 700;
}

.tag-cloud-legend-specific {
    color: var(--text-color);
    font-weight: 600;
}

/* Phones: every word is a 40px touch target. */
@media (max-width: 768px) {
    .tag-cloud-words .tag-cloud-word {
        display: inline-flex;
        align-items: center;
        min-height: 40px;
    }
}

/* No push and no fades for readers who asked for less motion; the glow and popup stay. */
@media (prefers-reduced-motion: reduce) {
    .tag-cloud-words .tag-cloud-word {
        transform: none;
        transition: none;
    }

    .tag-cloud-popup {
        animation: none;
    }
}

/* ============================================
   SYNERGY DENSITY SCORE
   ============================================ */

.synergy-density-container {
    min-height: 240px;
}

.synergy-density-empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85em;
    text-align: center;
    padding: var(--space-5) 0;
}

.synergy-density-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
}

/* Donut ring */
.synergy-donut-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
}

.synergy-donut {
    overflow: visible;
    transition: all 0.4s ease;
}

.synergy-donut-pct {
    font-size: 13px;
    font-weight: 700;
    fill: var(--text-color);
}

.synergy-donut-label {
    font-size: 0.74em;
    color: var(--text-muted);
    font-style: italic;
    text-transform: capitalize;
    letter-spacing: 0.04em;
}

.synergy-donut-sublabel {
    font-size: 0.68em;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    opacity: 0.85;
}

/* Cluster list */
.synergy-cluster-list {
    width: 100%;
    columns: 1;
    gap: var(--space-4);
}

@media (min-width: 900px) {
    .synergy-cluster-list {
        columns: 2;
    }
}

@media (min-width: 1400px) {
    .synergy-cluster-list {
        columns: 3;
    }
}

.synergy-cluster-row {
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
    padding: var(--space-1) var(--space-2);
    margin-bottom: var(--space-1);
    border-radius: var(--radius-md);
    font-size: 0.78em;
    transition: background 0.15s;
    break-inside: avoid;
}

.synergy-cluster-row:hover {
    background: var(--entry-hover-bg);
}

.cluster-name {
    flex: 1;
    font-weight: 500;
    color: var(--text-color);
}

.cluster-edges {
    font-size: 0.85em;
    color: var(--text-muted);
    min-width: 20px;
    text-align: right;
}

.synergy-cluster-more {
    color: var(--text-muted);
    font-size: 0.76em;
    font-style: italic;
    padding: var(--space-1) var(--space-2);
    break-inside: avoid;
}

.synergy-density-empty-inline {
    width: 100%;
    padding: var(--space-1) var(--space-2);
}

/* ============================================
   Vulnerability PROFILE
   ============================================ */

.weakness-profile-container {
    min-height: 240px;
}

/* Card Link in Suggestions */
.card-link-suggestion {
    color: var(--accent-color);
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
    /* Subtle space where underline would be */
    padding-bottom: var(--space-px);
}

.card-link-suggestion:hover {
    color: var(--accent-light);
    border-bottom: 1px solid var(--accent-glow);
    filter: brightness(1.1);
}

.weakness-checklist {
    width: 100%;
    columns: 1;
    gap: var(--space-3);
}

@media (min-width: 900px) {
    .weakness-checklist {
        columns: 2;
    }
}

.weakness-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: 7px 10px;
    margin-bottom: var(--space-2);
    border-radius: var(--radius-lg);
    border-left: 3px solid transparent;
    background: var(--entry-bg);
    transition: background 0.15s;
    flex-wrap: wrap;
    break-inside: avoid;
}

.weakness-row:hover {
    background: var(--entry-hover-bg);
}

.check-healthy {
    border-left-color: var(--success-color);
}

.check-minor {
    border-left-color: var(--type-instant);
}

.check-moderate {
    border-left-color: var(--warning-color);
}

.check-critical {
    border-left-color: var(--danger-color);
}

.weakness-icon {
    font-size: 0.9em;
    flex-shrink: 0;
    margin-top: var(--space-px);
}

.weakness-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 100px;
}

.weakness-name {
    font-size: 0.82em;
    font-weight: 600;
    color: var(--text-color);
}

.weakness-count {
    font-size: 0.72em;
    color: var(--text-muted);
}

/* A check's verdict: a colored word after a dot of the same color, not a tinted pill. */
.weakness-level {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.75em;
    font-weight: 700;
    text-transform: capitalize;
    flex-shrink: 0;
    align-self: flex-start;
}

.weakness-level::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: var(--radius-pill);
    background: currentColor;
}

.check-healthy .weakness-level {
    color: var(--success-color);
}

.check-minor .weakness-level {
    color: var(--type-instant);
}

.check-moderate .weakness-level {
    color: var(--warning-color);
}

.check-critical .weakness-level {
    color: var(--danger-color);
}

/* ============================================
   BRACKET ROW
   Our estimate and Commander Bracket's on one 1-5 scale, each marked by a pointer
   carrying its logo (ui/panels/stats/bracket_compare.rs). Their logo badge keeps its
   own light plate: never recolored, filtered or cropped, only scaled by height.
   ============================================ */
.bracket-compare {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    text-shadow: none;
}

/* The title, with how the two compare as its subtitle. */
.bracket-compare-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
    padding-right: var(--space-8);
}

.bracket-compare-title {
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--chart-title-color);
}

.bracket-compare-headline {
    color: var(--text-color);
    font-size: 1.1em;
    font-weight: 600;
}

.bracket-scale {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.bracket-scale-row,
.bracket-scale-track {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.bracket-scale-row {
    min-height: 36px;
}

.bracket-scale-row-ours {
    align-items: end;
}

.bracket-scale-row-theirs {
    align-items: start;
}

.bracket-scale-track {
    gap: var(--space-1);
    list-style: none;
    margin: 0;
    padding: 0;
}

.bracket-scale-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    background: var(--accent-bg);
}

.bracket-scale-step:first-child {
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.bracket-scale-step:last-child {
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.bracket-scale-step-4 {
    background: color-mix(in srgb, var(--warning-color) 16%, transparent);
}

.bracket-scale-step-5 {
    background: color-mix(in srgb, var(--danger-color) 16%, transparent);
}

.bracket-scale-num {
    font-size: 1.15em;
    font-weight: 700;
}

.bracket-scale-name {
    font-size: 0.75em;
    color: var(--text-secondary);
}

.bracket-scale-step.is-marked .bracket-scale-name {
    color: var(--text-color);
}

/* How long a game at the bracket usually runs, under its name. */
.bracket-scale-turns {
    font-size: 0.68em;
    color: var(--text-muted);
}

.bracket-marker {
    grid-row: 1;
    justify-self: center;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    background: var(--bg-secondary);
}

.bracket-marker-ours {
    margin-bottom: var(--space-2);
}

/* The owner's target: a pin on our row, in the accent, beside ours when they agree. */
.bracket-marker-target {
    margin-bottom: var(--space-2);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.bracket-marker-target-label {
    font-size: 0.75em;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.bracket-marker-pair {
    grid-row: 1;
    justify-self: center;
    display: inline-flex;
    align-items: end;
    gap: var(--space-1);
}

.bracket-compare-target {
    color: var(--accent-color);
    font-size: 0.85em;
    font-weight: 600;
}

/* Their pointer, placed by win turn rather than centred in its column. */
.bracket-scale-row-theirs {
    position: relative;
}

.bracket-marker.is-placed {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
}

.bracket-marker-theirs {
    margin-top: var(--space-2);
}

/* The pointer's tip, toward the scale. */
.bracket-marker::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
}

.bracket-marker-ours::after {
    top: 100%;
    border-top-color: var(--border-color);
    border-bottom: 0;
}

.bracket-marker-target::after {
    top: 100%;
    border-top-color: var(--accent-color);
    border-bottom: 0;
}

.bracket-marker-theirs::after {
    bottom: 100%;
    border-bottom-color: var(--border-color);
    border-top: 0;
}

.bracket-marker-logo {
    display: block;
    height: 20px;
    width: auto;
}

.bracket-marker-fallback {
    font-size: 0.75em;
    font-weight: 700;
    color: var(--text-color);
}

/* Their win turn, beside their logo. */
.bracket-marker-note {
    margin-left: var(--space-2);
    font-size: 0.78em;
    font-weight: 700;
    color: var(--text-color);
}

/* Commander Bracket's borderline band: the two brackets it sits between. */
.bracket-scale-band {
    grid-row: 1;
    align-self: start;
    height: 6px;
    margin: 0 var(--space-6);
    border-radius: var(--radius-pill);
    background: repeating-linear-gradient(
        135deg,
        color-mix(in srgb, var(--text-secondary) 55%, transparent) 0 4px,
        transparent 4px 8px
    );
}

.bracket-compare-reasons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-6);
}

.bracket-compare-reasons.is-solo {
    grid-template-columns: minmax(0, 1fr);
}

@container (max-width: 900px) {
    .bracket-compare-reasons {
        grid-template-columns: minmax(0, 1fr);
    }
}

.bracket-compare-side {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
}

.bracket-compare-side-title {
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.bracket-compare-verdict {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.bracket-compare-number {
    font-size: 2em;
    font-weight: 700;
    line-height: 1;
}

.bracket-compare-name {
    font-size: 1.1em;
    font-weight: 600;
}

.bracket-compare-line {
    margin: 0;
    font-size: 0.9em;
    line-height: 1.45;
    color: var(--text-secondary);
}

.bracket-compare-note {
    margin: 0;
    font-size: 0.85em;
    color: var(--warning-color);
}

.bracket-compare-ours .bracket-counts {
    justify-content: flex-start;
}

.bracket-compare-actions,
.bracket-compare-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.bracket-compare-ask {
    font-size: 0.85em;
    color: var(--text-secondary);
}

.bracket-compare-action {
    font-size: 0.85em;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-md);
}

.bracket-compare-action[aria-pressed="true"] {
    border-color: var(--accent-color);
    color: var(--text-color);
}

.bracket-compare-feedback {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.bracket-compare-notes-label {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    font-size: 0.85em;
    color: var(--text-secondary);
}

.bracket-compare-notes {
    min-height: 60px;
    resize: vertical;
    font: inherit;
}

.bracket-compare-link {
    font-size: 0.85em;
}

/* "Powered by Commander Bracket": their credit, wherever their data shows. */
.cb-credit {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.8em;
    color: var(--text-secondary);
    text-decoration: none;
}

.cb-credit:hover,
.cb-credit:focus-visible {
    color: var(--text-color);
    text-decoration: underline;
}

.cb-credit-logo {
    display: block;
    height: 20px;
    width: auto;
}

/* Their reasons in the bracket explainer, after ours. */
.stat-explain-partner {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-color);
}

.stat-explain-partner-title {
    margin: 0;
    font-size: 1.25rem;
}

/* Their estimate's heading: a kicker, "Bracket N", and the name under it. */
.stat-explain-partner-head {
    display: flex;
    flex-direction: column;
    gap: var(--space-px);
}

.stat-explain-partner-kicker {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--chart-title-color);
}

.stat-explain-partner-name {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-secondary);
}

/* Their deck profile: label and value, two columns. */
.stat-explain-def {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-1) var(--space-4);
    margin: 0;
}

.stat-explain-def-row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-1) 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9em;
}

.stat-explain-def-row dt {
    color: var(--text-secondary);
}

.stat-explain-def-row dd {
    margin: 0;
    font-weight: 600;
    color: var(--text-color);
    text-align: right;
}

/* Our signals with nothing behind them, one sentence each, at the bottom. */
.stat-explain-absent-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin: 0;
    padding-left: var(--space-5);
    font-size: 0.9em;
    color: var(--text-secondary);
}

.stat-explain-partner-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-4);
}

/* The row's sections: a small heading, then plain text or a chart. */
.bracket-fact {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.bracket-fact-title {
    margin: 0;
    font-size: 0.72em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--chart-title-color);
}

.bracket-fact-text {
    margin: 0;
    font-size: 0.9em;
    line-height: 1.45;
    color: var(--text-color);
}

.bracket-fact-caption {
    margin: 0;
    font-size: 0.8em;
    line-height: 1.4;
    color: var(--text-secondary);
}

/* Our six signals: a count each, outlined when it sets a floor. */
.bracket-signal-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
    list-style: none;
    margin: 0;
    padding: 0;
}

.bracket-signal {
    display: flex;
    flex-direction: column;
    gap: var(--space-px);
    padding: var(--space-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--accent-bg);
}

.bracket-signal.is-zero {
    background: transparent;
}

.bracket-signal.is-zero .bracket-signal-count,
.bracket-signal.is-zero .bracket-signal-label,
.bracket-signal.is-pending .bracket-signal-count,
.bracket-signal.is-pending .bracket-signal-label {
    color: var(--text-muted);
}

.bracket-signal.is-floor {
    border-color: var(--warning-color);
}

.bracket-signal-count {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--text-color);
}

.bracket-signal-label {
    font-size: 0.75em;
    color: var(--text-secondary);
}

.bracket-signal-floor {
    font-size: 0.7em;
    font-weight: 600;
    color: var(--warning-color);
}

.bracket-compare-link-button {
    align-self: flex-start;
    font-size: 0.82em;
    padding: var(--space-1) var(--space-2);
}

/* The cEDH markers, five dots. */
.bracket-dots {
    display: flex;
    gap: var(--space-1);
}

.bracket-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-round);
    background: var(--border-color);
}

.bracket-dot.is-met {
    background: var(--warning-color);
}

/* Their win turn on a turn 1-13 line, banded by Commander Bracket's win turns: Bracket 5 up
   to turn 4, 4 to turn 6, 3 to turn 8, 2 to turn 10, 1 after (positions are (turn - 1) / 12). */
.bracket-turn-chart {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.bracket-turn-track {
    position: relative;
    height: 8px;
    border-radius: var(--radius-pill);
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--danger-color) 60%, transparent) 0 25%,
        color-mix(in srgb, var(--warning-color) 55%, transparent) 25% 41.67%,
        color-mix(in srgb, var(--accent-color) 50%, transparent) 41.67% 58.33%,
        color-mix(in srgb, var(--accent-color) 35%, transparent) 58.33% 75%,
        color-mix(in srgb, var(--accent-color) 20%, transparent) 75% 100%
    );
}

.bracket-turn-pin {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    transform: translate(-50%, -50%);
    border: 2px solid var(--bg-color);
    border-radius: var(--radius-round);
    background: var(--text-color);
}

.bracket-turn-ticks {
    position: relative;
    height: 1.2em;
    font-size: 0.7em;
    color: var(--text-muted);
}

.bracket-turn-tick {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    white-space: nowrap;
}

.bracket-turn-tick.is-first {
    transform: none;
}

.bracket-turn-tick.is-last {
    transform: translateX(-100%);
}

/* Their at-the-table scores, 0 to 100. */
.bracket-meter-row {
    display: grid;
    grid-template-columns: 7em minmax(0, 1fr) 6.5em;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.85em;
}

.bracket-meter-label {
    color: var(--text-secondary);
}

.bracket-meter {
    height: 8px;
    overflow: hidden;
    border-radius: var(--radius-pill);
    background: var(--border-color);
}

.bracket-meter-fill {
    display: block;
    height: 100%;
    border-radius: var(--radius-pill);
    background: var(--accent-color);
}

.bracket-meter-fill.is-health {
    background: var(--success-color);
}

.bracket-meter-value {
    text-align: right;
    font-weight: 600;
    color: var(--text-color);
}

/* Their metrics: archenemy, deck health and speed, one list. */
.bracket-meters {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.bracket-meter-row.is-speed {
    align-items: start;
}

.bracket-meter-row.is-speed .bracket-turn-track,
.bracket-meter-row.is-speed .bracket-skeleton-bar {
    margin-top: var(--space-1);
}

/* A bar grows to its value when the answer lands. */
.bracket-meter-fill {
    transform-origin: left center;
    animation: bracketMeterGrow 600ms ease-out;
}

@keyframes bracketMeterGrow {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* The vote, as thumbs. */
.bracket-compare-thumb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 30px;
    padding: var(--space-1) var(--space-2);
}

/* The note box, in the theme's input colors: textareas have no global style. */
.bracket-compare-notes {
    padding: var(--space-1-5) var(--space-2-5);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 0.9em;
    transition: border-color 0.2s ease;
}

.bracket-compare-notes:hover {
    border-color: var(--accent-hover);
}

.bracket-compare-notes:focus {
    outline: none;
    border-color: var(--accent-color);
}

.bracket-compare-notes::placeholder {
    color: var(--text-muted);
}

/* Loading: their half's shape, shimmering, sized like the answer so nothing moves when it
   lands. */
.bracket-skeleton-half {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.bracket-skeleton {
    display: block;
    border-radius: var(--radius-pill);
    background: linear-gradient(
        90deg,
        var(--border-color) 25%,
        color-mix(in srgb, var(--border-color) 30%, transparent) 50%,
        var(--border-color) 75%
    );
    background-size: 200% 100%;
    animation: bracketShimmer 1.6s infinite;
}

.bracket-skeleton-number {
    width: 1.1em;
    height: 1em;
    font-size: 2em;
    border-radius: var(--radius-md);
}

.bracket-skeleton-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.9em;
    color: var(--text-secondary);
}

.bracket-skeleton-line {
    width: 90%;
    height: 0.8em;
    margin: var(--space-1) 0;
}

.bracket-skeleton-line.is-short {
    width: 55%;
}

.bracket-skeleton-line.is-links {
    width: 60%;
}

.bracket-skeleton-cell {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.bracket-skeleton-bar {
    height: 8px;
}

.bracket-skeleton-ticks {
    width: 100%;
    height: 0.6em;
    opacity: 0.6;
}

.bracket-skeleton-value {
    justify-self: end;
    width: 3em;
    height: 0.8em;
}

.bracket-skeleton-chip {
    width: 34px;
    height: 30px;
    border-radius: var(--radius-md);
}

@keyframes bracketShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Their pointer's row while the answer is on its way: a running stripe, so no bracket is
   implied before one arrives. */
.bracket-scale-pending {
    grid-column: 1 / -1;
    grid-row: 1;
    align-self: start;
    height: 4px;
    margin: var(--space-2) var(--space-6) 0;
    border-radius: var(--radius-pill);
    background: linear-gradient(
        90deg,
        transparent,
        color-mix(in srgb, var(--accent-color) 70%, transparent),
        transparent
    );
    background-size: 35% 100%;
    background-repeat: no-repeat;
    animation: bracketPending 1.4s ease-in-out infinite;
}

@keyframes bracketPending {
    0% { background-position: -40% 0; }
    100% { background-position: 140% 0; }
}

/* The answer fades in when it lands. */
.bracket-reveal {
    animation: bracketReveal 320ms ease-out both;
}

@keyframes bracketReveal {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .bracket-skeleton,
    .bracket-scale-pending,
    .bracket-reveal,
    .bracket-meter-fill {
        animation: none;
    }
}
