/* ── Agents (Arena) page-specific styles ──
   Chrome (topbar/sidebar/bottom-nav/tokens) lives in common.css.
   Subtitle/heading line uses B2 (#4d9eff) per brand-guide §4 Dashboard Secondary.
   ──────────────────────────────── */

/* ══════════════════════════════════
   GLASS PANEL (egos-style)
   ══════════════════════════════════ */

.glass-panel {
    background:
        linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0) 40%),
        rgba(255,255,255,0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.08);
    border-top-color: rgba(255,255,255,0.18);
    border-left-color: rgba(255,255,255,0.12);
    border-radius: 16px;
    box-shadow:
        0 4px 16px rgba(0,0,0,0.25),
        0 1px 0 rgba(255,255,255,0.08) inset,
        1px 0 0 rgba(255,255,255,0.04) inset,
        0 -1px 0 rgba(0,0,0,0.15) inset;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.glass-panel:hover {
    border-top-color: rgba(255,255,255,0.25);
    border-left-color: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.14);
    background:
        linear-gradient(135deg, rgba(255,255,255,0.09) 0%, rgba(255,255,255,0.01) 40%),
        rgba(255,255,255,0.05);
    box-shadow:
        0 8px 28px rgba(0,0,0,0.35),
        0 1px 0 rgba(255,255,255,0.12) inset,
        1px 0 0 rgba(255,255,255,0.06) inset,
        0 -1px 0 rgba(0,0,0,0.2) inset;
    transform: translateY(-1px);
}

/* ── Page (override: tighter padding) ── */
.page-content {
    position: relative;
    padding: 16px 24px;
}
.page-content::before {
    content: '';
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100vh;
    pointer-events: none;
    background:
        radial-gradient(ellipse 50% 60% at 30% 40%, rgba(var(--b2-rgb),0.12) 0%, transparent 70%),
        radial-gradient(ellipse 45% 55% at 70% 55%, rgba(var(--positive-rgb),0.06) 0%, transparent 70%);
    z-index: 0;
}

.page-header {
    position: relative; z-index: 1;
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}

.page-title { font-size: 28px; font-weight: 800; color: #fff; }
.page-subtitle {
    font-size: 15px; line-height: 1.35; margin-top: 6px;
    color: var(--b2-soft);
    text-shadow: 0 0 8px rgba(var(--b2-rgb), 0.20), 0 0 20px rgba(var(--b2-rgb), 0.08);
}

.view-toggle { display: flex; gap: 4px; }
.view-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-dim); padding: 4px; border-radius: 6px;
    transition: color 0.15s;
}
.view-btn:hover, .view-btn.active { color: var(--b2); }
.view-btn .material-symbols-outlined { font-size: 20px; }

/* ══════════════════════════════════
   SUB TABS
   ══════════════════════════════════ */

.sub-tabs {
    display: inline-flex; position: relative; margin: 5px 0 21px;
    background: rgba(255,255,255,0.04);
    border: none;
    border-radius: 14px; padding: 3px;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.sub-tabs-slider {
    position: absolute; top: 3px; bottom: 3px;
    border-radius: 11px;
    background: linear-gradient(180deg, rgba(var(--b2-rgb),0.25) 0%, rgba(var(--b2-rgb),0.10) 100%);
    border: 1px solid rgba(var(--b2-rgb),0.30);
    border-top-color: rgba(var(--b2-rgb),0.45);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.12),
        0 2px 8px rgba(var(--b2-rgb),0.14);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}
.sub-tab {
    position: relative; z-index: 1;
    padding: 6px 20px; font-size: 13px; font-weight: 600;
    border-radius: 11px; text-decoration: none;
    color: var(--text-dim); background: transparent;
    transition: color 0.2s;
}
.sub-tab:hover {
    color: var(--text-muted);
}
.sub-tab.active {
    color: #fff;
}

/* ══════════════════════════════════
   POSITION GAUGE
   ══════════════════════════════════ */

/* ── Section Heading (egos-idea style) ── */
.leagues-section { margin-bottom: 35px; }
.section-heading {
    font-size: 18px; font-weight: 800; margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px;
    color: var(--b2);
    text-shadow: 0 0 8px rgba(var(--b2-rgb), 0.20);
}
.section-heading .material-symbols-outlined {
    font-size: 20px;
    color: var(--b2);
}
.section-heading-count {
    margin-left: auto;
    font-size: 12px; font-weight: 600;
    color: var(--text-dim);
    text-shadow: none;
}

.gauge-wrap { display: flex; flex-direction: column; gap: 10px; }
.gauge-bar {
    display: flex; height: 28px; border-radius: 8px; overflow: hidden;
    gap: 2px; background: rgba(255,255,255,0.02);
}
.gauge-seg {
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; transition: width 0.5s ease; min-width: 0;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.gauge-seg-long {
    background: linear-gradient(180deg, rgba(var(--positive-rgb),0.4) 0%, rgba(var(--positive-rgb),0.15) 50%, rgba(var(--positive-rgb),0.22) 100%);
    border: 1px solid rgba(var(--positive-rgb),0.3); border-top-color: rgba(var(--positive-rgb),0.5);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 2px 8px rgba(var(--positive-rgb),0.1);
    color: var(--positive);
}
.gauge-seg-short {
    background: linear-gradient(180deg, rgba(var(--negative-rgb),0.4) 0%, rgba(var(--negative-rgb),0.15) 50%, rgba(var(--negative-rgb),0.22) 100%);
    border: 1px solid rgba(var(--negative-rgb),0.3); border-top-color: rgba(var(--negative-rgb),0.5);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 2px 8px rgba(var(--negative-rgb),0.1);
    color: var(--negative);
}
.gauge-seg-flat {
    background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.03) 50%, rgba(255,255,255,0.06) 100%);
    border: 1px solid rgba(255,255,255,0.08); border-top-color: rgba(255,255,255,0.18);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
    color: var(--text-dim);
}
.gauge-legend { display: flex; gap: 20px; font-size: 12px; }
.gauge-legend-item { display: flex; align-items: center; gap: 6px; }
.gauge-dot { width: 10px; height: 10px; border-radius: 50%; }
.gauge-dot-long { background: var(--positive); box-shadow: 0 0 6px rgba(var(--positive-rgb),0.4); }
.gauge-dot-short { background: var(--negative); box-shadow: 0 0 6px rgba(var(--negative-rgb),0.4); }
.gauge-dot-flat { background: var(--text-dim); }
.gauge-val { font-weight: 700; color: #fff; }

/* ══════════════════════════════════
   FILTERS
   ══════════════════════════════════ */

.filter-bar {
    position: relative; z-index: 1;
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin-bottom: 12px;
    padding: 4px 0;
}
.filter-bar .view-toggle { margin-left: auto; }

/* Active filter chips — shown below filter-bar when any filter is set.
   Each chip is removable; clicking the × clears that single filter dimension. */
.active-filters {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-bottom: 12px;
}
.active-filters:empty { display: none; }
.filter-chip-active {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    background: rgba(var(--b2-rgb), 0.14);
    color: var(--b2-soft);
    border: 1px solid rgba(var(--b2-rgb), 0.30);
    border-radius: 14px;
    font-size: 11px; font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-family: inherit;
}
.filter-chip-active:hover {
    background: rgba(var(--b2-rgb), 0.22);
    border-color: rgba(var(--b2-rgb), 0.50);
}
.filter-chip-active .filter-chip-x {
    font-size: 14px; line-height: 1;
    color: var(--text-dim);
    margin-left: 2px;
}
.filter-chip-active:hover .filter-chip-x { color: #fff; }

/* ── Search — neutral baseline matching pill/dropdown defaults; B2 azure on focus ── */
.search-wrap {
    position: relative; display: flex; align-items: center;
}
.search-icon {
    position: absolute; left: 10px; font-size: 16px; color: rgba(255,255,255,0.35);
    pointer-events: none; transition: color 0.15s;
}
.search-input {
    padding: 5px 12px 5px 30px; font-size: 12px; border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04); color: var(--text-primary);
    font-family: inherit; font-weight: 500; width: 190px;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
    transition: all 0.2s; outline: none;
}
.search-input::placeholder { color: var(--text-dim); font-weight: 500; }
.search-input:focus {
    border-color: rgba(var(--b2-rgb),0.40);
    background: rgba(255,255,255,0.06);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 0 10px rgba(var(--b2-rgb),0.14);
}
.search-input:focus ~ .search-icon,
.search-wrap.has-value .search-icon { color: var(--b2); }
.search-hint {
    position: absolute; left: 0; top: calc(100% + 4px);
    font-size: 11px; color: var(--text-dim); white-space: nowrap;
    opacity: 0; transform: translateY(-4px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}
.search-wrap.show-hint .search-hint {
    opacity: 1; transform: translateY(0);
}
.search-wrap.show-hint { margin-bottom: 14px; }

.filter-pills { display: flex; gap: 6px; }
/* Period pills don't apply in heatmap (score-centric, no period series) — hide */
body[data-view="heatmap"] .filter-pills { display: none; }

.pill {
    padding: 5px 14px; font-size: 12px; border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.08); cursor: pointer; font-weight: 500;
    background: rgba(255,255,255,0.04); color: var(--text-dim);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
    transition: all 0.15s;
}
.pill:hover {
    background: rgba(255,255,255,0.08); color: var(--text-muted);
    border-color: rgba(255,255,255,0.14);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 2px 6px rgba(0,0,0,0.15);
}
/* Active pill — luminous B2 azure translucent gradient (matches sub-tab slider + dropdown active) */
.pill.active {
    background: linear-gradient(180deg, rgba(var(--b2-rgb),0.25) 0%, rgba(var(--b2-rgb),0.10) 100%);
    color: var(--b2-soft);
    border-color: rgba(var(--b2-rgb),0.35);
    border-top-color: rgba(var(--b2-rgb),0.50);
    font-weight: 600;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.12),
        0 2px 8px rgba(var(--b2-rgb),0.14);
}

.filter-dropdowns { display: flex; gap: 6px; }

/* ── Custom Dropdown ── */
.dropdown { position: relative; }

.dropdown-btn {
    padding: 5px 14px; font-size: 12px; border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04); color: var(--text-dim);
    cursor: pointer; font-family: inherit; font-weight: 500;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
    transition: all 0.15s; white-space: nowrap;
}
.dropdown-btn:hover {
    border-color: rgba(255,255,255,0.15); color: var(--text-muted);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 2px 6px rgba(0,0,0,0.15);
}
/* Active dropdown — same luminous B2 azure treatment as .pill.active */
.dropdown-btn.dropdown-active {
    background: linear-gradient(180deg, rgba(var(--b2-rgb),0.25) 0%, rgba(var(--b2-rgb),0.10) 100%);
    color: var(--b2-soft);
    border-color: rgba(var(--b2-rgb),0.35);
    border-top-color: rgba(var(--b2-rgb),0.50);
    font-weight: 600;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.12),
        0 2px 8px rgba(var(--b2-rgb),0.14);
}

.dropdown-menu {
    display: none;
    position: absolute; top: calc(100% + 4px); left: 0;
    min-width: 140px; max-height: 280px; overflow-y: auto;
    background: rgba(15,20,35,0.85);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px; padding: 4px; z-index: 200;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.dropdown.open .dropdown-menu { display: block; }

.dropdown-item {
    padding: 6px 12px; font-size: 12px; border-radius: 8px; cursor: pointer;
    color: var(--text-muted); transition: background 0.1s, color 0.1s;
}
.dropdown-item:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.dropdown-item-active { color: var(--b2); font-weight: 600; }

.btn-reset {
    padding: 5px 10px; font-size: 11px; border-radius: 20px;
    border: none; cursor: pointer;
    background: none; color: var(--text-dim);
    text-decoration: underline; text-underline-offset: 3px;
}
.btn-reset:hover { color: var(--b2); }

/* ══════════════════════════════════
   LEAGUE SECTIONS
   ══════════════════════════════════ */

.league-section { margin-bottom: 32px; }

.league-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}

.league-title {
    font-size: 22px; font-weight: 800;
}
/* league-title — gradient text via background-clip + drop-shadow glow.
   Mirrors the prototype rendering for consistent tier hierarchy. */
.league-title.tier-major,
.league-title.tier-minor,
.league-title.tier-bench {
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.league-title.tier-major {
    background-image: linear-gradient(135deg, var(--tier-major) 0%, color-mix(in srgb, var(--tier-major) 50%, white) 100%);
    filter: drop-shadow(0 0 6px rgba(var(--tier-major-rgb), 0.35));
}
.league-title.tier-minor {
    background-image: linear-gradient(135deg, var(--tier-minor) 0%, color-mix(in srgb, var(--tier-minor) 50%, white) 100%);
    filter: drop-shadow(0 0 6px rgba(var(--tier-minor-rgb), 0.35));
}
.league-title.tier-bench {
    background-image: linear-gradient(135deg, var(--tier-bench) 0%, color-mix(in srgb, var(--tier-bench) 60%, white) 100%);
    filter: drop-shadow(0 0 6px rgba(var(--tier-bench-rgb), 0.35));
}

.league-count {
    font-size: 13px; font-weight: 600;
    animation: glow-pulse 2.5s ease-in-out infinite;
}
.tier-major + .league-count { color: var(--tier-major); --glow-rgb: var(--tier-major-rgb); }
.tier-minor + .league-count { color: var(--tier-minor); --glow-rgb: var(--tier-minor-rgb); }
.tier-bench + .league-count { color: var(--tier-bench); --glow-rgb: var(--tier-bench-rgb); }

@keyframes glow-pulse {
    0%, 100% { text-shadow: 0 0 6px rgba(var(--glow-rgb),0.5), 0 0 14px rgba(var(--glow-rgb),0.25); }
    50% { text-shadow: 0 0 10px rgba(var(--glow-rgb),0.7), 0 0 22px rgba(var(--glow-rgb),0.4); }
}

/* ══════════════════════════════════
   TABLE (glass)
   ══════════════════════════════════ */

.table-wrap {
    overflow-x: auto; border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0) 40%),
        rgba(255,255,255,0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.08);
    border-top-color: rgba(255,255,255,0.18);
    border-left-color: rgba(255,255,255,0.12);
    box-shadow:
        0 4px 16px rgba(0,0,0,0.25),
        0 1px 0 rgba(255,255,255,0.08) inset;
}

/* Glass-card wrapper — mirrors .mag-compact so list view + magazine compact
   share the same surface treatment. */
.agents-table-wrap {
    background:
        linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0) 40%),
        rgba(255,255,255,0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.08);
    border-top-color: rgba(255,255,255,0.18);
    border-left-color: rgba(255,255,255,0.12);
    border-radius: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    box-shadow:
        0 4px 16px rgba(0,0,0,0.25),
        0 1px 0 rgba(255,255,255,0.08) inset;
}

.agents-table {
    width: 100%; min-width: 700px;
    border-collapse: collapse;
    background: transparent;
}

.agents-table th,
.agents-table td {
    background: transparent;
    text-align: center;
}
.agents-table th {
    padding: 8px 12px; font-size: 10px; font-weight: 600;
    text-transform: uppercase; white-space: nowrap;
    color: var(--text-dim);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.agents-table th.sortable { cursor: pointer; user-select: none; }
.agents-table th.sortable:hover { color: var(--b2); }

.agents-table td {
    padding: 8px 12px; font-size: 12px; white-space: nowrap;
    border-bottom: 1px solid rgba(255,255,255,0.02);
}

.agents-table tr:hover td { background: rgba(255,255,255,0.03); }
.agents-table tr.row-alt td { background: rgba(255,255,255,0.01); }

/* Agent column stays left-aligned (matches magazine .mag-ch-agent / .mag-row-agent) */
.agents-table th:nth-child(2),
.agents-table td.cell-agent { text-align: left; }
.cell-agent { display: inline-flex; align-items: center; gap: 6px; }

.cell-num { text-align: center; font-variant-numeric: tabular-nums; font-weight: 500; color: #fff; }

/* Score colored by parent league tier — score number reinforces tier ranking
   instead of pulling B2 azure (which carries chrome / interactive active states). */
.score-chip {
    font-weight: 700; color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.league-major .score-chip,
.league-major .mag-card-score   { color: var(--tier-major); }
.league-minor .score-chip,
.league-minor .mag-card-score   { color: var(--tier-minor); }
.league-bench .score-chip,
.league-bench .mag-card-score   { color: var(--tier-bench); }

.pos-badge { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; }
.tone-pos { color: var(--positive); }
.tone-neg { color: var(--negative); }
.tone-flat { color: var(--text-dim); }

.viewer-link {
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--text-dim); text-decoration: none; vertical-align: middle;
    transition: color 0.15s;
}
.viewer-link:hover { color: var(--b2); }
.viewer-link .material-symbols-outlined { font-size: 20px; line-height: 1; }

/* Card-as-link — strip anchor defaults, signal interactivity via cursor + parent hover */
a.mag-card,
a.bar-card,
a.mag-row,
a.agent-card {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}
/* When a card/row is the link, the inner icon span tracks parent hover */
a.mag-card:hover .viewer-link-static,
a.bar-card:hover .viewer-link-static,
a.mag-row:hover .viewer-link-static,
a.agent-card:hover .viewer-link-static { color: var(--b2); }

/* ══════════════════════════════════
   CARD GRID (glass)
   ══════════════════════════════════ */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.agent-card {
    background:
        linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0) 40%),
        rgba(255,255,255,0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.08);
    border-top-color: rgba(255,255,255,0.18);
    border-left-color: rgba(255,255,255,0.12);
    border-radius: 16px; padding: 14px;
    box-shadow:
        0 4px 16px rgba(0,0,0,0.25),
        0 1px 0 rgba(255,255,255,0.08) inset,
        1px 0 0 rgba(255,255,255,0.04) inset,
        0 -1px 0 rgba(0,0,0,0.15) inset;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    cursor: default;
}
.agent-card:hover {
    border-top-color: rgba(255,255,255,0.25);
    border-left-color: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.14);
    background:
        linear-gradient(135deg, rgba(255,255,255,0.09) 0%, rgba(255,255,255,0.01) 40%),
        rgba(255,255,255,0.05);
    box-shadow:
        0 8px 28px rgba(0,0,0,0.35),
        0 1px 0 rgba(255,255,255,0.12) inset,
        1px 0 0 rgba(255,255,255,0.06) inset,
        0 -1px 0 rgba(0,0,0,0.2) inset;
    transform: translateY(-1px);
}

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

.card-identity { display: flex; align-items: center; gap: 6px; }

/* ══ Bar Cards ══ */

.bar-card { padding: 14px; }
.bar-chart { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bar-label { width: 28px; color: var(--text-dim); font-weight: 600; font-size: 11px; flex-shrink: 0; }
.bar-track { flex: 1; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.04); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.bar-val { width: 64px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 12px; }
/* Bar card footer — typography-only stat grid (no bar/ring viz).
   The bar-chart above is the primary viz; footer keeps secondary metrics
   as a clean 4-column label/value stack so visual attention isn't fragmented. */
.bar-footer {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.06);
}
.bar-footer .footer-stat {
    display: flex; flex-direction: column; gap: 2px;
    align-items: flex-start; min-width: 0;
}
.bar-footer .footer-label {
    font-size: 9px; color: var(--text-dim);
    font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
}
.bar-footer .footer-val {
    font-size: 13px; color: #fff;
    font-weight: 700; font-variant-numeric: tabular-nums;
    line-height: 1;
}
.bar-footer .footer-val.tone-neg { color: var(--negative); }

/* ══ Mosaic — Squarified Treemap (heatmap successor) ══
   Each tile's area is proportional to its agent's score (after score^EMPHASIS
   weighting in JS). Layout is a squarified treemap (Bruls 2000): tiles fully
   tile the container with aspect ratios near 1. JS computes pixel rects and
   emits inline `%` styles so the mosaic scales with the container.
   Per-tile font size uses container query units (`cqi`) so text auto-fits the
   tile, not the viewport. */

.mosaic-grid {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 14px;
    background: rgba(255,255,255,0.02);
    margin: 8px 0;
}

a.mosaic-tile { text-decoration: none; color: inherit; }
.mosaic-tile {
    position: absolute;
    box-sizing: border-box;
    container-type: inline-size;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 2px; padding: 4px;
    border: 1px solid rgba(0,0,0,0.30);
    overflow: hidden;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: filter 0.15s, box-shadow 0.15s;
}
.mosaic-tile:hover {
    filter: brightness(1.18);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35);
    z-index: 5;
}

.mosaic-id {
    display: inline-flex; align-items: baseline; gap: 4px;
    line-height: 1.1; text-align: center;
    flex-wrap: wrap; justify-content: center;
    max-width: 100%;
}
/* Container-query units: 1cqmin = 1% of the tile's SHORT side. Using cqmin
   (not cqi) ensures fonts shrink with the truly limiting dimension — so
   smaller tiles always show smaller text, preserving visual hierarchy. */
.mosaic-tile .agent-ego-text {
    font-size: clamp(7px, 11cqmin, 22px);
    color: #fff; font-weight: 700;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    white-space: nowrap;
}
.mosaic-tile .module-chip {
    font-size: clamp(5px, 7cqmin, 13px);
    padding: 0 4px;
}
.mosaic-score {
    font-size: clamp(9px, 22cqmin, 42px);
    font-weight: 800; color: #fff; line-height: 1.0;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    font-variant-numeric: tabular-nums;
}
.mosaic-pnl {
    font-size: clamp(6px, 9cqmin, 16px);
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Small tiles drop secondary chrome to keep the score legible. */
.mosaic-tile.is-small .module-chip { display: none; }
.mosaic-tile.is-small .mosaic-pnl { display: none; }
.mosaic-tile.is-small { gap: 1px; padding: 3px; }

/* Tiny tiles show only score (or nothing if even that won't fit). */
.mosaic-tile.is-tiny .mosaic-id,
.mosaic-tile.is-tiny .mosaic-pnl { display: none; }
.mosaic-tile.is-tiny { padding: 2px; gap: 0; }
.mosaic-tile.is-tiny .mosaic-score { font-size: clamp(7px, 28cqmin, 14px); }

@media (min-width: 768px) {
    .mosaic-grid { aspect-ratio: 16 / 9; margin: 10px 0; }
}

.heat-legend { display: flex; gap: 16px; padding: 8px 0; font-size: 11px; color: var(--text-dim); flex-wrap: wrap; }
.heat-legend-item { display: flex; align-items: center; gap: 4px; }
.heat-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }

/* ══════════════════════════════════
   MAGAZINE (glass, no top3 bg colors)
   ══════════════════════════════════ */

.mag-featured {
    display: grid;
    /* minmax(0, 1fr) — 1fr's default min is min-content, which lets card
       contents (long % strings, labels) push columns past the viewport. The
       (0, 1fr) form forces columns to shrink to share the row equally. */
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px; margin-bottom: 16px;
}

.mag-card {
    background:
        linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0) 40%),
        rgba(255,255,255,0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.08);
    border-top-color: rgba(255,255,255,0.18);
    border-left-color: rgba(255,255,255,0.12);
    border-radius: 16px; padding: 16px;
    box-shadow:
        0 4px 16px rgba(0,0,0,0.25),
        0 1px 0 rgba(255,255,255,0.08) inset,
        1px 0 0 rgba(255,255,255,0.04) inset,
        0 -1px 0 rgba(0,0,0,0.15) inset;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.mag-card:hover {
    border-top-color: rgba(255,255,255,0.25);
    border-left-color: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.14);
    background:
        linear-gradient(135deg, rgba(255,255,255,0.09) 0%, rgba(255,255,255,0.01) 40%),
        rgba(255,255,255,0.05);
    box-shadow:
        0 8px 28px rgba(0,0,0,0.35),
        0 1px 0 rgba(255,255,255,0.12) inset,
        1px 0 0 rgba(255,255,255,0.06) inset,
        0 -1px 0 rgba(0,0,0,0.2) inset;
    transform: translateY(-1px);
}

.mag-card-top {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.mag-top-left { display: flex; align-items: center; gap: 8px; }

/* Rank chip — neutral ordinal, no tier signal (tier already conveyed by section) */
.mag-rank-bg {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 8px;
    font-size: 14px; font-weight: 800;
    background: rgba(255,255,255,0.06); color: var(--text-primary);
    flex-shrink: 0;
}

/* mag-card-score color is set by parent .league-* selector above */
.mag-card-score {
    font-size: 22px; font-weight: 800; color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.mag-card-body { display: flex; gap: 16px; align-items: stretch; }
.mag-card-bars { flex: 1; display: flex; flex-direction: column; gap: 6px; }

.mag-card-stats {
    display: flex; flex-direction: column; gap: 6px;
    min-width: 80px; flex-shrink: 0;
    padding-left: 14px;
    border-left: 1px solid rgba(255,255,255,0.08);
}
.mag-stat { display: flex; flex-direction: column; }
.mag-stat-label { font-size: 10px; color: var(--text-dim); font-weight: 600; text-transform: uppercase; }
.mag-stat-val { font-size: 14px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }

/* Compact list (glass) */
.mag-compact {
    display: flex; flex-direction: column;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0) 40%),
        rgba(255,255,255,0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.08);
    border-top-color: rgba(255,255,255,0.18);
    border-left-color: rgba(255,255,255,0.12);
    border-radius: 16px;
    overflow-x: auto; overflow-y: hidden;
    box-shadow:
        0 4px 16px rgba(0,0,0,0.25),
        0 1px 0 rgba(255,255,255,0.08) inset;
}

.mag-compact-header {
    display: flex; align-items: center;
    padding: 8px 12px; font-size: 10px;
    font-weight: 600; text-transform: uppercase;
    color: var(--text-dim);
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    min-width: max-content;
}

.mag-ch-rank { width: 32px; text-align: center; flex-shrink: 0; }
.mag-ch-agent { flex: 1; min-width: 100px; }
.mag-ch-pos { width: 52px; text-align: center; flex-shrink: 0; }
.mag-ch-score { width: 52px; text-align: center; flex-shrink: 0; }
.mag-ch-ret { width: 72px; text-align: center; flex-shrink: 0; }
.mag-ch-metric { width: 64px; text-align: center; flex-shrink: 0; }

.mag-row {
    display: flex; align-items: center;
    padding: 8px 12px; font-size: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.02);
    transition: background 0.15s;
    min-width: max-content;
}
.mag-row:hover { background: rgba(255,255,255,0.03); }
.mag-row.row-alt { background: rgba(255,255,255,0.01); }

.mag-row-rank { text-align: center; flex-shrink: 0; font-weight: 700; color: var(--text-dim); font-size: 13px; }
.mag-row-agent { display: flex; align-items: center; gap: 6px; }

/* ── States ── */
.empty-state, .loading-state {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 12px;
    min-height: 200px; color: var(--text-dim); font-size: 14px;
}
.empty-main { font-size: 14px; color: var(--text-muted); }
.empty-detail { font-size: 12px; color: var(--text-dim); }
.empty-reset-btn {
    padding: 6px 14px;
    background: rgba(var(--b2-rgb), 0.14);
    color: var(--b2-soft);
    border: 1px solid rgba(var(--b2-rgb), 0.30);
    border-radius: 6px;
    font-family: inherit; font-size: 12px; font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.empty-reset-btn:hover { background: rgba(var(--b2-rgb), 0.22); }

/* Info bar — Top agent link inherits info-val tone with subtle hover */
.info-link {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px dotted rgba(255,255,255,0.20);
    font-weight: 600;
    transition: color 0.15s, border-color 0.15s;
}
.info-link:hover {
    color: var(--b2-soft);
    border-bottom-color: rgba(var(--b2-rgb), 0.55);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .bottom-nav { display: flex; }
    .page-content { margin-left: 0; padding: 12px; padding-bottom: 80px; overflow-x: hidden; }
    .filter-bar { gap: 6px; }
    .card-grid { grid-template-columns: 1fr; }
    .mag-featured { grid-template-columns: 1fr; }
    .spark-grid { grid-template-columns: 1fr; }
    .gauge-legend { flex-wrap: wrap; gap: 8px 16px; }
}
