/* ==========================================================================
   Design tokens
   8px spacing scale, type scale 12/14/16/20/28, colour, radius and shadow tokens.
   ========================================================================== */
:root {
    --s-half: 4px;
    --s1: 8px;
    --s2: 16px;
    --s3: 24px;
    --s4: 32px;
    --s5: 40px;
    --s6: 48px;

    --t-xs: 12px;
    --t-sm: 14px;
    --t-md: 16px;
    --t-lg: 20px;
    --t-xl: 28px;

    --bg: #0a1017;
    --surface: rgba(14, 20, 28, 0.9);
    --surface-solid: #111922;
    --surface-2: rgba(255, 255, 255, 0.04);
    --surface-3: rgba(255, 255, 255, 0.08);
    --hover: rgba(255, 255, 255, 0.07);
    --line: rgba(255, 255, 255, 0.08);
    --line-2: rgba(255, 255, 255, 0.14);
    --text: #eef3f8;
    --text-2: #a9b6c4;
    --text-3: #8a97a3; /* 4.5:1 or better on the surfaces, also over the daylight map */
    --accent: #f5b942;
    --accent-2: #ffd27a;
    --accent-ink: #1d1404;
    --good: #3fd07a;
    --bad: #ff6b5e;
    --warn: #f0a530;
    --info: #5aa9ff;
    --violet: #a98bff;
    --bronze: #d08a4e;
    --silver: #c8d2dc;
    --gold: #f5c542;

    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 20px;
    --r-pill: 999px;

    --sh-1: 0 2px 8px rgba(0, 0, 0, 0.28);
    --sh-2: 0 12px 32px rgba(0, 0, 0, 0.42);
    --sh-3: 0 24px 64px rgba(0, 0, 0, 0.55);
    --glass: blur(16px) saturate(1.3);

    --tap: 44px;
    --hud-h: 64px;
    --drawer-w: 420px;
    --rail-w: 84px;
    --row-pad: 12px;

    font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "SF Pro Text", Roboto, sans-serif;
    font-size: var(--t-sm);
    line-height: 1.4;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }
body { color: var(--text); }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; }
input, select {
    font: inherit; font-size: var(--t-md); color: var(--text); background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 0 var(--s2); min-height: var(--tap); min-width: 0;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245, 185, 66, 0.18); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.ic { flex: none; display: block; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.warn { color: var(--warn); }
.muted { color: var(--text-2); }
.num, .stat-v, .lrow-v, .kv b, td.n { font-variant-numeric: tabular-nums; }

#map { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; cursor: grab; }
#map.dragging { cursor: grabbing; }

/* ==========================================================================
   Components
   ========================================================================== */

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--s1);
    min-height: var(--tap); padding: 0 var(--s2); border-radius: var(--r-md);
    font-size: var(--t-sm); font-weight: 600; letter-spacing: 0.01em;
    background: var(--surface-3); border: 1px solid var(--line-2); color: var(--text);
    transition: background 0.15s, border-color 0.15s, transform 0.08s, box-shadow 0.15s;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.22); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.42; }
.btn small { font-size: var(--t-xs); font-weight: 500; opacity: 0.8; }
.btn.primary {
    background: linear-gradient(180deg, #ffd06a, #f0a92c); border-color: #ffd98a; color: var(--accent-ink);
    box-shadow: 0 6px 18px rgba(245, 185, 66, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #ffdb85, #f5b43c); border-color: #ffe4a8; }
.btn.primary small { color: rgba(29, 20, 4, 0.75); }
.btn.danger { background: rgba(255, 107, 94, 0.1); border-color: rgba(255, 107, 94, 0.4); color: #ffb3ab; }
.btn.danger:hover:not(:disabled) { background: rgba(255, 107, 94, 0.18); border-color: rgba(255, 107, 94, 0.6); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { color: var(--text); background: var(--hover); }
.btn.quiet { background: transparent; border-color: var(--line-2); }
.btn.block { width: 100%; }
.btn-lg { min-height: 52px; font-size: var(--t-md); border-radius: var(--r-md); }
.btn-lg .btn-l { display: flex; flex-direction: column; }
.btn.stack { flex-direction: column; gap: 0; }
.btns { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s1); }

.icon-btn {
    position: relative; display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); flex: none;
    border-radius: var(--r-md); color: var(--text-2); transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.badge-dot {
    position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill);
    background: var(--bad); color: #fff; font-size: 12px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--surface-solid);
}

/* Category tile */
.tile {
    --tc: #64748b; display: inline-grid; place-items: center; flex: none; border-radius: var(--r-md);
    color: #fff; background: linear-gradient(145deg, color-mix(in srgb, var(--tc) 92%, #fff 8%), color-mix(in srgb, var(--tc) 70%, #000 30%));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 2px 6px rgba(0, 0, 0, 0.3);
}
.tile-sm { width: 28px; height: 28px; border-radius: var(--r-sm); }
.tile-md { width: 40px; height: 40px; }
.tile-lg { width: 52px; height: 52px; border-radius: var(--r-lg); }

/* Chips and badges */
.chips { display: flex; flex-wrap: wrap; gap: var(--s1); }
.chip {
    display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: var(--r-pill);
    font-size: var(--t-xs); font-weight: 600; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line-2); white-space: nowrap;
}
button.chip { height: 36px; padding: 0 14px; }
button.chip:hover { color: var(--text); background: var(--hover); }
.chip.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.chip.good { color: var(--good); border-color: rgba(63, 208, 122, 0.35); background: rgba(63, 208, 122, 0.08); }
.chip.bad { color: var(--bad); border-color: rgba(255, 107, 94, 0.35); background: rgba(255, 107, 94, 0.08); }
.chip.info { color: var(--info); border-color: rgba(90, 169, 255, 0.35); background: rgba(90, 169, 255, 0.08); }
.chip.warn { color: var(--warn); border-color: rgba(240, 165, 48, 0.35); background: rgba(240, 165, 48, 0.08); }
.badge {
    display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700;
    letter-spacing: 0.04em; text-transform: uppercase; background: var(--surface-3); color: var(--text-2); vertical-align: middle;
}
.badge.good { background: rgba(63, 208, 122, 0.16); color: var(--good); }
.badge.bad { background: rgba(255, 107, 94, 0.16); color: var(--bad); }
.badge.info { background: rgba(90, 169, 255, 0.16); color: var(--info); }
.badge.gold { background: rgba(245, 197, 66, 0.18); color: var(--gold); }
.badge.new { background: var(--accent); color: var(--accent-ink); }

/* Progress */
.progress { height: 8px; border-radius: var(--r-pill); background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.progress.thin { height: 4px; }
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #f0a92c, #ffd06a); transition: width 0.4s ease; }
.progress.good i { background: linear-gradient(90deg, #26a95d, #4ee08c); }
.progress.bad i { background: linear-gradient(90deg, #d4443a, #ff7b6e); }
.progress.info i { background: linear-gradient(90deg, #3a83d8, #72b6ff); }

/* Level pips */
.pips { display: inline-flex; gap: 3px; vertical-align: middle; }
.pips i { width: 6px; height: 10px; border-radius: 2px; background: rgba(255, 255, 255, 0.14); }
.pips i.on { background: var(--accent); box-shadow: 0 0 6px rgba(245, 185, 66, 0.5); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: var(--s1); }
.stat-b { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.stat-ic { position: absolute; top: 12px; right: 12px; color: var(--text-3); }
.stat-k { font-size: var(--t-xs); color: var(--text-2); font-weight: 600; }
.stat-v { font-size: var(--t-lg); font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-s { font-size: var(--t-xs); color: var(--text-3); }

/* List rows */
.list { display: flex; flex-direction: column; gap: var(--s1); }
.lrow {
    display: flex; align-items: center; gap: var(--s2); min-height: 56px; padding: var(--row-pad) 14px; border-radius: var(--r-md);
    background: var(--surface-2); border: 1px solid var(--line); transition: background 0.15s, border-color 0.15s;
}
.lrow.click { cursor: pointer; }
.lrow.click:hover { background: var(--hover); border-color: var(--line-2); }
.lrow.me { border-color: rgba(245, 185, 66, 0.45); background: rgba(245, 185, 66, 0.07); }
.lrow.done { opacity: 0.7; }
.lrow.alert { border-color: rgba(255, 107, 94, 0.45); background: rgba(255, 107, 94, 0.08); }
.lrow-lead { flex: none; display: grid; place-items: center; }
.lrow-main { flex: 1; min-width: 0; }
.lrow-t { font-size: var(--t-sm); font-weight: 600; overflow-wrap: anywhere; }
.lrow-s { font-size: var(--t-xs); color: var(--text-2); margin-top: 2px; overflow-wrap: anywhere; }
.lrow-s .progress { margin-top: 6px; }
.lrow-v { flex: none; text-align: right; font-size: var(--t-sm); font-weight: 700; white-space: nowrap; }
.lrow-v small { display: block; font-size: var(--t-xs); font-weight: 500; color: var(--text-3); }
.lrow-a { flex: none; display: flex; gap: var(--s1); align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.lrow-a .btn { min-height: 40px; padding: 0 14px; }
.rank-n { width: 28px; text-align: center; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
/* A rival's money figure as a range (security audit #14): quieter than an exact number. */
.band { color: var(--text-2); font-weight: 500; white-space: nowrap; }

.kv { display: flex; justify-content: space-between; gap: var(--s2); padding: 6px 0; font-size: var(--t-sm); color: var(--text-2); border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv b { color: var(--text); font-weight: 600; text-align: right; }

/* Cards and sections */
.card { border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--line); padding: var(--s2); }
.card + .card { margin-top: var(--s1); }
.card-h { display: flex; align-items: center; gap: var(--s1); font-weight: 700; font-size: var(--t-sm); margin-bottom: var(--s1); }
.card-aside { margin-left: auto; font-weight: 500; color: var(--text-2); font-size: var(--t-xs); }
.card.accent { border-color: rgba(245, 185, 66, 0.35); background: linear-gradient(160deg, rgba(245, 185, 66, 0.12), rgba(245, 185, 66, 0.02)); }
.card.alert { border-color: rgba(255, 107, 94, 0.4); background: rgba(255, 107, 94, 0.08); }
.card.alert .card-h { color: #ffb3ab; }
.sect { margin-top: var(--s3); }
.sect:first-child { margin-top: 0; }
.sect-h { display: flex; align-items: baseline; gap: var(--s1); margin-bottom: var(--s1); font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.sect-aside { margin-left: auto; letter-spacing: 0; text-transform: none; font-weight: 500; }
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--s1); padding: var(--s3) var(--s2); color: var(--text-3); text-align: center; }
.empty p { margin: 0; font-size: var(--t-sm); }
.hint { margin: var(--s1) 0 0; font-size: var(--t-xs); color: var(--text-2); line-height: 1.5; }
body.no-hints .hint { display: none; }
p.lead { margin: 0 0 var(--s2); color: var(--text-2); }

.next-card {
    display: flex; gap: var(--s2); align-items: flex-start; padding: 14px var(--s2); border-radius: var(--r-md);
    border: 1px dashed rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.02); color: var(--text-2); margin-top: var(--s1);
}
.next-card > .ic { margin-top: 2px; color: var(--text-3); }
.next-main { flex: 1; min-width: 0; }
.next-k { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.next-t { font-weight: 700; color: var(--text); margin-top: 2px; }
.next-s, .next-how { font-size: var(--t-xs); margin-top: 2px; }
.next-how { color: var(--accent-2); }
.next-card .progress { margin-top: var(--s1); }

/* Tabs */
.tabs {
    position: sticky; top: 0; z-index: 2; display: flex; gap: 4px; padding: 4px; margin: 0 0 var(--s2);
    border-radius: var(--r-md); background: rgba(8, 12, 18, 0.92); border: 1px solid var(--line); backdrop-filter: var(--glass);
    overflow-x: auto; scrollbar-width: none;
}
.tab {
    position: relative; flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 0 12px;
    border-radius: var(--r-sm); font-size: var(--t-sm); font-weight: 600; color: var(--text-2); white-space: nowrap;
}
.tab:hover { color: var(--text); background: var(--hover); }
.tab.on { color: var(--text); background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 -2px 0 var(--accent); }
.tab-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--surface-3); font-size: 12px; line-height: 18px; }
.new-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(245, 185, 66, 0.25); }
.tab .new-dot { position: absolute; top: 6px; right: 6px; }
/* Four tabs (the most a panel has) in a drawer or phone sheet: labels only, tighter padding, so every tab fits unscrolled. */
.tabs { container-type: inline-size; }
@container (max-width: 460px) {
    .tab:nth-last-child(n+4), .tab:nth-last-child(n+4) ~ .tab { padding: 0 8px; gap: 4px; }
    .tab:nth-last-child(n+4) > .ic, .tab:nth-last-child(n+4) ~ .tab > .ic { display: none; }
}

/* Segmented control */
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: var(--r-md); background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); flex-wrap: wrap; }
.seg-i { min-height: 36px; padding: 0 14px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 600; }
.seg-i:hover { color: var(--text); }
.seg-i.on { background: rgba(255, 255, 255, 0.12); color: var(--text); }

/* Overflow menu */
.ovf { position: relative; }
.ovf-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 220px; padding: 6px; border-radius: var(--r-md);
    background: var(--surface-solid); border: 1px solid var(--line-2); box-shadow: var(--sh-2);
}
.ovf-i { display: flex; align-items: center; gap: 10px; width: 100%; min-height: var(--tap); padding: 0 12px; border-radius: var(--r-sm); text-align: left; font-weight: 600; }
.ovf-i:hover:not(:disabled) { background: var(--hover); }
.ovf-i:disabled { opacity: 0.4; }
.ovf-i small { margin-left: auto; color: var(--text-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.ovf-i.danger { color: #ffb3ab; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s2); }
.field > span { font-size: var(--t-xs); font-weight: 600; color: var(--text-2); }
.form-row { display: flex; flex-wrap: wrap; gap: var(--s1); align-items: center; margin-top: var(--s1); }
.form-row input, .form-row select { flex: 1 1 110px; }
.form-row .btn { flex: none; }
.err { color: var(--bad); min-height: 20px; font-size: var(--t-sm); margin: var(--s1) 0; }

.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: baseline; }
.ai-tag { font-size: 12px; padding: 1px 6px; border-radius: 4px; background: var(--surface-3); color: var(--text-2); margin-left: 6px; font-weight: 700; letter-spacing: 0.04em; }

/* Tables (kept for wide data such as finance) */
.tbl-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: var(--t-xs); }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
th { color: var(--text-3); font-weight: 600; background: rgba(255, 255, 255, 0.03); }
td.n, th.n { text-align: right; }
tr.me td { background: rgba(245, 185, 66, 0.08); }

/* ==========================================================================
   Shell: HUD
   ========================================================================== */
#hud {
    position: fixed; top: 0; left: 0; right: 0; z-index: 20; height: var(--hud-h);
    display: flex; align-items: center; gap: var(--s1); padding: 0 var(--s2);
    background: linear-gradient(180deg, rgba(8, 12, 18, 0.9), rgba(8, 12, 18, 0.72)); border-bottom: 1px solid var(--line);
    backdrop-filter: var(--glass);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 220px; height: var(--tap); padding: 0 10px 0 4px; border-radius: var(--r-md); flex: 0 1 auto; }
.brand:hover { background: var(--hover); }
.avatar {
    flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: var(--t-md); color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 2px 8px rgba(0, 0, 0, 0.35);
}
.brand-t { display: flex; flex-direction: column; min-width: 0; text-align: left; }
.brand-t b { font-size: var(--t-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-t span { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.hud-stats { display: flex; align-items: center; gap: var(--s1); flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.hud-stats::-webkit-scrollbar { display: none; }
.hstat {
    position: relative; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px 0 10px; border-radius: var(--r-md);
    background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); flex: none; text-align: left;
}
button.hstat:hover { background: var(--hover); }
.hstat .ic { color: var(--text-3); }
.hstat-t { display: flex; flex-direction: column; }
.hstat-k { font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: 0.02em; }
.hstat-v { font-size: var(--t-md); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hstat .progress { position: absolute; left: 10px; right: 10px; bottom: 5px; height: 3px; }
.hstat.cash .ic { color: var(--accent); }
.hstat.till .ic { color: var(--good); }
.hstat.full { border-color: rgba(63, 208, 122, 0.5); box-shadow: 0 0 0 3px rgba(63, 208, 122, 0.12); }
.hstat.flash-up .hstat-v { animation: flashUp 0.9s ease; }
.hstat.flash-down .hstat-v { animation: flashDown 0.9s ease; }
@keyframes flashUp { 0% { color: var(--good); transform: scale(1.08); } 100% { color: inherit; transform: none; } }
@keyframes flashDown { 0% { color: var(--bad); } 100% { color: inherit; } }
.cash-float { position: fixed; z-index: 60; pointer-events: none; font-weight: 800; font-size: var(--t-md); animation: floatUp 1.4s ease forwards; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6); }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(6px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(-28px); } }
.hud-r { display: flex; align-items: center; gap: 4px; flex: none; margin-left: auto; }

.next-chip {
    display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px 0 10px; border-radius: var(--r-md); max-width: 280px;
    background: linear-gradient(160deg, rgba(245, 185, 66, 0.16), rgba(245, 185, 66, 0.04)); border: 1px solid rgba(245, 185, 66, 0.35); text-align: left;
}
.next-chip:hover { border-color: rgba(245, 185, 66, 0.6); }
.next-chip > .ic { color: var(--accent); }
.next-chip .nc-t { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 3px; }
.next-chip .nc-k { font-size: 12px; font-weight: 700; color: var(--accent-2); letter-spacing: 0.04em; text-transform: uppercase; }
.next-chip .nc-n { font-size: var(--t-xs); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-chip .progress { width: 100%; }

/* Rail */
#rail {
    position: fixed; left: var(--s1); top: calc(var(--hud-h) + var(--s1)); bottom: var(--s1); z-index: 15; width: var(--rail-w);
    display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: var(--r-lg); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent;
    background: var(--surface); border: 1px solid var(--line); backdrop-filter: var(--glass); box-shadow: var(--sh-1);
}
.rail-i {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 60px; padding: 6px 2px;
    border-radius: var(--r-md); color: var(--text-2); font-size: 12px; font-weight: 600; text-align: center; flex: none;
}
.rail-i:hover { background: var(--hover); color: var(--text); }
.rail-i.on { background: rgba(245, 185, 66, 0.14); color: var(--accent-2); box-shadow: inset 3px 0 0 var(--accent); }
.rail-i .new-dot { position: absolute; top: 8px; right: 14px; }
.rail-i.fresh { animation: railPulse 1.2s ease 1; }
.rail-i .badge-dot { top: 4px; right: 8px; }
.rail-sep { height: 1px; background: var(--line); margin: 4px 6px; flex: none; }
@keyframes railPulse { 0% { box-shadow: 0 0 0 0 rgba(245, 185, 66, 0.7); } 100% { box-shadow: 0 0 0 14px rgba(245, 185, 66, 0); } }

/* Dock */
#dock {
    position: fixed; bottom: var(--s2); left: 50%; transform: translateX(-50%); z-index: 15;
    display: flex; gap: var(--s1); padding: var(--s1); border-radius: var(--r-xl);
    background: var(--surface); border: 1px solid var(--line); backdrop-filter: var(--glass); box-shadow: var(--sh-2);
}
.dock-b {
    position: relative; display: flex; align-items: center; gap: 10px; min-width: 120px; height: 56px; padding: 0 var(--s2) 0 12px;
    border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); text-align: left; transition: background 0.15s, border-color 0.15s;
}
.dock-b:hover { background: var(--hover); border-color: var(--line-2); }
.dock-b .ic { color: var(--text-2); }
.dock-b .db-t { display: flex; flex-direction: column; min-width: 0; }
.dock-b b { font-size: var(--t-sm); }
.dock-b small { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; font-variant-numeric: tabular-nums; }
.dock-b.go { background: linear-gradient(180deg, rgba(63, 208, 122, 0.22), rgba(63, 208, 122, 0.08)); border-color: rgba(63, 208, 122, 0.45); }
.dock-b.go .ic { color: var(--good); }
.dock-b.ready { animation: readyPulse 1.6s infinite; }
@keyframes readyPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(63, 208, 122, 0.5); } 50% { box-shadow: 0 0 0 8px rgba(63, 208, 122, 0); } }
.dock-b.menu-b { display: none; }
#nudge {
    position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 30; padding: 10px 16px; border-radius: var(--r-pill);
    background: var(--surface-solid); border: 1px solid var(--line-2); box-shadow: var(--sh-2); font-size: var(--t-sm); font-weight: 600;
    white-space: normal; text-align: center; line-height: 1.35; width: max-content; max-width: min(520px, calc(100vw - 32px)); cursor: pointer;
    animation: nudgeIn 0.2s ease;
}
@keyframes nudgeIn { from { opacity: 0; transform: translate(-50%, 6px); } }

/* Journal tracker */
#tracker {
    position: fixed; left: var(--s2); top: calc(var(--hud-h) + var(--s2)); z-index: 14; width: 320px;
    border-radius: var(--r-lg); background: var(--surface); border: 1px solid rgba(245, 185, 66, 0.3); backdrop-filter: var(--glass); box-shadow: var(--sh-2);
    padding: 14px var(--s2); cursor: pointer; transition: border-color 0.15s;
}
#tracker:hover { border-color: rgba(245, 185, 66, 0.6); }
body.has-rail #tracker { left: calc(var(--rail-w) + var(--s2)); }
.trk-k { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-2); }
.trk-k .trk-n { margin-left: auto; color: var(--text-3); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.trk-t { margin-top: 6px; font-size: var(--t-md); font-weight: 700; line-height: 1.3; }
.trk-p { margin-top: var(--s1); display: flex; align-items: center; gap: var(--s1); font-size: var(--t-xs); color: var(--text-2); font-variant-numeric: tabular-nums; }
.trk-p .progress { flex: 1; }
.trk-a { margin-top: var(--s1); display: flex; gap: var(--s1); }
.trk-a .btn { min-height: var(--tap); }
.trk-done { display: flex; align-items: center; gap: 6px; color: var(--good); font-weight: 600; font-size: var(--t-xs); margin-top: 6px; }

/* Coach marks */
.coach { position: relative; z-index: 2; animation: coach 1.4s ease-in-out infinite; outline: 2px solid var(--accent); outline-offset: 3px; }
@keyframes coach { 0%, 100% { box-shadow: 0 0 0 0 rgba(245, 185, 66, 0.55); } 50% { box-shadow: 0 0 0 10px rgba(245, 185, 66, 0); } }
#pointer {
    position: fixed; z-index: 13; pointer-events: none; transform: translate(-50%, -100%); color: var(--accent);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6)); animation: bob 1s ease-in-out infinite;
}
#pointer .ptr-l {
    display: block; margin-bottom: 4px; padding: 4px 10px; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink);
    font-size: var(--t-xs); font-weight: 800; white-space: nowrap; text-align: center;
}
#pointer .ic { margin: 0 auto; }
@keyframes bob { 0%, 100% { margin-top: 0; } 50% { margin-top: -8px; } }

/* Event bar */
#eventBar {
    position: fixed; top: calc(var(--hud-h) + var(--s1)); left: 50%; transform: translateX(-50%); z-index: 12; max-width: min(560px, calc(100vw - 32px));
    display: flex; align-items: center; gap: var(--s1); padding: 8px 14px; border-radius: var(--r-pill); font-size: var(--t-xs);
    background: rgba(16, 32, 48, 0.9); border: 1px solid rgba(90, 169, 255, 0.4); box-shadow: var(--sh-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#eventBar b { color: #8cc4ff; }
#eventBar.next { background: rgba(40, 32, 12, 0.9); border-color: rgba(245, 185, 66, 0.4); }
#eventBar.next b { color: var(--accent-2); }

/* ==========================================================================
   Sheets: plot card and panel drawer
   Desktop: a 420px right column; the two never overlap (the unfocused one docks as a header bar).
   Phone: a bottom sheet with peek, half and full snap points.
   ========================================================================== */
#stack {
    position: fixed; z-index: 16; right: var(--s1); top: calc(var(--hud-h) + var(--s1)); bottom: var(--s1); width: var(--drawer-w);
    display: flex; flex-direction: column; gap: var(--s1); pointer-events: none;
}
.sheet {
    pointer-events: auto; display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto;
    border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--line); backdrop-filter: var(--glass); box-shadow: var(--sh-3);
    overflow: hidden; animation: sheetIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes sheetIn { from { opacity: 0; transform: translateX(24px); } }
.sheet.docked { flex: none; cursor: pointer; }
.sheet.docked .sheet-b, .sheet.docked .sheet-handle { display: none; }
.sheet.docked .sheet-h { border-bottom: 0; }
.sheet-handle { display: none; }
.sheet-h { display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px var(--s2); border-bottom: 1px solid var(--line); flex: none; min-height: 64px; }
.sheet-h .sh-lead { flex: none; }
.sheet-h .sh-main { flex: 1; min-width: 0; }
.sheet-h .sh-t { font-size: var(--t-lg); font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-h .sh-s { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--t-xs); color: var(--text-2); margin-top: 2px; }
.sheet-h .sh-r { display: flex; align-items: center; gap: 2px; flex: none; }
.sheet-b { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--s2) var(--s2) 0; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.15) transparent; }
.sheet-b::after { content: ""; display: block; height: var(--s2); }
.pfoot {
    position: sticky; bottom: 0; z-index: 3; margin: var(--s2) calc(var(--s2) * -1) 0; padding: 12px var(--s2) calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(14, 20, 28, 0.6), rgba(14, 20, 28, 0.98) 30%); border-top: 1px solid var(--line); backdrop-filter: var(--glass);
    display: flex; gap: var(--s1); align-items: center;
}
.pfoot .btn { flex: 1; }
.pfoot .foot-note { flex: 1; font-size: var(--t-xs); color: var(--text-2); }
.sheet-b:has(.pfoot)::after { display: none; }

/* Plot card */
.hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: var(--s1); margin-bottom: var(--s2); }
.hero-i { padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.hero-k { font-size: 12px; font-weight: 600; color: var(--text-3); }
.hero-v { font-size: var(--t-lg); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-i .progress { margin-top: 6px; }
.feat-chips { margin-bottom: var(--s2); }
.check-l { display: flex; flex-direction: column; gap: 6px; }
.check-i { display: flex; align-items: center; gap: 10px; font-size: var(--t-sm); }
.check-i .ck { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); }
.check-i.ok .ck { background: rgba(63, 208, 122, 0.18); color: var(--good); }
.check-i.ok { color: var(--text-2); }
.check-i .ck-t { flex: 1; min-width: 0; }
.check-i .ck-v { color: var(--text-3); font-size: var(--t-xs); font-variant-numeric: tabular-nums; }

/* Build picker */
.bgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2) var(--s1); padding-top: 10px; }
.bcard {
    position: relative; display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: var(--r-md); text-align: left;
    background: var(--surface-2); border: 1px solid var(--line); transition: border-color 0.15s, background 0.15s, transform 0.1s; min-width: 0;
}
.bcard:hover { border-color: var(--line-2); background: var(--hover); }
.bcard.on { border-color: var(--accent); background: rgba(245, 185, 66, 0.1); box-shadow: 0 0 0 3px rgba(245, 185, 66, 0.15); }
.bcard.poor { opacity: 0.62; }
.bcard .bc-h { display: flex; align-items: center; gap: 10px; }
.bcard .bc-n { font-weight: 700; font-size: var(--t-sm); line-height: 1.2; overflow-wrap: anywhere; }
.bcard .bc-c { font-size: var(--t-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.bcard .bc-i { font-size: var(--t-lg); font-weight: 800; color: var(--good); font-variant-numeric: tabular-nums; }
.bcard .bc-i small { font-size: var(--t-xs); font-weight: 600; color: var(--text-3); }
.bcard .bc-m { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: var(--t-xs); color: var(--text-2); }
.bcard .bc-m .ic { display: inline-block; vertical-align: -3px; }
.bcard .best { position: absolute; top: -9px; right: 10px; line-height: 0; } /* sits on the top border, clear of the name */
.adj-up { color: var(--good); font-weight: 700; }
.adj-down { color: var(--bad); font-weight: 700; }
.bcard .bc-blurb { font-size: var(--t-xs); color: var(--text-2); }
.filter-row { display: flex; gap: var(--s1); overflow-x: auto; scrollbar-width: none; margin-bottom: var(--s2); padding-bottom: 2px; }

/* Why? breakdown */
.why-row { display: grid; grid-template-columns: 1fr auto; gap: 4px var(--s2); align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.why-row:last-child { border-bottom: 0; }
.why-row .w-k { font-size: var(--t-sm); color: var(--text-2); }
.why-row .w-v { font-weight: 700; font-variant-numeric: tabular-nums; }
.why-row .w-bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.06); position: relative; overflow: hidden; }
.why-row .w-bar i { position: absolute; top: 0; bottom: 0; left: 50%; }
.why-row .w-bar i.up { background: var(--good); }
.why-row .w-bar i.down { background: var(--bad); right: 50%; left: auto; }

/* Journal */
.chapter {
    padding: var(--s2); border-radius: var(--r-lg); margin-bottom: var(--s2);
    background: radial-gradient(120% 140% at 0% 0%, rgba(245, 185, 66, 0.22), rgba(245, 185, 66, 0.02) 60%), var(--surface-2); border: 1px solid rgba(245, 185, 66, 0.3);
}
.chapter .ch-k { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-2); }
.chapter .ch-t { font-size: var(--t-xl); font-weight: 800; letter-spacing: -0.02em; margin: 2px 0 var(--s1); line-height: 1.15; }
.chapter .progress { margin-top: var(--s1); }
.obj { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.obj + .obj { margin-top: var(--s1); }
.obj .ck { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-2); color: transparent; }
.obj.done .ck { background: var(--good); border-color: var(--good); color: #062812; }
.obj.cur { border-color: rgba(245, 185, 66, 0.45); }
.obj .o-t { flex: 1; min-width: 0; font-weight: 600; padding-top: 4px; }
.obj.done .o-t { color: var(--text-2); text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, 0.25); }
.obj .o-p { display: flex; align-items: center; gap: var(--s1); margin-top: 6px; font-size: var(--t-xs); color: var(--text-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.obj .o-p .progress { flex: 1; }
.reward { display: flex; flex-wrap: wrap; gap: var(--s1); }
.medal {
    flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.05); border: 2px solid rgba(255, 255, 255, 0.1);
}
.medal.bronze { color: #fff; background: radial-gradient(circle at 35% 30%, #f2b27a, var(--bronze) 60%, #8c5328); border-color: #f2b27a; }
.medal.silver { color: #1d2733; background: radial-gradient(circle at 35% 30%, #fff, var(--silver) 60%, #8996a4); border-color: #fff; }
.medal.gold { color: #3a2a02; background: radial-gradient(circle at 35% 30%, #fff1b0, var(--gold) 55%, #b08414); border-color: #fff1b0; }
.steps { display: inline-flex; gap: 4px; }
.steps i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, 0.1); }
.steps i.bronze { background: var(--bronze); }
.steps i.silver { background: var(--silver); }
.steps i.gold { background: var(--gold); }
.skill-l { display: flex; align-items: center; gap: 6px; }
.lvl { min-width: 36px; height: 36px; border-radius: var(--r-md); display: grid; place-items: center; font-weight: 800; font-size: var(--t-md); background: var(--surface-3); font-variant-numeric: tabular-nums; }
details.help { border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
details.help + details.help { margin-top: var(--s1); }
details.help summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 14px; cursor: pointer; font-weight: 600; }
details.help summary::-webkit-details-marker { display: none; }
details.help summary .ic:last-child { margin-left: auto; transition: transform 0.15s; color: var(--text-3); }
details.help[open] summary .ic:last-child { transform: rotate(90deg); }
details.help p { margin: 0; padding: 0 14px 14px 44px; color: var(--text-2); font-size: var(--t-sm); }

/* News */
.news-i { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.news-i:last-child { border-bottom: 0; }
.news-i .n-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--text-3); }
.news-i.attack .n-dot { background: var(--bad); }
.news-i.deal .n-dot { background: var(--accent); }
.news-i.event .n-dot { background: var(--info); }
.news-i.conquest .n-dot { background: var(--violet); }
.news-i .n-t { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.news-i .n-x { font-size: var(--t-sm); margin-top: 2px; overflow-wrap: anywhere; }

/* Chat */
.chat-log { height: 46vh; overflow-y: auto; border-radius: var(--r-md); background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); padding: var(--s1) 12px; font-size: var(--t-sm); }
.chat-msg { padding: 4px 0; overflow-wrap: anywhere; }
.chat-msg .t { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.chat-msg b { cursor: pointer; }
.chat-msg.me .tx { color: #f3e6c5; }
.chat-send { display: flex; gap: var(--s1); margin-top: var(--s1); }
.chat-send input { flex: 1; }

/* ==========================================================================
   Overlays: modal, intro card, toasts, notification center
   ========================================================================== */
#modal {
    position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: var(--s2);
    background: radial-gradient(80% 80% at 50% 40%, rgba(5, 8, 12, 0.55), rgba(5, 8, 12, 0.88));
    backdrop-filter: blur(3px); overflow-y: auto;
}
#modal.light { background: rgba(5, 8, 12, 0.35); backdrop-filter: none; align-items: flex-end; padding-bottom: 112px; }
.dialog {
    position: relative; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; border-radius: var(--r-xl); padding: var(--s3);
    background: var(--surface-solid); border: 1px solid var(--line-2); box-shadow: var(--sh-3); animation: pop 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.dialog.wide { width: min(760px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.dialog h1 { margin: 0; font-size: var(--t-xl); letter-spacing: -0.02em; line-height: 1.15; }
.dialog h2 { margin: 0 0 var(--s1); font-size: var(--t-lg); }
.dialog .lede { color: var(--text-2); margin: var(--s1) 0 var(--s3); font-size: var(--t-md); }
.dialog .x { position: absolute; top: 12px; right: 12px; }
.reg-hero {
    margin: calc(var(--s3) * -1) calc(var(--s3) * -1) var(--s3); padding: var(--s4) var(--s3) var(--s3); border-radius: var(--r-xl) var(--r-xl) 0 0;
    background: radial-gradient(120% 120% at 100% 0%, rgba(245, 185, 66, 0.28), transparent 60%), radial-gradient(100% 140% at 0% 100%, rgba(90, 169, 255, 0.2), transparent 60%), #0d151e;
    border-bottom: 1px solid var(--line);
}
.reg-hero .logo { display: flex; align-items: flex-end; gap: 6px; margin-bottom: var(--s2); }
.reg-hero .logo i { display: block; width: 12px; border-radius: 3px 3px 0 0; background: linear-gradient(180deg, #ffd06a, #c8861c); }
.reg-hero .tag { font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-2); }
.town-card {
    display: flex; align-items: center; gap: 14px; padding: 14px var(--s2); border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line-2);
}
.town-card .tc-t { flex: 1; min-width: 0; }
.town-card .tc-k { font-size: var(--t-xs); color: var(--text-3); font-weight: 600; }
.town-card .tc-n { font-size: var(--t-md); font-weight: 700; }
.town-card .tc-s { font-size: var(--t-xs); color: var(--text-2); }
.linkish { color: var(--accent-2); font-weight: 600; min-height: var(--tap); padding: 0 4px; }
.linkish:hover { text-decoration: underline; }
.pickers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s1); margin-top: var(--s2); }
.pickers .field { margin: 0; }
.peoples { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s1); margin: var(--s2) 0; }
.people {
    display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: var(--r-md); text-align: left;
    background: var(--surface-2); border: 1px solid var(--line); transition: border-color 0.15s, background 0.15s;
}
.people:hover { border-color: var(--line-2); }
.people.on { border-color: var(--accent); background: rgba(245, 185, 66, 0.1); }
.people b { font-size: var(--t-md); }
.people span { font-size: var(--t-xs); color: var(--text-2); }
.people em { font-style: normal; font-size: var(--t-xs); color: var(--accent-2); font-weight: 600; }
.intro-card { text-align: center; }
.intro-card .intro-ic {
    width: 72px; height: 72px; margin: 0 auto var(--s2); border-radius: 22px; display: grid; place-items: center; color: var(--accent-ink);
    background: linear-gradient(145deg, #ffe08f, #f0a92c); box-shadow: 0 10px 30px rgba(245, 185, 66, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    animation: introIc 0.6s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes introIc { from { transform: scale(0.4) rotate(-20deg); opacity: 0; } }
.intro-card .intro-k { font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-2); }
.intro-card h2 { font-size: var(--t-xl); margin: 4px 0 var(--s1); }
.intro-card p { color: var(--text-2); font-size: var(--t-md); margin: 0 0 var(--s3); }
.intro-card .btns { justify-content: center; }
.intro-card .btns .btn { min-width: 140px; }
.intro-q { margin-top: var(--s2); font-size: var(--t-xs); color: var(--text-3); }

#toasts { position: fixed; top: calc(var(--hud-h) + var(--s2)); left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: var(--s1); pointer-events: none; width: min(440px, calc(100vw - 32px)); }
.toast {
    display: flex; align-items: center; gap: 12px; padding: 12px var(--s2); border-radius: var(--r-md); font-size: var(--t-sm); font-weight: 600;
    background: var(--surface-solid); border: 1px solid var(--line-2); box-shadow: var(--sh-2); animation: toastIn 0.25s ease, toastOut 0.4s ease 4.2s forwards;
}
.toast .ic { flex: none; }
.toast.bad { border-color: rgba(255, 107, 94, 0.55); }
.toast.bad .ic { color: var(--bad); }
.toast.good .ic { color: var(--good); }
.toast.unlock { border-color: rgba(245, 185, 66, 0.6); background: linear-gradient(160deg, rgba(245, 185, 66, 0.18), rgba(17, 25, 34, 0.98) 50%); }
.toast.unlock .ic { color: var(--accent); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }

#notes {
    position: fixed; z-index: 45; top: calc(var(--hud-h) + 4px); right: var(--s1); width: min(380px, calc(100vw - 16px)); max-height: min(70vh, 560px);
    display: flex; flex-direction: column; border-radius: var(--r-lg); background: var(--surface-solid); border: 1px solid var(--line-2); box-shadow: var(--sh-3); overflow: hidden;
}
.notes-h { display: flex; align-items: center; gap: var(--s1); padding: 8px 8px 8px var(--s2); border-bottom: 1px solid var(--line); font-weight: 700; font-size: var(--t-md); }
.notes-h span { flex: 1; }
.notes-b { overflow-y: auto; padding: var(--s1); }
.note { display: flex; gap: 12px; padding: 10px; border-radius: var(--r-sm); }
.note.unread { background: rgba(245, 185, 66, 0.06); }
.note .ic { flex: none; margin-top: 2px; color: var(--text-3); }
.note.bad .ic { color: var(--bad); }
.note.good .ic { color: var(--good); }
.note.unlock .ic { color: var(--accent); }
.note .nt-x { font-size: var(--t-sm); overflow-wrap: anywhere; }
.note .nt-t { font-size: 12px; color: var(--text-3); margin-top: 2px; font-variant-numeric: tabular-nums; }

#conn { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); z-index: 55; padding: 10px 16px; border-radius: var(--r-pill); background: var(--surface-solid); border: 1px solid var(--line-2); color: var(--text-2); font-weight: 600; }
#fatal {
    position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: var(--s2); background: rgba(5, 8, 12, 0.92);
}
#fatal .dialog { border-color: rgba(255, 107, 94, 0.5); }
#fatal pre { white-space: pre-wrap; font-size: var(--t-xs); color: var(--text-2); background: rgba(0, 0, 0, 0.3); padding: var(--s1); border-radius: var(--r-sm); }

/* Command Center */
.cc-top { display: flex; gap: var(--s1); flex-wrap: wrap; margin-bottom: var(--s2); }
.cc-top .btn { flex: 1 1 150px; }
.vcard { border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--line); padding: 14px; }
.vcard + .vcard { margin-top: var(--s1); }
.vcard.here { border-color: rgba(245, 185, 66, 0.4); }
.vc-h { display: flex; align-items: center; gap: 12px; }
.vc-h .vc-t { flex: 1; min-width: 0; }
.vc-h b { display: block; font-size: var(--t-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vc-h span { font-size: var(--t-xs); color: var(--text-2); }
.vc-g { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s1); margin-top: 12px; }
.vc-g .hero-i { padding: 8px 10px; }
.vc-g .hero-v { font-size: var(--t-md); }
.vc-a { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: 12px; }
.vc-a .btn { flex: 1 1 auto; min-height: 40px; }

/* Phone menu grid */
.menu-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s1); }
.menu-grid .rail-i { background: var(--surface-2); border: 1px solid var(--line); min-height: 76px; }

/* Desktop: map stays usable beside the drawer. */
body.has-rail #eventBar { margin-left: calc(var(--rail-w) / 2); }

/* ==========================================================================
   Compact density (Executive default; switchable in settings)
   ========================================================================== */
body.compact { --row-pad: 8px; --hud-h: 56px; }
body.compact .lrow { min-height: 48px; }
body.compact .sheet-b { padding: 12px 12px 0; }
body.compact .pfoot { margin: 12px -12px 0; padding: 10px 12px; }
body.compact .hstat { height: 40px; }
body.compact .hero-v { font-size: var(--t-md); }
body.compact .stat-v { font-size: var(--t-md); }
body.compact .sect { margin-top: var(--s2); }
body.compact .rail-i { min-height: var(--tap); gap: 2px; padding: 4px 2px; }
body.compact #rail { gap: 2px; }
body.compact .dock-b { height: 48px; }
body.compact .next-chip { height: 40px; }
@media (pointer: coarse) { body.compact .lrow, body.compact .rail-i { min-height: var(--tap); } body.compact .hstat, body.compact .dock-b { height: var(--tap); } }

#mobileNext { display: none; position: fixed; z-index: 14; top: calc(var(--hud-h) + 4px); left: var(--s1); right: var(--s1); max-width: none; height: 44px; background: rgba(28, 22, 10, 0.92); backdrop-filter: var(--glass); }
body.sheet-open #mobileNext { display: none !important; }
body.event-on #mobileNext { top: calc(var(--hud-h) + 40px); }

/* ==========================================================================
   Phones (< 700px): bottom sheet with peek, half and full snap points; map always visible.
   ========================================================================== */
@media (max-width: 699px) {
    :root { --hud-h: 60px; }
    #hud { padding: 0 var(--s1); gap: 6px; }
    .brand { max-width: none; min-width: var(--tap); padding: 0 2px; flex: none; justify-content: center; }
    .brand-t { display: none; }
    .hstat, body.compact .hstat { height: var(--tap); padding: 0 10px 0 8px; gap: 8px; }
    body.compact .dock-b, body.compact .rail-i, body.compact .lrow { min-height: var(--tap); }
    .hstat .ic { display: none; }
    .hstat-v { font-size: var(--t-sm); }
    .hud-r .next-chip { display: none; }
    #rail { display: none; }
    body.has-rail #tracker { left: var(--s1); }
    body.has-rail #eventBar { margin-left: 0; }
    #tracker { left: var(--s1); right: var(--s1); width: auto; top: auto; bottom: 92px; padding: 12px 14px; }
    .trk-t { font-size: var(--t-sm); }
    #dock { left: var(--s1); right: var(--s1); transform: none; bottom: var(--s1); padding: 6px; gap: 6px; }
    .dock-b { flex: 1 1 0; min-width: 0; height: 56px; flex-direction: column; justify-content: center; gap: 2px; padding: 0 4px; text-align: center; }
    .dock-b .db-t { align-items: center; }
    .dock-b small { max-width: 100%; }
    .dock-b.menu-b { display: flex; }
    #nudge { bottom: 84px; }
    #eventBar { top: calc(var(--hud-h) + 4px); font-size: 12px; }
    #mobileNext { display: flex; }

    #stack { left: 0; right: 0; bottom: 0; top: auto; width: auto; height: var(--sheet-h, 45vh); gap: 0; transition: height 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); }
    #stack.dragging { transition: none; }
    .sheet { border-radius: var(--r-xl) var(--r-xl) 0 0; border-bottom: 0; animation: sheetUp 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); }
    @keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
    .sheet.docked { border-radius: var(--r-lg) var(--r-lg) 0 0; margin: 0 var(--s1); }
    .sheet.docked .sheet-h { min-height: 52px; padding-top: 6px; padding-bottom: 6px; }
    .sheet.docked .sh-t { font-size: var(--t-sm); }
    .sheet.docked + .sheet { border-top-left-radius: 0; border-top-right-radius: 0; }
    .sheet-handle { display: block; flex: none; height: 24px; touch-action: none; cursor: grab; position: relative; }
    .sheet-handle::before { content: ""; position: absolute; left: 50%; top: 9px; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: rgba(255, 255, 255, 0.28); }
    .sheet-h { padding: 0 6px 10px var(--s2); min-height: 52px; touch-action: none; }
    .sheet-h .sh-t { font-size: var(--t-md); }
    .sheet-b { padding: 12px 12px 0; }
    .pfoot { margin: 12px -12px 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
    /* Sheet open: the dock stays at peek (the sheet sits above it), the tracker shrinks to a one-line strip above the sheet. */
    body.sheet-open.snap-half #dock, body.sheet-open.snap-full #dock, body.sheet-open.snap-full #tracker { display: none; }
    body.sheet-open.snap-peek #stack { bottom: 76px; }
    body.sheet-open #tracker { bottom: calc(var(--sheet-h, 45vh) + 8px); padding: 8px 12px; }
    body.sheet-open.snap-peek #tracker { bottom: calc(var(--sheet-h, 45vh) + 84px); }
    body.sheet-open #tracker .trk-k, body.sheet-open #tracker .trk-p, body.sheet-open #tracker .trk-how, body.sheet-open #tracker .trk-a { display: none; }
    body.sheet-open #tracker .trk-t { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .bgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pickers { grid-template-columns: 1fr; }
    .dialog { padding: var(--s2); }
    .reg-hero { margin: calc(var(--s2) * -1) calc(var(--s2) * -1) var(--s2); padding: var(--s3) var(--s2) var(--s2); }
    .vc-g { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #modal.light { padding-bottom: var(--s2); }
    #toasts { top: calc(var(--hud-h) + 52px); }
    /* Two stats and "+N"; open, the rest drop down as a grid under the bar. */
    .hud-stats { overflow: visible; }
    .hud-stats.open { position: absolute; top: calc(var(--hud-h) - 4px); left: var(--s1); right: var(--s1); flex-wrap: wrap; padding: var(--s1); border-radius: var(--r-lg);
        background: var(--surface-solid); border: 1px solid var(--line-2); box-shadow: var(--sh-3); z-index: 46; }
    .hud-stats.open .hstat { flex: 1 1 40%; }
    /* Closed, the two stats give way (truncate) so "+N" never slides under the right-hand buttons. */
    .hud-stats:not(.open) .hstat:not(.more) { flex: 0 1 auto; min-width: 0; padding: 0 8px; }
    .hud-stats:not(.open) .hstat-t { min-width: 0; }
    .hud-stats:not(.open) .hstat-k { overflow: hidden; text-overflow: ellipsis; }
    .hud-r .dev-b { display: none; } /* reachable from Menu on phones */
    .hud-stats .hstat.more { flex: none; min-width: 44px; padding: 0 8px; }
    .menu-gh { margin: var(--s2) 0 6px; }
}

/* ==========================================================================
   Feedback, dialogs, grouping and accessibility (UX review fixes)
   ========================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
#nudge.good { border-color: rgba(63, 208, 122, 0.45); }

/* Toasts: attack alerts stay until dismissed and can jump to the building. */
.toast .toast-x { flex: 1; min-width: 0; }
.toast.sticky, .toast .toast-a { pointer-events: auto; }
.toast.sticky { animation: toastIn 0.25s ease; border-color: rgba(255, 107, 94, 0.7); }
.toast.attack .ic { color: var(--bad); }
.toast-a { display: flex; align-items: center; gap: 4px; flex: none; }
.toast-a .btn { min-height: 36px; padding: 0 12px; }

/* Notification rows with a Show button */
.note .nt-m { flex: 1; min-width: 0; }
.note .btn { flex: none; align-self: center; }

/* Venture switcher */
#vmenu {
    position: fixed; z-index: 45; top: calc(var(--hud-h) + 4px); left: var(--s1); width: min(340px, calc(100vw - 16px)); max-height: min(70vh, 520px);
    display: flex; flex-direction: column; border-radius: var(--r-lg); background: var(--surface-solid); border: 1px solid var(--line-2); box-shadow: var(--sh-3); overflow: hidden;
}
#vmenu[hidden] { display: none; }
.vm-b { overflow-y: auto; padding: var(--s1); }
.vm-i { display: flex; align-items: center; gap: 12px; width: 100%; min-height: var(--tap); padding: 8px 10px; border-radius: var(--r-sm); text-align: left; }
.vm-i:hover { background: var(--hover); }
.vm-i.on { background: rgba(245, 185, 66, 0.12); }
.vm-t { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.vm-t small { color: var(--text-3); font-size: var(--t-xs); }
.vm-f { padding: 6px var(--s2) 10px; font-size: var(--t-xs); }
.brand .ic:last-child { flex: none; color: var(--text-3); }

/* HUD "+N" */
.hstat.more { justify-content: center; min-width: 52px; }

/* Rail sections */
.rail-g { display: flex; flex-direction: column; gap: 2px; }
.rail-g + .rail-g { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.rail-gh { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); text-align: center; padding: 2px 0; }
body.compact .rail-gh { display: none; }
.menu-gh { font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); margin: var(--s2) 0 var(--s1); }

/* Tracker: the text is a button that opens the Journal */
.trk-open { display: block; width: 100%; text-align: left; padding: 0; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
.trk-open .trk-k, .trk-open .trk-t { display: flex; }
.trk-open .trk-t { display: block; }
.trk-how { margin-top: 4px; font-size: var(--t-xs); color: var(--text-2); line-height: 1.35; }

/* Inline forms with visible labels */
.form-row { align-items: flex-end; }
.form-row .field { flex: 1 1 140px; margin: 0; min-width: 0; }
.form-row .field input, .form-row .field select { width: 100%; }

/* In-flight actions */
.busy { opacity: 0.6; cursor: progress; }
[aria-disabled="true"] { pointer-events: none; }

/* Confirm dialog */
.confirm-d { max-width: 440px; }
.confirm-d .btns { justify-content: flex-end; margin-top: var(--s2); }

/* Recovery code */
.code { display: block; margin: 6px 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line-2);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--t-xs); overflow-wrap: anywhere; user-select: all; }

.reg-note { margin: var(--s2) 0 0; }
.reg-signin { display: block; margin: var(--s2) auto 0; }
.login .err:empty { display: none; }
.login-msg { margin: 0 0 var(--s2); padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); }

/* Attacked-by card on a damaged building */
.card.attacked { margin-bottom: var(--s2); }
.card.attacked .btns { margin-top: var(--s1); }

/* Chapter-complete card */
.intro-card.chapter .intro-ic { background: rgba(63, 208, 122, 0.16); color: var(--good); }
.intro-chips { justify-content: center; margin: var(--s1) 0 0; }
.intro-un { margin-top: var(--s2); text-align: left; display: flex; flex-direction: column; gap: 8px; }
.intro-un .intro-k { text-align: center; }
.intro-u { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); }
.intro-u .ic { flex: none; color: var(--accent); margin-top: 2px; }
.intro-u b { display: block; font-size: var(--t-sm); }
.intro-u span { display: block; font-size: var(--t-xs); color: var(--text-2); }
.o-how { font-size: var(--t-xs); color: var(--text-2); margin-top: 2px; }

/* "While you were away" and the new-venture summary */
.away .lrow-t { font-size: var(--t-sm); font-weight: 600; white-space: normal; }
.nv-sum { margin-top: var(--s2); }

/* Keyboard focus is always visible */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lrow.click:focus-visible { outline-offset: -2px; }

/* Touch screens: 44px targets for chips, segmented controls and row actions */
@media (pointer: coarse) {
    button.chip, .seg-i, .lrow-a .btn, .avatar { min-height: var(--tap); }
}

/* Reduced motion: no looping or sliding animation; coach marks keep a static outline */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
    .coach, #pointer, .dock-b.ready, .rail-i.fresh, .sheet, .dialog, .cash-float, .toast, #nudge, .intro-ic { animation: none !important; }
    .coach { box-shadow: 0 0 0 4px rgba(245, 185, 66, 0.35); }
    .cash-float { display: none; }
}

/* Second pass of UX review fixes: tracker alternative, name rules, people weapons, item caps, research costs, map cursor. */
.trk-or { color: var(--text); font-weight: 600; }
.name-msg { font-size: var(--t-xs); color: var(--text-3); margin: -4px 0 var(--s1); }
.name-msg.bad { color: var(--bad); }
.people .pw { display: block; margin-top: 6px; line-height: 1.4; }
.people .pw b { font-size: inherit; color: var(--text); }
.cap-bar { padding: 8px 12px; border-bottom: 1px solid var(--line); }
.cap-bar:last-child { border-bottom: 0; }
.cap-t { display: flex; gap: 8px; align-items: baseline; font-size: var(--t-sm); margin-bottom: 6px; }
.cap-t span:first-child { flex: 1; }
.r-cost { margin-top: 2px; color: var(--text-2); }
.r-miss { margin-top: 2px; font-size: var(--t-xs); color: var(--text-3); }
#map:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.pips-t { display: none; font-size: var(--t-xs); color: var(--text-2); }
@media (max-width: 699px) { .pips { display: none; } .pips-t { display: inline; } }

/* ---- Guild progression and the market (features/guild*.js, features/market*.js) ---- */
.g-sub { margin: 0 0 var(--s2); }
.g-sub .seg { display: flex; width: 100%; }
.g-sub .seg-i { flex: 1 1 auto; }
.gbanner { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 28px; height: 34px; color: var(--gb2); background: var(--gb1);
    border-radius: 6px 6px 50% 50% / 6px 6px 22% 22%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), var(--sh-1); }
.gbanner-md { width: 40px; height: 48px; }
.gbanner-lg { width: 64px; height: 78px; }
.gl-head { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s1); }
.gl-main { min-width: 0; }
.gl-lvl { font-size: var(--t-lg); font-weight: 700; }
.gl-xp { font-size: var(--t-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }
.gl-act { margin-top: var(--s2); }
.gl-act .progress { margin: 4px 0 var(--s1); }
.gb-preview { display: flex; justify-content: center; padding: var(--s1) 0 var(--s2); }
.gb-swatches { display: flex; flex-wrap: wrap; gap: var(--s1); }
.gb-sw { width: var(--tap); height: var(--tap); border-radius: var(--r-sm); background: var(--sw); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
.gb-sw.on { box-shadow: 0 0 0 3px var(--accent), inset 0 0 0 1px rgba(0, 0, 0, 0.3); }
.gb-emblems { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: var(--s1); }
.gb-em { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 64px; border-radius: var(--r-sm);
    background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }
.gb-em small { font-size: var(--t-xs); color: var(--text-2); }
.gb-em.on { border-color: var(--accent); background: rgba(245, 185, 66, 0.12); }
.gb-em:disabled { opacity: 0.45; }
details.gp-later { margin-top: var(--s2); border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
details.gp-later summary { display: flex; align-items: center; min-height: var(--tap); padding: 0 14px; cursor: pointer; font-weight: 600; color: var(--text-2); }
details.gp-later .list { padding: 0 var(--s1) var(--s1); }
.xb-book { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s1); }
.xb-side { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.xb-side td, .xb-side th { padding: 8px 10px; font-size: var(--t-sm); }
.form-row .field input, .form-row .field select { flex: none; }
.gs-band { margin: var(--s1) 0 0; padding: 8px 12px; border-radius: var(--r-sm); background: rgba(245, 185, 66, 0.08); border: 1px solid rgba(245, 185, 66, 0.25); font-size: var(--t-sm); color: var(--text); font-variant-numeric: tabular-nums; }
/* ---- Chat, logistics and items screens (features/chat.js, logistics.js, remote.js, items.js) ---- */
.chat-msg { display: flex; align-items: flex-start; gap: 4px; border-radius: var(--r-sm); }
.chat-msg:hover { background: var(--surface-2); }
.chat-line { flex: 1; min-width: 0; line-height: 1.5; }
.chat-name { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; cursor: pointer; }
.chat-name:hover { text-decoration: underline; }
.chat-msg .chip { vertical-align: baseline; height: auto; min-height: 28px; padding: 0 10px; margin: 0 2px; }
.chat-msg .ovf { flex: none; }
.chat-msg .ovf .icon-btn { width: 36px; height: 36px; opacity: 0.55; }
.chat-msg:hover .ovf .icon-btn, .chat-msg .ovf.open .icon-btn { opacity: 1; }
/* The log scrolls (a floating menu would be clipped), so a message menu opens inline under its message. */
.chat-msg { flex-wrap: wrap; }
.chat-msg .ovf.open { display: contents; }
.chat-log .ovf-menu { position: static; order: 3; flex-basis: 100%; min-width: 0; margin: 4px 0 6px; box-shadow: none; }
.chat-log .ovf-i { min-height: 40px; }
.chat-chans { margin-bottom: var(--s1); }
.chat-chans .chip b { margin-left: 4px; color: var(--accent); }
.chat-ctx { margin: var(--s1) 0 4px; padding-left: 10px; border-left: 2px solid var(--line-2); opacity: 0.75; font-size: var(--t-sm); }
.chat-msg.reported { padding: 6px 10px; margin: 4px 0 var(--s1); background: rgba(255, 107, 94, 0.08); border: 1px solid rgba(255, 107, 94, 0.25); font-size: var(--t-sm); overflow-wrap: anywhere; display: block; }
.chat-msg.ctx { display: block; padding: 2px 0; overflow-wrap: anywhere; }
.card.report { margin-bottom: var(--s2); }
.card.report .field { margin-top: var(--s1); }
.sect-h.sub-h { margin: var(--s2) 0 var(--s1); color: var(--text-2); }
.sect-h.sub-h:first-child { margin-top: 0; }
.badge.warn { background: rgba(240, 165, 48, 0.16); color: var(--warn); }
/* Notices that stay when hints are off (body.no-hints hides .hint). */
.say { margin: var(--s1) 0; font-size: var(--t-sm); line-height: 1.45; color: var(--text-2); }
.say.neg { color: var(--bad); }
@media (max-width: 699px) { .chat-log { height: 38vh; } }

/* Endgame: season banner, track, Prestige stars and the reset review, Metropolis prize (client/js/features/season.js,
   prestige.js, metropolis.js). --sc is the season theme colour, validated by safeColor. */
.season-banner {
    --sc: var(--accent);
    position: relative; overflow: hidden; padding: var(--s2); margin-bottom: var(--s2); border-radius: var(--r-lg);
    border: 1px solid color-mix(in srgb, var(--sc) 45%, transparent);
    background: linear-gradient(135deg, color-mix(in srgb, var(--sc) 26%, transparent), color-mix(in srgb, var(--sc) 4%, transparent) 70%);
}
.season-banner .progress i { background: var(--sc); }
.season-banner .progress { margin-top: var(--s2); background: rgba(255, 255, 255, 0.12); }
.sb-top { display: flex; align-items: center; gap: 12px; }
.sb-ic { flex: none; width: 48px; height: 48px; border-radius: var(--r-md); display: grid; place-items: center; color: #fff; background: color-mix(in srgb, var(--sc) 70%, #000); }
.sb-t { flex: 1; min-width: 0; }
.sb-k { font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
.sb-n { font-size: var(--t-lg); font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.sb-left { flex: none; text-align: right; }
.sb-v { font-size: var(--t-lg); font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sb-week { margin-top: var(--s1); font-size: var(--t-xs); color: var(--text-2); }
.season-banner.compact { padding: 12px; margin-bottom: 0; }
.season-banner.compact .sb-ic { width: 36px; height: 36px; }
.season-banner.compact .sb-n, .season-banner.compact .sb-v { font-size: var(--t-md); }
.season-banner.compact .progress { margin-top: 10px; }
.season-cc { display: block; width: 100%; text-align: left; padding: 0; margin-bottom: var(--s2); border: 0; background: none; color: inherit; font: inherit; cursor: pointer; border-radius: var(--r-lg); }
.season-cc:hover .season-banner, .season-cc:focus-visible .season-banner { border-color: var(--sc); }
.season-cc-l { display: flex; align-items: center; justify-content: space-between; gap: var(--s1); padding: 8px 4px 0; font-size: var(--t-sm); color: var(--text-2); }
.hero-s { font-size: var(--t-xs); color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-sum { margin-bottom: var(--s2); }
.track-k { display: flex; justify-content: space-between; margin-top: 6px; font-size: var(--t-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.tier-n { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: var(--t-sm); color: var(--text-3); background: var(--surface-3); font-variant-numeric: tabular-nums; }
.tier-n.on { color: var(--accent-ink); background: var(--accent); }
.pstar-card { display: flex; flex-direction: column; align-items: center; gap: var(--s2); padding: var(--s3) var(--s2); text-align: center; }
.pstars { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.pstar { color: var(--text-3); opacity: 0.45; }
.pstar.on { color: var(--gold); opacity: 1; }
.pstar.on .ic { fill: currentColor; }
.pstar.next { color: var(--gold); opacity: 1; animation: pstar-pulse 1.6s ease-in-out infinite; }
@keyframes pstar-pulse { 50% { transform: scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .pstar.next { animation: none; } }
.pstar-sum { display: flex; flex-direction: column; gap: 4px; }
.pstar-sum b { font-size: var(--t-lg); }
.pstar-sum span { font-size: var(--t-sm); color: var(--text-2); }
.pflow { display: flex; flex-direction: column; gap: 12px; }
.pflow-i { display: flex; gap: 12px; align-items: flex-start; }
.pflow-i b { display: block; font-size: var(--t-sm); }
.pflow-i span { font-size: var(--t-xs); color: var(--text-2); }
.card.gain { border-color: rgba(245, 197, 66, 0.4); background: linear-gradient(160deg, rgba(245, 197, 66, 0.12), rgba(245, 197, 66, 0.02)); }
.card.gain .pstars { justify-content: flex-start; margin-bottom: var(--s1); }
.card.lose { border-color: rgba(255, 107, 94, 0.3); }
.card.gain .kv, .card.lose .kv { padding: 6px 0; }
details.disc { margin-top: var(--s2); border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
details.disc summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 14px; cursor: pointer; font-weight: 600; color: var(--text-2); }
details.disc summary::-webkit-details-marker { display: none; }
details.disc summary .ic { transition: transform 0.15s; }
details.disc[open] summary .ic { transform: rotate(90deg); }
details.disc .list { padding: 0 var(--s1) var(--s1); }
.chips.keep .chip { padding: 6px 12px; }
.metro-prize { display: flex; flex-direction: column; gap: 12px; }
.mp-title { display: flex; gap: 12px; align-items: center; color: var(--gold); }
.mp-title b { display: block; color: var(--text); font-size: var(--t-md); }
.mp-title span { font-size: var(--t-xs); color: var(--text-2); }
.swatch.lg { width: 20px; height: 20px; border-radius: 6px; margin: 0; }
.bunker-card { margin-bottom: var(--s2); border-color: rgba(139, 92, 246, 0.45); background: rgba(139, 92, 246, 0.08); }
.chip.gold { color: var(--gold); border-color: rgba(245, 197, 66, 0.4); background: rgba(245, 197, 66, 0.08); }
