/* Glass theme. theme.js sets data-theme to the player's choice, or to the system setting by default. */
:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --text: #14161a;
  --muted: #3a3f48;
  --dim: #5b6270;
  --label: rgb(20 22 26 / 60%);
  --base: #dce8f1;
  --scene: linear-gradient(180deg, #b7d3ee 0%, #dce8f1 44%, #e9e2d2 49%, #a9b096 58%, #6e7a5f 100%);
  --scene-2: linear-gradient(180deg, #9fc4e8 0%, #d6e4ee 40%, #e4dcc8 47%, #b3a98c 56%, #7c7358 100%);
  --blob-a: rgb(246 165 110 / 55%);
  --blob-b: rgb(125 180 255 / 60%);
  --glass: rgb(255 255 255 / 30%);
  --glass-strong: rgb(255 255 255 / 40%);
  /* Panels over Street View imagery keep text readable on any photo. */
  --glass-hud: rgb(255 255 255 / 62%);
  --glass-solid: rgb(246 248 250 / 84%);
  --glass-border: rgb(255 255 255 / 65%);
  --glass-hi: rgb(255 255 255 / 95%);
  --shadow: rgb(20 30 50 / 16%);
  --fill: rgb(255 255 255 / 55%);
  --fill-soft: rgb(255 255 255 / 35%);
  --fill-hover: rgb(255 255 255 / 74%);
  --fill-active: rgb(255 255 255 / 88%);
  --active-shadow: 0 4px 14px rgb(20 30 50 / 10%);
  --chip: rgb(255 255 255 / 78%);
  --ring-track: rgb(20 22 26 / 12%);
  --ring-core: rgb(255 255 255 / 92%);
  --line: rgb(20 22 26 / 9%);
  --line-strong: rgb(20 22 26 / 17%);
  --field: rgb(255 255 255 / 62%);
  /* Native dropdown lists need a solid background; a see-through one shows as white. */
  --option-bg: #ffffff;
  --inv: #14161a;
  --inv-text: #fff;
  --accent: #ff7a3d;
  --accent-text: #b14a16;
  --pri: linear-gradient(180deg, #ff8a50, #f26a2c);
  --pri-hover: linear-gradient(180deg, #ff9763, #f5763a);
  --pri-text: #fff;
  --pri-shadow: 0 10px 24px rgb(242 106 44 / 35%);
  --map: #e6ebe4;
  --map-land: #d4dccf;
  --map-edge: #b9c4b4;
  --map-grid: rgb(20 22 26 / 5%);
  --map-label: #5b6270;
  --pos: #1e8a45;
  --neg: #c8372d;
  --host-bg: rgb(255 122 61 / 20%);
  --host-fg: #b14a16;
  --ready-bg: rgb(52 199 89 / 20%);
  --ready-fg: #1a7a3d;
  --idle-bg: rgb(20 22 26 / 7%);
  --idle-fg: #5b6270;
  --bar-neg: rgb(217 68 58 / 14%);
  --bar-top: rgb(255 122 61 / 32%);
  --bar-base: rgb(255 255 255 / 55%);
  --code-focus: rgb(242 106 44 / 80%);
  --warn-bg: rgb(255 214 140 / 78%);
  --warn-fg: #5f3f05;
  --gold-bg: rgb(255 200 80 / 36%);
  --gold-fg: #7a5200;
  --backdrop: rgb(20 26 36 / 34%);
  /* Older names, still used by the drawing, description and admin styles. */
  --surface: rgb(255 255 255 / 48%);
  --surface2: var(--fill);
  --border: var(--line);
  --strong: var(--line-strong);
  --soft: var(--accent-text);
  --ink: var(--pri-text);
  font-family: var(--font);
  font-synthesis: none;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --text: #f4f5f7;
  --muted: rgb(235 235 245 / 72%);
  --dim: rgb(235 235 245 / 54%);
  --label: rgb(255 255 255 / 52%);
  --base: #0c0b0a;
  /* A dim horizon spread over a wide band, so text in the middle of the page stays readable. */
  --scene: linear-gradient(180deg, #0b1226 0%, #161e44 30%, #2c2b4a 43%, #4f3632 52%, #2a201b 61%, #0e0c0b 100%);
  --scene-2: linear-gradient(180deg, #14203a 0%, #273250 34%, #4a3e46 47%, #3a2e26 56%, #16130f 100%);
  --blob-a: rgb(255 122 61 / 18%);
  --blob-b: rgb(46 107 255 / 22%);
  --glass: rgb(30 32 42 / 46%);
  --glass-strong: rgb(30 32 42 / 56%);
  --glass-hud: rgb(22 24 32 / 60%);
  --glass-solid: rgb(26 28 36 / 86%);
  --glass-border: rgb(255 255 255 / 14%);
  --glass-hi: rgb(255 255 255 / 22%);
  --shadow: rgb(0 0 0 / 45%);
  --fill: rgb(255 255 255 / 10%);
  --fill-soft: rgb(255 255 255 / 5%);
  --fill-hover: rgb(255 255 255 / 16%);
  --fill-active: rgb(255 255 255 / 16%);
  --active-shadow: inset 0 0 0 1px rgb(255 255 255 / 18%);
  --chip: rgb(30 32 42 / 72%);
  --ring-track: rgb(255 255 255 / 16%);
  --ring-core: rgb(20 22 28 / 85%);
  --line: rgb(255 255 255 / 9%);
  --line-strong: rgb(255 255 255 / 18%);
  --field: rgb(0 0 0 / 24%);
  --option-bg: #1e2029;
  --inv: #f4f5f7;
  --inv-text: #14161a;
  --accent-text: #ffb48c;
  --pri: #ff7a3d;
  --pri-hover: #ff8f5c;
  --pri-text: #1a0e07;
  --pri-shadow: 0 10px 30px rgb(255 122 61 / 30%);
  --map: #1a1d24;
  --map-land: #262b33;
  --map-edge: #3a434c;
  --map-grid: rgb(255 255 255 / 4%);
  --map-label: #a0adb5;
  --pos: #7ee29a;
  --neg: #ff8a80;
  --host-bg: rgb(255 122 61 / 22%);
  --host-fg: #ffb48c;
  --ready-bg: rgb(52 199 89 / 20%);
  --ready-fg: #7ee29a;
  --idle-bg: rgb(255 255 255 / 10%);
  --idle-fg: rgb(235 235 245 / 62%);
  --bar-neg: rgb(255 90 80 / 16%);
  --bar-top: rgb(255 122 61 / 35%);
  --bar-base: rgb(255 255 255 / 8%);
  --code-focus: rgb(255 150 99 / 75%);
  --warn-bg: rgb(64 48 22 / 88%);
  --warn-fg: #ffe0a6;
  --gold-bg: rgb(122 86 30 / 55%);
  --gold-fg: #ffdd8a;
  --backdrop: rgb(4 6 10 / 55%);
  --surface: rgb(30 32 42 / 55%);
}
* {
  box-sizing: border-box;
}
html {
  background: var(--base);
}
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
/* The horizon backdrop behind every page; the game screens cover it with Street View. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(26% 22% at 60% 56%, var(--blob-a), transparent 72%),
    radial-gradient(24% 26% at 88% 18%, var(--blob-b), transparent 72%),
    var(--scene);
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
a {
  color: inherit;
  text-decoration: none;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
::selection {
  background: var(--accent);
  color: #fff;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1,
h2,
h3 {
  font-weight: 700;
  letter-spacing: -0.025em;
}
h1 {
  font-size: clamp(36px, 4.5vw, 56px);
  line-height: 1.05;
}
h2 {
  font-size: 28px;
  line-height: 1.15;
}
h3 {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
p {
  line-height: 1.55;
}
/* Google's Street View compass needle is a <button> rotated via transform: a
   transform transition spins it the long way round whenever it crosses north. */
button:where(:not(.gm-style *)) {
  transition:
    background 0.15s,
    box-shadow 0.15s,
    color 0.15s,
    transform 0.15s;
}
button:active:not(:disabled):where(:not(.gm-style *)) {
  transform: translateY(1px);
}
svg {
  display: block;
}
button svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 13px;
}
.mono {
  font-family: var(--mono);
}
.eyebrow {
  display: block;
  margin-bottom: 14px;
  font: 500 11px var(--mono);
  letter-spacing: 0.14em;
  color: var(--label);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--idle-bg);
  color: var(--idle-fg);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.pill.accent {
  background: var(--host-bg);
  color: var(--host-fg);
}
.pill svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}
/* Shared glass surfaces. */
.panel,
.tile,
.hero-card,
.how-item,
.top-actions,
.waiting-card,
.standings-card,
.chains-card,
.error-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
  backdrop-filter: blur(34px) saturate(180%);
  box-shadow:
    inset 0 1px 0 var(--glass-hi),
    0 20px 60px var(--shadow);
}
.hud-pill,
.game-actions .btn,
.original-panel,
.map-panel,
.chain-tabs,
.stage-actions .btn,
.stage-actions .pill,
.playback,
.final-instruction {
  background: var(--glass-hud);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow:
    inset 0 1px 0 var(--glass-hi),
    0 10px 30px var(--shadow);
}
@media (prefers-reduced-transparency: reduce) {
  :root,
  :root[data-theme] {
    --glass: var(--glass-solid);
    --glass-strong: var(--glass-solid);
    --glass-hud: var(--glass-solid);
  }
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-mark {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
}
.topbar {
  height: 88px;
  max-width: min(100%, 1800px);
  margin: auto;
  padding: 0 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
.top-actions:empty {
  display: none;
}
.theme-toggle {
  width: 34px;
  height: 34px;
  margin-left: -10px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle:hover {
  background: var(--fill);
  color: var(--text);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
}
.text-button {
  background: none;
  border: none;
  color: var(--muted);
  padding: 10px 0;
  font-size: 14px;
}
.text-button:hover {
  color: var(--text);
}
.text-button.strong {
  color: var(--text);
  font-weight: 600;
}
.btn {
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--fill);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px var(--line);
}
.btn:hover:not(:disabled) {
  background: var(--fill-hover);
}
.btn.primary {
  background: var(--pri);
  color: var(--pri-text);
  font-weight: 650;
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 40%),
    var(--pri-shadow);
}
.btn.primary:hover:not(:disabled) {
  background: var(--pri-hover);
}
.btn.primary:disabled {
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 40%);
}
.btn.large {
  height: 54px;
  padding: 0 26px;
  font-size: 16px;
}
.btn.block {
  width: 100%;
}
.icon-button {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--text);
  background: var(--fill);
  box-shadow: inset 0 0 0 1px var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.icon-button:hover:not(:disabled) {
  background: var(--fill-hover);
}
input,
select {
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--field);
  color: var(--text);
  padding: 0 14px;
  min-width: 0;
  width: 100%;
}
option,
optgroup {
  background-color: var(--option-bg);
  color: var(--text);
}
input::placeholder,
textarea::placeholder {
  color: var(--dim);
}
label {
  font-size: 13px;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}
form {
  margin: 0;
}
.field {
  margin-bottom: 16px;
}
.form-row {
  display: flex;
  gap: 8px;
}
.form-row input {
  flex: 1;
}
.error-text {
  color: var(--neg);
  font-size: 13px;
  margin: 12px 0 0;
}
.avatar {
  position: relative;
  overflow: hidden;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--avatar, #8e7cf0);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 35%);
}
.avatar-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--avatar, #8e7cf0);
}
.avatar.small-avatar {
  width: 30px;
  height: 30px;
  font-size: 13px;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 500;
}
.boot {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
}
.boot .brand-mark {
  width: 48px;
  height: 48px;
}
.boot p {
  color: var(--muted);
}

/* Landing: title on the left, sign-in or room card on the right. */
/* The hero takes whatever height the steps and footer leave, so the landing fits one screen. */
.landing {
  max-width: 1800px;
  min-height: calc(100dvh - 88px);
  margin: auto;
  padding: 0 64px 24px;
  display: flex;
  flex-direction: column;
}
.hero {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  align-items: end;
  gap: 48px;
  padding-bottom: 32px;
}
.hero-kicker {
  font-size: 17px;
  color: var(--muted);
  margin-bottom: 14px;
}
.hero-title {
  font-size: clamp(64px, min(10vw, 15vh), 148px);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 0.9;
  margin: 0 0 24px;
}
.hero-text {
  max-width: 440px;
  font-size: 16px;
  color: var(--muted);
  margin: 0;
}
.hero-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 36px;
  box-shadow:
    inset 0 1px 0 var(--glass-hi),
    0 30px 80px var(--shadow);
}
.hero-card-head {
  padding: 18px 18px 10px;
}
.hero-card-head h2 {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0;
}
.hero-card-head p {
  font-size: 14px;
  color: var(--muted);
  margin: 6px 0 0;
  line-height: 1.45;
}
.hero-card > .btn.primary {
  height: 54px;
  border-radius: 26px;
  font-size: 16px;
}
.hero-card > .small {
  margin: 0;
  padding: 0 18px;
}
.hero-card > .small a {
  color: var(--accent-text);
  font-weight: 600;
}
.hero-links {
  display: flex;
  gap: 6px;
}
.hero-links .btn {
  flex: 1;
  border-radius: 22px;
}
.hero-links .btn svg {
  width: 16px;
  height: 16px;
}
.auth-panel {
  padding: 14px 14px 12px;
  border-radius: 26px;
  background: var(--fill-soft);
}
.auth-panel h3 {
  font-size: 14px;
  margin: 0 4px 2px;
}
.auth-panel p {
  font-size: 12px;
  color: var(--muted);
  margin: 0 4px 10px;
}
.auth-panel label {
  margin: 0 4px 6px;
}
.auth-panel .btn {
  border-radius: 14px;
}
/* Room code: one real input under six display boxes. */
.code-form {
  display: grid;
  gap: 4px;
}
.code-row {
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 26px;
  background: var(--fill-soft);
}
.code-boxes {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}
.code-boxes input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  opacity: 0;
  cursor: text;
}
/* The highlighted box shows focus and where the next character goes. */
.code-boxes input:focus-visible {
  outline: none;
}
.code-box {
  height: 42px;
  border-radius: 14px;
  background: var(--fill);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 18px var(--mono);
  text-transform: uppercase;
}
.code-box.current {
  border-color: var(--code-focus);
  box-shadow: 0 0 0 1px var(--code-focus);
}
.code-row .icon-button {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 14px;
  background: var(--inv);
  color: var(--inv-text);
  box-shadow: none;
}
.code-hint {
  margin: 0;
  padding: 4px 0 8px;
  text-align: center;
  font-size: 13px;
  color: var(--dim);
}
.how-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.how-item {
  display: flex;
  gap: 16px;
  padding: 22px;
  border-radius: 28px;
}
.step-number {
  font: 600 12px var(--mono);
  color: var(--accent-text);
  width: 24px;
  flex-shrink: 0;
  padding-top: 3px;
}
.how-item strong {
  font-weight: 650;
  font-size: 15px;
}
.how-item p {
  font-size: 14px;
  color: var(--muted);
  margin: 6px 0 0;
  line-height: 1.5;
}
.page-footer {
  display: flex;
  justify-content: space-between;
  color: var(--label);
  font: 500 11px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 24px;
  padding: 0 4px;
  gap: 20px;
}

/* Rooms: lobby and queue as one grid of glass tiles. */
.room-page {
  max-width: 1320px;
  margin: auto;
  padding: 0 40px 24px;
}
.bento {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas:
    "code code players players"
    "settings settings players players"
    "start start players players";
  gap: 18px;
}
.tile {
  position: relative;
  min-width: 0;
  /* Shorter screens get shorter tiles, so the lobby fits without scrolling. */
  min-height: clamp(132px, 16vh, 168px);
  padding: 22px;
  border-radius: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
.tile-label {
  font-size: 14px;
  color: var(--muted);
}
/* Host settings: the native control covers its row, so the whole row opens it. */
.tile-control {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  opacity: 0;
  cursor: pointer;
  appearance: none;
}
.tile-control:disabled {
  cursor: default;
}
.setting-row:has(.tile-control:not(:disabled)):hover {
  background: var(--fill-soft);
}
.setting-row:has(.tile-control:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.code-tile {
  grid-area: code;
  min-height: clamp(150px, 20vh, 200px);
  padding: 24px 26px;
}
.tile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
}
.tile-head .text-button {
  padding: 4px 0;
}
.room-code-value {
  font: 700 clamp(40px, 5vw, 64px) / 1 var(--mono);
  letter-spacing: 0.1em;
  overflow-wrap: anywhere;
}
/* With the settings in one panel, the lobby's room code and Start button are shorter
   so the page still fits on one screen. */
.lobby-page .code-tile {
  min-height: 0;
  padding: 20px 26px;
  gap: 8px;
}
.lobby-page .start-button {
  min-height: 0;
  padding: 18px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 16px;
  row-gap: 4px;
}
.lobby-page .start-button strong {
  grid-column: 2;
  grid-row: 1 / span 2;
}
/* Mode, map, rounds and timers share one panel, one row each, followed by the rules. */
.settings-tile {
  grid-area: settings;
  justify-content: flex-start;
  gap: 8px;
  padding: 22px 18px;
}
.settings-list {
  display: grid;
  gap: 2px;
}
.setting-row {
  position: relative;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 18px;
}
.setting-label {
  font-size: 14px;
  color: var(--muted);
}
.setting-value strong {
  display: block;
  font-size: 18px;
  font-weight: 650;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.setting-value small {
  display: block;
  font-size: 13px;
  color: var(--dim);
  margin-top: 2px;
}
.setting-edit {
  font-size: 12px;
  font-weight: 600;
  color: var(--dim);
}
.settings-rules {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding: 12px 12px 0;
  border-top: 1px solid var(--glass-border);
  font-size: 13px;
  color: var(--muted);
}
.settings-rules p {
  margin: 0;
  line-height: 1.5;
}
.settings-rules strong {
  color: var(--text);
  font-weight: 650;
}
.start-tile {
  grid-area: start;
  display: flex;
  min-width: 0;
}
.start-button {
  flex: 1;
  min-height: clamp(132px, 16vh, 168px);
  padding: 22px;
  border: 0;
  border-radius: 32px;
  background: var(--pri);
  color: var(--pri-text);
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 40%),
    var(--pri-shadow);
}
.start-button:hover:not(:disabled) {
  background: var(--pri-hover);
}
.start-button:disabled {
  opacity: 0.55;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 40%);
}
.start-button > span:first-child {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.8;
}
.start-button small {
  font-size: 13px;
  line-height: 1.4;
  opacity: 0.85;
}
.start-button strong {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.start-button strong svg {
  width: 26px;
  height: 26px;
}
.start-wait {
  flex: 1;
}
.start-wait strong {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.players-tile {
  grid-area: players;
  justify-content: flex-start;
  gap: 8px;
  padding: 22px 18px;
}
.tile-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 0 8px 6px;
}
.tile-title h2 {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0;
}
.tile-title span {
  font-size: 14px;
  color: var(--muted);
}
.roster {
  display: grid;
  gap: 4px;
}
.player-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border-radius: 22px;
}
.player-row.me {
  background: var(--fill);
}
.player-row .avatar {
  width: 48px;
  height: 48px;
  font-size: 19px;
}
.waiting-card .player-row .avatar,
.queue-page .player-row .avatar {
  width: 38px;
  height: 38px;
  font-size: 15px;
}
.player-info {
  flex: 1;
  min-width: 0;
}
.player-info strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.player-info strong .muted {
  font-weight: 500;
}
.player-info small {
  font-size: 13px;
  color: var(--dim);
  display: block;
  margin-top: 2px;
}
.player-status {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--idle-bg);
  color: var(--idle-fg);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.player-status.ready {
  background: var(--ready-bg);
  color: var(--ready-fg);
}
.player-status.queued {
  background: var(--host-bg);
  color: var(--host-fg);
}
.empty-seat {
  display: flex;
  gap: 14px;
  align-items: center;
  color: var(--dim);
  font-size: 14px;
  padding: 10px;
}
.empty-seat span {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1.5px dashed var(--line-strong);
  border-radius: 50%;
  font-size: 18px;
}
.roster-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.players-tile > .roster-actions {
  padding: 0 8px 6px;
}
.roster-actions .btn {
  flex: 1;
}
.roster-footer {
  margin-top: auto;
  padding: 14px 8px 0;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.roster-footer .roster-actions {
  flex: 1 1 220px;
}
.readiness-summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.readiness-summary strong {
  font-size: 15px;
  font-weight: 650;
}
.readiness-summary .is-ready {
  color: var(--ready-fg);
}
.add-bots {
  align-self: flex-start;
  padding: 6px 8px;
}
.kick-button {
  color: var(--neg);
  font-size: 13px;
  font-weight: 600;
}
.ban-button {
  opacity: 0.75;
}
.queue-page .bento {
  grid-template-areas:
    "code code current current"
    "intro intro current current"
    "waiting waiting current current";
}
.queue-intro {
  grid-area: intro;
  justify-content: flex-start;
}
.queue-intro h1 {
  font-size: 32px;
  margin: 0 0 8px;
}
.queue-intro p {
  color: var(--muted);
  margin: 0;
}
.queue-waiting {
  grid-area: waiting;
  justify-content: flex-start;
}
.queue-current {
  grid-area: current;
  justify-content: flex-start;
}
.notice {
  padding: 14px 16px;
  border-radius: 20px;
  background: var(--fill-soft);
  margin-top: 16px;
}
.notice strong {
  font-size: 14px;
  font-weight: 650;
  color: var(--accent-text);
}
.notice p {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0 0;
  line-height: 1.55;
}
.score-example {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--fill-soft);
  font: 600 15px var(--mono);
  color: var(--text);
}
.score-example small {
  display: block;
  font: 500 10px var(--font);
  color: var(--dim);
  margin-top: 4px;
}
.score-example b {
  font-weight: 700;
  color: var(--pos);
}
.panel {
  border-radius: 28px;
  overflow: hidden;
}
.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-header h3 {
  margin: 0;
  font-size: 16px;
}
.room-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 28px;
}
.room-heading h1 {
  font-size: 40px;
  margin-bottom: 8px;
}
.room-heading p {
  color: var(--muted);
  font-size: 15px;
  margin: 0;
}
.breadcrumb {
  display: flex;
  gap: 10px;
  align-items: center;
  font: 500 11px var(--mono);
  letter-spacing: 0.12em;
  color: var(--label);
  margin-bottom: 24px;
}
.breadcrumb .text-button {
  font: 500 14px var(--font);
  letter-spacing: 0;
}
.error-page {
  min-height: calc(100dvh - 88px);
  display: grid;
  place-items: center;
  padding: 32px 16px 88px;
}
.error-card {
  width: min(100%, 580px);
  padding: clamp(28px, 6vw, 48px);
  border-radius: 36px;
}
.error-card h1 {
  font-size: clamp(34px, 5vw, 48px);
  margin-bottom: 14px;
}
.error-card p {
  color: var(--muted);
  margin-bottom: 28px;
}
.admin-page > .text-button {
  display: inline-block;
  margin: 28px 0 16px;
}
.admin-page > .panel {
  padding: 24px;
  margin-bottom: 18px;
}
.admin-page > .panel > h3 {
  margin-bottom: 10px;
}
.admin-page > .panel p {
  color: var(--muted);
}

/* Map picker: a modal list of maps with stats, stars and uploads. */
.help-dialog.map-dialog {
  width: 820px;
  max-height: calc(100dvh - 48px);
  padding: 30px 32px;
}
.map-dialog[open] {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.map-dialog-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-right: 40px;
}
.map-dialog-head h2 {
  font-size: 28px;
  margin: 0;
}
.map-dialog-head .eyebrow {
  margin-bottom: 8px;
}
.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.map-toolbar input {
  flex: 1 1 220px;
  width: auto;
}
.map-toolbar select {
  width: 150px;
}
.map-filters {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--fill-soft);
  box-shadow: inset 0 0 0 1px var(--line);
}
.map-filter {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
}
.map-filter[aria-pressed="true"] {
  background: var(--fill-active);
  box-shadow: var(--active-shadow);
  color: var(--text);
  font-weight: 650;
}
.map-dialog-status:empty {
  display: none;
}
.map-dialog-status {
  margin: 0;
}
.map-list {
  display: grid;
  gap: 8px;
  overflow-y: auto;
  min-height: 120px;
  padding-right: 4px;
}
.map-card {
  border-radius: 22px;
  background: var(--fill-soft);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 16px 18px;
  display: grid;
  gap: 12px;
}
.map-card.selected {
  background: var(--fill-active);
  box-shadow:
    inset 0 0 0 1.5px var(--code-focus),
    var(--active-shadow);
}
.map-card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.map-card h3 {
  font-size: 16px;
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}
.map-card-head p {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  overflow-wrap: anywhere;
}
.map-card .star-button {
  float: none;
  flex-shrink: 0;
  align-self: flex-start;
  width: auto;
  height: 32px;
  margin: 0;
  padding: 0 12px;
  border-radius: 999px;
  font: 600 13px var(--mono);
  white-space: nowrap;
}
.map-card .star-button.starred {
  background: var(--gold-bg);
  color: var(--gold-fg);
  box-shadow: none;
}
.map-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  margin: 0;
}
.map-stats dt {
  font: 500 10px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--label);
}
.map-stats dd {
  margin: 3px 0 0;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.map-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.map-card-actions .btn {
  height: 38px;
  font-size: 13px;
}
.map-card label > input,
.map-form label > input {
  display: block;
  margin-top: 6px;
}
.map-upload-panel {
  border-radius: 22px;
  padding: 16px 18px;
  background: var(--fill-soft);
  box-shadow: inset 0 0 0 1px var(--line);
}
.map-form {
  display: grid;
  gap: 4px;
}
.map-form input[type="file"] {
  height: auto;
  padding: 10px;
}
.map-upload-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.map-form .btn {
  justify-self: start;
}
@media (max-width: 740px) {
  .help-dialog.map-dialog {
    padding: 22px 16px;
  }
  .map-dialog-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .map-toolbar select,
  .map-filters {
    flex: 1 1 100%;
    width: 100%;
  }
  .map-filter {
    flex: 1;
    height: 36px;
  }
  .map-upload-fields {
    grid-template-columns: 1fr;
  }
}

/* Rounds: Street View fills the screen and glass controls float above it. */
.game-shell {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--scene-2);
}
/* A quiet edge-only warning: no tint over the centre or blocked map controls. */
.drawing-game::after,
.game-shell::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  box-shadow:
    inset 0 0 40px 8px rgb(239 55 68 / 48%),
    inset 0 0 100px 20px rgb(239 55 68 / 16%);
  opacity: 0;
  transition: opacity 220ms ease;
}
.drawing-game.time-running-out::after,
.game-shell.time-running-out::after {
  opacity: 0.6;
  animation: time-warning-pulse 2.6s ease-in-out infinite;
}
@keyframes time-warning-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.85; }
}
.pano-main {
  position: absolute;
  inset: 0;
}
.demo-scene {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
.demo-scene:active {
  cursor: grabbing;
}
/* Spans to the original panel so the heading strip centres in the free gap. */
.game-hud {
  position: absolute;
  left: 22px;
  right: 364px;
  top: 22px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  z-index: 4;
  pointer-events: none;
}
.game-hud > :not(.heading-strip) {
  pointer-events: auto;
}
.hud-pill {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  max-width: min(520px, 100%);
  padding: 7px 22px 7px 7px;
  border-radius: 30px;
}
.timer-ring {
  --progress: 1;
  --ring: var(--accent);
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: conic-gradient(var(--ring) calc(var(--progress) * 100%), var(--ring-track) 0);
  display: grid;
  place-items: center;
}
.timer-ring:has(.urgent) {
  --ring: var(--neg);
}
.timer {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.timer-ring .timer {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ring-core);
  display: grid;
  place-items: center;
  font-size: 11px;
  letter-spacing: -0.02em;
}
.timer-ring .timer.paused {
  font-size: 7px;
  letter-spacing: 0;
}
.timer.urgent {
  color: var(--neg);
}
.hud-text {
  min-width: 0;
}
.hud-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.hud-round {
  font-size: 15px;
  font-weight: 650;
  white-space: nowrap;
}
.hud-round span {
  color: var(--dim);
  font-weight: 500;
}
.hud-link {
  font: 500 10px var(--mono);
  letter-spacing: 0.14em;
  color: var(--label);
  white-space: nowrap;
}
.selection-instruction {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}
.final-instruction {
  position: absolute;
  left: 22px;
  top: 92px;
  width: min(380px, calc(100vw - 44px));
  padding: 18px 20px;
  border-radius: 26px;
  z-index: 4;
}
.final-instruction .eyebrow {
  margin-bottom: 8px;
  color: var(--accent-text);
}
.final-instruction h2 {
  font-size: 22px;
  margin-bottom: 6px;
}
.final-instruction p {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0;
}
/* Heading strip: the track slides by --heading; --ppd is pixels per degree. */
.heading-strip {
  --heading: 0;
  --ppd: 2.4px;
  position: relative;
  flex: 0 1 240px;
  min-width: 150px;
  height: 32px;
  margin: 12px auto 0;
  border-radius: 16px;
  background: rgb(20 24 34 / 46%);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 16%);
  overflow: hidden;
  pointer-events: none;
  z-index: 4;
}
.heading-strip::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--accent);
}
.heading-track {
  position: absolute;
  inset: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.heading-reel {
  position: absolute;
  inset: 0 auto 0 50%;
  transform: translateX(calc(var(--heading) * var(--ppd) * -1));
}
.heading-reel > * {
  position: absolute;
  left: calc(var(--at) * var(--ppd));
}
.heading-reel i {
  top: 10px;
  width: 1px;
  height: 12px;
  margin-left: -0.5px;
  background: rgb(255 255 255 / 52%);
}
.heading-label {
  top: 0;
  line-height: 32px;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgb(0 0 0 / 40%);
}
.heading-label.north {
  font-size: 16px;
  font-weight: 800;
}
/* No room beside the HUD: sit under the original panel, clear of the instructions. */
@media (max-width: 820px) {
  .heading-strip {
    position: fixed;
    top: 254px;
    right: 22px;
    width: 240px;
    margin: 0;
  }
}
@media (max-width: 740px) {
  .heading-strip {
    top: 196px;
    right: 12px;
    width: 154px;
    min-width: 0;
  }
}
.original-panel {
  position: absolute;
  right: 22px;
  top: 22px;
  width: 320px;
  height: 236px;
  padding: 8px;
  border-radius: 30px;
  display: flex;
  flex-direction: column;
  z-index: 5;
  /* Avoid repeated Street View canvas resizes during expansion/collapse. */
  transition: none;
}
.original-panel.expanded {
  z-index: 50;
}
/* Use the same near-full-window reference size in both game modes. */
.game-shell .original-panel.expanded,
.drawing-game .drawing-reference.expanded {
  position: fixed;
  inset: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  z-index: 50;
  box-shadow: 0 0 0 100vmax var(--backdrop);
}
.original-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 22px;
  overflow: hidden;
  background: var(--scene-2);
}
.original-view {
  position: absolute;
  inset: 0;
}
.original-foot {
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 1;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgb(10 12 16 / 46%);
  font: 500 10px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  pointer-events: none;
}
.original-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 4px 2px 10px;
}
.original-bar > span {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
}
/* Keyboard shortcut shown beside an expand button. Hidden where there is no keyboard. */
.key-hint {
  flex: none;
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  font: 600 10px var(--mono);
  color: var(--dim);
  pointer-events: none;
}
@media (max-width: 740px), (hover: none) and (pointer: coarse) {
  .key-hint {
    display: none;
  }
}
.original-bar button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.original-bar button:hover {
  background: var(--fill);
  color: var(--text);
}
.original-bar button svg {
  width: 14px;
  height: 14px;
}
.game-bottom-note {
  position: absolute;
  left: 26px;
  bottom: 80px;
  font: 500 10px var(--mono);
  letter-spacing: 0.12em;
  color: rgb(255 255 255 / 76%);
  text-shadow: 0 1px 3px rgb(0 0 0 / 60%);
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
}
.panorama-compass-clearance {
  width: 1px;
  height: 40px;
  pointer-events: none;
}
/* Return to selected, help, end and leave. Live rounds keep clear of Google's logo and compass. */
.game-actions {
  position: absolute;
  left: 22px;
  bottom: 22px;
  z-index: 6;
  display: flex;
  gap: 8px;
}
.game-shell.live .game-actions {
  left: 96px;
}
.game-actions .btn {
  height: 44px;
  padding: 0 18px;
  font-weight: 500;
}
.game-actions .btn:hover:not(:disabled) {
  background: var(--glass-solid);
}
.game-actions .btn svg {
  width: 17px;
  height: 17px;
}
.game-actions .btn:not(.end-game) svg {
  display: none;
}
.map-panel {
  position: absolute;
  right: 22px;
  bottom: 22px;
  width: 360px;
  height: 270px;
  padding: 8px;
  border-radius: 32px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow:
    inset 0 1px 0 var(--glass-hi),
    0 20px 50px var(--shadow);
  transition:
    width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
    height 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.map-panel.expanded {
  width: min(660px, calc(100vw - 44px));
  height: min(460px, calc(100dvh - 110px));
}
.map-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 24px;
  overflow: hidden;
  background: var(--map);
}
.guess-map {
  position: absolute;
  inset: 0;
  background: var(--map);
}
.map-header {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 2;
  pointer-events: none;
}
.map-header > * {
  pointer-events: auto;
}
.map-header > span {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--chip);
  font: 500 10px var(--mono);
  letter-spacing: 0.12em;
  color: var(--muted);
}
.map-size-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 34px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--chip);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgb(0 0 0 / 12%);
}
.map-size-controls .icon-button {
  width: 28px;
  height: 28px;
  background: transparent;
  box-shadow: none;
  font-size: 20px;
  font-weight: 500;
}
.map-size-controls .icon-button:hover:not(:disabled) {
  background: var(--fill);
}
.map-size-controls #map-size-label {
  font: 600 11px var(--mono);
  white-space: nowrap;
  padding: 0 2px;
}
.map-footer {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.map-footer .btn {
  height: 48px;
  font-size: 15px;
}
.map-footer .btn.primary {
  flex: 1;
  padding: 0 16px;
}
/* Return to selected: a round pin button, labelled while the map is enlarged. It appears only
   when there is a selection to return to. */
.map-footer .selection-return {
  flex: none;
  width: 48px;
  padding: 0;
  font-size: 14px;
}
.map-footer .selection-return:disabled {
  display: none;
}
.map-footer .selection-return > span {
  display: none;
}
.map-panel.expanded .map-footer .selection-return {
  width: auto;
  padding: 0 18px 0 16px;
}
.map-panel.expanded .map-footer .selection-return > span {
  display: inline;
}
.map-info {
  font-size: 12px;
  color: var(--muted);
  display: none;
  flex: 1;
  min-width: 0;
  padding-left: 10px;
}
.map-panel.expanded .map-info {
  display: block;
}
.map-panel.expanded .map-footer .btn.primary {
  flex: 0 0 auto;
  min-width: 200px;
}
.candidate-empty {
  color: #fff;
  text-shadow: 0 1px 4px rgb(0 0 0 / 50%);
}
.scene-loading {
  z-index: 25;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: var(--scene-2);
  color: var(--muted);
  gap: 16px;
  padding: 40px;
  text-align: center;
}
.scene-loading .brand-mark {
  width: 48px;
  height: 48px;
}
.scene-loading h2 {
  color: var(--text);
}
.scene-loading[hidden] {
  display: none;
}
.demo-map {
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  background: var(--map);
}
.demo-map .land {
  fill: var(--map-land);
  stroke: var(--map-edge);
  stroke-width: 0.6;
}
.demo-map .grid {
  stroke: var(--map-grid);
  stroke-width: 0.4;
}
.demo-map .road {
  stroke: #3b82f6;
  stroke-width: 1.3;
  fill: none;
  pointer-events: stroke;
  cursor: crosshair;
}
.demo-map .road-hit {
  stroke: transparent;
  stroke-width: 12;
  fill: none;
  pointer-events: stroke;
  cursor: crosshair;
}
.demo-map .city-label {
  fill: var(--map-label);
  font: 7px var(--mono);
  pointer-events: none;
}
.demo-map .pin {
  fill: var(--accent);
  stroke: #fff;
  stroke-width: 2;
  pointer-events: none;
}
.demo-map-note {
  position: absolute;
  right: 8px;
  bottom: 8px;
  font: 9px var(--mono);
  color: var(--muted);
  background: var(--chip);
  padding: 3px 6px;
  border-radius: 999px;
  pointer-events: none;
  z-index: 2;
}
.waiting-layer {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  z-index: 20;
  padding: 20px;
}
.waiting-layer[hidden] {
  display: none;
}
.waiting-card {
  width: 420px;
  max-width: 100%;
  max-height: calc(100dvh - 40px);
  overflow: auto;
  border-radius: 36px;
  background: var(--glass-strong);
}
.waiting-heading {
  text-align: center;
  padding: 30px 28px 22px;
}
.check-icon {
  width: 52px;
  height: 52px;
  background: var(--pri);
  color: var(--pri-text);
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  box-shadow: var(--pri-shadow);
}
.check-icon svg {
  width: 24px;
  height: 24px;
}
.waiting-heading .eyebrow {
  margin-bottom: 8px;
}
.waiting-heading h2 {
  font-size: 24px;
  margin-bottom: 6px;
}
.waiting-heading p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}
.waiting-progress {
  padding: 0 16px 16px;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.progress-track {
  height: 6px;
  border-radius: 9px;
  background: var(--ring-track);
  margin: 10px 10px 12px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 9px;
  transition: width 0.3s;
}
.waiting-card .player-row {
  padding: 8px 10px;
  border-radius: 18px;
}

/* Results: Street View stage with a side panel, then the standings. */
.reveal-page {
  padding: 0 24px 40px;
}
.reveal-stage {
  position: relative;
  height: max(600px, calc(100dvh - 112px));
  border-radius: 28px;
  overflow: hidden;
  background: var(--scene-2);
  isolation: isolate;
  box-shadow: 0 20px 60px var(--shadow);
}
.reveal-panorama-panel {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.reveal-panorama {
  position: absolute;
  inset: 0;
}
.reveal-panorama-panel.loading .reveal-panorama {
  opacity: 0;
  pointer-events: none;
}
.reveal-panorama-status {
  position: absolute;
  inset: 0 424px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}
.reveal-panorama-status[hidden] {
  display: none;
}
.stage-top {
  position: absolute;
  top: 22px;
  left: 22px;
  right: 424px;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  pointer-events: none;
}
.stage-top > * {
  pointer-events: auto;
}
.chain-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 5px;
  border-radius: 999px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chain-tabs-label {
  padding: 0 10px 0 12px;
  font-size: 14px;
  color: var(--muted);
}
.chain-tab {
  flex: none;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chain-tab:hover {
  background: var(--fill);
}
.chain-tab.active {
  background: var(--fill-active);
  box-shadow: var(--active-shadow);
  font-weight: 700;
}
.stage-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.stage-actions .btn {
  height: 46px;
}
.stage-actions .btn.primary {
  background: var(--pri);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 40%),
    var(--pri-shadow);
  border: 0;
}
.stage-actions .pill {
  height: 46px;
  padding: 0 18px;
  color: var(--muted);
  font-size: 13px;
}
.reveal-side {
  position: absolute;
  top: 22px;
  right: 22px;
  bottom: 22px;
  z-index: 3;
  width: 380px;
  padding: 20px;
  border-radius: 34px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  backdrop-filter: blur(30px) saturate(190%);
  box-shadow:
    inset 0 1.5px 0 var(--glass-hi),
    0 20px 60px var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}
.reveal-card {
  flex: none;
  padding: 0 4px;
  overflow-wrap: anywhere;
}
.reveal-card .eyebrow {
  margin-bottom: 6px;
}
.reveal-country {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 8px;
}
.reveal-player {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}
.perfect-badge {
  flex: none;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--gold-bg);
  color: var(--gold-fg);
  font: 700 11px var(--mono);
  white-space: nowrap;
}
.reveal-card p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}
.reveal-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 12px 0 0;
}
.metric {
  border-radius: 16px;
  padding: 10px 12px;
  background: var(--fill-soft);
}
.metric small {
  display: block;
  font: 500 10px var(--mono);
  letter-spacing: 0.08em;
  color: var(--label);
  margin-bottom: 4px;
}
.metric strong {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.metric.perfect strong {
  color: var(--gold-fg);
}
.delta-line {
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--fill-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.delta-line span {
  font-size: 13px;
  color: var(--muted);
}
.delta-line strong {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--pos);
}
.delta-line strong.negative {
  color: var(--neg);
}
.reveal-card .notice {
  margin: 12px 0 0;
}
.reveal-steps {
  flex: 0 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.reveal-steps:empty {
  display: none;
}
.reveal-step {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.reveal-step:hover {
  background: var(--fill-soft);
}
.reveal-step[aria-current="step"] {
  background: var(--fill-active);
  box-shadow: var(--active-shadow);
}
.reveal-step .avatar,
.step-start {
  width: 34px;
  height: 34px;
  font-size: 13px;
}
.step-start {
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #3a3f4a;
  color: #fff;
}
.reveal-step-main {
  flex: 1;
  min-width: 0;
}
.reveal-step-main strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reveal-step-main small {
  display: block;
  font-size: 12px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reveal-step-score {
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--pos);
}
.reveal-step-score.negative {
  color: var(--neg);
}
.reveal-map {
  position: relative;
  flex: 1 1 160px;
  min-height: 140px;
  border-radius: 22px;
  overflow: hidden;
  background: var(--map);
}
.reveal-map .demo-map {
  margin: 0;
  width: 100%;
  height: 100%;
}
.playback {
  position: absolute;
  bottom: 22px;
  left: calc((100% - 424px) / 2);
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 468px);
  padding: 6px;
  border-radius: 30px;
}
.playback-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.playback-controls .icon-button {
  background: var(--fill);
  box-shadow: none;
}
.playback-controls .icon-button svg {
  width: 18px;
  height: 18px;
}
.playback-controls .btn {
  min-width: 112px;
  background: var(--inv);
  color: var(--inv-text);
  box-shadow: none;
}
.playback-controls .btn:hover:not(:disabled) {
  background: var(--inv);
  opacity: 0.88;
}
.playback-controls .btn.primary {
  background: var(--pri);
  color: var(--pri-text);
}
.playback .mono {
  padding: 0 10px;
  font: 500 13px var(--font);
  color: var(--muted);
  white-space: nowrap;
}
.reveal-mirror {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 6px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.reveal-mirror:empty {
  display: none;
}
.reveal-mirror .btn {
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
}
.explore-return {
  position: absolute;
  left: 22px;
  bottom: 22px;
  z-index: 4;
  height: 44px;
  padding: 0 16px;
  background: var(--glass-hud);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}
.explore-return svg {
  width: 16px;
  height: 16px;
}
.standings {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 20px;
  min-height: calc(100dvh - 40px);
  padding: 48px 0 8px;
}
.standings-card,
.chains-card {
  width: min(640px, 100%);
  border-radius: 40px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  backdrop-filter: blur(40px) saturate(180%);
  box-shadow:
    inset 0 1px 0 var(--glass-hi),
    0 30px 80px var(--shadow);
}
.standings-card {
  padding: 28px 24px 20px;
}
.chains-card {
  padding: 26px 28px 22px;
}
.standings-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 0 10px 18px;
}
.standings-head h2 {
  font-size: 30px;
  margin: 0;
}
.standings-head span {
  font-size: 14px;
  color: var(--dim);
}
.standings-rows {
  display: grid;
  gap: 6px;
}
.leaderboard-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 0 18px 0 10px;
  border-radius: 22px;
  background: var(--fill-soft);
  overflow: hidden;
}
.leaderboard-row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--bar, 4%);
  background: var(--bar-base);
}
.leaderboard-row.top::before {
  background: var(--bar-top);
}
.leaderboard-row.negative::before {
  background: var(--bar-neg);
}
.leaderboard-row > * {
  position: relative;
}
.leaderboard-avatar,
.player-avatar {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: 50%;
}
.leaderboard-avatar:focus-visible,
.player-avatar:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.leaderboard-avatar .avatar.spinning,
.player-avatar .avatar.spinning {
  animation: avatar-spin 0.65s ease-in-out;
}
@keyframes avatar-spin {
  to { transform: rotate(360deg); }
}
.rank {
  width: 22px;
  text-align: center;
  color: var(--dim);
  font-size: 15px;
  font-weight: 600;
}
.leaderboard-row .avatar {
  width: 38px;
  height: 38px;
  font-size: 15px;
}
.leaderboard-row .name {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.leaderboard-row strong {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.standings-card > p {
  margin: 14px 10px 0;
}
.standings-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}
.standings-actions > * {
  flex: 1;
  height: 52px;
  border-radius: 26px;
  font-size: 15px;
}
.standings-actions .pill {
  justify-content: center;
}
.chains-card h2,
.chains-card h3 {
  font-size: 22px;
  margin: 0 0 6px;
}
.chain-summary {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.chain-summary:last-of-type {
  border: 0;
}
.chain-summary strong {
  font-size: 14px;
  font-weight: 650;
}
.chain-summary p {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0 0;
  line-height: 1.55;
}
.final-results-note {
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 0;
}
.help-dialog {
  width: 520px;
  max-width: calc(100vw - 32px);
  padding: 34px;
  border: 1px solid var(--glass-border);
  border-radius: 34px;
  background: var(--glass-solid);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  backdrop-filter: blur(40px) saturate(180%);
  color: var(--text);
  box-shadow:
    inset 0 1px 0 var(--glass-hi),
    0 30px 80px var(--shadow);
}
.help-dialog::backdrop {
  background: var(--backdrop);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
}
.help-dialog h2 {
  font-size: 30px;
}
.help-steps {
  padding-left: 21px;
  line-height: 1.55;
  color: var(--muted);
  font-size: 14px;
}
.help-steps li {
  margin-bottom: 12px;
  padding-left: 6px;
}
.help-steps strong {
  color: var(--text);
  font-weight: 650;
}
.help-dialog > .small,
.help-dialog section > .small {
  margin: 14px 0 0;
}
#toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--glass-solid);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  padding: 13px 20px;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 500;
  z-index: 100;
  box-shadow:
    inset 0 1px 0 var(--glass-hi),
    0 12px 36px var(--shadow);
  max-width: calc(100vw - 32px);
  text-align: center;
}
#toast[hidden] {
  display: none;
}
.connection-pill {
  position: fixed;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  z-index: 80;
  background: var(--warn-bg);
  color: var(--warn-fg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px var(--shadow);
}
.screen-enter {
  animation: enter 0.22s ease-out;
}
@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
[hidden] {
  display: none !important;
}
.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.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;
}
.game-shell.live .game-bottom-note {
  display: none;
}
@media (max-width: 1100px) {
  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "code code"
      "players players"
      "settings settings"
      "start start";
  }
  .queue-page .bento {
    grid-template-areas:
      "code code"
      "intro intro"
      "waiting waiting"
      "current current";
  }
}
@media (max-width: 1000px) {
  .landing,
  .topbar {
    padding-left: 32px;
    padding-right: 32px;
  }
  .hero {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    align-content: end;
    min-height: auto;
    padding-top: 12vh;
    gap: 32px;
  }
  .hero-card {
    max-width: 480px;
  }
  .game-hud {
    right: 284px;
  }
  .original-panel {
    width: 250px;
    height: 196px;
  }
  .room-page {
    padding: 0 24px 28px;
  }
}
@media (max-width: 960px) {
  .reveal-page {
    padding: 0 12px 32px;
  }
  .reveal-stage {
    height: auto;
    border-radius: 0;
    overflow: visible;
    background: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .reveal-panorama-panel {
    position: relative;
    height: clamp(300px, 58dvh, 560px);
    border-radius: 24px;
    background: var(--scene-2);
  }
  .reveal-panorama-status {
    inset: 0;
  }
  .stage-top {
    top: 12px;
    left: 12px;
    right: 12px;
  }
  .reveal-side {
    position: relative;
    inset: auto;
    width: auto;
    border-radius: 28px;
    overflow: visible;
  }
  .reveal-steps {
    overflow: visible;
  }
  .reveal-map {
    flex: none;
    height: 280px;
  }
  .playback {
    top: calc(clamp(300px, 58dvh, 560px) - 70px);
    bottom: auto;
    left: 50%;
    max-width: calc(100% - 24px);
  }
  .favorites-stage .playback {
    top: calc(clamp(300px, 58dvh, 560px) - 70px);
  }
  .explore-return {
    left: 12px;
    bottom: auto;
    top: 64px;
  }
}
@media (max-width: 740px) {
  .topbar {
    height: 70px;
    padding: 0 16px;
  }
  .top-actions {
    gap: 12px;
    padding: 0 14px;
  }
  .top-actions .text-button {
    font-size: 13px;
    white-space: nowrap;
  }
  .top-actions .user-chip > span:last-child {
    display: none;
  }
  .topbar .brand {
    font-size: 15px;
  }
  .landing {
    min-height: calc(100dvh - 70px);
    padding: 0 16px 24px;
  }
  .hero {
    padding-top: 6vh;
    padding-bottom: 28px;
  }
  .hero-title {
    font-size: 76px;
  }
  .hero-kicker {
    font-size: 15px;
  }
  .hero-text {
    font-size: 15px;
  }
  .how-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .page-footer {
    font-size: 10px;
    margin-top: 28px;
  }
  .page-footer span:last-child {
    text-align: right;
  }
  .room-page {
    padding: 0 12px 24px;
  }
  .bento {
    gap: 10px;
    grid-template-areas:
      "code code"
      "players players"
      "settings settings"
      "start start";
  }
  .tile {
    min-height: 136px;
    padding: 18px;
    border-radius: 26px;
  }
  .settings-tile {
    padding: 16px 10px;
  }
  .setting-row {
    grid-template-columns: 88px minmax(0, 1fr) auto;
    gap: 10px;
  }
  .code-tile {
    min-height: 0;
    padding: 18px 20px;
  }
  .players-tile {
    padding: 16px 10px;
  }
  .player-row {
    gap: 10px;
    padding: 8px;
    flex-wrap: wrap;
  }
  .player-row .avatar {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
  .start-button {
    min-height: 136px;
    border-radius: 26px;
  }
  .start-button strong {
    font-size: 22px;
  }
  .kick-button {
    font-size: 12px;
  }
  .room-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 20px;
  }
  .room-heading h1 {
    font-size: 32px;
  }
  .game-hud {
    top: 12px;
    left: 12px;
    right: 12px;
  }
  .hud-pill {
    min-height: 44px;
    padding: 4px 14px 4px 4px;
    gap: 10px;
    border-radius: 24px;
  }
  .timer-ring {
    width: 36px;
    height: 36px;
  }
  .timer-ring .timer {
    width: 28px;
    height: 28px;
    font-size: 10px;
  }
  .hud-round {
    font-size: 13px;
  }
  .hud-link {
    display: none;
  }
  /* The instructions drop below the HUD, beside the original panel. */
  .selection-instruction {
    position: absolute;
    top: calc(100% + 8px);
    left: -1px;
    width: calc(100vw - 190px);
    padding: 10px 12px;
    border-radius: 16px;
    background: var(--glass-solid);
    border: 1px solid var(--glass-border);
    font-size: 11px;
  }
  .final-instruction {
    left: 12px;
    top: 64px;
    width: calc(100vw - 190px);
    padding: 12px;
    border-radius: 18px;
    background: var(--glass-solid);
  }
  .final-instruction .eyebrow {
    font-size: 9px;
    margin-bottom: 6px;
  }
  .final-instruction h2 {
    font-size: 17px;
    line-height: 1.15;
  }
  .final-instruction p {
    font-size: 11px;
  }
  .game-shell:has(.final-instruction) .selection-instruction {
    display: none;
  }
  .original-panel {
    top: 64px;
    right: 12px;
    width: 154px;
    height: 128px;
    padding: 5px;
    border-radius: 20px;
  }
  .original-frame {
    border-radius: 15px;
  }
  .original-bar {
    padding: 3px 0 0 6px;
  }
  .original-bar > span {
    font-size: 11px;
  }
  .original-bar button {
    height: 26px;
    padding: 0 6px;
    font-size: 0;
  }
  .original-foot {
    display: none;
  }
  .game-shell .original-panel.expanded .original-bar button {
    font-size: 13px;
  }
  /* Help, end and leave move into the top row; Return to selected moves into the map. */
  .game-actions {
    left: auto;
    right: 12px;
    top: 12px;
    bottom: auto;
    gap: 6px;
  }
  .game-shell.live .game-actions {
    left: auto;
  }
  .game-actions .btn {
    height: 44px;
    min-width: 44px;
    padding: 0 12px;
  }
  .game-actions .btn svg {
    display: block !important;
  }
  .game-actions .btn > span {
    display: none;
  }
  .game-hud {
    right: 116px;
  }
  .game-shell:has(.end-game) .game-hud {
    right: 166px;
  }
  .map-panel {
    right: 12px;
    bottom: 16px;
    width: calc(100vw - 24px);
    height: 230px;
    padding: 6px;
    border-radius: 26px;
    gap: 6px;
  }
  .map-frame {
    border-radius: 20px;
  }
  .map-panel.expanded {
    width: calc(100vw - 24px);
    height: 48dvh;
    bottom: 16px;
  }
  .map-footer .btn {
    height: 44px;
    font-size: 14px;
  }
  .game-bottom-note {
    display: none;
  }
  .waiting-card {
    width: 360px;
  }
  .waiting-heading {
    padding: 24px;
  }
  .help-dialog {
    padding: 26px 22px;
    border-radius: 28px;
  }
  .reveal-page {
    padding: 0 8px 24px;
  }
  .chain-tabs-label {
    display: none;
  }
  .stage-actions .btn,
  .stage-actions .pill {
    height: 40px;
    padding: 0 14px;
  }
  .reveal-side {
    padding: 16px;
  }
  .playback .mono {
    display: none;
  }
  .reveal-mirror {
    padding-left: 2px;
  }
  .reveal-mirror > span {
    display: none;
  }
  .standings {
    min-height: 0;
    padding-top: 32px;
  }
  .standings-card {
    padding: 22px 12px 14px;
    border-radius: 30px;
  }
  .chains-card {
    padding: 22px 18px 18px;
    border-radius: 30px;
  }
  .standings-head h2 {
    font-size: 24px;
  }
  .leaderboard-row {
    gap: 10px;
    padding: 0 14px 0 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Four map sizes, anchored at the bottom-right. Keep space for left controls. */
.map-panel[data-map-size="0"] {
  width: min(360px, calc(100vw - 24px));
  height: 270px;
}
.map-panel[data-map-size="1"] {
  width: min(600px, calc(100vw - 100px));
  height: min(460px, 54dvh);
}
.map-panel[data-map-size="2"] {
  width: min(1000px, calc(100vw - 100px));
  height: min(700px, 72dvh);
}
.map-panel[data-map-size="3"] {
  width: min(1200px, calc(100vw - 96px));
  height: min(800px, 84dvh);
}
.map-panel[data-map-size="3"] {
  z-index: 10;
}
@media (max-width: 740px) {
  .map-panel[data-map-size="0"] {
    height: 230px;
    width: calc(100vw - 24px);
  }
  .panorama-compass-clearance {
    height: 250px;
  }
  .map-panel[data-map-size="1"] {
    height: 42dvh;
    width: calc(100vw - 24px);
  }
  .map-panel[data-map-size="2"] {
    height: 62dvh;
    width: calc(100vw - 24px);
  }
  .map-panel[data-map-size="3"] {
    height: 78dvh;
    width: calc(100vw - 24px);
  }
  .map-header > span {
    font-size: 9px;
  }
  .map-panel .map-footer .btn {
    min-width: 0;
    font-size: 13px;
    padding: 0 12px;
  }
  .map-panel .map-footer .selection-return {
    width: 44px;
    padding: 0;
  }
  .map-panel.expanded .map-footer .selection-return {
    width: auto;
    padding: 0 14px 0 12px;
  }
  .map-panel.expanded .map-info {
    display: none;
  }
  .map-panel.expanded .map-footer .btn.primary {
    flex: 1;
    min-width: 0;
  }
}
.round-lab {
  position: absolute;
  top: 100px;
  left: 24px;
  width: min(360px, calc(100vw - 48px));
  z-index: 6;
  background: var(--glass-solid);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border-radius: 20px;
  font-size: 12px;
}
.round-lab summary { padding: 14px; cursor: pointer; font-weight: 650; }
.round-lab-body { padding: 0 14px 14px; max-height: calc(100dvh - 240px); overflow: auto; }
.round-lab p { margin: 8px 0 12px; line-height: 1.5; }
.round-lab label { display: grid; gap: 5px; min-width: 0; }
.round-lab select, .round-lab input { width: 100%; min-width: 0; }
.lab-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.round-lab .btn { font-size: 11px; padding: 8px 10px; height: auto; min-height: 34px; }
.lab-position { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 6px; }
.lab-position[hidden] { display: none; }
.lab-log { white-space: pre-wrap; overflow-wrap: anywhere; font: 10px/1.6 var(--mono); }
.lab-mode, .lab-status { color: var(--accent-text); }
@media (max-width: 700px) {
  .round-lab { top: 86px; left: 12px; width: min(300px, calc(100vw - 24px)); }
}

/* Past games and favorites. */
.history-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.history-link svg {
  width: 16px;
  height: 16px;
}
.history-page {
  max-width: 1120px;
  margin: auto;
  padding: 16px 40px 40px;
}
.history-page.favorites-page {
  max-width: min(100%, 1800px);
}
.history-heading {
  margin-bottom: 20px;
}
.history-heading h1 {
  font-size: 40px;
  margin-bottom: 8px;
}
.history-heading p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}
.history-tabs {
  display: inline-flex;
  margin-bottom: 18px;
}
.history-tabs .chain-tab {
  padding: 0 16px;
  font-size: 14px;
}
.history-list {
  padding: 6px;
}
.history-empty {
  margin: 0;
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
}
.history-empty strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 650;
}
.history-empty p {
  margin: 0 auto 20px;
  max-width: 420px;
  font-size: 14px;
}
.game-row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 170px 64px 18px;
  align-items: center;
  gap: 20px;
  padding: 14px 18px;
  border-radius: 22px;
  transition: background 0.15s;
}
.game-row:hover {
  background: var(--fill-soft);
}
.game-row small {
  display: block;
  margin-top: 4px;
  color: var(--dim);
  font-size: 12px;
}
.game-row-when strong {
  font-size: 14px;
  font-weight: 650;
}
.game-row-players {
  min-width: 0;
}
.game-row-players small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.avatar-stack {
  display: flex;
  align-items: center;
}
.avatar-stack .avatar {
  margin-right: -6px;
  box-shadow: 0 0 0 2px var(--fill-active);
}
.avatar-more {
  margin-left: 14px;
  color: var(--dim);
  font-size: 12px;
  font-weight: 600;
}
.game-row-result {
  text-align: right;
}
.game-row-result strong {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.game-row-favorites {
  display: flex;
  justify-content: flex-end;
}
.game-row > svg {
  width: 18px;
  height: 18px;
  color: var(--dim);
}
.history-more {
  display: flex;
  margin: 10px auto;
}
.reveal-page.past-game {
  padding-bottom: 32px;
}
/* Floated so the card's text wraps around the star at any width. */
.star-button {
  float: right;
  margin: -4px -4px 8px 12px;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--fill);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--muted);
}
.star-button:not(.saved):hover:not(:disabled) {
  background: var(--fill-hover);
  color: var(--text);
}
.star-button.saved {
  background: var(--host-bg);
  box-shadow: none;
  color: var(--accent);
}
.star-button.saved svg {
  fill: currentColor;
}
.favorite-removed {
  color: var(--neg) !important;
}
.favorites-stage {
  height: clamp(560px, 74dvh, 860px);
}
.favorites-list {
  margin-top: 24px;
}
.favorite-rows {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px;
  padding: 12px;
}
.favorite-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.favorite-row:hover {
  background: var(--fill-soft);
}
.favorite-row.active {
  background: var(--fill-active);
  box-shadow: var(--active-shadow);
}
.favorite-row.active .favorite-row-index {
  color: var(--accent-text);
}
.favorite-row.removed .favorite-row-main {
  opacity: 0.45;
  text-decoration: line-through;
}
.favorite-row-index {
  width: 22px;
  color: var(--dim);
  font-size: 11px;
}
.favorite-row-main {
  flex: 1;
  min-width: 0;
}
.favorite-row-main strong {
  display: block;
  font-size: 14px;
  font-weight: 650;
}
.favorite-row-main small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--dim);
  font-size: 12px;
}
.favorite-row > svg {
  width: 16px;
  height: 16px;
  color: var(--dim);
}
.demo-point {
  pointer-events: none;
}
.demo-point-hit {
  cursor: pointer;
}
@media (max-width: 1000px) {
  .history-page {
    padding: 8px 24px 32px;
  }
}
@media (max-width: 740px) {
  .history-page {
    padding: 4px 12px 24px;
  }
  .history-heading h1 {
    font-size: 32px;
  }
  .history-link span {
    display: none;
  }
  .game-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "when result" "players favorites";
    gap: 12px 14px;
    padding: 14px;
  }
  .game-row-when {
    grid-area: when;
  }
  .game-row-players {
    grid-area: players;
  }
  .game-row-result {
    grid-area: result;
  }
  .game-row-favorites {
    grid-area: favorites;
  }
  .game-row > svg {
    display: none;
  }
  .hero-links .btn {
    padding: 0 12px;
  }
  .favorite-rows {
    grid-template-columns: 1fr;
    padding: 8px;
  }
  .favorites-stage {
    height: auto;
  }
}
/* Signed-in phones keep every header action on one line by showing only the logo. */
@media (max-width: 480px) {
  .topbar:has(.history-link) .brand {
    gap: 0;
    font-size: 0;
  }
}

.reveal-map-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.candidate-actions { position: absolute; left: 22px; bottom: 108px; z-index: 6; display: flex; gap: 8px; }
.game-shell.live .candidate-actions { left: 96px; }
.candidate-actions .btn { height: 44px; }
.candidate-actions svg { width: 18px; height: 18px; }
@media (max-width: 760px) {
  .candidate-actions, .game-shell.live .candidate-actions { left: 12px; top: auto; bottom: 258px; }
  .candidate-actions .btn { min-width: 44px; padding: 0 12px; }
  .candidate-actions .btn span { display: none; }
}
