/* The site's one look: a plain page. Serif font, ink on paper, thin lines, normal case,
   no shadows, blur, gradients or glow. --font is the one typeface (a system serif); --mono is only for
   key caps. Games and canvases read the same colours through js/theme.js.

   THE PALETTE (the only colours anything should use):
     --c1   colour 1, ink: text, lines, filled buttons. Black in light mode, near-white in dark.
     --c2   colour 2, paper: the page and every panel. White in light mode, near-black in dark.
     --p1 … --p7   seven colours for the games, wherever a game needs colour:
                   1 red · 2 orange · 3 yellow · 4 green · 5 cyan · 6 blue · 7 purple
                   (Blockfall's seven pieces: Z, L, O, S, I, J, T). Slightly lighter in dark mode.
   Each has an -rgb twin for translucent uses: rgba(var(--c1-rgb), .1).
   Dark mode is <html data-mode="dark">: set before first paint from the saved choice or the system
   setting, and switched by the header's Dark / Light link (js/theme.js).

   Everything below the palette is derived from it. The older names (--bg, --text, --accent…) are kept
   because games.css and the games are written against them. */
:root {
  --c1: #111111; --c1-rgb: 17, 17, 17;
  --c2: #ffffff; --c2-rgb: 255, 255, 255;
  --p1: #d9342b; --p1-rgb: 217, 52, 43;
  --p2: #e8790c; --p2-rgb: 232, 121, 12;
  --p3: #e5b400; --p3-rgb: 229, 180, 0;
  --p4: #2b9348; --p4-rgb: 43, 147, 72;
  --p5: #0f9bb0; --p5-rgb: 15, 155, 176;
  --p6: #2f5fd0; --p6-rgb: 47, 95, 208;
  --p7: #8241c8; --p7-rgb: 130, 65, 200;
  --muted: #6e6e6e;
  --mode: light;
  color-scheme: light;
}
:root[data-mode="dark"] {
  --c1: #ececec; --c1-rgb: 236, 236, 236;
  --c2: #121212; --c2-rgb: 18, 18, 18;
  --p1: #ef5b52; --p1-rgb: 239, 91, 82;
  --p2: #f5933a; --p2-rgb: 245, 147, 58;
  --p3: #f2cb3a; --p3-rgb: 242, 203, 58;
  --p4: #4cbb68; --p4-rgb: 76, 187, 104;
  --p5: #35b9cc; --p5-rgb: 53, 185, 204;
  --p6: #6b90f2; --p6-rgb: 107, 144, 242;
  --p7: #a777e6; --p7-rgb: 167, 119, 230;
  --muted: #8e8e8e;
  --mode: dark;
  color-scheme: dark;
}
:root {
  /* derived: page and text */
  --bg: var(--c2); --bg-rgb: var(--c2-rgb); --bg-elev: var(--c2);
  --fg-rgb: var(--c1-rgb); --shadow-rgb: 0, 0, 0;
  --text: var(--c1); --strong: var(--c1);
  --text-soft: rgba(var(--c1-rgb), .8);
  --on-accent: #ffffff;
  --line: rgba(var(--c1-rgb), .13);
  --line-strong: rgba(var(--c1-rgb), .28);
  --tint: rgba(var(--c1-rgb), .055);

  /* derived: colour roles */
  --accent: var(--p6);   --accent-rgb: var(--p6-rgb);
  --accent-2: var(--p1); --accent-2-rgb: var(--p1-rgb);
  --accent-3: var(--p4); --accent-3-rgb: var(--p4-rgb);
  --accent-4: var(--p7); --accent-4-rgb: var(--p7-rgb);
  --gold: var(--p2); --bad-soft: var(--p1);
  --danger: var(--p1); --success: var(--p4);
  --cross: var(--c1); --cross-hit: var(--p1); /* Flick's crosshair */

  /* older tokens, kept flat for games.css */
  --glass-rgb: var(--c2-rgb); --panel: var(--c2); --panel-solid: var(--c2);
  --surface: var(--c2); --surface-2: rgba(var(--c1-rgb), .05); --surface-hover: rgba(var(--c1-rgb), .08);
  --rk: .3; --bk: 0; --sk: 0; --vig: 0;

  --font: ui-serif, Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --heading: var(--font);
  --display: var(--font);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --header-h: 48px;
  --radius: 3px;
}

/* a game's colour, by data-hue="1".."4" (js/theme.js hueOf) */
[data-hue="1"] { --h: var(--accent);   --h-rgb: var(--accent-rgb);   --h2: var(--accent-2); }
[data-hue="2"] { --h: var(--accent-2); --h-rgb: var(--accent-2-rgb); --h2: var(--accent-3); }
[data-hue="3"] { --h: var(--accent-3); --h-rgb: var(--accent-3-rgb); --h2: var(--accent-4); }
[data-hue="4"] { --h: var(--accent-4); --h-rgb: var(--accent-4-rgb); --h2: var(--accent); }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  min-height: 100%;
  background: var(--bg); color: var(--text);
  font: 16px/1.45 var(--font);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  overflow-x: hidden;
}
/* no page scroll inside a game */
body[data-game="blockfall"], body[data-game="pulse"], body[data-game="race"], body[data-game="aim"],
body[data-game="trace"], body[data-game="type"], body[data-game="snap"], body[data-game="tap"], body[data-game="math"], body[data-game="glide"], body[data-game="weave"], body[data-game="stop"], body[data-game="track"], body[data-game="follow"], body[data-game="veer"], body[data-game="cadence"] {
  height: 100%; overflow: hidden;
}
button { font: inherit; color: inherit; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* =====================================================================
   HEADER
   ===================================================================== */
.shell-header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h); z-index: 60;
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
/* hidden while a round is being played */
body.pulse-playing .shell-header, body.race-playing .shell-header, body.aim-playing .shell-header,
body.trace-playing .shell-header, body.type-playing .shell-header, body.snap-playing .shell-header, body.tap-playing .shell-header, body.math-playing .shell-header, body.glide-playing .shell-header, body.weave-playing .shell-header, body.stop-playing .shell-header, body.track-playing .shell-header, body.follow-playing .shell-header, body.veer-playing .shell-header, body.cadence-playing .shell-header {
  visibility: hidden;
}
.brand-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  font-weight: 700; font-size: 15px; color: var(--strong); flex-shrink: 0;
}

.arcade-nav { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.arcade-nav::-webkit-scrollbar { display: none; }
body[data-game="hub"] .arcade-nav { visibility: hidden; }
.arcade-nav button {
  display: inline-flex; align-items: baseline; gap: 4px;
  background: none; border: 0; padding: 4px 8px; cursor: pointer; white-space: nowrap; flex-shrink: 0;
  color: var(--muted);
}
.arcade-nav button:hover { color: var(--text); }
.arcade-nav button[aria-selected="true"] { color: var(--strong); text-decoration: underline; text-underline-offset: 4px; }
.arcade-nav .a-tries { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.arcade-nav .a-tries.none { color: var(--danger); }
.arcade-nav .a-tries[hidden] { display: none; }

.shell-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; margin-left: auto; }
.mode-toggle { background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--muted); }
.mode-toggle:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.sound-toggle.is-muted { opacity: .65; text-decoration: line-through; }
.header-clock { color: var(--muted); font-size: 14px; white-space: nowrap; }
.header-link { background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--text); }
.header-link:hover { text-decoration: underline; text-underline-offset: 3px; }
body:not([data-game="hub"]) .header-link { display: none; }

/* account */
.arcade-account { position: relative; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.a-who {
  display: inline-flex; align-items: center; gap: 6px; max-width: 200px;
  background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--text);
}
.a-who:hover .a-who-name { text-decoration: underline; text-underline-offset: 3px; }
.a-avatar { display: none; }
.a-who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-total-chip { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.a-total-chip::before { content: "("; } .a-total-chip::after { content: ")"; }
.a-link { background: none; border: 0; padding: 0; cursor: pointer; color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.a-link:hover { color: var(--strong); }

.acct-menu {
  position: absolute; top: calc(100% + 8px); right: 0; width: 240px; z-index: 80;
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 12px;
  display: grid; gap: 10px;
}
.acct-menu[hidden] { display: none; }
.acct-head { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.acct-head b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.acct-head small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.acct-tries-mini { display: grid; gap: 5px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.acct-tries-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.acct-btn-row { display: grid; gap: 2px; }
.acct-action {
  width: 100%; text-align: left; display: flex; align-items: center; gap: 8px;
  padding: 5px 0; border: 0; background: none; cursor: pointer; font-size: 14px;
}
.acct-action:hover { text-decoration: underline; text-underline-offset: 3px; }
.acct-action.danger { color: var(--danger); }
.acct-action svg { display: none; }

/* bottom bar on phones, inside games */
.mobile-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  background: var(--bg); border-top: 1px solid var(--line);
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
  justify-content: space-around; gap: 2px;
}
body.pulse-playing .mobile-nav, body.race-playing .mobile-nav, body.aim-playing .mobile-nav,
body.trace-playing .mobile-nav, body.type-playing .mobile-nav, body.snap-playing .mobile-nav, body.tap-playing .mobile-nav, body.math-playing .mobile-nav, body.glide-playing .mobile-nav, body.weave-playing .mobile-nav, body.stop-playing .mobile-nav, body.track-playing .mobile-nav, body.follow-playing .mobile-nav, body.veer-playing .mobile-nav, body.cadence-playing .mobile-nav,
body[data-game="hub"] .mobile-nav { visibility: hidden; }
.mobile-nav button {
  flex: 1; background: none; border: 0; padding: 8px 2px; cursor: pointer;
  font-size: 13px; color: var(--muted);
}
.mobile-nav button[aria-selected="true"] { color: var(--strong); text-decoration: underline; text-underline-offset: 4px; }
.mobile-nav svg { display: none; }

/* =====================================================================
   SHARED: tries, buttons, keys
   ===================================================================== */
.try-pips { display: inline-flex; align-items: center; gap: 3px; }
.try-pip { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--line-strong); background: none; }
.try-pip.on { background: var(--text); border-color: var(--text); }
.try-pip.spend { background: var(--danger); border-color: var(--danger); }

.p-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 14px; color: var(--bg);
  background: var(--text); border: 1px solid var(--text); border-radius: var(--radius);
  padding: 6px 14px; cursor: pointer;
}
.p-btn:hover { opacity: .85; }
.p-btn.ghost { color: var(--text); background: var(--bg); border-color: var(--line-strong); }
.p-btn.ghost:hover { background: var(--tint); }
.p-btn:disabled { opacity: .5; cursor: default; }
.a-signin { padding: 4px 12px; font-size: 14px; }

/* =====================================================================
   FRONT PAGE
   ===================================================================== */
#view-hub {
  display: none;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1000px);
  gap: 48px; align-items: start;
  padding: calc(var(--header-h) + 40px) 20px 40px;
  max-width: 1440px;
}
body[data-game="hub"] #view-hub { display: grid; }

.stage-rail { display: grid; gap: 18px; }

.portal-row { border-top: 1px solid var(--line); }
.portal {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px;
  width: 100%; padding: 10px 6px; text-align: left; cursor: pointer;
  background: none; border: 0; border-bottom: 1px solid var(--line);
}
.portal-name { font-size: 16px; font-weight: 400; color: var(--strong); }
.portal.is-previewed { background: var(--tint); }
.portal:hover .portal-name { text-decoration: underline; text-underline-offset: 3px; }
.portal:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Tag icons beside each game, and the filter bar across the top of the lobby */
.portal[hidden] { display: none; }
/* name, then its tag icons right after it; the grade and try dots stay on the right */
.portal-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.portal-tags { display: inline-flex; gap: 1px; font-size: 12px; line-height: 1; opacity: .7; }
.tag-ico { width: 1.35em; text-align: center; }
/* your grade for the game: a bold letter, coloured by grade; a faint dash if not played yet */
.portal-grade { min-width: 1.4em; text-align: center; font-family: var(--display); font-size: 15px; font-weight: 700; line-height: 1; color: var(--line-strong); }
.portal-grade[data-grade="S"] { text-shadow: 0 0 10px currentColor; }
.portal-empty { padding: 14px 6px; color: var(--muted); font-size: 14px; border-bottom: 1px solid var(--line); }
.tag-bar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: -22px; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 9px; cursor: pointer;
  font: inherit; font-size: 13px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: 999px;
}
.tag-chip:hover { background: var(--tint); }
.tag-chip .tag-e { font-size: 15px; line-height: 1; }
.tag-chip small { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.tag-chip[aria-pressed="true"] { color: var(--bg); background: var(--text); border-color: var(--text); }
.tag-chip[aria-pressed="true"] small { color: inherit; opacity: .7; }
.tag-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tag-sep { width: 1px; height: 20px; background: var(--line-strong); margin: 0 4px; }
.tag-edit-btn { margin-left: auto; border-style: dashed; color: var(--muted); }
.tag-edit-btn:hover { color: var(--strong); border-color: var(--text); }
@media (max-width: 700px) {
  .tag-bar { flex-wrap: nowrap; overflow-x: auto; margin: 0 -20px -22px; padding: 0 20px 4px; scrollbar-width: none; }
  .tag-chip { flex: none; }
}

.stage-exhibit { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 24px; align-items: start; }
.hub-board { display: grid; gap: 10px; min-width: 0; }
.hub-board-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.hub-board-title b { font-size: 16px; font-weight: 600; color: var(--strong); }
.hub-board-title button { font-size: 13px; color: var(--muted); }
#hubBoards .a-board { max-width: none; }
#hubBoards .a-board:not(.is-active) { display: none; }
@media (max-width: 1100px) {
  .stage-exhibit { grid-template-columns: 1fr; }
}
.preview-shell {
  position: relative; width: 100%; aspect-ratio: 16 / 10; overflow: hidden; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line-strong);
}
.preview-shell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.preview-stage { position: absolute; inset: 0; }
.preview-vid {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; pointer-events: none;
}
.preview-vid.is-active { opacity: 1; }

/* =====================================================================
   SHELL VIEWS
   ===================================================================== */
.shell-view {
  display: none;
  max-width: 900px;
  padding: calc(var(--header-h) + 32px) 20px 64px;
}
body[data-game="palette"] #view-palette { display: block; }

/* =====================================================================
   PALETTE VIEW (#palette)
   ===================================================================== */
.pal-section { margin-top: 28px; display: grid; gap: 12px; }
.pal-head {
  display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px 14px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.pal-head h2 { font-size: 17px; font-weight: 600; color: var(--strong); }

.pal-base { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pal-game { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.pal-swatch {
  text-align: left; cursor: pointer; background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden;
  transition: border-color .12s ease;
}
.pal-swatch:hover { border-color: var(--text); }
.pal-swatch-base { display: flex; align-items: center; gap: 10px; padding: 10px; }
.pal-chip { width: 32px; height: 32px; border-radius: var(--radius); border: 1px solid var(--line-strong); flex-shrink: 0; display: block; }
.pal-swatch-p { display: flex; flex-direction: column; }
.pal-bar {
  height: 40px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px;
  color: #fff; font-family: var(--mono);
}
.pal-bar b { font-family: var(--display); font-size: 16px; font-weight: 700; }
.pal-bar small { font-size: 11px; opacity: .9; }
.pal-swatch-p .pal-meta { padding: 8px; }
.pal-meta { display: grid; gap: 2px; min-width: 0; }
.pal-meta b { font-size: 14px; font-weight: 600; color: var(--strong); }
.pal-meta b small { font-family: var(--mono); font-weight: 400; font-size: 12px; color: var(--muted); }
.pal-meta em { font-style: normal; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.pal-meta > small { font-size: 12px; color: var(--muted); }

.pal-roles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.pal-role {
  display: grid; gap: 2px; padding: 9px 11px; text-align: left; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.pal-role:hover { background: var(--tint); border-color: var(--text); }
.pal-role[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.pal-role[aria-pressed="true"] b, .pal-role[aria-pressed="true"] span { color: var(--bg); }
.pal-role b { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--strong); }
.pal-role em { font-style: normal; font-size: 12px; color: var(--text-soft); }
.pal-role span { font-size: 12px; color: var(--muted); line-height: 1.3; }
.pal-note { font-size: 13px; color: var(--muted); min-height: 1.3em; }

@media (max-width: 820px) {
  .pal-base { grid-template-columns: 1fr; }
  .pal-game { grid-template-columns: repeat(4, 1fr); }
  .pal-roles { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .pal-game { grid-template-columns: repeat(2, 1fr); }
}

.boards-hero {
  display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px;
  margin-bottom: 24px;
}
.boards-hero h1 { font-size: 22px; font-weight: 700; }
.boards-hero p { font-size: 14px; color: var(--muted); margin-top: 2px; }
.boards-actions { display: flex; gap: 8px; align-items: center; }

/* =====================================================================
   SIGN-IN / TRIES DIALOG, LEADERBOARDS, TOAST
   ===================================================================== */
.a-modal {
  position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(0, 0, 0, .3);
}
.a-modal[hidden] { display: none; }
.a-modal [hidden] { display: none !important; }
.a-card { width: min(420px, 100%); }
.a-title { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.a-card .p-row { justify-content: flex-start; margin-top: 6px; }
.a-modal-pips {
  display: flex; align-items: center; gap: 10px; margin: 10px 0 4px;
  font-size: 14px;
}
.a-form { display: grid; gap: 12px; margin-top: 6px; }
.a-form label { display: grid; gap: 4px; font-size: 14px; color: var(--text-soft); }
.a-form input {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 6px 8px;
  user-select: text; -webkit-user-select: text;
}
.a-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.a-form .p-msg { margin: 0; min-height: 0; }
.a-switch { font-size: 14px; color: var(--muted); }

/* Admin tag editor modal (js/tag-editor.js) */
.te-card {
  width: min(760px, 100%); max-height: min(86vh, 760px);
  display: flex; flex-direction: column; overflow: hidden; padding: 0;
}
.te-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 18px 22px 12px;
}
.te-head .a-title { margin-bottom: 2px; }
.te-sub { font-size: 13px; color: var(--muted); }
.te-close {
  background: none; border: 0; padding: 0 4px; cursor: pointer;
  font-size: 24px; line-height: 1; color: var(--muted);
}
.te-close:hover { color: var(--strong); }
.te-tabs {
  display: flex; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--line);
}
.te-tab {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 10px; margin-bottom: -1px;
  cursor: pointer; font-size: 14px; color: var(--muted);
}
.te-tab:hover { color: var(--text); }
.te-tab[aria-selected="true"] { color: var(--strong); font-weight: 600; border-bottom-color: var(--text); }
.te-body { flex: 1; overflow: auto; padding: 14px 22px; }
.te-games { display: grid; }
.te-game {
  display: grid; grid-template-columns: 112px 1fr; gap: 8px 14px; align-items: start;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.te-game:last-child { border-bottom: 0; }
.te-game-name { font-size: 15px; font-weight: 600; color: var(--strong); padding-top: 3px; }
.te-chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.te-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px 3px 7px; cursor: pointer;
  font-size: 12.5px; color: var(--muted); background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: 999px;
}
.te-chip:hover { color: var(--text); background: var(--tint); }
.te-chip[aria-pressed="true"] { color: var(--bg); background: var(--text); border-color: var(--text); }
.te-chip-e { font-size: 13px; line-height: 1; }
.te-sep { width: 1px; height: 18px; background: var(--line-strong); margin: 0 3px; }
.te-empty { font-size: 13px; color: var(--muted); }
.te-manage { display: grid; gap: 14px; }
.te-tag-list { display: grid; gap: 8px; }
.te-tag-row, .te-add-row {
  display: grid; grid-template-columns: 52px 1fr 104px auto auto auto; gap: 6px; align-items: center;
}
.te-add-row { grid-template-columns: 52px 1fr 104px auto; padding-top: 12px; border-top: 1px solid var(--line); }
.te-in {
  font: inherit; font-size: 14px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 5px 8px;
  user-select: text; -webkit-user-select: text; min-width: 0;
}
.te-in:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.te-in-emoji { text-align: center; padding: 5px 4px; }
.te-icon-btn {
  width: 30px; height: 30px; display: grid; place-items: center; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius);
  font-size: 14px; color: var(--text);
}
.te-icon-btn:hover:not(:disabled) { background: var(--tint); }
.te-icon-btn:disabled { opacity: .35; cursor: default; }
.te-icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.te-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 22px 16px; border-top: 1px solid var(--line);
}
.te-foot .p-msg { margin: 0; min-height: 0; font-size: 13px; }
.te-actions { display: flex; gap: 8px; margin-left: auto; }
@media (max-width: 600px) {
  .te-game { grid-template-columns: 1fr; }
  .te-tag-row { grid-template-columns: 46px 1fr 88px auto auto auto; }
  .te-add-row { grid-template-columns: 46px 1fr 88px auto; }
}

.a-board { }
.a-board[hidden] { display: none; }
.a-board-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.a-board-head b { font-size: 14px; font-weight: 600; }
.a-board-head span { font-size: 13px; color: var(--muted); }
.a-board-status { font-size: 14px; color: var(--text-soft); margin: 0 0 8px; max-width: none !important; line-height: 1.45 !important; }
.a-board-status.ok { color: var(--success); }
.a-board-status.err { color: var(--danger); }
.a-board-empty { font-size: 14px; color: var(--muted); margin: 0; padding: 16px 0; }
.a-board-list { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--line); }
.a-board-list li {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 8px; align-items: baseline;
  font-size: 14px; padding: 6px 4px; border-bottom: 1px solid var(--line);
}
.a-board-list.has-mods li:not(.gap) { grid-template-columns: 36px 1fr auto auto; }
.a-mod {
  justify-self: end; font-size: 11px; font-weight: 600; line-height: 1; white-space: nowrap;
  padding: 3px 6px; border-radius: 999px; color: var(--mc); background: rgba(var(--mc-rgb), .12);
  --mc: var(--muted); --mc-rgb: var(--c1-rgb);
}
.a-mod[data-mod="none"] { background: none; padding-inline: 0; font-weight: 400; }
.a-mod[data-mod="easy"]   { --mc: var(--p4); --mc-rgb: var(--p4-rgb); }
.a-mod[data-mod="medium"] { --mc: var(--p2); --mc-rgb: var(--p2-rgb); }
.a-mod[data-mod="hard"]   { --mc: var(--p1); --mc-rgb: var(--p1-rgb); }
.a-board-list li.me { background: var(--tint); font-weight: 600; }
.a-board-list li.gap { display: block; text-align: center; color: var(--muted); padding: 2px; line-height: 1; }
.a-board-list .a-r { color: var(--muted); font-variant-numeric: tabular-nums; }
.a-board-list .a-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-board-list b { font-weight: 600; font-variant-numeric: tabular-nums; }
.a-board.compact { max-width: 268px; }
.a-board.compact .a-board-list li { font-size: 13px; padding: 3px 4px; }

.a-toast {
  position: fixed; top: calc(var(--header-h) + 10px); left: 50%; transform: translateX(-50%);
  z-index: 100; opacity: 0; pointer-events: none;
  font-size: 14px; color: var(--bg); background: var(--text);
  padding: 6px 12px; border-radius: var(--radius);
}
.a-toast.show { animation: aToast 3.4s linear; }
@keyframes aToast { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }

/* the menu card every game shows before and after a round */
.p-screen {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  padding: calc(var(--header-h) + 16px) 16px 20px;
}
.p-screen.show { display: flex; }
.p-card {
  position: relative; width: min(600px, 100%); max-height: calc(100vh - var(--header-h) - 36px); overflow: auto;
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 20px 22px;
}
.p-title { font-size: 24px; font-weight: 700; }
.p-sub { color: var(--text-soft); font-size: 15px; margin: 6px 0 16px; line-height: 1.5; }

.game-loader {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--muted); pointer-events: none;
}
.game-loader[hidden] { display: none; }

.p-msg { font-size: 14px; margin-top: 6px; color: var(--success); min-height: 1.2em; }
.p-msg.err { color: var(--danger); }
.p-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* =====================================================================
   SMALL SCREENS
   ===================================================================== */
@media (max-width: 860px) {
  #view-hub { grid-template-columns: 1fr; gap: 24px; padding-top: calc(var(--header-h) + 20px); }
  .stage-exhibit { order: -1; }
}
@media (max-width: 780px) {
  .shell-header { padding: 0 14px; }
  .arcade-nav { display: none; }
  .mobile-nav { display: flex; }
  .shell-view { padding: calc(var(--header-h) + 20px) 14px 90px; }
  .p-screen { padding: calc(var(--header-h) + 10px) 12px 70px; }
  .p-card { max-height: calc(100vh - var(--header-h) - 80px); padding: 16px; }
  #game-blockfall { padding: calc(var(--header-h) + 8px) 8px 70px; }
}
@media (max-width: 560px) {
  .shell-right { gap: 12px; }
  /* just the countdown, without "Resets in" */
  .header-clock { font-size: 0; }
  .header-clock #stageClock { font-size: 13px; }
}
