/* ============================================================
   FLAG GUESS WHO — atlas/cartographic + bright playful
   Mobile-first. ============================================ */

:root {
  /* paper + ink */
  --paper:    oklch(0.962 0.016 83);   /* warm map cream */
  --paper-2:  oklch(0.988 0.010 83);   /* card surface, near-white warm */
  --paper-3:  oklch(0.932 0.020 80);   /* inset / deeper */
  --ink:      oklch(0.255 0.022 56);   /* sepia near-black */
  --ink-soft: oklch(0.470 0.024 58);   /* muted label ink */
  --ink-faint:oklch(0.640 0.022 62);
  --line:     oklch(0.838 0.030 73);   /* tan hairline */
  --line-2:   oklch(0.760 0.038 70);

  /* bright cartographic accents */
  --ocean:    oklch(0.585 0.115 232);  /* primary sea blue */
  --ocean-ink:oklch(0.40 0.10 232);
  --coral:    oklch(0.640 0.165 31);    /* warm red — guess / no */
  --sun:      oklch(0.790 0.135 78);    /* gold highlight */
  --leaf:     oklch(0.620 0.120 150);   /* green — yes */
  --leaf-ink: oklch(0.42 0.10 150);

  --shadow-sm: 0 1px 0 oklch(0.70 0.04 70 / 0.5), 0 2px 5px oklch(0.4 0.05 60 / 0.10);
  --shadow-md: 0 2px 0 oklch(0.70 0.04 70 / 0.45), 0 10px 26px oklch(0.4 0.05 60 / 0.16);
  --shadow-lg: 0 18px 50px oklch(0.35 0.05 60 / 0.30);

  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 26px;

  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-ui: "Hanken Grotesk", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;

  --maxw: 540px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* overscroll-behavior must be on <html> too: Chrome (Android) reads pull-to-refresh
   from the root element, so setting it on <body> alone is ignored and a drag-down
   reloads the page mid-game. */
html, body { height: 100%; overscroll-behavior-y: none; }

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background-color: var(--paper);
  /* faint map graticule */
  background-image:
    linear-gradient(oklch(0.5 0.03 70 / 0.045) 1px, transparent 1px),
    linear-gradient(90deg, oklch(0.5 0.03 70 / 0.045) 1px, transparent 1px),
    radial-gradient(oklch(0.55 0.04 70 / 0.05) 1px, transparent 1.4px);
  background-size: 44px 44px, 44px 44px, 22px 22px;
  background-position: -1px -1px, -1px -1px, 0 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

#root, #app { min-height: 100%; }

.app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: linear-gradient(oklch(0.97 0.012 83 / 0.4), oklch(0.97 0.012 83 / 0));
  box-shadow: 0 0 0 1px var(--line), 0 0 60px oklch(0.4 0.04 60 / 0.06);
}

/* ---- typography helpers ---- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0;
}
.coord { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.06em; color: var(--ink-faint); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 800; margin: 0; letter-spacing: -0.01em; line-height: 1.04; }
.muted { color: var(--ink-soft); }

/* ============================================================ BUTTONS */
.btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  border: 1.5px solid var(--ink);
  border-radius: var(--r-md);
  padding: 14px 20px;
  background: var(--sun);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.08s ease, box-shadow 0.12s ease, background 0.15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  line-height: 1;
}
.btn:active { transform: translateY(2px); box-shadow: 0 0 0 oklch(0.7 0.04 70 / 0.5); }
.btn--primary { background: var(--ocean); color: oklch(0.99 0.01 230); border-color: var(--ocean-ink); }
.btn--coral   { background: var(--coral); color: oklch(0.99 0.01 30); border-color: oklch(0.42 0.12 31); }
.btn--ghost   { background: var(--paper-2); color: var(--ink); }
.btn--block   { width: 100%; }
.btn--lg      { font-size: 1.12rem; padding: 17px 24px; }
.btn:disabled { opacity: 0.42; cursor: not-allowed; box-shadow: none; transform: none; }
.btn:disabled:active { transform: none; }

/* segmented control (difficulty) */
.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  border: 1.5px solid var(--ink); border-radius: var(--r-md);
  overflow: hidden; background: var(--paper-2); box-shadow: var(--shadow-sm);
}
.seg button {
  font-family: var(--font-ui); font-weight: 700; font-size: 0.86rem;
  border: none; background: transparent; color: var(--ink-soft);
  padding: 12px 6px; cursor: pointer; border-right: 1.5px solid var(--line);
  transition: background 0.15s, color 0.15s;
}
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--ink); color: var(--paper); }
.seg .sub { display: block; font-family: var(--font-mono); font-size: 0.55rem; letter-spacing: 0.08em; opacity: 0.7; margin-top: 3px; font-weight: 400; }

/* ============================================================ LOBBY */
.lobby { flex: 1; display: flex; flex-direction: column; padding: 26px 22px 30px; }
.lobby__top { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; }
.compass {
  width: 76px; height: 76px; border-radius: 50%;
  border: 2px solid var(--ink); position: relative; background: var(--paper-2);
  box-shadow: var(--shadow-md); overflow: hidden;
}
.compass::before, .compass::after {
  content: ""; position: absolute; background: var(--line-2);
}
.compass::before { left: 0; right: 0; top: 50%; height: 1.5px; transform: translateY(-50%); }
.compass::after { top: 0; bottom: 0; left: 50%; width: 1.5px; transform: translateX(-50%); }
.compass .needle {
  position: absolute; top: 50%; left: 50%; width: 15px; height: 54px;
  transform: translate(-50%, -50%) rotate(34deg);
  background: linear-gradient(to bottom, var(--coral) 0 50%, var(--ink) 50% 100%);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.15)); z-index: 2;
}
.compass .needle::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 8px; height: 8px;
  transform: translate(-50%, -50%); background: var(--paper-2);
  border: 1.5px solid var(--ink); border-radius: 50%;
}
.brand h1 { font-size: clamp(2.4rem, 11vw, 3.2rem); }
.brand .tag { max-width: 46ch; color: var(--ink-soft); font-size: 1rem; line-height: 1.4; }

.lobby__field label { display: block; }
.input {
  font-family: var(--font-ui); font-size: 1rem; width: 100%;
  padding: 13px 15px; border: 1.5px solid var(--ink); border-radius: var(--r-md);
  background: var(--paper-2); color: var(--ink); box-shadow: var(--shadow-sm);
}
.input::placeholder { color: var(--ink-faint); }

.lobby__actions { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.link-btn {
  background: none; border: none; font-family: var(--font-ui); font-weight: 600;
  color: var(--ocean-ink); cursor: pointer; padding: 8px; font-size: 0.92rem;
  text-decoration: underline; text-underline-offset: 3px; align-self: center;
}

/* ============================================================ HOW TO PLAY */
.sheet-scrim {
  position: fixed; inset: 0; background: oklch(0.25 0.03 60 / 0.42);
  backdrop-filter: blur(2px); z-index: 60; display: flex; align-items: flex-end;
  animation: fade 0.2s ease;
}
.sheet {
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  background: var(--paper); border-radius: var(--r-xl) var(--r-xl) 0 0;
  border: 1.5px solid var(--ink); border-bottom: none;
  box-shadow: var(--shadow-lg); padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  max-height: 88dvh; overflow-y: auto; animation: slideUp 0.26s cubic-bezier(.2,.9,.3,1);
}
.sheet__grab { width: 40px; height: 4px; border-radius: 99px; background: var(--line-2); margin: 4px auto 14px; }
.sheet__title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.icon-btn {
  border: 1.5px solid var(--line-2); background: var(--paper-2); border-radius: 50%;
  width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer;
  font-size: 1.1rem; color: var(--ink-soft); line-height: 1;
}

.howto-step { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px dashed var(--line); }
.howto-step:last-child { border-bottom: none; }
.howto-num {
  flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--ocean);
  color: white; font-family: var(--font-display); font-weight: 800; display: grid; place-items: center;
  border: 1.5px solid var(--ocean-ink);
}
.howto-step h3 { font-size: 1.02rem; margin-bottom: 3px; }
.howto-step p { margin: 0; color: var(--ink-soft); font-size: 0.92rem; line-height: 1.45; }

/* ============================================================ GAME HEADER */
.gphead {
  position: sticky; top: 0; z-index: 30; background: var(--paper);
  border-bottom: 1.5px solid var(--ink);
  padding: 10px 16px calc(10px);
  box-shadow: 0 6px 16px oklch(0.4 0.04 60 / 0.05);
}
.gphead__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.turnpill {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display);
  font-weight: 700; font-size: 0.92rem; padding: 7px 13px; border-radius: 99px;
  border: 1.5px solid var(--ink);
}
.turnpill.me  { background: var(--leaf); color: oklch(0.99 0.02 150); border-color: var(--leaf-ink); }
.turnpill.bot { background: var(--paper-2); color: var(--ink-soft); }
.turnpill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.turnpill.bot .dot { animation: blink 1s infinite; }

.countpill { text-align: right; }
.countpill .n { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; line-height: 1; }
.countpill .lab { font-family: var(--font-mono); font-size: 0.55rem; letter-spacing: 0.12em; color: var(--ink-soft); text-transform: uppercase; display: block; }

.gphead__meta { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.score { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; color: var(--ink-soft); text-transform: uppercase; }
.score b { color: var(--ink); font-size: 0.84rem; }
.mysecret-chip { display: flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.mysecret-chip img { width: 30px; height: 22px; object-fit: cover; border-radius: 3px; border: 1.5px solid var(--ink); box-shadow: var(--shadow-sm); }
.mysecret-chip.lg { flex-direction: column; gap: 9px; font-size: 0.62rem; }
.mysecret-chip.lg img { width: 96px; height: 64px; border-radius: 6px; border-width: 2px; box-shadow: var(--shadow-md); }

/* ============================================================ BOARD */
.boardwrap { flex: 1; padding: 14px 14px 4px; }
.board {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px;
}
.tile {
  position: relative; border: 1.5px solid var(--ink); border-radius: var(--r-sm);
  background: var(--paper-2); cursor: pointer; overflow: hidden; padding: 0;
  box-shadow: var(--shadow-sm); transition: transform 0.12s, box-shadow 0.12s, opacity 0.3s, filter 0.3s;
  aspect-ratio: 4 / 3; display: block; width: 100%;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .pin {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: oklch(0.25 0.03 60 / 0.5); opacity: 0; transition: opacity 0.2s;
}
.tile .pin span {
  font-family: var(--font-display); font-weight: 800; color: white; font-size: 0.7rem;
  background: var(--coral); border: 1.5px solid white; border-radius: 99px; padding: 3px 9px;
}
.tile:active { transform: scale(0.95); }
.tile.is-out { opacity: 0.26; filter: grayscale(1) contrast(0.9); }
.tile.is-out::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 47%, var(--coral) 47%, var(--coral) 53%, transparent 53%);
  opacity: 0.55;
}
.tile.is-pick { box-shadow: 0 0 0 3px var(--sun), var(--shadow-md); border-color: var(--ink); transform: translateY(-2px); }
.tile.guessable { animation: wobble 1.4s ease-in-out infinite; }
.tile.guessable { box-shadow: 0 0 0 2.5px var(--coral), var(--shadow-md); }
.tile.is-flag-flip { animation: flip 0.4s ease; }

/* choosing-phase caption under tiles */
.tile .cap {
  position: absolute; left: 0; right: 0; bottom: 0; font-size: 0.5rem;
  font-family: var(--font-mono); text-align: center; color: white; letter-spacing: 0.02em;
  background: oklch(0.25 0.03 60 / 0.62); padding: 2px 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ============================================================ CLUE TICKER */
.ticker {
  margin: 8px 14px 0; border: 1.5px dashed var(--line-2); border-radius: var(--r-md);
  background: var(--paper-2); padding: 10px 13px; display: flex; align-items: center; gap: 10px;
  cursor: pointer; min-height: 46px; width: calc(100% - 28px); text-align: left;
}
.ticker .who { font-family: var(--font-mono); font-size: 0.56rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); flex: none; }
.ticker .txt { font-size: 0.9rem; flex: 1; line-height: 1.25; }
.ticker .ans { font-family: var(--font-display); font-weight: 800; font-size: 0.82rem; padding: 3px 9px; border-radius: 99px; border: 1.5px solid var(--ink); flex: none; }
.ans.yes { background: var(--leaf); color: white; border-color: var(--leaf-ink); }
.ans.no  { background: var(--coral); color: white; border-color: oklch(0.42 0.12 31); }
.ticker .more {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.06em; flex: none;
  color: var(--ocean-ink); background: oklch(0.585 0.115 232 / 0.12); padding: 4px 9px; border-radius: 99px;
}

/* ============================================================ FOOTER ACTIONS */
.actions {
  position: sticky; bottom: 0; z-index: 30; display: flex; gap: 10px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--paper) 28%);
}
.actions .btn { flex: 1; }

/* ============================================================ ASK SHEET */
.qsection-label { display: flex; align-items: center; gap: 8px; margin: 14px 0 9px; }
.qsection-label .eyebrow { white-space: nowrap; }
.qsection-label .rule { flex: 1; height: 1px; background: var(--line); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--font-ui); font-weight: 600; font-size: 0.88rem;
  border: 1.5px solid var(--ink); border-radius: 99px; padding: 9px 14px;
  background: var(--paper-2); color: var(--ink); cursor: pointer; text-transform: capitalize;
  display: inline-flex; align-items: center; gap: 8px; box-shadow: var(--shadow-sm);
  transition: transform 0.08s, background 0.15s;
}
.chip:active { transform: translateY(1px); }
.chip.asked { opacity: 0.4; text-decoration: line-through; box-shadow: none; cursor: not-allowed; }
.chip .sw { width: 15px; height: 15px; border-radius: 4px; border: 1px solid oklch(0.3 0.02 60 / 0.4); }
.sw-red{background:#cf3023}.sw-orange{background:#e8821e}.sw-yellow{background:#f0c419}
.sw-green{background:#1e9e54}.sw-blue{background:#2f6fc9}.sw-white{background:#fff}
.sw-black{background:#222}.sw-brown{background:#7c4a1f}

/* collapsible question categories */
.qcat { border-bottom: 1px dashed var(--line); }
.qcat:first-of-type { border-top: 1px dashed var(--line); }
.qcat > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
  padding: 13px 2px; user-select: none;
}
.qcat > summary::-webkit-details-marker { display: none; }
.qcat__title { font-family: var(--font-display); font-weight: 800; font-size: 1rem; letter-spacing: -0.01em; }
.qcat__meta {
  margin-left: auto; font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ocean-ink); background: oklch(0.585 0.115 232 / 0.12);
  padding: 3px 7px; border-radius: 99px;
}
.qcat__meta.done { color: var(--ink-faint); background: var(--paper-3); }
.qcat__chev { font-size: 0.8rem; color: var(--ink-soft); transition: transform 0.18s; }
.qcat[open] > summary .qcat__chev { transform: rotate(180deg); }
.qcat[open] > .chips { padding: 2px 2px 14px; }

/* ============================================================ LOG SHEET */
.log { list-style: none; padding: 0; margin: 0; }
.log li { display: flex; align-items: center; gap: 10px; padding: 11px 2px; border-bottom: 1px dashed var(--line); font-size: 0.92rem; }
.log li:last-child { border-bottom: none; }
.log .who { font-family: var(--font-mono); font-size: 0.55rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); width: 58px; flex: none; }
.log .txt { flex: 1; }
.log .ans { font-family: var(--font-display); font-weight: 800; font-size: 0.74rem; padding: 2px 8px; border-radius: 99px; }
.log .ans.yes { background: var(--leaf); color: white; } .log .ans.no { background: var(--coral); color: white; }
.log .empty { color: var(--ink-faint); font-style: italic; }

/* ============================================================ RESULT */
.result { flex: 1; display: flex; flex-direction: column; padding: 26px 22px 24px; gap: 18px; }
.stamp {
  align-self: center; font-family: var(--font-display); font-weight: 800;
  font-size: 1.5rem; letter-spacing: 0.02em; padding: 10px 22px; border-radius: 10px;
  border: 3px solid; transform: rotate(-7deg); position: relative; text-transform: uppercase;
  animation: stampIn 0.4s cubic-bezier(.2,1.4,.4,1) both;
}
.stamp.win  { color: var(--leaf-ink); border-color: var(--leaf-ink); }
.stamp.lose { color: var(--coral);    border-color: var(--coral); }
.result__head { text-align: center; }
.result__head h2 { font-size: 1.9rem; margin-top: 10px; }
.result__head p { color: var(--ink-soft); margin: 6px 0 0; }

.reveal-card {
  border: 1.5px solid var(--ink); border-radius: var(--r-lg); background: var(--paper-2);
  box-shadow: var(--shadow-md); overflow: hidden;
}
.reveal-card__flag { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; border-bottom: 1.5px solid var(--ink); }
.reveal-card__body { padding: 16px 18px; }
.reveal-card__name { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.reveal-card__name h3 { font-size: 1.3rem; }
.reveal-card__fact { margin: 10px 0 0; line-height: 1.5; font-size: 0.96rem; }
.fact-eyebrow { display: flex; align-items: center; gap: 7px; margin-top: 4px; }
.fact-eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sun); border: 1px solid var(--ink); }
.reveal-card__geo { display: flex; flex-wrap: wrap; gap: 5px 16px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--paper-3); font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.02em; color: var(--ink-soft); }
.reveal-card__geo b { color: var(--ink); font-weight: 700; }

/* ---- post-game "where in the world" map ---- */
.flagmap {
  width: 100%; margin: 12px 0 0; aspect-ratio: 1000 / 507; border-radius: var(--r-sm);
  overflow: hidden; border: 1.5px solid var(--line); background: oklch(0.9 0.028 232); /* faint ocean */
}
.flagmap svg, .flagmap .worldmap { width: 100%; height: 100%; display: block; }
.worldmap path { fill: var(--paper-3); stroke: oklch(0.84 0.03 73); stroke-width: 0.4; }
.worldmap path.hl { fill: var(--coral); stroke: oklch(0.42 0.12 31); stroke-width: 0.6; }

/* ---- end-of-round bonus geography question ---- */
.bonus-card { margin-top: 12px; border: 1.5px solid var(--ink); border-radius: var(--r-lg); background: var(--paper-2); box-shadow: var(--shadow-md); padding: 14px 16px; }
.bonus-card.is-correct { border-color: var(--leaf-ink); }
.bonus-card.is-wrong { border-color: var(--coral); }
.bonus-eyebrow { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.bonus-badge { display: inline-block; font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.04em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; border: 1.5px solid var(--ink); }
.bonus-badge.win { color: var(--leaf-ink); border-color: var(--leaf-ink); }
.bonus-badge.miss { color: var(--coral); border-color: var(--coral); }
.bonus-q { margin: 9px 0 12px; font-size: 1.02rem; line-height: 1.4; }
.bonus-sub { color: var(--ink-soft); font-size: 0.82rem; }
.bonus-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bonus-opt { padding: 11px 10px; border: 1.5px solid var(--ink); border-radius: var(--r-md); background: var(--paper); font: inherit; font-size: 0.9rem; cursor: pointer; transition: transform .08s, background .12s; text-align: center; color: var(--ink); }
.bonus-opt:not(:disabled):hover { transform: translateY(-1px); background: var(--paper-2); }
.bonus-opt:disabled { cursor: default; }
.bonus-opt.correct { background: var(--leaf); color: oklch(0.99 0.02 150); border-color: var(--leaf-ink); font-weight: 700; }
.bonus-opt.wrong { background: var(--coral); color: oklch(0.99 0.01 30); border-color: oklch(0.42 0.12 31); }

.result__actions { display: flex; gap: 10px; margin-top: auto; }
.result__actions .btn { flex: 1; }

/* mini board recap of how few were left */
.recap { display: flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.06em; color: var(--ink-soft); text-transform: uppercase; }
.recap--stat { margin-top: 6px; font-size: 0.62rem; color: var(--ink-faint); text-transform: none; letter-spacing: 0.04em; }

/* ============================================================ CHOOSING */
.choosing { flex: 1; display: flex; flex-direction: column; padding: 20px 14px 0; }
.choosing__head { padding: 0 4px 4px; }
.choosing__head h2 { font-size: 1.5rem; }
.choosing__head p { color: var(--ink-soft); margin: 6px 0 0; font-size: 0.94rem; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 11px 18px; border-radius: 99px;
  font-size: 0.88rem; z-index: 80; box-shadow: var(--shadow-lg); max-width: 90%;
  animation: fade 0.2s ease;
}

/* ============================================================ ANIM */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes flip { 0% { transform: rotateY(0); } 50% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }
@keyframes wobble { 0%,100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-2px) rotate(-1.5deg); } 75% { transform: translateY(-2px) rotate(1.5deg); } }
@keyframes stampIn { 0% { transform: rotate(-7deg) scale(2.6); } 60% { transform: rotate(-7deg) scale(0.94); } 100% { transform: rotate(-7deg) scale(1); } }
@keyframes pop { 0% { transform: scale(0.55); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.pop { animation: pop 0.28s cubic-bezier(.2,1.3,.4,1) both; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
}

/* confetti dots */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i {
  position: absolute; top: -12px; width: 9px; height: 13px; border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(108dvh) rotate(540deg); opacity: 0.9; }
}

/* desktop niceties */
@media (min-width: 600px) {
  .board { gap: 11px; }
}

/* Larger screens: let the centred column breathe instead of staying phone-width */
@media (min-width: 760px) {
  :root { --maxw: 720px; }
}
@media (min-width: 1100px) {
  :root { --maxw: 860px; }
}

/* ============================================================ MODE PICKER */
.modes { display: flex; flex-direction: column; gap: 10px; }
.mode-btn {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  padding: 14px 15px; border: 1.5px solid var(--ink); border-radius: var(--r-md);
  background: var(--paper-2); color: var(--ink); box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform 0.08s, box-shadow 0.12s;
  font-family: var(--font-ui);
}
.mode-btn:active { transform: translateY(2px); box-shadow: none; }
.mode-btn .badge {
  flex: none; width: 42px; height: 42px; border-radius: 11px; border: 1.5px solid var(--ink);
  display: grid; place-items: center; font-family: var(--font-mono); font-weight: 700;
  font-size: 0.72rem; letter-spacing: 0.02em; background: var(--paper);
}
.mode-btn .l { flex: 1; }
.mode-btn .l b { font-family: var(--font-display); font-size: 1.06rem; display: block; line-height: 1.1; }
.mode-btn .l span { font-size: 0.8rem; color: var(--ink-soft); }
.mode-btn .chev { font-size: 1.1rem; color: var(--ink-faint); }
.mode-btn--primary { background: var(--ocean); color: oklch(0.99 0.01 230); border-color: var(--ocean-ink); }
.mode-btn--primary .badge { background: oklch(1 0 0 / 0.16); border-color: oklch(1 0 0 / 0.5); color: white; }
.mode-btn--primary .l span { color: oklch(1 0 0 / 0.82); }
.mode-btn--primary .chev { color: oklch(1 0 0 / 0.7); }

.online-panel {
  border: 1.5px dashed var(--line-2); border-radius: var(--r-md); padding: 14px;
  background: var(--paper-2); display: flex; flex-direction: column; gap: 12px;
  animation: fade 0.2s ease;
}
.online-panel .join-row { display: flex; gap: 8px; }
.online-panel .join-row .input { text-transform: uppercase; letter-spacing: 0.22em; font-family: var(--font-mono); font-weight: 700; text-align: center; }
.online-panel .join-row .btn { flex: none; }

/* ============================================================ HANDOFF / PRIVACY */
.handoff { flex: 1; display: flex; flex-direction: column; padding: 30px 24px; }
.handoff__inner {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 16px;
}
.hidden-flag {
  width: 120px; aspect-ratio: 4/3; border: 2px solid var(--ink); border-radius: var(--r-sm);
  background:
    repeating-linear-gradient(135deg, var(--paper-3), var(--paper-3) 9px, var(--paper-2) 9px, var(--paper-2) 18px);
  display: grid; place-items: center; box-shadow: var(--shadow-md); margin-bottom: 4px;
}
.hidden-flag span { font-family: var(--font-display); font-weight: 800; font-size: 2.6rem; color: var(--ink-soft); }
.handoff h2 { font-size: 1.9rem; }
.handoff p.muted { max-width: 26ch; line-height: 1.45; }
.handoff .btn { margin-top: 8px; white-space: nowrap; }

/* ============================================================ REMOTE ROOM */
.remote { flex: 1; display: flex; flex-direction: column; padding: 22px 22px 28px; }
.remote .link-btn { align-self: flex-start; padding-left: 0; text-decoration: none; }
.remote__body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; }
.remote__body h2 { font-size: 1.7rem; }
.codebox {
  font-family: var(--font-mono); font-weight: 700; font-size: 2.4rem; letter-spacing: 0.3em;
  padding: 14px 10px 14px 24px; border: 2px dashed var(--ink); border-radius: var(--r-md);
  background: var(--paper-2); color: var(--ink); box-shadow: var(--shadow-sm);
}
.waiting { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 0.92rem; }
.disc-banner {
  display: flex; align-items: center; gap: 10px; margin: 10px 14px 0; padding: 10px 14px;
  border: 1.5px solid var(--line-2); border-left: 4px solid var(--coral); border-radius: var(--r-sm);
  background: var(--paper-2); color: var(--ink-soft); font-size: 0.86rem; font-weight: 600;
}
.spinner {
  width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--line-2);
  border-top-color: var(--ocean); animation: spin 0.9s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.note-banner {
  border: 1.5px solid var(--line-2); border-left: 4px solid var(--sun); border-radius: var(--r-sm);
  background: var(--paper-2); padding: 12px 14px; font-size: 0.88rem; line-height: 1.45;
  color: var(--ink-soft); text-align: left; max-width: 34ch;
}
.note-banner b { color: var(--ink); }

/* accessibility: visible keyboard focus */
:focus-visible { outline: 3px solid var(--ocean); outline-offset: 2px; }

/* ============================================================ SETTINGS */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 2px; border-bottom: 1px dashed var(--line); }
.set-row:last-child { border-bottom: none; }
.set-row > span { font-weight: 600; }
.switch { width: 48px; height: 28px; flex: none; border-radius: 99px; border: 1.5px solid var(--ink); background: var(--paper-3); position: relative; cursor: pointer; transition: background 0.15s; padding: 0; }
.switch .knob { position: absolute; top: 1.5px; left: 1.5px; width: 22px; height: 22px; border-radius: 50%; background: var(--paper-2); border: 1.5px solid var(--ink); transition: transform 0.15s; }
.switch.on { background: var(--leaf); }
.switch.on .knob { transform: translateX(20px); }
.accents { display: flex; gap: 8px; }
.accent-opt { width: 28px; height: 28px; flex: none; border-radius: 8px; border: 2px solid var(--ink); cursor: pointer; padding: 0; }
.accent-opt.on { box-shadow: 0 0 0 2px var(--sun); }
.codebox { cursor: pointer; }
