/* The WelcomeTo Arcade: WelcomeTo-Site's tokens, the HUD and the menus (docs/20 section 5.2). */

@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 100 900; font-display: swap; src: url(../vendor/fonts/fraunces.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap; src: url(../vendor/fonts/inter.woff2) format('woff2'); }

:root {
  color-scheme: dark;
  --bg: #0c0a0b;
  --surface: #161214;
  --surface-2: #1f1a1d;
  --raised: #29232a;
  --overlay: rgba(6, 4, 5, 0.72);
  --glass: rgba(22, 18, 20, 0.78);
  --glass-2: rgba(31, 26, 29, 0.86);
  --line: rgba(255, 238, 230, 0.08);
  --line-strong: rgba(255, 238, 230, 0.16);
  --text: #f4efeb;
  --text-muted: #bdb3ad;
  --text-faint: #9a908a;
  --accent: #b5232c;
  --accent-hover: #c22a33;
  --accent-text: #ff7a72;
  --accent-wash: rgba(181, 35, 44, 0.14);
  --gold: #e7bf6a;
  --green: #5dd39e;
  --danger: #ff7a72;
  --r-6: 6px;
  --r-8: 8px;
  --r-12: 12px;
  --r-18: 18px;
  --pill: 999px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --shadow-big: 0 24px 60px -20px rgba(0, 0, 0, 0.75);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --display: 'Fraunces', 'Times New Roman', serif;
  --body: 'Inter', 'Arial', 'Helvetica', sans-serif;
  --tap: 36px;
}

@media (pointer: coarse) {
  :root { --tap: 44px; }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#ui > * { pointer-events: none; }

h1, h2, h3 { font-family: var(--display); font-weight: 560; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 34px; line-height: 1.1; }
h2 { font-size: 20px; }
h3 { font-size: 18px; }
p { margin: 0; }
[hidden] { display: none !important; }

/* ---- controls ---- */

.btn {
  pointer-events: auto;
  font: 600 14px/1 var(--body);
  color: var(--text);
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  min-height: var(--tap);
  padding: 0 18px;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.15s var(--ease), opacity 0.15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #332c34; border-color: rgba(255, 238, 230, 0.26); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:focus-visible, .tab:focus-visible, .seg-btn:focus-visible, .option:focus-visible, .swatch:focus-visible, .comp-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px #750000, 0 0 14px 2px rgba(140, 0, 0, 0.75);
}
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.secondary { background: rgba(93, 211, 158, 0.16); border-color: rgba(93, 211, 158, 0.45); color: #d6f6e6; }
.btn.secondary:hover:not(:disabled) { background: rgba(93, 211, 158, 0.24); }
.btn.ghost { background: transparent; }
.btn.ghost:hover:not(:disabled) { background: rgba(255, 238, 230, 0.06); }
.btn.danger { background: rgba(255, 122, 114, 0.14); border-color: rgba(255, 122, 114, 0.45); color: var(--danger); }
.btn.ghost.danger { color: var(--danger); border-color: rgba(255, 122, 114, 0.3); }
.btn.small { min-height: 30px; padding: 0 13px; font-size: 13px; }
.btn.tiny { min-height: 24px; padding: 0 9px; font-size: 12px; font-weight: 500; }
.btn.big { min-height: 48px; padding: 0 28px; font-size: 16px; }
@media (pointer: coarse) { .btn.small, .btn.tiny { min-height: 40px; } }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line); border-radius: var(--pill); pointer-events: auto; }
.seg.full { display: flex; width: 100%; }
.seg.full .seg-btn { flex: 1; }
.seg-btn { font: 600 13px/1 var(--body); color: var(--text-muted); background: transparent; border: 0; border-radius: var(--pill); min-height: 30px; padding: 0 14px; cursor: pointer; transition: background 0.15s var(--ease), color 0.15s; }
.seg-btn:hover:not(:disabled) { color: var(--text); }
.seg-btn.on { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 2px 8px rgba(0, 0, 0, 0.3); }
.seg-btn:disabled { cursor: default; }
@media (pointer: coarse) { .seg-btn { min-height: 40px; } }

.input, .select {
  pointer-events: auto;
  width: 100%;
  font: 500 14px var(--body);
  color: var(--text);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-8);
  min-height: var(--tap);
  padding: 0 12px;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}
.input:focus, .select:focus { border-color: rgba(255, 122, 114, 0.6); }
.select option { background: var(--surface-2); }

.badge { display: inline-flex; align-items: center; font: 600 11px/1 var(--body); letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 8px; border-radius: var(--pill); background: rgba(255, 238, 230, 0.08); color: var(--text-muted); }
.badge.gold { background: rgba(231, 191, 106, 0.16); color: var(--gold); }
.badge.green { background: rgba(93, 211, 158, 0.15); color: var(--green); }
.badge.big { font-size: 13px; padding: 7px 14px; }

.chip { --chip: 36px; position: relative; flex: none; display: inline-grid; place-items: center; width: var(--chip); height: var(--chip); border-radius: 50%; background: linear-gradient(145deg, #3a3038, #211b1f); box-shadow: 0 0 0 2px var(--ring), 0 4px 10px rgba(0, 0, 0, 0.35); overflow: hidden; }
.chip img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.chip-initial { font: 700 calc(var(--chip) * 0.42) / 1 var(--body); color: var(--text-muted); }

.hint { color: var(--text-faint); font-size: 13px; }
.eyebrow { font: 600 11px/1 var(--body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-text); }
.field { display: flex; flex-direction: column; gap: 8px; }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; }
.field-label { font: 600 11px/1 var(--body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.empty { display: flex; flex-direction: column; gap: 4px; padding: 22px 16px; border: 1px dashed var(--line-strong); border-radius: var(--r-12); color: var(--text-muted); text-align: center; }
.empty strong { color: var(--text); font-weight: 600; }
.value-text { font-weight: 600; }
.form { display: flex; flex-direction: column; gap: 10px; min-width: min(360px, 80vw); }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; pointer-events: auto; font-size: 14px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: relative; width: 38px; height: 22px; border-radius: var(--pill); background: var(--raised); border: 1px solid var(--line-strong); transition: background 0.15s; }
.switch-track i { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-muted); transition: transform 0.2s var(--ease), background 0.2s; }
.switch input:checked + .switch-track { background: rgba(93, 211, 158, 0.3); }
.switch input:checked + .switch-track i { transform: translateX(16px); background: var(--green); }

/* ---- boot ---- */

.boot { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: radial-gradient(120% 80% at 50% 0%, #2a1a20 0%, var(--bg) 60%); transition: opacity 0.45s var(--ease); }
.boot.done { opacity: 0; pointer-events: none; }
.boot-card { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 34px; min-width: min(380px, 86vw); text-align: center; }
.boot-mark { font: 600 15px var(--body); letter-spacing: 0.24em; text-transform: uppercase; color: var(--text-muted); }
.boot-mark span { display: block; font: 560 54px/1 var(--display); letter-spacing: -0.02em; text-transform: none; color: var(--text); margin-top: 6px; }
.boot-bar { width: 220px; height: 4px; border-radius: var(--pill); background: rgba(255, 238, 230, 0.08); overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-text)); transition: width 0.4s var(--ease); }
.boot-line { color: var(--text-muted); font-size: 14px; min-height: 20px; }
.boot.idle .boot-bar { display: none; }
.boot-error { display: flex; flex-direction: column; gap: 14px; align-items: center; max-width: 360px; color: var(--danger); }
.boot.failed .boot-bar { display: none; }

/* ---- shell ---- */

.shell { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 14px 18px 18px; gap: 14px; }
.topbar { position: relative; display: flex; align-items: center; gap: 18px; pointer-events: auto; }
.brand { display: flex; flex-direction: column; line-height: 1; padding: 4px 10px 4px 2px; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45); }
.brand-small { font: 600 10px var(--body); letter-spacing: 0.24em; text-transform: uppercase; color: rgba(255, 255, 255, 0.82); }
.brand-big { font: 600 25px var(--display); letter-spacing: -0.02em; color: #fff; }
.tabs { display: flex; gap: 2px; padding: 4px; margin: 0 auto; background: var(--glass); border: 1px solid var(--line); border-radius: var(--pill); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow); }
.tab { font: 600 14px/1 var(--body); color: var(--text-muted); background: transparent; border: 0; border-radius: var(--pill); min-height: var(--tap); padding: 0 18px; cursor: pointer; transition: background 0.15s var(--ease), color 0.15s; }
.tab:hover { color: var(--text); }
.tab.on { background: var(--accent); color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.conn { display: inline-flex; align-items: center; gap: 7px; font: 600 12px var(--body); color: var(--text-muted); background: var(--glass); border: 1px solid var(--line); padding: 7px 12px; border-radius: var(--pill); backdrop-filter: blur(12px); }
.conn i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.conn.open i { background: var(--green); box-shadow: 0 0 8px var(--green); }
.conn.reconnecting i, .conn.connecting i { background: var(--gold); animation: pulse 1s infinite; }
.topbar-right .btn { background: var(--glass); backdrop-filter: blur(12px); }
.popover { position: absolute; right: 0; top: calc(100% + 8px); z-index: 5; display: flex; flex-direction: column; gap: 10px; width: 280px; padding: 16px; background: var(--glass-2); border: 1px solid var(--line-strong); border-radius: var(--r-12); box-shadow: var(--shadow-big); backdrop-filter: blur(18px); pointer-events: auto; animation: rise 0.18s var(--ease); }
.popover-title { font: 600 11px var(--body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); margin-top: 4px; }

.content { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; display: grid; gap: 14px; grid-template-columns: minmax(260px, 320px) 1fr minmax(290px, 360px); }
.view.look { grid-template-columns: 1fr minmax(320px, 420px); }
.stage-gap { pointer-events: none; }
.panel {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r-18);
  box-shadow: var(--shadow-big);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  animation: rise 0.3s var(--ease);
  scrollbar-width: thin;
  scrollbar-color: var(--raised) transparent;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.count { font-size: 12px; color: var(--text-faint); font-weight: 500; }

/* ---- party ---- */

.player-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.player { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r-12); transition: background 0.15s; }
.player:hover { background: rgba(255, 238, 230, 0.04); }
.player.me { background: var(--accent-wash); }
.player.away { opacity: 0.5; }
.player-main { flex: 1; min-width: 0; }
.player-name { font-weight: 600; display: flex; gap: 6px; align-items: baseline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you { font-size: 11px; color: var(--accent-text); font-weight: 600; }
.player-sub { display: flex; gap: 8px; align-items: center; margin-top: 3px; font-size: 12px; color: var(--text-faint); }
.state.ready { color: var(--green); }
.points { color: var(--gold); font-weight: 600; }
.player-actions { display: none; gap: 4px; }
.player:hover .player-actions, .player:focus-within .player-actions { display: flex; }
@media (pointer: coarse) { .player-actions { display: flex; } }

.playlist { display: flex; flex-direction: column; gap: 6px; }
.playlist-empty { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--r-12); background: linear-gradient(120deg, rgba(231, 191, 106, 0.12), rgba(181, 35, 44, 0.1)); border: 1px solid var(--line); }
.playlist-empty span { font-size: 13px; color: var(--text-muted); }
.playlist-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 0; border-radius: var(--r-8); background: rgba(0, 0, 0, 0.22); border-left: 4px solid var(--game); }
.playlist-n { width: 24px; text-align: center; color: var(--text-faint); font-size: 12px; font-weight: 600; }
.playlist-name { flex: 1; font-weight: 600; }
.playlist-time { font-size: 12px; color: var(--text-faint); }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper-value { min-width: 34px; text-align: center; font: 600 20px var(--display); }
.setup-footer { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.setup-footer .row { justify-content: flex-end; }
.setup-footer .btn.big { flex: 1; }
.ready-line { font-size: 13px; color: var(--text-muted); }

/* ---- game cards ---- */

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card-stack { display: flex; flex-direction: column; gap: 12px; }
.game-card { display: flex; flex-direction: column; overflow: hidden; border-radius: var(--r-18); background: var(--surface-2); border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform 0.2s var(--ease), border-color 0.2s; }
.game-card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.game-card.selected { border-color: color-mix(in srgb, var(--game) 70%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--game) 50%, transparent), var(--shadow); }
.card-art { position: relative; height: 112px; overflow: hidden; background: radial-gradient(130% 120% at 15% 0%, color-mix(in srgb, var(--game) 92%, white) 0%, var(--game) 45%, color-mix(in srgb, var(--game) 55%, black) 100%); }
.card-art.big { height: 100%; min-height: 180px; }
.card-art::before { content: ''; position: absolute; inset: 0; opacity: 0.22; }
.card-art.p-hex::before { background-image: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.9) 0 2px, transparent 3px); background-size: 22px 19px; }
.card-art.p-stripes::before { background: repeating-linear-gradient(-35deg, rgba(255, 255, 255, 0.6) 0 10px, transparent 10px 26px); }
.card-art.p-dots::before { background-image: radial-gradient(rgba(255, 255, 255, 0.85) 2px, transparent 3px); background-size: 16px 16px; }
.card-art.p-waves::before { background: repeating-radial-gradient(circle at 80% 120%, rgba(255, 255, 255, 0.55) 0 4px, transparent 4px 18px); }
.card-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.35)); }
.card-art-mark { position: absolute; right: 12px; bottom: -22px; font: 700 110px/1 var(--display); color: rgba(255, 255, 255, 0.24); z-index: 1; }
.card-art.big .card-art-mark { font-size: 220px; bottom: -48px; }
.card-art-kind { position: absolute; left: 12px; top: 12px; z-index: 2; font: 600 10px/1 var(--body); letter-spacing: 0.14em; text-transform: uppercase; color: #fff; background: rgba(0, 0, 0, 0.28); padding: 6px 9px; border-radius: var(--pill); backdrop-filter: blur(6px); }
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; }
.card-tagline { color: var(--text-muted); font-size: 13px; }
.card-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-text { font: 600 11px/1 var(--body); color: var(--text-muted); background: rgba(255, 238, 230, 0.07); padding: 5px 8px; border-radius: var(--pill); }
.chip-text.solo { color: var(--gold); background: rgba(231, 191, 106, 0.12); }
.card-credit { font-size: 11px; color: var(--text-faint); }
.card-actions { display: flex; justify-content: flex-end; margin-top: 2px; }
.card-best { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-muted); }

/* ---- boards ---- */

.board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.board-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--r-12); background: rgba(0, 0, 0, 0.18); }
.board-row.me { background: var(--accent-wash); box-shadow: inset 0 0 0 1px rgba(255, 122, 114, 0.3); }
.board-row .rank { width: 30px; font: 600 15px var(--display); color: var(--text-muted); }
.board-row.top1 .rank { color: var(--gold); }
.board-row.top2 .rank { color: #c9ced6; }
.board-row.top3 .rank { color: #d39363; }
.board-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-sub { font-size: 12px; color: var(--text-faint); }
.board-best { font: 600 15px var(--body); font-variant-numeric: tabular-nums; }
.board-mine { font-size: 13px; color: var(--text-muted); text-align: center; }
.mini-board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.mini-board li { display: flex; gap: 10px; align-items: center; padding: 5px 8px; border-radius: var(--r-6); font-size: 13px; }
.mini-board li.me { background: var(--accent-wash); }
.mini-board .rank { width: 24px; color: var(--text-faint); font-weight: 600; }

/* ---- look ---- */

.look-preview { position: relative; pointer-events: auto; cursor: grab; }
.look-hint { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); font-size: 12px; color: rgba(255, 255, 255, 0.75); background: rgba(0, 0, 0, 0.3); padding: 6px 12px; border-radius: var(--pill); backdrop-filter: blur(8px); }
.look-fields { display: flex; flex-direction: column; gap: 16px; }
.options { display: flex; flex-wrap: wrap; gap: 6px; }
.option { pointer-events: auto; font: 500 13px/1 var(--body); color: var(--text-muted); background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); border-radius: var(--pill); min-height: 32px; padding: 0 12px; cursor: pointer; transition: all 0.15s var(--ease); }
.option:hover { color: var(--text); border-color: var(--line-strong); }
.option.on { color: #fff; background: var(--accent); border-color: transparent; }
.swatches { gap: 8px; }
.swatch { pointer-events: auto; width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--swatch); cursor: pointer; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.35); transition: transform 0.15s var(--ease), box-shadow 0.15s; }
.swatch:hover { transform: scale(1.08); }
.swatch.on { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
@media (pointer: coarse) { .option { min-height: 44px; } .swatch { width: 40px; height: 40px; } }
.look-actions { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---- competitions ---- */

.comp-section { display: flex; flex-direction: column; gap: 6px; }
.comp-item { pointer-events: auto; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 4px 8px; text-align: left; padding: 10px 12px; border-radius: var(--r-12); background: rgba(0, 0, 0, 0.18); border: 1px solid transparent; color: var(--text); font: inherit; cursor: pointer; }
.comp-item:hover { border-color: var(--line-strong); }
.comp-item.on { border-color: rgba(255, 122, 114, 0.45); background: var(--accent-wash); }
.comp-name { font-weight: 600; }
.comp-date { font-size: 12px; color: var(--text-faint); }
.adjustments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.adjustments li { display: flex; justify-content: space-between; gap: 10px; }
.host-tools { padding-top: 10px; border-top: 1px solid var(--line); }

/* ---- modal and toasts ---- */

.modal-host { position: absolute; inset: 0; z-index: 6; }
.modal-wrap { position: absolute; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(6, 4, 5, 0.55); backdrop-filter: blur(6px); pointer-events: auto; opacity: 0; transition: opacity 0.2s var(--ease); }
.modal-wrap.in { opacity: 1; }
.modal-wrap.out { opacity: 0; }
.modal { width: min(460px, 100%); max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-18); box-shadow: var(--shadow-big); transform: translateY(8px) scale(0.98); transition: transform 0.25s var(--ease); }
.modal.wide { width: min(900px, 100%); }
.modal-wrap.in .modal { transform: none; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px; overflow: auto; min-height: 0; overscroll-behavior: contain; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }
.toasts { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 7; }
.toast { font-size: 14px; font-weight: 500; padding: 10px 16px; border-radius: var(--pill); background: var(--glass-2); border: 1px solid var(--line-strong); box-shadow: var(--shadow); backdrop-filter: blur(12px); opacity: 0; transform: translateY(8px); transition: all 0.25s var(--ease); }
.toast.in { opacity: 1; transform: none; }
.toast.out { opacity: 0; transform: translateY(-6px); }
.toast.good { border-color: rgba(93, 211, 158, 0.45); }
.toast.bad { border-color: rgba(255, 122, 114, 0.5); color: #ffd6d2; }

/* ---- intro ---- */

.intro { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; background: radial-gradient(80% 70% at 50% 50%, rgba(6, 4, 5, 0.25), rgba(6, 4, 5, 0.75)); opacity: 0; transition: opacity 0.3s var(--ease); }
.intro.in { opacity: 1; }
.intro.out { opacity: 0; }
.intro-card { display: grid; grid-template-columns: 220px 1fr; width: min(820px, 100%); overflow: hidden; border-radius: 22px; background: var(--glass-2); border: 1px solid var(--line-strong); box-shadow: var(--shadow-big); backdrop-filter: blur(18px); transform: translateY(14px) scale(0.98); transition: transform 0.45s var(--ease); }
.intro.in .intro-card { transform: none; }
.intro-body { display: flex; flex-direction: column; gap: 12px; padding: 26px 28px; }
.intro-body h1 { font-size: 44px; }
.variant { font: 600 13px var(--body); color: var(--gold); }
.intro-tagline { color: var(--text-muted); font-size: 16px; }
.howto { margin: 4px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; color: var(--text); }
.howto li::marker { color: var(--accent-text); font-weight: 700; }
.intro-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.control { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); background: rgba(0, 0, 0, 0.25); padding: 6px 10px 6px 6px; border-radius: var(--r-8); }
kbd { font: 700 11px/1 var(--body); color: var(--text); background: var(--raised); border: 1px solid var(--line-strong); border-bottom-width: 2px; padding: 5px 7px; border-radius: 6px; min-width: 22px; text-align: center; }
.intro-foot { display: flex; align-items: center; gap: 16px; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.intro-timer { position: relative; width: 58px; height: 58px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: rgba(255, 238, 230, 0.1); stroke-width: 7; }
.ring-arc { fill: none; stroke: var(--game, var(--accent)); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 276.5; stroke-dashoffset: 0; }
.intro-count { position: absolute; inset: 0; display: grid; place-items: center; font: 600 22px var(--display); }
.intro-meta { display: flex; flex-direction: column; gap: 2px; }
.intro-status { font-weight: 600; }

/* ---- results ---- */

.results { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(6, 4, 5, 0.4); opacity: 0; transition: opacity 0.3s var(--ease); pointer-events: auto !important; }
.results.in { opacity: 1; }
.results.out { opacity: 0; }
.results-card { width: min(760px, 100%); max-height: 100%; display: flex; flex-direction: column; overflow: hidden; border-radius: 22px; background: var(--glass-2); border: 1px solid var(--line-strong); box-shadow: var(--shadow-big); backdrop-filter: blur(18px); border-top: 4px solid var(--game); transform: translateY(14px); transition: transform 0.45s var(--ease); }
.results.in .results-card { transform: none; }
.results-head { display: flex; flex-direction: column; gap: 6px; padding: 22px 26px 12px; }
.results-body { display: grid; grid-template-columns: 1fr 220px; gap: 18px; padding: 8px 26px 18px; overflow: auto; }
.result-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.result-row { display: grid; grid-template-columns: 48px auto 1fr auto 56px; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--r-12); background: rgba(0, 0, 0, 0.2); opacity: 0; transform: translateX(-10px); animation: slide-in 0.45s var(--ease) forwards; animation-delay: var(--delay); }
.result-row.me { background: var(--accent-wash); box-shadow: inset 0 0 0 1px rgba(255, 122, 114, 0.3); }
.result-row .place { font: 600 18px var(--display); color: var(--text-muted); }
.result-row.place-1 .place { color: var(--gold); }
.result-row.place-2 .place { color: #c9ced6; }
.result-row.place-3 .place { color: #d39363; }
.result-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-value { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.result-points { font-weight: 700; color: var(--gold); text-align: right; }
.result-standings { display: flex; flex-direction: column; gap: 8px; padding-left: 16px; border-left: 1px solid var(--line); }
.results-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 26px; border-top: 1px solid var(--line); }
.result-next { color: var(--text-muted); font-size: 14px; }
.solo-card { width: min(480px, 100%); text-align: center; }
.solo-card .results-head { align-items: center; }
.solo-score { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 26px 22px; }
.solo-number { font: 600 72px/1 var(--display); letter-spacing: -0.02em; }
.solo-line { color: var(--text-muted); }
.solo-line.bad { color: var(--danger); }
.solo-card .results-foot { justify-content: center; }

/* ---- podium ---- */

.podium { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; padding: 26px 20px; gap: 12px; opacity: 0; transition: opacity 0.6s var(--ease); }
.podium.in { opacity: 1; }
.podium-head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6); }
.podium-head .eyebrow { color: #fff; background: rgba(12, 10, 11, 0.55); padding: 6px 12px; border-radius: var(--pill); text-shadow: none; }
.podium-head h1 { font-size: 48px; }
.podium-names { position: absolute; bottom: 30px; display: flex; gap: 14px; align-items: flex-end; }
.podium-name { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: var(--pill); background: var(--glass-2); border: 1px solid var(--line-strong); backdrop-filter: blur(14px); box-shadow: var(--shadow); }
.podium-name.p1 { order: 2; border-color: rgba(231, 191, 106, 0.6); transform: translateY(-8px); }
.podium-name.p2 { order: 1; }
.podium-name.p3 { order: 3; }
.podium-place { font: 600 16px var(--display); color: var(--gold); }
.podium-name span:last-child { color: var(--text-muted); font-size: 13px; }
.podium-rest { position: absolute; right: 20px; top: 26px; width: 220px; padding: 10px; background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-12); }

/* ---- HUD ---- */

.hud { position: absolute; inset: 0; }
.hud-top { position: absolute; left: 16px; right: 16px; top: 14px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 12px; }
.hud-timer { justify-self: center; font: 600 26px/1 var(--display); padding: 10px 20px; border-radius: var(--pill); background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); font-variant-numeric: tabular-nums; box-shadow: var(--shadow); }
.hud-timer.low { color: var(--accent-text); border-color: rgba(255, 122, 114, 0.5); animation: pulse 1s infinite; }
.hud-score { justify-self: end; display: flex; flex-direction: column; align-items: flex-end; padding: 8px 16px; border-radius: var(--r-12); background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); box-shadow: var(--shadow); }
.hud-score-value { font: 600 30px/1 var(--display); font-variant-numeric: tabular-nums; }
.hud-score-label { font: 600 10px var(--body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); margin-top: 4px; }
.hud-list { justify-self: start; display: flex; flex-direction: column; gap: 3px; min-width: 150px; }
.hud-list:empty { visibility: hidden; }
.hud-list-title { font: 600 10px var(--body); letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255, 255, 255, 0.8); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); margin-bottom: 2px; }
.hud-row { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: var(--pill); background: var(--glass); backdrop-filter: blur(8px); }
.hud-row.me { box-shadow: inset 0 0 0 1px rgba(255, 122, 114, 0.5); }
.hud-row.out { opacity: 0.45; text-decoration: line-through; }
.hud-row-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-row-value { color: var(--gold); font-variant-numeric: tabular-nums; }
.hud-dot { width: 8px; height: 8px; border-radius: 50%; }
.hud-bars { position: absolute; left: 50%; top: 70px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; }
.hud-bar { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); }
.hud-bar-track { width: 200px; height: 8px; border-radius: var(--pill); background: rgba(0, 0, 0, 0.4); overflow: hidden; }
.hud-bar-track i { display: block; height: 100%; border-radius: var(--pill); transition: width 0.15s linear; }
.hud-banner { position: absolute; inset: 0; display: grid; place-items: center; }
.hud-banner-card { text-align: center; transform: scale(0.6); opacity: 0; transition: transform 0.35s cubic-bezier(0.2, 1.5, 0.4, 1), opacity 0.2s; }
.hud-banner-card.in { transform: none; opacity: 1; }
.hud-banner-card.out { transform: scale(1.15); opacity: 0; }
.hud-banner-text { font: 700 84px/1 var(--display); letter-spacing: -0.02em; color: #fff; text-shadow: 0 6px 30px rgba(0, 0, 0, 0.5), 0 0 2px rgba(0, 0, 0, 0.4); }
.hud-banner-card.go .hud-banner-text { color: #fff; -webkit-text-stroke: 2px rgba(181, 35, 44, 0.65); }
.hud-banner-card.gold .hud-banner-text { color: var(--gold); }
.hud-banner-card.bad .hud-banner-text { color: var(--accent-text); }
.hud-banner-sub { font: 600 18px var(--body); color: rgba(255, 255, 255, 0.9); text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); margin-top: 8px; }
.hud-toasts { position: absolute; left: 16px; bottom: 18px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hud-toast { font-size: 13px; font-weight: 600; padding: 7px 13px; border-radius: var(--pill); background: var(--glass); backdrop-filter: blur(8px); opacity: 0; transform: translateX(-8px); transition: all 0.25s var(--ease); }
.hud-toast.in { opacity: 1; transform: none; }
.hud-toast.out { opacity: 0; }
.hud-note { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); font-size: 14px; font-weight: 600; padding: 9px 16px; border-radius: var(--pill); background: var(--glass-2); border: 1px solid var(--line-strong); backdrop-filter: blur(10px); }
.hud-tags { position: absolute; inset: 0; overflow: hidden; }
.hud-tag { position: absolute; left: 0; top: 0; font: 600 12px/1 var(--body); padding: 5px 9px; border-radius: var(--pill); background: rgba(12, 10, 11, 0.62); color: #fff; white-space: nowrap; box-shadow: inset 0 0 0 1px var(--tag, rgba(255, 255, 255, 0.12)); transition: opacity 0.2s; will-change: transform; }

/* ---- touch ---- */

.touch { position: absolute; inset: 0; }
.touch-stick { position: absolute; left: 90px; bottom: 90px; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: rgba(12, 10, 11, 0.32); border: 2px solid rgba(255, 255, 255, 0.18); opacity: 0.45; transition: opacity 0.15s; }
.touch-stick.on { opacity: 1; bottom: auto; }
.touch-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); }
.touch-pad { position: absolute; right: 22px; bottom: 22px; display: grid; grid-template-columns: repeat(2, auto); gap: 12px; align-items: end; }
.touch-btn { pointer-events: auto; width: 76px; height: 76px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.3); background: rgba(12, 10, 11, 0.45); color: #fff; font: 700 13px var(--body); backdrop-filter: blur(6px); touch-action: none; }
.touch-btn.down { background: var(--accent); border-color: transparent; transform: scale(0.94); }
.touch-jump { grid-column: 2; width: 92px; height: 92px; }

/* ---- screen effects and endings ---- */

.fx-flash { position: absolute; inset: 0; opacity: 0.6; transition: opacity 0.4s var(--ease); }
.fx-flash.go { opacity: 0; }
.ended { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; background: var(--overlay); pointer-events: auto !important; }
.ended-card { display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; padding: 28px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-18); max-width: 420px; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slide-in { to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { opacity: 0.55; } }

/* ---- small screens ---- */

@media (max-width: 960px) {
  .view { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
  .view .stage-gap { display: none; }
  .view.look { grid-template-columns: 1fr 1fr; }
  .intro-card { grid-template-columns: 1fr; }
  .card-art.big { min-height: 90px; height: 90px; }
  .card-art.big .card-art-mark { font-size: 110px; bottom: -24px; }
  .results-body { grid-template-columns: 1fr; }
  .result-standings { border-left: 0; padding-left: 0; }
}
@media (max-width: 640px) {
  .shell { padding: 10px; gap: 10px; }
  .brand { display: none; }
  .tab { padding: 0 12px; font-size: 13px; }
  .view, .view.look { grid-template-columns: 1fr; overflow: auto; }
  .view .panel { min-height: auto; }
  .conn span { display: none; }
  .intro-body h1 { font-size: 32px; }
  .hud-banner-text { font-size: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
