/* =========================================================
   Free Play - shell styles
   ========================================================= */

:root {
  /* palette - themes below only rewrite these */
  --bg: #0a0e17;
  --bg-deep: #060910;
  --surface: #101725;
  --surface-2: #141d2e;
  --surface-3: #1a2537;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.26);
  --line-hot: var(--accent);
  --text: #e8edf6;
  --muted: #9aa8bd;
  --dim: #6b7a91;
  --accent: #5b9dff;
  --accent-strong: #3d84f5;
  --accent-soft: rgba(91, 157, 255, 0.13);
  --violet: #9d7bff;
  --success: #52d6a4;
  --warning: #f0b95e;
  --danger: #f2706e;
  --gold: #f5c96b;
  --pink: #f07fd4;

  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 22px 48px rgba(0, 0, 0, 0.5);
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --side-w: 232px;

  --font-display: "Outfit", system-ui, sans-serif;
  --font-ui: "Outfit", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* One dial for the whole type scale. Everything below is relative to it,
     so making the site easier to read is a single number. */
  --step: 17px;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* ---------- themes ---------- */

[data-theme="slate"] {
  --bg: #0d1117; --bg-deep: #090d13; --surface: #151b24; --surface-2: #1b222d;
  --surface-3: #222a37; --accent: #7d93b8; --accent-strong: #6478a0;
  --accent-soft: rgba(125, 147, 184, 0.14); --violet: #8f9ec4;
}
[data-theme="carbon"] {
  --bg: #0b0b0d; --bg-deep: #070708; --surface: #131315; --surface-2: #19191c;
  --surface-3: #212125; --accent: #d8d8dd; --accent-strong: #b8b8c0;
  --accent-soft: rgba(216, 216, 221, 0.1); --violet: #a9a9b4; --line: rgba(255,255,255,0.09);
}
[data-theme="aurora"] {
  --bg: #071316; --bg-deep: #040c0e; --surface: #0d1e22; --surface-2: #12272c;
  --surface-3: #173238; --accent: #3fd9c9; --accent-strong: #24bdad;
  --accent-soft: rgba(63, 217, 201, 0.13); --violet: #5fb8ff; --success: #6ee7a8;
}
[data-theme="ember"] {
  --bg: #140c0a; --bg-deep: #0d0705; --surface: #1e1310; --surface-2: #261915;
  --surface-3: #31211c; --accent: #ff8a5c; --accent-strong: #f06f3d;
  --accent-soft: rgba(255, 138, 92, 0.13); --violet: #ff6f9d; --gold: #ffc27a;
}
[data-theme="violet"] {
  --bg: #0d0a16; --bg-deep: #08060f; --surface: #161123; --surface-2: #1c162c;
  --surface-3: #251d3a; --accent: #a98bff; --accent-strong: #8f6df5;
  --accent-soft: rgba(169, 139, 255, 0.14); --violet: #d78bff;
}
[data-theme="daylight"] {
  --bg: #eef1f6; --bg-deep: #e2e7ef; --surface: #ffffff; --surface-2: #f5f7fb;
  --surface-3: #e9edf4; --line: rgba(15, 23, 42, 0.1); --line-strong: rgba(15,23,42,0.2);
  --text: #131a26; --muted: #55617a; --dim: #7a8698;
  --accent: #2f6fe0; --accent-strong: #1d55bd; --accent-soft: rgba(47, 111, 224, 0.1);
  --shadow: 0 4px 14px rgba(15, 23, 42, 0.09);
  --shadow-lg: 0 20px 44px rgba(15, 23, 42, 0.14);
}

* { box-sizing: border-box; }

/* Any rule with a display: of its own outranks the browser's [hidden]
   handling, which silently leaves "hidden" panels on screen. One global
   guard is safer than remembering a .thing[hidden] rule every time. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

html { font-size: var(--step); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font-family: var(--font-ui); color: inherit; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.display { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.025em; }

strong, b { font-weight: 700; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--dim); }

/* ---------- ambient layers ---------- */

.bg-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; opacity: 0.55; }
body.no-backdrop .bg-canvas { display: none; }

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 0%, var(--accent-soft), transparent 46%),
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.5) 100%);
}
[data-theme="daylight"] .vignette {
  background: radial-gradient(circle at 18% 0%, var(--accent-soft), transparent 46%);
}

/* ---------- boot ---------- */

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: var(--bg-deep);
  transition: opacity 0.45s var(--ease), visibility 0.45s;
}
.boot-screen.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; }

.boot-logo {
  width: 76px; height: 76px;
  display: grid; place-items: center;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  font-family: var(--font-display);
  font-size: 1.8rem; font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
  background: var(--surface);
  animation: boot-pulse 1.8s ease-in-out infinite;
}
@keyframes boot-pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.04); opacity: 1; }
}
.boot-line { margin: 0; color: var(--muted); font-size: 0.82rem; letter-spacing: 0.14em; text-transform: uppercase; font-family: var(--font-ui); }
.boot-track { width: 220px; height: 3px; border-radius: 999px; background: var(--line); overflow: hidden; }
.boot-fill { height: 100%; width: 0%; border-radius: 999px; background: var(--accent); transition: width 0.2s linear; }

/* ---------- sign-in gate ---------- */

.gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg-deep);
  overflow-y: auto;
}

.gate-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

.gate-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.gate-logo {
  width: 48px; height: 48px; flex: none;
  display: grid; place-items: center;
  border-radius: 13px;
  background: var(--accent-soft);
  border: 1px solid var(--line-strong);
  color: var(--accent);
  font-family: var(--font-display); font-weight: 700; font-size: 1.15rem;
  letter-spacing: -0.03em;
}
.gate-brand h1 { margin: 0; font-size: 1.4rem; }
.gate-brand p { margin: 3px 0 0; color: var(--dim); font-size: 0.8rem; }

.gate-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  margin-bottom: 20px;
}
.gate-tab {
  border: 0; background: transparent; color: var(--muted);
  padding: 9px 6px; border-radius: 9px; cursor: pointer;
  font-size: 0.82rem; font-weight: 600;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.gate-tab:hover { color: var(--text); }
.gate-tab.is-active { background: var(--surface-3); color: var(--text); }

.gate-pane { display: none; flex-direction: column; gap: 13px; }
.gate-pane.is-active { display: flex; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span {
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); font-family: var(--font-ui); font-weight: 600;
}
.field input, .field select {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg-deep);
  color: var(--text);
  font-size: 0.92rem;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input::placeholder { color: var(--dim); }

.gate-fine { margin: 2px 0 0; color: var(--dim); font-size: 0.75rem; line-height: 1.55; }
.gate-empty { margin: 0; color: var(--dim); font-size: 0.8rem; line-height: 1.55; }

.gate-warn {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: rgba(240, 185, 94, 0.08);
  border: 1px solid rgba(240, 185, 94, 0.24);
  font-size: 0.78rem; line-height: 1.5;
}
.gate-warn strong { color: var(--warning); font-size: 0.8rem; }
.gate-warn span { color: var(--muted); }

.field-error { margin: 12px 0 0; min-height: 1.1em; color: var(--danger); font-size: 0.8rem; }

.avatar-row { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-pick {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg-deep);
  cursor: pointer; font-size: 1rem;
  transition: transform 0.16s var(--ease), border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.avatar-pick:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.avatar-pick.is-active { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- shell ---------- */

.page-shell {
  position: relative;
  z-index: 3;
  display: flex;
  min-height: 100vh;
}

/* ---------- sidebar ---------- */

.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  width: var(--side-w);
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 12px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  transition: width 0.22s var(--ease);
}

.side-top { display: flex; align-items: center; gap: 8px; padding: 4px 6px 12px; }

.side-brand {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 0;
  text-decoration: none; color: inherit;
}
.side-logo {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  border: 1px solid var(--line-strong);
  color: var(--accent);
  font-family: var(--font-display); font-weight: 700; font-size: 0.85rem;
  letter-spacing: -0.03em;
}
.side-word {
  font-family: var(--font-display); font-weight: 800; font-size: 1.12rem;
  letter-spacing: -0.02em; white-space: nowrap; overflow: hidden;
}

.side-collapse {
  width: 26px; height: 26px; flex: none;
  display: grid; place-items: center;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: transparent; color: var(--muted);
  cursor: pointer; font-size: 1rem; line-height: 1;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.side-collapse:hover { background: var(--surface-3); color: var(--text); }

.side-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 2px;
}

.side-heading {
  margin: 16px 0 5px;
  padding: 0 12px;
  font-family: var(--font-ui); font-weight: 700;
  font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}
.side-heading:first-child { margin-top: 2px; }

.side-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  position: relative;
  padding: 11px 12px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted);
  cursor: pointer; text-align: left;
  font-family: var(--font-ui);
  font-size: 0.95rem; font-weight: 600;
  white-space: nowrap;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}
.side-item:hover { background: var(--surface-2); color: var(--text); transform: translateX(2px); }
.side-item.is-active { background: var(--accent-soft); color: var(--text); }

/* a spine on the active row, so the current page is obvious at a glance */
.side-item.is-active::before {
  content: "";
  position: absolute; left: -12px; top: 50%;
  width: 3px; height: 60%;
  transform: translateY(-50%);
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.sidebar.is-narrow .side-item.is-active::before { left: -8px; }
.side-item.is-active .side-ico { filter: none; }

.side-ico { width: 22px; flex: none; text-align: center; font-size: 1.05rem; line-height: 1; }
.side-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }

.side-count {
  flex: none;
  min-width: 20px; padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700;
  text-align: center;
}

.side-account {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  color: inherit; cursor: pointer; text-align: left;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.side-account:hover { border-color: var(--line-strong); background: var(--surface-2); }
.side-acc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.side-acc-text strong { font-size: 0.92rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-acc-text small { color: var(--dim); font-size: 0.74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.side-resize {
  position: absolute; top: 0; right: -3px; width: 6px; height: 100%;
  cursor: col-resize; z-index: 5;
}
.side-resize:hover { background: var(--accent-soft); }

/* collapsed rail */
.sidebar.is-narrow { width: 60px; padding-left: 8px; padding-right: 8px; }
.sidebar.is-narrow .side-word,
.sidebar.is-narrow .side-label,
.sidebar.is-narrow .side-count,
.sidebar.is-narrow .side-acc-text,
.sidebar.is-narrow .side-heading { display: none; }
.sidebar.is-narrow .side-item,
.sidebar.is-narrow .side-account { justify-content: center; padding-left: 0; padding-right: 0; }
.sidebar.is-narrow .side-collapse { transform: rotate(180deg); }
.sidebar.is-narrow .side-top { justify-content: center; padding-bottom: 8px; }
.sidebar.is-narrow .side-brand { flex: none; }

/* ---------- main column ---------- */

.shell-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.side-open { display: none; }

.eyebrow {
  margin: 0;
  font-family: var(--font-ui); font-weight: 700;
  font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent);
}

.hud { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }

.hud-card {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-width: 92px;
}
.hud-card strong { display: block; font-family: var(--font-mono); font-size: 1.16rem; font-weight: 700; line-height: 1.2; }
.hud-card small { display: block; margin-top: 2px; color: var(--dim); font-size: 0.72rem; }
.hud-label {
  display: block;
  font-family: var(--font-ui); font-weight: 700;
  font-size: 0.65rem; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--dim); margin-bottom: 2px;
}
.hud-card.bump { animation: hud-bump 0.32s var(--ease); }
@keyframes hud-bump { 0% { transform: scale(1); } 45% { transform: scale(1.05); } 100% { transform: scale(1); } }

.xp-track { margin-top: 5px; height: 3px; border-radius: 999px; background: var(--line); overflow: hidden; }
.xp-fill { height: 100%; width: 0%; border-radius: 999px; background: var(--accent); transition: width 0.35s var(--ease); }

.topbar-actions { display: flex; gap: 6px; }

.icon-button {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer; font-size: 0.95rem;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.icon-button:hover { background: var(--surface-3); color: var(--text); border-color: var(--line-strong); }
.icon-button.is-off { color: var(--dim); opacity: 0.5; }
.icon-button.danger:hover { color: var(--danger); border-color: var(--danger); }

/* ---------- views ---------- */

.views { flex: 1; padding: 26px 24px 40px; max-width: 1280px; width: 100%; }

.view { display: none; animation: view-in 0.28s var(--ease); }
.view.is-active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.view-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.view-head h2 { margin: 4px 0 0; font-size: clamp(1.65rem, 2.6vw, 2.35rem); }
.view-note { margin: -4px 0 20px; color: var(--muted); font-size: 0.95rem; max-width: 76ch; line-height: 1.65; }
.all-head { margin-top: 38px; }

.pill {
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-ui); font-weight: 600;
  font-size: 0.72rem; letter-spacing: 0.05em;
}
.pill.neutral { color: var(--dim); }

.filter-row { display: flex; gap: 6px; flex-wrap: wrap; }

.chip {
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent; color: var(--muted);
  cursor: pointer; font-size: 0.88rem; font-weight: 600;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

/* ---------- settings ---------- */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  align-items: start;
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.panel h3 { margin: 0 0 4px; font-size: 1.02rem; }
.panel h4 { margin: 20px 0 8px; font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); font-weight: 600; }
.panel-note { margin: 0 0 14px; color: var(--muted); font-size: 0.8rem; line-height: 1.55; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.danger-panel { border-color: rgba(242, 112, 110, 0.24); }

/* Row gap has to clear the caption each swatch hangs below itself,
   otherwise the labels land on top of the next row. */
.theme-row { display: flex; column-gap: 8px; row-gap: 26px; flex-wrap: wrap; }
.theme-swatch {
  width: 44px; height: 44px;
  border-radius: 11px;
  border: 2px solid var(--line);
  cursor: pointer; padding: 0;
  position: relative;
  transition: transform 0.16s var(--ease), border-color 0.16s var(--ease);
}
.theme-swatch:hover { transform: translateY(-2px); }
.theme-swatch.is-active { border-color: var(--accent); }
.theme-swatch span {
  position: absolute; inset: auto 0 -18px; text-align: center;
  font-size: 0.6rem; color: var(--dim); letter-spacing: 0.04em;
}
.theme-row { margin-bottom: 22px; }

.switch {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; cursor: pointer;
  font-size: 0.86rem; color: var(--muted);
}
.switch input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.switch:hover { color: var(--text); }

.slider-field { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; font-size: 0.8rem; color: var(--muted); }
.slider-field b { color: var(--text); font-family: var(--font-mono); }
.slider-field input { width: 100%; accent-color: var(--accent); }

.acct-line { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; }
.acct-badge {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  border-radius: 11px; font-size: 1.2rem;
  border: 1px solid var(--line-strong);
}
.acct-line strong { display: block; font-size: 0.98rem; }
.acct-line small { color: var(--dim); font-size: 0.74rem; }

.tag-verified, .tag-guest, .tag-unverified {
  display: inline-block; margin-left: 6px;
  padding: 1px 7px; border-radius: 999px;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  vertical-align: middle;
}
.tag-verified { background: rgba(82, 214, 164, 0.14); color: var(--success); }
.tag-unverified { background: rgba(240, 185, 94, 0.14); color: var(--warning); }
.tag-guest { background: rgba(154, 168, 189, 0.14); color: var(--muted); }

/* ---------- rival picture-in-picture ---------- */

.rival-pip {
  position: absolute;
  left: 16px; bottom: 16px;
  z-index: 6;
  width: 360px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--bg-deep);
  box-shadow: var(--shadow-lg);
  animation: pip-in 0.35s var(--ease);
}
@keyframes pip-in { from { opacity: 0; transform: translateY(14px) scale(0.95); } to { opacity: 1; transform: none; } }

.pip-head {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.pip-avatar { font-size: 0.92rem; line-height: 1; }
.pip-name {
  flex: 1; min-width: 0;
  font-family: var(--font-ui); font-weight: 600; font-size: 0.78rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pip-score { font-family: var(--font-mono); font-weight: 700; font-size: 0.85rem; color: var(--accent); }

.rival-pip canvas { display: block; width: 100%; height: auto; background: #05070c; }

.pip-foot {
  padding: 5px 10px;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.68rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rival-pip.is-compact canvas { display: none; }
.rival-pip.is-compact { width: 230px !important; }
.rival-pip.is-compact .pip-head { border-bottom: 0; }

.rival-pip[data-size="s"] { width: 250px; }
.rival-pip[data-size="m"] { width: 360px; }
.rival-pip[data-size="l"] { width: 500px; }

.pip-size {
  flex: none;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.pip-size:hover { color: var(--text); border-color: var(--line-strong); }

.rival-pip.is-losing { border-color: rgba(242, 112, 110, 0.5); }
.rival-pip.is-winning { border-color: rgba(82, 214, 164, 0.5); }

/* duel mode shrinks the board a touch to make room for the pip */
.cabinet-stage.has-pip #gameCanvas { max-width: calc(100% - 40px); }

/* ---------- how-to block ---------- */

.howto {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 22px;
}
.howto h3 { margin: 0 0 10px; font-size: 0.98rem; }
.howto ol { margin: 0; padding-left: 20px; color: var(--muted); font-size: 0.84rem; line-height: 1.85; }
.howto strong { color: var(--text); font-weight: 600; }
.howto-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.howto-note { color: var(--dim); font-size: 0.76rem; }

.block { width: 100%; justify-content: center; }


/* ---------- featured band ---------- */

.featured-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 18px;
}
.featured-head h2 { margin: 4px 0 0; font-size: clamp(1.7rem, 3vw, 2.6rem); }
.featured-note { margin: 0; color: var(--dim); font-size: 0.88rem; max-width: 46ch; }

.featured-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(262px, 1fr);
  gap: 20px;
  overflow-x: auto;
  padding: 4px 4px 18px;
  scroll-snap-type: x mandatory;
}
.featured-row > * { scroll-snap-align: start; }

.featured-row .game-card.is-big {
  border-width: 2px;
  box-shadow: var(--shadow-lg), 0 0 40px -20px var(--card-glow, rgba(142,198,255,0.6));
}
.featured-row .game-card.is-big .card-body h3 { font-size: 1.4rem; }
.featured-row .game-card.is-big .card-badge { font-size: 0.66rem; padding: 6px 13px; }

/* ---------- game cards ---------- */

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 20px;
}

.game-card {
  position: relative;
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(16,23,33,0.96), rgba(9,13,20,0.96));
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  color: inherit;
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease), border-color 0.28s;
}

.game-card::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: var(--radius);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  box-shadow: inset 0 0 0 1px var(--card-glow, rgba(142,198,255,0.5));
}

.game-card:hover, .game-card:focus-visible {
  transform: translateY(-6px);
  border-color: transparent;
  box-shadow: var(--shadow-lg), 0 0 44px -14px var(--card-glow, rgba(142,198,255,0.7));
  outline: none;
}
.game-card:hover::after, .game-card:focus-visible::after { opacity: 1; }

.card-shot { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #070b11; }
.card-shot img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform: scale(1.01);
  transition: transform 0.5s var(--ease), filter 0.4s;
}
.game-card:hover .card-shot img { transform: scale(1.07); filter: saturate(1.18) brightness(1.06); }
.card-shot::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 38%, rgba(7,11,17,0.92) 100%);
}

.card-badge {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  padding: 5px 11px; border-radius: 999px;
  font-family: var(--font-ui); font-weight: 700;
  font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: #05080d;
  background: var(--card-glow, var(--accent));
  box-shadow: 0 6px 16px rgba(0,0,0,0.45);
}

.card-best {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  padding: 5px 11px; border-radius: 999px;
  font-family: var(--font-ui); font-weight: 600; font-size: 0.7rem;
  color: var(--gold);
  background: rgba(6,10,16,0.78);
  border: 1px solid rgba(255,212,121,0.3);
  backdrop-filter: blur(6px);
}

.card-play { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; opacity: 0; transition: opacity 0.28s var(--ease); }
.game-card:hover .card-play, .game-card:focus-visible .card-play { opacity: 1; }
.card-play span {
  width: 60px; height: 60px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 1.35rem; color: #05080d; padding-left: 5px;
  background: var(--card-glow, var(--accent));
  box-shadow: 0 12px 34px rgba(0,0,0,0.55);
  transform: scale(0.8);
  transition: transform 0.28s var(--ease);
}
.game-card:hover .card-play span { transform: scale(1); }

.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { margin: 0; font-size: 1.18rem; }
.card-body p { margin: 0; color: var(--muted); font-size: 0.85rem; line-height: 1.5; flex: 1; }
.card-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

.card-tag {
  padding: 4px 9px; border-radius: 7px;
  font-family: var(--font-ui); font-size: 0.68rem;
  color: var(--muted);
  background: rgba(148,163,184,0.1);
  border: 1px solid var(--line);
}

/* ---------- versus lobby ---------- */

.versus-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.versus-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.lobby { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 18px; }

.lobby-block {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(15,22,31,0.95), rgba(10,14,21,0.95));
  box-shadow: var(--shadow);
}
.lobby-block h3 { margin: 0 0 6px; font-size: 1.05rem; }
.lobby-hint { margin: 0 0 12px; color: var(--dim); font-size: 0.76rem; line-height: 1.5; }

.online-list, .standing-list, .account-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.online-row, .standing-row, .account-row {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid transparent;
  font-size: 0.82rem;
}
.online-row.is-me { border-color: rgba(142,198,255,0.3); background: rgba(142,198,255,0.07); }
.account-row.is-current { border-color: rgba(124,224,181,0.4); background: rgba(124,224,181,0.07); }

.online-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; box-shadow: 0 0 8px currentColor; }
.online-avatar {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: rgba(148,163,184,0.12);
  border: 1px solid var(--line);
  font-size: 0.95rem;
}
.online-name { flex: 1; font-family: var(--font-ui); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-state { color: var(--dim); font-size: 0.7rem; }
.online-empty { color: var(--dim); font-size: 0.78rem; line-height: 1.5; padding: 6px 2px; }

.standing-rank { width: 20px; color: var(--gold); font-family: var(--font-display); font-weight: 800; }
.standing-score { color: var(--muted); font-size: 0.74rem; font-family: var(--font-ui); }

.mini-button {
  padding: 5px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(15,22,32,0.9);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-ui); font-weight: 600; font-size: 0.72rem;
  transition: all 0.15s var(--ease);
}
.mini-button:hover { border-color: var(--line-hot); color: var(--text); transform: translateY(-1px); }
.mini-button.primary { color: #05101a; background: var(--accent); border-color: var(--accent); }
.mini-button.danger { color: var(--danger); border-color: rgba(255,122,122,0.3); }

/* ---------- lab / upgrades / awards ---------- */

.lab-grid, .upgrade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.buy-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(15,22,31,0.95), rgba(10,14,21,0.95));
  box-shadow: var(--shadow);
  transition: border-color 0.2s, transform 0.2s var(--ease);
}
.buy-card.affordable { border-color: rgba(124,224,181,0.35); }
.buy-card.maxed { opacity: 0.62; }

.buy-head { display: flex; align-items: center; gap: 12px; }
.buy-icon {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border-radius: 13px; font-size: 1.25rem;
  background: rgba(142,198,255,0.1);
  border: 1px solid var(--line);
}
.buy-head h3 { margin: 0; font-size: 1.02rem; }
.buy-head small { color: var(--dim); font-family: var(--font-ui); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; }
.buy-card p { margin: 0; color: var(--muted); font-size: 0.84rem; line-height: 1.5; }
.buy-stats { display: flex; justify-content: space-between; gap: 10px; font-size: 0.78rem; color: var(--dim); font-family: var(--font-ui); }
.buy-stats strong { color: var(--text); font-family: var(--font-ui); font-weight: 600; }

.buy-button {
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-hot);
  background: rgba(110,168,255,0.12);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-ui); font-weight: 700; font-size: 0.88rem;
  transition: all 0.16s var(--ease);
}
.buy-button:hover:not(:disabled) { background: rgba(110,168,255,0.24); transform: translateY(-1px); }
.buy-button:disabled { opacity: 0.4; cursor: not-allowed; border-color: var(--line); background: rgba(148,163,184,0.06); }

.award-grid, .stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }

.award-card {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(11,16,24,0.9);
  opacity: 0.5; filter: grayscale(0.75);
  transition: all 0.25s var(--ease);
}
.award-card.is-unlocked {
  opacity: 1; filter: none;
  border-color: rgba(255,212,121,0.34);
  background: linear-gradient(180deg, rgba(30,25,14,0.7), rgba(12,16,23,0.92));
}
.award-icon { font-size: 1.5rem; line-height: 1; flex: none; }
.award-card h4 { margin: 0 0 4px; font-size: 0.92rem; }
.award-card p { margin: 0; color: var(--muted); font-size: 0.77rem; line-height: 1.45; }

.stat-card { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(11,16,24,0.9); }
.stat-card span { display: block; color: var(--muted); font-family: var(--font-ui); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 7px; }
.stat-card strong { font-size: 1.35rem; }
.stat-board { margin: 8px 0 0; color: var(--dim); font-size: 0.72rem; line-height: 1.7; }

/* ---------- buttons ---------- */

.primary-button {
  padding: 12px 24px;
  border-radius: 13px;
  border: 1px solid transparent;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #05101a;
  font-family: var(--font-display); font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(110,168,255,0.28);
  transition: transform 0.16s var(--ease), box-shadow 0.16s;
}
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(110,168,255,0.36); }
.primary-button.danger { background: linear-gradient(180deg, #ff9c9c, #ef6a6a); box-shadow: 0 10px 26px rgba(239,106,106,0.28); }

.ghost-button {
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(15,22,32,0.85);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-ui); font-weight: 600; font-size: 0.88rem;
  transition: all 0.16s var(--ease);
}
.ghost-button:hover { border-color: var(--line-hot); transform: translateY(-1px); }
.ghost-button.danger { border-color: rgba(255,122,122,0.32); color: #ffd6d6; }
.ghost-button.danger:hover { border-color: var(--danger); }
.ghost-button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ---------- cabinet ---------- */

.cabinet {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column;
  background: radial-gradient(circle at 50% 20%, #101a26, #04070b 68%);
  animation: cab-in 0.3s var(--ease);
}
.cabinet[hidden] { display: none; }
@keyframes cab-in { from { opacity: 0; transform: scale(0.985); } to { opacity: 1; transform: none; } }

.cabinet-bar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(7,11,17,0.9);
  flex: none;
}
.cabinet-id { flex: 1; min-width: 0; }
.cabinet-id h2 { margin: 0; font-size: 1.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cabinet-id p { margin: 2px 0 0; color: var(--dim); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cabinet-stats { display: flex; gap: 20px; }
.cab-stat { text-align: right; }
.cab-stat span { display: block; color: var(--muted); font-family: var(--font-ui); font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; }
.cab-stat strong { font-size: 1.1rem; }
.cab-stat:nth-child(3) strong { color: var(--gold); }

.cabinet-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; padding: 14px; }

#gameCanvas {
  display: block;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #05080d;
  box-shadow: 0 0 80px -22px rgba(110,168,255,0.5), var(--shadow-lg);
  touch-action: none;
  max-width: 100%; max-height: 100%;
}

.game-layer { position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center; }
.game-layer > * { pointer-events: auto; }

.cabinet-overlay {
  position: absolute; inset: 0; z-index: 5;
  display: grid; place-items: center;
  background: rgba(4,7,11,0.82);
  backdrop-filter: blur(7px);
  animation: view-in 0.24s var(--ease);
}
.cabinet-overlay[hidden] { display: none; }

.overlay-card {
  width: min(440px, 90vw);
  padding: 30px;
  border: 1px solid var(--line-hot);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(18,27,39,0.98), rgba(9,13,20,0.98));
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.overlay-card h3 { margin: 6px 0 10px; font-size: 1.9rem; }
.overlay-card > p { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.55; }

.overlay-metrics { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin: 20px 0 4px; }
.overlay-metrics div { min-width: 96px; padding: 12px; border-radius: 13px; border: 1px solid var(--line); background: rgba(10,15,22,0.9); }
.overlay-metrics span { display: block; color: var(--muted); font-family: var(--font-ui); font-size: 0.63rem; letter-spacing: 0.11em; text-transform: uppercase; margin-bottom: 5px; }
.overlay-metrics strong { font-size: 1.2rem; }
.overlay-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }

.cabinet-foot {
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 11px 18px;
  border-top: 1px solid var(--line);
  background: rgba(7,11,17,0.9);
  flex-wrap: wrap;
}
.control-legend { display: flex; gap: 8px; flex-wrap: wrap; }
.control-legend .key {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 10px; border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(14,20,29,0.9);
  font-family: var(--font-ui); font-size: 0.76rem;
  color: var(--muted);
}
.control-legend .key b {
  font-family: var(--font-display); font-weight: 800; font-size: 0.74rem;
  color: var(--accent);
  padding: 2px 7px; border-radius: 6px;
  background: rgba(142,198,255,0.12);
}
.cabinet-hint { margin: 0; color: var(--dim); font-size: 0.8rem; }

/* ---------- in-game DOM widgets ---------- */

.hud-chip-row {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 92%;
}
.hud-chip {
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(8,12,19,0.82);
  color: var(--muted);
  font-family: var(--font-ui); font-size: 0.74rem;
  backdrop-filter: blur(6px);
}
.hud-chip b { color: var(--text); }

.shop-dock {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; gap: 9px; justify-content: center; flex-wrap: wrap;
  padding: 12px;
}
.shop-chip {
  min-width: 124px;
  padding: 9px 14px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(12,18,27,0.94);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  backdrop-filter: blur(8px);
  transition: all 0.16s var(--ease);
}
.shop-chip:hover:not(:disabled) { border-color: var(--line-hot); transform: translateY(-2px); }
.shop-chip:disabled { opacity: 0.42; cursor: not-allowed; }
.shop-chip.is-active { border-color: var(--accent); background: rgba(110,168,255,0.16); }
.shop-chip b { display: block; font-family: var(--font-ui); font-weight: 700; font-size: 0.84rem; }
.shop-chip span { display: block; color: var(--gold); font-size: 0.72rem; margin-top: 3px; font-family: var(--font-ui); }
.shop-chip.danger { border-color: rgba(255,122,122,0.3); }
.shop-chip.danger b { color: #ffd6d6; }

/* ---------- drawers (accounts, mode picker) ---------- */

.drawer {
  position: fixed; inset: 0; z-index: 86;
  display: grid; place-items: center;
  background: rgba(4,7,11,0.8);
  backdrop-filter: blur(6px);
  animation: view-in 0.22s var(--ease);
  padding: 20px;
}
.drawer[hidden] { display: none; }

.drawer-card {
  position: relative;
  width: min(560px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  padding: 28px;
  border-radius: 24px;
  border: 1px solid var(--line-hot);
  background: linear-gradient(180deg, rgba(18,26,37,0.98), rgba(9,13,20,0.98));
  box-shadow: var(--shadow-lg);
}
.drawer-card.narrow { width: min(430px, 100%); }
.drawer-card h3 { margin: 4px 0 10px; font-size: 1.7rem; }
.drawer-note { margin: 0 0 18px; color: var(--muted); font-size: 0.85rem; line-height: 1.55; }

.drawer-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(15,22,32,0.9);
  color: var(--muted);
  font-size: 1.2rem; line-height: 1;
  cursor: pointer;
}
.drawer-close:hover { color: var(--text); border-color: var(--line-hot); }

.account-actions { display: flex; gap: 6px; }
.account-meta { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.account-meta strong { font-size: 0.92rem; }
.account-meta span { color: var(--dim); font-size: 0.72rem; font-family: var(--font-ui); }

.account-new { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.account-new h4 { margin: 0 0 12px; font-size: 1rem; }

.avatar-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.avatar-pick {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(15,22,32,0.9);
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.avatar-pick:hover { transform: translateY(-2px); border-color: var(--line-hot); }
.avatar-pick.is-active { border-color: var(--accent); background: rgba(110,168,255,0.2); transform: translateY(-2px); }

.field-row { display: flex; gap: 8px; flex-wrap: wrap; }
.field-row input {
  flex: 1 1 130px;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(8,12,19,0.9);
  color: var(--text);
  font-size: 0.9rem;
}
.field-row input:focus { outline: none; border-color: var(--line-hot); }
.field-error { margin: 10px 0 0; color: var(--danger); font-size: 0.8rem; min-height: 1em; }

.mode-list { display: flex; flex-direction: column; gap: 9px; margin-top: 8px; }
.mode-row {
  display: flex; align-items: center; gap: 13px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(13,19,28,0.9);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all 0.16s var(--ease);
}
.mode-row:hover:not(:disabled) { border-color: var(--line-hot); transform: translateX(3px); }
.mode-row.is-disabled, .mode-row:disabled { opacity: 0.45; cursor: not-allowed; }
.mode-icon { font-size: 1.5rem; flex: none; }
.mode-text { display: flex; flex-direction: column; }
.mode-text strong { font-size: 0.98rem; }
.mode-text span { color: var(--muted); font-size: 0.78rem; font-family: var(--font-ui); }

/* ---------- invite ---------- */

.invite-card {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  z-index: 88;
  padding: 16px 22px;
  border-radius: 18px;
  border: 1px solid rgba(255,157,226,0.45);
  background: linear-gradient(180deg, rgba(38,20,34,0.98), rgba(12,16,23,0.98));
  box-shadow: var(--shadow-lg);
  animation: award-in 0.45s var(--ease);
}
.invite-card[hidden] { display: none; }
.invite-inner { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.invite-avatar { font-size: 1.9rem; }
.invite-card strong { display: block; color: var(--pink); font-size: 1rem; }
.invite-card span { color: var(--muted); font-size: 0.82rem; }
.invite-actions { display: flex; gap: 8px; }

/* ---------- toasts / popups / modal ---------- */

.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 70; display: flex; flex-direction: column; gap: 9px; pointer-events: none; }

.toast {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 17px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(13,19,28,0.96);
  box-shadow: var(--shadow);
  font-size: 0.86rem;
  animation: toast-in 0.3s var(--ease);
  max-width: 340px;
}
.toast.is-out { animation: toast-out 0.3s var(--ease) forwards; }
.toast.good { border-color: rgba(124,224,181,0.4); }
.toast.bad { border-color: rgba(255,122,122,0.4); }
.toast.gold { border-color: rgba(255,212,121,0.4); }
.toast em { font-style: normal; font-size: 1.05rem; }

@keyframes toast-in { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(26px); } }

.award-popup {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  z-index: 80;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 24px;
  border-radius: 16px;
  border: 1px solid rgba(255,212,121,0.45);
  background: linear-gradient(180deg, rgba(38,31,16,0.97), rgba(12,16,23,0.97));
  box-shadow: var(--shadow-lg);
  animation: award-in 0.5s var(--ease);
}
.award-popup[hidden] { display: none; }
.award-popup-icon { font-size: 1.8rem; }
.award-popup strong { display: block; color: var(--gold); font-size: 0.98rem; }
.award-popup span { color: var(--muted); font-size: 0.8rem; }

@keyframes award-in {
  0% { opacity: 0; transform: translate(-50%, -28px) scale(0.9); }
  60% { transform: translate(-50%, 6px) scale(1.02); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.modal { position: fixed; inset: 0; z-index: 92; display: grid; place-items: center; background: rgba(4,7,11,0.8); backdrop-filter: blur(6px); animation: view-in 0.2s var(--ease); }
.modal[hidden] { display: none; }
.modal-card {
  width: min(420px, 90vw);
  padding: 28px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18,26,37,0.98), rgba(9,13,20,0.98));
  box-shadow: var(--shadow-lg);
}
.modal-card h3 { margin: 0 0 10px; font-size: 1.4rem; }
.modal-card p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.55; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

.footer {
  display: flex; justify-content: space-between; gap: 14px;
  margin-top: 34px; padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.76rem;
  flex-wrap: wrap;
}

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .versus-layout { grid-template-columns: 1fr; }
  .lobby { position: static; }
  .settings-grid { grid-template-columns: 1fr; }
}

/* below this the sidebar slides in over the page instead of pushing it */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 40;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: none; }
  .sidebar.is-narrow { width: var(--side-w); }
  .sidebar.is-narrow .side-word,
  .sidebar.is-narrow .side-label,
  .sidebar.is-narrow .side-count,
  .sidebar.is-narrow .side-acc-text,
  .sidebar.is-narrow .side-heading { display: revert; }
  .sidebar.is-narrow .side-item,
  .sidebar.is-narrow .side-account { justify-content: flex-start; padding-left: 10px; padding-right: 10px; }
  .side-resize { display: none; }
  .side-open { display: grid; }
  .views { padding: 20px 14px 32px; }
  .topbar { padding: 10px 14px; }
  .hud-card { min-width: 78px; padding: 6px 10px; }
}

@media (max-width: 720px) {
  .rival-pip, .rival-pip[data-size="s"], .rival-pip[data-size="m"],
  .rival-pip[data-size="l"] { width: 46vw; max-width: 260px; left: 8px; bottom: 8px; }
  .cabinet-stats { gap: 12px; }
  .cab-stat:nth-child(2) { display: none; }
  .cabinet-bar { padding: 10px 12px; gap: 10px; }
  .cabinet-id p { display: none; }
  .game-grid { grid-template-columns: 1fr; }
  .featured-row { grid-auto-columns: minmax(80vw, 1fr); }
  .cabinet-foot { padding: 9px 12px; }
  .cabinet-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- locked machines ---------- */

.game-card.is-locked .card-shot img { filter: grayscale(0.85) brightness(0.5); }
.game-card.is-locked .card-play { opacity: 1; }
.game-card.is-locked .card-play span {
  background: rgba(6, 9, 16, 0.78);
  border-color: var(--line-strong);
  color: var(--warning);
}
.game-card.is-locked:hover { border-color: rgba(240, 185, 94, 0.45); }

.card-lock {
  position: absolute;
  left: 10px; bottom: 10px;
  z-index: 3;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(240, 185, 94, 0.16);
  border: 1px solid rgba(240, 185, 94, 0.4);
  color: var(--warning);
  font-family: var(--font-ui); font-weight: 700;
  font-size: 0.64rem; letter-spacing: 0.08em; text-transform: uppercase;
}

/* ---------- letter marks in place of emoji ---------- */

.side-ico svg, .ico { display: block; flex: none; }
.side-ico { display: grid; place-items: center; }

.avatar-pick,
.online-avatar,
.acct-badge,
.buy-icon,
.award-icon,
.pip-avatar,
.invite-avatar,
.mode-icon {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.avatar-pick { font-size: 0.78rem; color: var(--muted); }
.avatar-pick.is-active { color: var(--text); }

.online-avatar {
  font-size: 0.66rem;
  color: var(--muted);
  background: var(--surface-3);
  border: 1px solid var(--line);
}

.acct-badge { font-size: 0.9rem; }
.buy-icon, .award-icon { font-size: 0.82rem; color: var(--accent); }
.award-card.is-unlocked .award-icon { color: var(--gold); }
.award-icon svg { stroke: var(--dim); }

.mode-icon { font-size: 0.72rem; color: var(--muted); }
.pip-avatar, .invite-avatar { font-size: 0.72rem; color: var(--muted); }
.pip-avatar:empty, .invite-avatar:empty { display: none; }

.card-play span svg { stroke: var(--warning); }

/* ---------- lobby connection state ---------- */

.link-line {
  display: flex; align-items: center; gap: 7px;
  margin: 0 0 12px;
  font-size: 0.74rem; color: var(--dim); line-height: 1.45;
}
.link-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--dim);
}
.link-line.is-live .link-dot { background: var(--success); box-shadow: 0 0 7px var(--success); }
.link-line.is-live { color: var(--muted); }
.link-line.is-down .link-dot { background: var(--warning); }

/* ---------- settings warning note ---------- */

.opt-warn {
  margin: 6px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(240, 185, 94, 0.07);
  border: 1px solid rgba(240, 185, 94, 0.22);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}
.opt-warn strong { color: var(--warning); font-weight: 600; }

/* ---------- the result card ---------- */

.overlay-card.is-win, .overlay-card.is-loss, .overlay-card.is-draw {
  animation: result-in 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes result-in {
  0%   { opacity: 0; transform: scale(0.9) translateY(14px); }
  100% { opacity: 1; transform: none; }
}

.overlay-card.is-win h3   { color: var(--success); }
.overlay-card.is-loss h3  { color: var(--danger); }
.overlay-card.is-win  { border-color: rgba(82, 214, 164, 0.45); }
.overlay-card.is-loss { border-color: rgba(242, 112, 110, 0.45); }

.overlay-card h3 {
  font-size: clamp(2.1rem, 5vw, 3.1rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

/* ---------- readability + motion pass ---------- */

.card-body h3 { font-size: 1.24rem; font-weight: 800; letter-spacing: -0.02em; }
.card-body p { font-size: 0.92rem; line-height: 1.55; }
.card-tag { font-size: 0.76rem; font-weight: 600; }
.featured-row .game-card.is-big .card-body h3 { font-size: 1.55rem; }

.game-card { transition: transform 0.24s var(--ease), border-color 0.24s var(--ease), box-shadow 0.24s var(--ease); }
.game-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.game-card:active { transform: translateY(-1px); }
.game-card .card-shot img { transition: transform 0.45s var(--ease); }
.game-card:hover .card-shot img { transform: scale(1.045); }

.buy-head h3 { font-size: 1.1rem; }
.buy-card p { font-size: 0.9rem; }
.buy-button { font-size: 0.95rem; font-weight: 700; padding: 11px 16px; }
.buy-card { transition: transform 0.2s var(--ease), border-color 0.2s var(--ease); }
.buy-card.affordable:hover { transform: translateY(-3px); }

.award-card h4 { font-size: 1rem; }
.award-card p { font-size: 0.85rem; }
.stat-card strong { font-size: 1.5rem; }
.stat-card span { font-size: 0.74rem; }

.primary-button, .ghost-button {
  font-size: 0.95rem;
  font-weight: 700;
  padding: 11px 20px;
  transition: transform 0.16s var(--ease), background 0.16s var(--ease),
              border-color 0.16s var(--ease), color 0.16s var(--ease);
}
.primary-button:active, .ghost-button:active { transform: scale(0.97); }

.mini-button { font-size: 0.82rem; font-weight: 600; padding: 6px 12px; }
.online-name { font-size: 0.95rem; font-weight: 600; }
.online-state { font-size: 0.78rem; }
.lobby-block h3 { font-size: 1.15rem; }

.mode-row { transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), background 0.18s var(--ease); }
.mode-text strong { font-size: 1.02rem; font-weight: 700; }
.mode-text span { font-size: 0.85rem; }

.switch { font-size: 0.95rem; padding: 10px 0; }
.switch input { width: 18px; height: 18px; }
.panel h3 { font-size: 1.15rem; }
.panel-note { font-size: 0.88rem; }
.field > span { font-size: 0.76rem; font-weight: 700; }
.field input, .field select { font-size: 1rem; padding: 12px 14px; }

.gate-card { width: min(460px, 100%); padding: 32px; }
.gate-brand h1 { font-size: 1.7rem; }
.gate-brand p { font-size: 0.9rem; }
.gate-tab { font-size: 0.92rem; font-weight: 700; padding: 11px 6px; }

.cabinet-id h2 { font-size: 1.4rem; }
.cabinet-id p { font-size: 0.88rem; }
.cab-stat strong { font-size: 1.3rem; font-family: var(--font-mono); }
.cab-stat span { font-size: 0.7rem; font-weight: 700; }
.cabinet-hint { font-size: 0.9rem; }
.control-legend .key { font-size: 0.82rem; }

.toast { font-size: 0.95rem; }
.overlay-metrics strong { font-size: 1.4rem; }
.overlay-card > p { font-size: 1rem; }

/* views slide in a touch further so a page change reads as a change */
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.view.is-active { animation: view-in 0.32s var(--ease); }

/* cards stagger in behind each other on first paint */
@keyframes card-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.game-grid .game-card, .featured-row .game-card { animation: card-in 0.4s var(--ease) backwards; }
.game-grid .game-card:nth-child(1) { animation-delay: 0.02s; }
.game-grid .game-card:nth-child(2) { animation-delay: 0.05s; }
.game-grid .game-card:nth-child(3) { animation-delay: 0.08s; }
.game-grid .game-card:nth-child(4) { animation-delay: 0.11s; }
.game-grid .game-card:nth-child(5) { animation-delay: 0.14s; }
.game-grid .game-card:nth-child(6) { animation-delay: 0.17s; }

/* ---------- touch controls ---------- */

.touch-layer {
  position: absolute; inset: 0;
  z-index: 7;
  pointer-events: none;
  touch-action: none;
}
.touch-layer[hidden] { display: none !important; }

.tstick {
  position: absolute;
  width: 116px; height: 116px;
  margin: -58px 0 0 -58px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: rgba(10, 14, 23, 0.3);
  opacity: 0;
  transition: opacity 0.14s var(--ease);
  pointer-events: none;
}
.tstick.is-live { opacity: 1; }
.touch-layer.no-stick .tstick { display: none; }

.tstick-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 14px rgba(0, 0, 0, 0.45);
}

.tbtns {
  position: absolute;
  right: 14px; bottom: 14px;
  display: flex; flex-wrap: wrap-reverse; justify-content: flex-end;
  gap: 10px;
  max-width: 58%;
  pointer-events: auto;
}

.tbtn {
  min-width: 72px; height: 72px;
  padding: 0 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  background: rgba(10, 14, 23, 0.55);
  color: #fff;
  font-family: var(--font-ui);
  font-weight: 800; font-size: 0.82rem; letter-spacing: 0.04em;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  transition: transform 0.09s var(--ease), background 0.09s var(--ease);
}
.tbtn.is-wide { border-radius: 36px; min-width: 112px; }
.tbtn.is-down { transform: scale(0.92); background: var(--accent); border-color: var(--accent); }

.touch-hint {
  position: absolute;
  left: 50%; bottom: 12px;
  transform: translateX(-50%);
  padding: 7px 15px;
  border-radius: 999px;
  background: rgba(10, 14, 23, 0.75);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.82rem; font-weight: 600;
  white-space: nowrap;
  transition: opacity 0.5s var(--ease);
}
.touch-hint.is-gone { opacity: 0; }

/* on a phone the rival bar must not sit under the thumbstick */
@media (pointer: coarse) {
  .rival-pip, .rival-pip[data-size="s"], .rival-pip[data-size="m"],
  .rival-pip[data-size="l"] { left: auto; right: 8px; top: 8px; bottom: auto; }
}

/* ---------- device picker ---------- */

.device-row { display: grid; gap: 12px; }

.device-pick {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 2px 14px;
  align-items: center;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--bg-deep);
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s var(--ease), transform 0.16s var(--ease), background 0.16s var(--ease);
}
.device-pick:hover { border-color: var(--accent); background: var(--surface-2); transform: translateY(-2px); }
.device-pick svg { grid-row: 1 / 3; color: var(--accent); }
.device-pick strong { font-family: var(--font-display); font-size: 1.1rem; }
.device-pick span { color: var(--muted); font-size: 0.85rem; line-height: 1.45; }

/* ---------- segmented control ---------- */

.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px; padding: 4px;
  border-radius: 12px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  margin-bottom: 10px;
}
.seg-btn {
  border: 0; background: transparent; color: var(--muted);
  padding: 9px 6px; border-radius: 9px; cursor: pointer;
  font-size: 0.88rem; font-weight: 700;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.seg-btn:hover { color: var(--text); }
.seg-btn.is-active { background: var(--surface-3); color: var(--text); }

/* ---------- the cabinet on a phone ----------
   A 16:9 board in a portrait window is a thin strip with the screen
   wasted above and below it, so we shrink the furniture, hide the
   keyboard legend the pad replaces, and say plainly that turning the
   phone sideways is worth it. */

@media (max-width: 620px) {
  .cabinet-bar {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 8px 10px;
  }
  .cabinet-bar .ghost-button {
    padding: 8px 10px;
    font-size: 0.8rem;
    white-space: nowrap;
    flex: none;
  }
  .cabinet-id { flex: 1 1 auto; min-width: 0; }
  .cabinet-id h2 { font-size: 0.98rem; }
  .cabinet-id p { display: none; }
  .cabinet-stats { gap: 12px; flex: none; }
  .cab-stat span { font-size: 0.56rem; letter-spacing: 0.06em; }
  .cab-stat strong { font-size: 0.95rem; }
  .cab-stat:nth-child(2) { display: none; }
  .cabinet-stage { padding: 4px; }
}

/* the on-screen pad replaces the key legend entirely */
@media (pointer: coarse) {
  .cabinet-foot .control-legend { display: none; }
  .cabinet-foot { padding: 7px 12px; justify-content: center; }
  .cabinet-hint { display: block; font-size: 0.8rem; text-align: center; }
}

/* ---------- turn your phone ---------- */

.rotate-nudge {
  position: absolute;
  left: 50%; top: 14px;
  transform: translateX(-50%);
  z-index: 8;
  display: none;
  align-items: center; gap: 9px;
  padding: 9px 15px;
  border-radius: 999px;
  background: rgba(10, 14, 23, 0.9);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 0.82rem; font-weight: 600;
  white-space: nowrap;
}
.rotate-nudge button {
  border: 0; background: transparent; color: var(--dim);
  font-size: 1.05rem; line-height: 1; cursor: pointer; padding: 0 2px;
}
.rotate-nudge svg { color: var(--accent); }

/* only on a touch device held upright, and only while a game is open */
@media (pointer: coarse) and (orientation: portrait) {
  .cabinet:not([hidden]) .rotate-nudge:not(.is-dismissed) { display: flex; }
}

/* the nudge has to fit a 360px phone, and the hint must clear the buttons */
.rotate-nudge {
  max-width: calc(100% - 20px);
  white-space: normal;
  text-align: left;
  font-size: 0.78rem;
  line-height: 1.35;
  padding: 8px 12px;
}
.touch-hint { bottom: 98px; max-width: calc(100% - 24px); white-space: normal; text-align: center; }
.touch-layer.no-stick .touch-hint { bottom: 96px; }

/* The hint belongs at the top: the bottom of the stage is where the stick
   and the buttons live, and on a short landscape window it landed on the
   board itself. */
.touch-hint, .touch-layer.no-stick .touch-hint {
  top: 10px; bottom: auto;
}
/* short landscape windows: smaller buttons so they clear the board */
@media (max-height: 470px) {
  .tbtn { min-width: 58px; height: 58px; font-size: 0.72rem; }
  .tbtn.is-wide { min-width: 92px; border-radius: 29px; }
  .tbtns { gap: 8px; right: 10px; bottom: 10px; }
}
