/* Bragging Rights — mobile-first, three selectable themes.
   Themes are palettes over one "arcade sticker" structure:
   - darklime  (default): black bg, purple accent, lime pop
   - darkorange: black bg, purple accent, orange pop, gold third
   - light: cream bg, black outlines, pink accent, lime pop */

:root, [data-theme="darklime"] {
  --bg0: #0d0b14; --bg1: #171126;
  --card: #1a1626; --card2: #221c33;
  --line: #6c5ce7; --line-soft: #3b3252;
  --ink: #ffffff; --mut: rgba(255,255,255,.62);
  --acc: #6c5ce7; --acc-deep: #4c3fd4; --acc-ink: #ffffff;
  --pop: #c9e832; --pop-deep: #93ad1a; --pop-ink: #141414;
  --link: #c9e832;
  --third: #e84fd0; --third-deep: #b12f9c; --third-ink: #ffffff;
  --warn: #ff5d5d; --ok: #3ddc84;
  --input-bg: #0d0b14;
  --nav-bg: #08060d;
  --sh-acc: 0 5px 0 var(--acc-deep);
  --sh-pop: 0 5px 0 var(--pop-deep);
  --sh-third: 0 5px 0 var(--third-deep);
  --sh-card: 0 5px 0 rgba(0,0,0,.45);
  --sh-plain: 0 4px 0 var(--line-soft);
  --border-w: 3px;
}
[data-theme="darkorange"] {
  --bg0: #0d0a12; --bg1: #1a1122;
  --card: #1c1526; --card2: #251b33;
  --line: #8b46f0; --line-soft: #43325e;
  --ink: #ffffff; --mut: rgba(255,255,255,.62);
  --acc: #8b46f0; --acc-deep: #6528c9; --acc-ink: #ffffff;
  --pop: #f78f1e; --pop-deep: #b5620a; --pop-ink: #1c1005;
  --link: #f78f1e;
  --third: #ffb520; --third-deep: #c78508; --third-ink: #201502;
  --warn: #ff5d5d; --ok: #3ddc84;
  --input-bg: #0d0a12;
  --nav-bg: #080510;
  --sh-acc: 0 5px 0 var(--acc-deep);
  --sh-pop: 0 5px 0 var(--pop-deep);
  --sh-third: 0 5px 0 var(--third-deep);
  --sh-card: 0 5px 0 rgba(0,0,0,.45);
  --sh-plain: 0 4px 0 var(--line-soft);
  --border-w: 3px;
}
[data-theme="light"] {
  --bg0: #fffdf6; --bg1: #fdf7e8;
  --card: #ffffff; --card2: #fdf3fb;
  --line: #141414; --line-soft: #141414;
  --ink: #141414; --mut: rgba(0,0,0,.55);
  --acc: #ff8ae8; --acc-deep: #141414; --acc-ink: #141414;
  --pop: #d9e94b; --pop-deep: #141414; --pop-ink: #141414;
  --link: #141414;
  --third: #8ad9ff; --third-deep: #141414; --third-ink: #141414;
  --warn: #ff5d5d; --ok: #26a65b;
  --input-bg: #ffffff;
  --nav-bg: #ffffff;
  --sh-acc: 4px 4px 0 #141414;
  --sh-pop: 4px 4px 0 #141414;
  --sh-third: 4px 4px 0 #141414;
  --sh-card: 5px 5px 0 #141414;
  --sh-plain: 4px 4px 0 #141414;
  --border-w: 3.5px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* The page scrolls normally, as it did before v115.
   Taking the scroll away — one screen-tall app with an inner scrolling pane —
   is what left the app short of the bottom of the display in an installed iOS
   PWA: the space showed on EVERY screen, including ones with no nav at all.
   The rubber-band that made a fixed bar float is dealt with directly below by
   overscroll-behavior, which stops the bounce without restructuring anything. */
html { font-size: 16px; }
body {
  overscroll-behavior-y: none;
  font-family: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Arial Rounded MT Bold", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(165deg, var(--bg0) 0%, var(--bg1) 100%) fixed;
  min-height: 100vh; min-height: 100dvh;
  color: var(--ink);
  user-select: none; -webkit-user-select: none;
}
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

button { font: inherit; border: 0; cursor: pointer; color: inherit; background: none; }
input, select { font: inherit; }

.screen {
  flex: 1; display: flex; flex-direction: column;
  /* Bottom padding clears the fixed nav; top clears the translucent status bar
     the content sits behind. */
  padding: 16px 16px calc(78px + min(env(safe-area-inset-bottom, 0px), 16px));
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
}

/* ---------- splash ---------- */
#splash {
  position: fixed; inset: 0; z-index: 999; background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px;
}
[data-theme="light"] #splash { background: #fff; }
#splash img {
  width: min(78vw, 330px);
  /* pops in, then breathes gently until the app is ready */
  animation: splash-in .5s cubic-bezier(.2, .9, .3, 1.45) both,
             splash-pulse 1.6s .5s ease-in-out infinite;
}
@keyframes splash-in {
  from { opacity: 0; transform: scale(.8); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes splash-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}
#splash.leaving { opacity: 0; transform: scale(1.04); transition: opacity .38s ease, transform .38s ease; }
#splash .stag { animation: splash-fade .6s .35s both; }
@keyframes splash-fade { from { opacity: 0; } to { opacity: 1; } }
/* honour reduced-motion: keep the logo, drop the movement */
@media (prefers-reduced-motion: reduce) {
  #splash img, #splash .stag, #splash .sdots span { animation: none; }
}
#splash .sdots { display: flex; gap: 10px; }
#splash .sdots span { width: 15px; height: 15px; border-radius: 99px; animation: bounce 1s infinite; }
#splash .sdots span:nth-child(1) { background: var(--acc); animation-delay: 0s; }
#splash .sdots span:nth-child(2) { background: var(--pop); animation-delay: .15s; }
#splash .sdots span:nth-child(3) { background: var(--third); animation-delay: .3s; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
#splash .stag { font-weight: 900; letter-spacing: 2px; font-size: .82rem; color: var(--pop); }
[data-theme="light"] #splash .stag { color: #141414; opacity: .6; }

.brand-logo { display: block; margin: 0 auto; }

/* ---------- in-app waits (saving a round, building a quiz) ----------
   A lone line of grey text on a blank screen reads as "stuck", so these
   borrow the splash treatment: the logo breathes and the dots bounce. */
.loadwrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; min-height: 62vh; text-align: center;
}
.loadwrap .loadlogo .brand-logo {
  animation: splash-in .45s cubic-bezier(.2, .9, .3, 1.45) both,
             splash-pulse 1.6s .45s ease-in-out infinite;
}
.loadwrap .sdots { display: flex; gap: 10px; }
.loadwrap .sdots span { width: 13px; height: 13px; border-radius: 99px; animation: bounce 1s infinite; }
.loadwrap .sdots span:nth-child(1) { background: var(--acc); animation-delay: 0s; }
.loadwrap .sdots span:nth-child(2) { background: var(--pop); animation-delay: .15s; }
.loadwrap .sdots span:nth-child(3) { background: var(--third); animation-delay: .3s; }
.loadwrap .spin { padding: 0; }
@media (prefers-reduced-motion: reduce) {
  .loadwrap .loadlogo .brand-logo, .loadwrap .sdots span { animation: none; }
}
/* sign-off logo at the bottom of the play screen */
.home-brand { margin: 22px auto 4px; opacity: .55; }

/* signup progress dots — one per step, so the end is always in sight */
.wizbar { display: flex; gap: 6px; justify-content: center; margin: 2px 0 6px; }
.wizdot { width: 26px; height: 5px; border-radius: 99px; background: var(--line-soft); opacity: .5; }
.wizdot.on { background: var(--pop); opacity: 1; }

/* Flags are images: Windows has no flag emoji font and would otherwise print
   the country's two-letter code, which gives the answer away. */
.flagimg { display: block; width: 100%; max-width: 260px; height: auto; margin: 0 auto;
  border-radius: 10px; border: 2px solid rgba(0,0,0,.25); box-shadow: 0 6px 18px rgba(0,0,0,.28); }
.flagimg.big { max-width: min(72vw, 320px); }
.flag .flagimg { max-width: 190px; }

/* unanswered-invite badges — a dialog can be dismissed, a badge waits */
.nav-dot, .tab-dot {
  display: inline-block; min-width: 17px; height: 17px; line-height: 17px;
  padding: 0 4px; margin-left: 4px; border-radius: 99px;
  background: var(--warn); color: #fff; font-size: .68rem; font-weight: 900;
  text-align: center; vertical-align: middle;
}
.nav-dot { position: absolute; top: 4px; right: 50%; margin-right: -22px; }
.nav button { position: relative; }

/* a leaderboard row you can open for more */
.lb-row.tappable { cursor: pointer; position: relative; padding-right: 22px; }
.lb-row.tappable::after {
  content: '›'; position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  color: var(--mut); font-weight: 900; font-size: 1.1rem;
}
.lb-row.tappable:active { opacity: .65; }

/* ---------- drop-down alert ----------
   Slides in from the top edge, sits above everything, and leaves on its own.
   Used for good news that shouldn't interrupt — an invite being accepted. */
.toast-wrap {
  position: fixed; top: 0; left: 0; right: 0; z-index: 300;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 10px 0;
  pointer-events: none;
}
.toast {
  pointer-events: auto; cursor: pointer;
  width: min(100%, 460px);
  display: flex; align-items: center; gap: 12px;
  background: var(--card); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 18px;
  box-shadow: 0 6px 0 var(--ink), 0 12px 26px rgba(0, 0, 0, .28);
  padding: 12px 14px; text-align: left;
  animation: toast-in .42s cubic-bezier(.2, .9, .3, 1.35) both;
}
.toast.out { animation: toast-out .32s ease forwards; }
.toast .tico { font-size: 1.7rem; line-height: 1; flex: 0 0 auto; }
.toast .tbody { flex: 1; min-width: 0; }
.toast .tt { font-weight: 900; font-size: .95rem; }
.toast .ts { font-size: .82rem; color: var(--mut); margin-top: 2px; }
.toast .txp { flex: 0 0 auto; font-weight: 900; color: var(--pop); font-size: 1.05rem; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(-120%); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-120%); } }
@media (prefers-reduced-motion: reduce) {
  .toast, .toast.out { animation: none; }
}

/* ---------- add-to-home-screen nudge ---------- */
.a2hs-step { display: flex; align-items: center; gap: 11px; margin: 11px 0; font-size: .92rem; font-weight: 600; text-align: left; }
.a2hs-step > span {
  flex: 0 0 27px; width: 27px; height: 27px; border-radius: 99px;
  background: var(--acc); color: var(--acc-ink);
  display: flex; align-items: center; justify-content: center; font-weight: 900;
}

/* ---------- generic ---------- */
.card {
  background: var(--card);
  border: var(--border-w) solid var(--line);
  border-radius: 22px; padding: 16px;
  box-shadow: var(--sh-card);
}
.btn {
  display: block; width: 100%; padding: 14px 18px; border-radius: 18px;
  background: var(--pop); color: var(--pop-ink);
  border: var(--border-w) solid var(--line-soft);
  font-weight: 900; font-size: 1.05rem; text-align: center;
  box-shadow: var(--sh-pop);
}
[data-theme="light"] .btn { border-color: #141414; }
.btn:active { transform: translateY(3px); box-shadow: none; }
.btn.secondary { background: var(--card); color: var(--ink); border-color: var(--line); box-shadow: var(--sh-plain); }
.btn.danger { background: var(--warn); color: #fff; border-color: var(--line-soft); box-shadow: 0 5px 0 #a12525; }
[data-theme="light"] .btn.danger { border-color: #141414; box-shadow: 4px 4px 0 #141414; }
.btn.small { width: auto; padding: 8px 14px; font-size: .88rem; border-radius: 13px; box-shadow: var(--sh-plain); background: var(--card2); color: var(--ink); border-color: var(--line); }
.btn.accent { background: var(--acc); color: var(--acc-ink); box-shadow: var(--sh-acc); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: .82rem; font-weight: 900; margin-bottom: 6px; color: var(--pop); }
[data-theme="light"] .field label { color: #141414; }
.field input, .field select, #app select {
  width: 100%; padding: 12px 14px; border-radius: 14px;
  border: var(--border-w) solid var(--line);
  background: var(--input-bg); color: var(--ink); font-size: 1rem; font-weight: 700;
}
#app select {
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%23999999' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 40px;
}
#app select option { color: #141414; background: #fff; }
.field input::placeholder { color: var(--mut); font-weight: 600; }
.error { background: var(--warn); color: #fff; padding: 10px 14px; border-radius: 14px; margin-bottom: 12px; font-size: .9rem; font-weight: 800; display: none; border: var(--border-w) solid var(--line-soft); }
[data-theme="light"] .error { border-color: #141414; }
.error.show { display: block; }
h1 { font-size: 1.5rem; margin-bottom: 4px; font-weight: 900; }
h2 { font-size: 1.12rem; margin-bottom: 10px; font-weight: 900; }
.muted { color: var(--mut); font-size: .85rem; }

/* ---------- welcome / login ---------- */
.hero { text-align: center; padding: 26px 0 16px; }
.hero .logo { font-size: 3rem; }
.hero h1 { font-size: 1.8rem; }
.hero p { color: var(--mut); font-weight: 700; }
.player-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.player-tile {
  background: var(--card); border: var(--border-w) solid var(--line);
  border-radius: 20px; padding: 18px 10px; text-align: center; color: var(--ink);
  box-shadow: var(--sh-plain); font-family: inherit;
}
.player-tile:active { transform: translateY(3px); box-shadow: none; }
.player-tile .pe { font-size: 2.4rem; display: block; }
.player-tile .pn { font-weight: 900; margin-top: 6px; display: block; }
.player-tile .pl { font-size: .72rem; color: var(--mut); display: block; margin-top: 2px; font-weight: 700; }
.fam-head { display: flex; align-items: center; gap: 8px; margin: 18px 4px 6px; font-weight: 900; }

/* ---------- home ---------- */
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.topbar .avatar { font-size: 2.1rem; }
.avatar-btn {
  position: relative; background: var(--card); border: var(--border-w) solid var(--pop);
  border-radius: 16px; padding: 6px 8px 2px; box-shadow: var(--sh-plain);
}
.avatar-btn .edit-dot { position: absolute; right: -6px; bottom: -6px; font-size: .8rem; background: var(--pop); border-radius: 999px; padding: 2px 3px; border: 2px solid var(--line-soft); }
.topbar .who { flex: 1; }
.topbar .who .name { font-weight: 900; font-size: 1.12rem; }
.badge { display: inline-block; background: var(--pop); color: var(--pop-ink); border-radius: 999px; padding: 2px 10px; font-size: .72rem; font-weight: 900; }
.badge.lvl1 { background: #3ddc84; color: #072b16; } .badge.lvl2 { background: #35c8c0; color: #062423; } .badge.lvl3 { background: var(--pop); color: var(--pop-ink); }
.badge.lvl4 { background: #ff9d47; color: #2b1503; } .badge.lvl5 { background: #ff5d5d; color: #fff; } .badge.lvl6 { background: var(--acc); color: var(--acc-ink); }
.xpbar { height: 10px; background: var(--card); border: 2px solid var(--line); border-radius: 999px; margin-top: 6px; overflow: hidden; }
.xpbar > div { height: 100%; background: var(--pop); border-radius: 999px; }

.dinner {
  display: flex; gap: 12px; align-items: center;
  background: var(--pop); color: var(--pop-ink);
  border: var(--border-w) solid var(--line-soft);
  border-radius: 18px; padding: 12px 14px; margin-bottom: 16px;
  box-shadow: var(--sh-pop);
}
[data-theme="light"] .dinner { border-color: #141414; }
.dinner .di { font-size: 1.9rem; }
.dinner .dt { font-size: .78rem; font-weight: 800; opacity: .75; }
.dinner .dw { font-weight: 900; font-size: 1.02rem; }
.dinner .btn.small { flex-shrink: 0; }

.game-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.game-tile {
  border-radius: 20px; padding: 16px 8px 13px; text-align: center;
  border: var(--border-w) solid var(--line-soft); font-family: inherit;
}
[data-theme="light"] .game-tile { border-color: #141414; }
.game-tile:active { transform: translateY(3px); box-shadow: none !important; }
.game-tile .ge { display: block; font-size: 2.5rem; margin-bottom: 4px; filter: drop-shadow(0 3px 5px rgba(0,0,0,.35)); }
.game-tile .gn { font-weight: 900; display: block; font-size: .93rem; letter-spacing: .3px; }
.game-tile .gb { font-size: .7rem; display: block; margin-top: 3px; opacity: .78; font-weight: 700; }
.game-tile.c0 { background: var(--acc); color: var(--acc-ink); box-shadow: var(--sh-acc); }
.game-tile.c1 { background: var(--pop); color: var(--pop-ink); box-shadow: var(--sh-pop); }
.game-tile.c2 { background: var(--third); color: var(--third-ink); box-shadow: var(--sh-third); }
.game-tile.c3 { background: var(--card); color: var(--ink); border-color: var(--line); box-shadow: var(--sh-plain); }

.lb-row { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-bottom: 2px solid var(--line-soft); }
[data-theme="light"] .lb-row { border-bottom-color: rgba(0,0,0,.12); }
.lb-row:last-child { border-bottom: 0; }
.lb-row .rank { width: 26px; font-weight: 900; text-align: center; font-size: 1.05rem; }
.lb-row .lbe { font-size: 1.5rem; }
.lb-row .lbn { flex: 1; font-weight: 800; }
.lb-row .lbs { font-weight: 900; font-variant-numeric: tabular-nums; color: var(--pop); }
[data-theme="light"] .lb-row .lbs { color: #141414; }
.lb-row.me { background: var(--card2); border-radius: 12px; border-bottom: 0; outline: 2px solid var(--pop); }
.lb-row .crown { margin-left: 4px; }

/* ---------- bottom nav ---------- */
.nav {
  /* Exactly as it was before all of this: pinned to the bottom of the viewport.
     The bounce that used to drag it out of place is stopped at the body now. */
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; display: flex;
  background: var(--nav-bg);
  border-top: var(--border-w) solid var(--line);
  /* The home-indicator inset is CAPPED, not taken whole.
     iOS reports 34px at the bottom of this phone, and adding all of it put a
     visible band of dead space under the icons — the bar was eating more of the
     screen than it needs to. 16px clears the indicator without the icons
     floating halfway up their own bar. */
  padding: 3px 0 max(8px, min(env(safe-area-inset-bottom, 0px), 16px));
  z-index: 40;
}
.nav button { flex: 1; color: var(--mut); font-size: .68rem; font-weight: 900; padding: 3px 0; font-family: inherit; }
.nav button .ni { display: block; font-size: 1.3rem; margin-bottom: 1px; }
.nav button.on { color: var(--pop); }
[data-theme="light"] .nav button.on { color: #141414; opacity: 1; }

/* ---------- round play ---------- */
.round-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.round-head .score { margin-left: auto; font-weight: 900; font-size: 1.15rem; font-variant-numeric: tabular-nums; color: var(--pop); }
[data-theme="light"] .round-head .score { color: #141414; }
.round-head .rtimer { font-size: .72rem; color: var(--mut); font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 800; }
.dots { display: flex; gap: 5px; flex: 1; }
.dots span, .dots button { flex: 1; height: 8px; padding: 0; border-radius: 99px; background: var(--card); border: 2px solid var(--line-soft); }
.dots .done-right { background: var(--pop); border-color: var(--pop); }
.dots .done-wrong { background: var(--warn); border-color: var(--warn); }
.dots .now { background: var(--acc); border-color: var(--acc); }
/* An answered dot can be tapped to look back at that question. The bar is 8px
   tall, which no thumb can hit, so a pseudo-element gives it a ~32px target
   without changing the layout of the header. */
.dots button { position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.dots button::before { content: ''; position: absolute; inset: -12px 0; }
.dots button:active { transform: scaleY(1.7); }

/* the look-back panel */
.rev-media { text-align: center; margin: 4px 0 12px; }
.rev-media img, .rev-media svg { max-height: 130px; max-width: 100%; border-radius: 12px; border: 2px solid var(--line); }
.rev-line { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--line); margin-top: 8px; font-weight: 800; }
.rev-line.ok { background: color-mix(in srgb, var(--pop) 22%, transparent); }
.rev-line.no { background: color-mix(in srgb, var(--warn) 22%, transparent); }
.rev-lab { font-size: .7rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; opacity: .7; flex: 0 0 auto; }

/* The last-five-seconds countdown. Hidden until then, so most of a question is
   played without a clock draining in the corner. */
.qcount {
  min-width: 26px; text-align: center; font-weight: 900; font-size: .95rem;
  padding: 1px 7px; border-radius: 999px; border: 2px solid var(--line);
  background: var(--card); margin-right: 4px;
}
.qcount.urgent { background: var(--warn); border-color: var(--warn); animation: qpulse .5s ease-in-out infinite alternate; }
@keyframes qpulse { from { transform: scale(1); } to { transform: scale(1.14); } }
@media (prefers-reduced-motion: reduce) { .qcount.urgent { animation: none; } }

/* the clean-sweep bonus on the results screen */
.perfect {
  margin: 10px 0 0; padding: 10px 14px; border-radius: 14px; text-align: center;
  font-weight: 900; border: var(--border-w) solid var(--line);
  background: var(--pop); color: #141414;
}

.qwrap { flex: 1; display: flex; flex-direction: column; }
.prompt { text-align: center; font-weight: 900; font-size: 1.1rem; margin: 6px 0 12px; min-height: 2.4em; display: flex; align-items: center; justify-content: center; }
.pts-chip { text-align: center; margin-bottom: 8px; }
.pts-chip span { background: var(--card); border: 2px solid var(--line); padding: 4px 13px; border-radius: 999px; font-size: .76rem; font-weight: 900; display: inline-block; }

/* swipe card */
.swipe-zone { flex: 1; display: flex; align-items: stretch; gap: 6px; min-height: 300px; }
.side-opt {
  width: 86px; display: flex; align-items: center; justify-content: center; text-align: center;
  border-radius: 18px; font-weight: 900; font-size: .95rem; padding: 8px;
  background: var(--card); border: 2.5px dashed var(--line);
  transition: background .15s, border-color .15s, transform .15s;
  word-break: break-word;
}
.side-opt.glow-l, .side-opt.glow-r { background: var(--pop); color: var(--pop-ink); border-color: var(--pop); border-style: solid; transform: scale(1.05); }
.card-arena { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; }
.play-card {
  position: absolute; inset: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #fff; color: #141414; border-radius: 24px;
  border: var(--border-w) solid var(--line-soft);
  box-shadow: 0 12px 30px rgba(0,0,0,.45); touch-action: none;
  will-change: transform;
}
[data-theme="light"] .play-card { border-color: #141414; box-shadow: 6px 6px 0 #141414; }
.play-card .flag { font-size: 6rem; line-height: 1; }
.play-card .cap-country { font-size: 1.5rem; font-weight: 900; text-align: center; padding: 0 12px; margin-top: 10px; }
.play-card .hint { position: absolute; bottom: 12px; left: 0; width: 100%; text-align: center; font-size: .74rem; color: #8b46f0; font-weight: 800; opacity: .75; }
.play-card.anim { transition: transform .25s ease-out, opacity .25s; }

/* tap options */
.media-box { text-align: center; margin-bottom: 14px; }
.media-box img {
  max-width: 100%; max-height: 34dvh; border-radius: 18px;
  border: var(--border-w) solid var(--line-soft);
  box-shadow: 0 10px 24px rgba(0,0,0,.4); object-fit: cover;
}
[data-theme="light"] .media-box img { border-color: #141414; box-shadow: 6px 6px 0 #141414; }
.media-box .big-emoji { font-size: 6rem; line-height: 1.2; display: block; filter: drop-shadow(0 8px 14px rgba(0,0,0,.35)); }
/* A photo that hasn't arrived yet: hold its space and show a shimmer, so the
   question never reads as "there is no picture". Normally unused — the round
   preloads its photos — but a weak connection can still outlast the budget. */
.media-box.photo-wait {
  min-height: 34dvh; border-radius: 18px;
  border: var(--border-w) solid var(--line-soft);
  background: linear-gradient(100deg, rgba(255,255,255,.05) 30%, rgba(255,255,255,.14) 50%, rgba(255,255,255,.05) 70%);
  background-size: 300% 100%; animation: photoShimmer 1.3s ease-in-out infinite;
}
[data-theme="light"] .media-box.photo-wait {
  border-color: #141414; box-shadow: 6px 6px 0 #141414;
  background-image: linear-gradient(100deg, rgba(0,0,0,.05) 30%, rgba(0,0,0,.12) 50%, rgba(0,0,0,.05) 70%);
}
.media-box.photo-wait img { opacity: 0; }
@keyframes photoShimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
@media (prefers-reduced-motion: reduce) { .media-box.photo-wait { animation: none; } }
.map-box { background: #bfdbfe; border-radius: 18px; overflow: hidden; border: var(--border-w) solid var(--line-soft); box-shadow: 0 10px 24px rgba(0,0,0,.4); }
[data-theme="light"] .map-box { border-color: #141414; box-shadow: 6px 6px 0 #141414; }
.map-box svg { display: block; width: 100%; height: 32dvh; }
/* NZ is portrait, so it needs more height to stay readable */
.map-box.nz { background: #cfe3ff; }
.map-box.nz svg { height: 42dvh; }
.map-tools { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.map-tools button:disabled { opacity: .35; }
.opts { display: grid; gap: 11px; margin-top: auto; }
.opt-btn {
  padding: 14px 16px; border-radius: 16px; background: #fff; color: #141414;
  border: var(--border-w) solid var(--line-soft);
  font-weight: 900; font-size: 1rem; text-align: center; font-family: inherit;
  box-shadow: 0 4px 0 rgba(0,0,0,.35);
}
[data-theme="light"] .opt-btn { border-color: #141414; box-shadow: 4px 4px 0 #141414; }
.opt-btn:active { transform: translateY(3px); box-shadow: none; }
.opt-btn.right { background: var(--ok); color: #04220f; }
.opt-btn.wrong { background: var(--warn); color: #fff; }
.opt-btn.reveal { outline: 4px solid var(--ok); }
.opt-btn:disabled { opacity: .92; }

.reveal-toast {
  position: fixed; left: 0; right: 0; margin-inline: auto; bottom: 34%;
  background: linear-gradient(135deg, #15803d, #166534); color: #fff;
  border: 3px solid #4ade80;
  padding: 18px 24px; border-radius: 20px; font-size: 1.15rem; z-index: 60;
  display: none; text-align: center; line-height: 1.4; font-weight: 800;
  width: max-content; max-width: 88vw;
  box-shadow: 0 10px 34px rgba(0,0,0,.6);
  animation: pop .35s ease-out;
}
.reveal-toast b { display: block; font-size: 1.55rem; margin-top: 4px; color: #bbf7d0; }
/* The reason behind the answer — quieter than the answer itself, and sized to
   read as a sentence rather than a headline. */
.reveal-toast .rt-why {
  display: block; margin-top: 8px; font-size: .95rem; font-weight: 700;
  line-height: 1.45; color: #dcfce7; max-width: 30ch; margin-inline: auto;
}
/* The verdict line when the card waits for Next: tick + points, or cross. */
.reveal-toast .rt-head { font-size: 1.3rem; font-weight: 900; margin-bottom: 6px; }
.reveal-toast .rt-head .rt-pts {
  display: inline-block; margin-left: 6px; padding: 2px 12px; border-radius: 999px;
  background: #D9E94B; color: #111; font-size: 1rem; vertical-align: middle;
}
.reveal-toast.is-wrong { background: linear-gradient(135deg, #9f1239, #881337); border-color: #fb7185; }
.reveal-toast.is-wrong b { color: #fecdd3; }
.reveal-toast.is-wrong .rt-why { color: #ffe4e6; }
/* Next, when the reveal waits for the player instead of a timer. */
.reveal-toast .rt-next {
  display: block; margin: 14px auto 0; padding: 12px 26px; border-radius: 999px;
  background: #D9E94B; color: #111; border: 3px solid #111; font: inherit;
  font-weight: 900; font-size: 1.05rem; cursor: pointer;
  box-shadow: 4px 4px 0 #111; -webkit-tap-highlight-color: transparent;
}
.reveal-toast .rt-next:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 #111; }
.feedback { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; pointer-events: none; z-index: 50; }
.feedback span { font-size: 5rem; filter: drop-shadow(0 6px 18px rgba(0,0,0,.4)); animation: pop .5s ease-out; }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }

/* spelling bee */
.gap-word { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin: 14px 0; }
.gslot {
  min-width: 34px; height: 44px; border-radius: 10px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 900;
  background: var(--card); border: 2.5px dashed var(--line); padding: 0 4px;
}
.gslot.fixed { border-style: solid; border-color: transparent; background: var(--card2); }
.gslot.filled { border-style: solid; border-color: var(--pop); background: var(--card2); color: var(--pop); }
[data-theme="light"] .gslot.filled { color: #141414; background: #f7fbd2; }
.letter-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ltile {
  min-width: 48px; height: 52px; border-radius: 12px; font-size: 1.5rem; font-weight: 900;
  background: #fff; color: #141414; border: var(--border-w) solid var(--line-soft);
  box-shadow: 0 4px 0 rgba(0,0,0,.35); font-family: inherit;
}
[data-theme="light"] .ltile { border-color: #141414; box-shadow: 3px 3px 0 #141414; }
.ltile:disabled { opacity: .25; }
.ltile:active { transform: translateY(3px); box-shadow: none; }

/* results */
.result-hero { text-align: center; padding: 26px 0 10px; }
.result-hero .rs { font-size: 3.4rem; font-weight: 900; color: var(--pop); }
[data-theme="light"] .result-hero .rs { color: #141414; }
.result-hero .re { font-size: 3rem; }
.stat-row { display: flex; gap: 10px; margin: 16px 0; }
.stat { flex: 1; text-align: center; background: var(--card); border: var(--border-w) solid var(--line); border-radius: 16px; padding: 12px 6px; box-shadow: var(--sh-plain); }
.stat .sv { font-weight: 900; font-size: 1.3rem; }
.stat .sl { font-size: .7rem; color: var(--mut); margin-top: 2px; font-weight: 800; }
.warmup-chip {
  align-self: center; margin: -2px 0 8px; padding: 6px 13px; border-radius: 14px;
  background: var(--card2); color: var(--ink); border: 2px solid var(--line);
  font-size: .72rem; font-weight: 800; text-align: center; max-width: 92%;
}
[data-theme="light"] .warmup-chip { border-color: #141414; }

.again-chip {
  align-self: center; margin: -4px 0 8px; padding: 5px 12px; border-radius: 999px;
  background: var(--third); color: var(--third-ink);
  border: 2px solid var(--line-soft); font-size: .74rem; font-weight: 900;
}
[data-theme="light"] .warmup-chip {
  align-self: center; margin: -2px 0 8px; padding: 6px 13px; border-radius: 14px;
  background: var(--card2); color: var(--ink); border: 2px solid var(--line);
  font-size: .72rem; font-weight: 800; text-align: center; max-width: 92%;
}
[data-theme="light"] .warmup-chip { border-color: #141414; }

.again-chip { border-color: #141414; }

.crownup {
  background: linear-gradient(135deg, #f59e0b, #f7c948); color: #2b1a00;
  border: var(--border-w) solid var(--line-soft); border-radius: 18px; padding: 14px;
  text-align: center; font-weight: 900; font-size: 1.15rem; margin-bottom: 14px;
  animation: pop .6s; box-shadow: 0 5px 0 #b45309;
}
.crownup span { display: block; font-size: .82rem; font-weight: 700; margin-top: 4px; opacity: .85; }
[data-theme="light"] .crownup { border-color: #141414; box-shadow: 4px 4px 0 #141414; }
.levelup { background: var(--pop); color: var(--pop-ink); border: var(--border-w) solid var(--line-soft); border-radius: 18px; padding: 14px; text-align: center; font-weight: 900; margin-bottom: 14px; animation: pop .6s; box-shadow: var(--sh-pop); }
[data-theme="light"] .levelup { border-color: #141414; }

/* leaderboard */
.tabs { display: flex; gap: 5px; background: var(--card); border: var(--border-w) solid var(--line); border-radius: 16px; padding: 5px; margin-bottom: 14px; box-shadow: var(--sh-plain); }
.tabs button { flex: 1; padding: 9px 2px; border-radius: 11px; color: var(--mut); font-weight: 900; font-size: .86rem; font-family: inherit; }
.tabs button.on { background: var(--acc); color: var(--acc-ink); }
[data-theme="light"] .tabs button.on { border: 2.5px solid #141414; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 18px 0 8px; }
.podium .p { text-align: center; flex: 1; max-width: 110px; }
.podium .pe { font-size: 2.4rem; }
.podium .pp { border-radius: 14px 14px 0 0; background: var(--card); border: var(--border-w) solid var(--line-soft); border-bottom: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding: 8px 4px; font-weight: 900; }
[data-theme="light"] .podium .pp { border-color: #141414; }
.podium .p1 .pp { height: 92px; background: var(--pop); color: var(--pop-ink); }
.podium .p2 .pp { height: 66px; background: var(--acc); color: var(--acc-ink); }
.podium .p3 .pp { height: 48px; background: var(--third); color: var(--third-ink); }
.podium .pn { font-size: .8rem; font-weight: 900; margin-top: 6px; }

/* admin */
.admin-user { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 2px solid var(--line-soft); }
[data-theme="light"] .admin-user { border-bottom-color: rgba(0,0,0,.12); }
.admin-user:last-child { border-bottom: 0; }
.admin-user .aue { font-size: 1.7rem; }
.admin-user .aun { flex: 1; font-weight: 800; }
.admin-user .aun small { display: block; color: var(--mut); font-weight: 600; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.pill { padding: 8px 14px; border-radius: 999px; background: var(--card2); border: 2px solid var(--line); color: var(--ink); font-weight: 900; font-size: .84rem; font-family: inherit; }
.pill.on { background: var(--pop); color: var(--pop-ink); border-color: var(--pop-deep); }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.72); display: none; align-items: flex-end; justify-content: center; z-index: 90; }
.modal-bg.show { display: flex; }
.modal { background: var(--bg1); border-top: var(--border-w) solid var(--line); width: 100%; max-width: 480px; border-radius: 24px 24px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom, 0px)); max-height: 86dvh; overflow-y: auto; }
.emoji-pick { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-bottom: 12px; }
.emoji-pick button { font-size: 1.6rem; background: var(--card); border: 2px solid var(--line-soft); border-radius: 10px; padding: 6px 0; }
.emoji-pick button.on { background: var(--pop); border-color: var(--pop-deep); }

/* theme picker — one card per scheme, previewing its real colours */
.theme-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0; }
.theme-dot {
  position: relative; border-radius: 16px; border: 3px solid var(--line);
  padding: 12px 6px 9px; font-family: inherit; font-weight: 900; font-size: .72rem;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.theme-dot .tswatch { display: flex; gap: 4px; }
.theme-dot .tswatch b { width: 15px; height: 15px; border-radius: 99px; display: block; }
.theme-dot .tname { line-height: 1.15; }
/* the tick sits over the card so selection never reflows the row */
.theme-dot i {
  position: absolute; top: -8px; right: -6px; width: 22px; height: 22px; border-radius: 99px;
  background: var(--pop); color: var(--pop-ink); font-style: normal; font-size: .8rem;
  display: none; align-items: center; justify-content: center; border: 2px solid var(--bg0);
}
.theme-dot.on { border-color: var(--pop); }
.theme-dot.on i { display: flex; }
.theme-dot.td-darklime { background: #0d0b14; color: #f3f0ff; }
.theme-dot.td-darkorange { background: #0d0a12; color: #f3f0ff; }
.theme-dot.td-light { background: #fffdf6; color: #141414; }

/* school typeahead */
.school-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-height: 300px; overflow-y: auto; }
.school-row {
  text-align: left; padding: 10px 12px; border-radius: 12px;
  background: var(--card); border: 2px solid var(--line-soft);
  color: var(--ink); font-size: .9rem; line-height: 1.3; font-weight: 700; font-family: inherit;
}
.school-row:active { background: var(--card2); }
.school-row b { display: block; }
.school-picked {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  background: var(--card2); border: 2.5px solid var(--ok); border-radius: 14px;
  padding: 10px 12px; line-height: 1.35;
}

/* join wizard */
.wiz-dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
.wiz-dots span { width: 32px; height: 8px; border-radius: 99px; background: var(--card); border: 2px solid var(--line-soft); }
.wiz-dots span.done { background: var(--ok); border-color: var(--ok); }
.wiz-dots span.now { background: var(--pop); border-color: var(--pop); }

/* avatar studio (parked) */
.av { display: inline-block; vertical-align: middle; }
.coin-chip { background: var(--card2); border: 2px solid var(--pop); color: var(--pop); border-radius: 999px; padding: 2px 10px; font-size: .76rem; font-weight: 900; white-space: nowrap; }
.studio-preview { text-align: center; padding: 8px 0 14px; }
.studio-tabs { flex-wrap: wrap; }
.studio-tabs button { min-width: 23%; font-size: .78rem; padding: 8px 2px; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 8px; }
.swatch { aspect-ratio: 1; border-radius: 12px; border: 3px solid transparent; position: relative; }
.swatch.on { border-color: var(--pop); }
.swatch.locked { opacity: .75; }
.swatch small { position: absolute; bottom: 2px; right: 4px; color: #fff; font-weight: 800; font-size: .6rem; text-shadow: 0 1px 2px #000; }
.pet-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.pet-btn { background: var(--card); border-radius: 14px; padding: 8px 2px; font-size: 1.6rem; border: 3px solid transparent; }
.pet-btn.on { border-color: var(--pop); }
.pet-btn small { display: block; font-size: .62rem; color: var(--pop); font-weight: 700; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden; }
.confetti i { position: absolute; top: -5%; font-size: 1.4rem; font-style: normal; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

.spin { text-align: center; padding: 40px 0; color: var(--mut); font-weight: 800; }

.help p { line-height: 1.5; font-size: .92rem; }
.help h2 { margin-bottom: 6px; color: var(--pop); }
[data-theme="light"] .help h2 { color: #141414; }

/* ---------- awards: a wall of collectable badges ---------- */
.aw-head {
  display: flex; align-items: center; gap: 8px;
  font-weight: 900; font-size: 1rem; margin: 18px 0 8px;
}
.aw-count {
  margin-left: auto; font-size: .78rem; font-weight: 900;
  background: var(--card2); border: 2px solid var(--line-soft);
  border-radius: 99px; padding: 1px 10px;
}
[data-theme="light"] .aw-count { border-color: #141414; }
.aw-wall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.aw-badge {
  border-radius: 16px; padding: 9px 6px 8px; text-align: center;
  border: var(--border-w) solid var(--line-soft);
  background: var(--card); box-shadow: var(--sh-plain);
  animation: awpop .32s cubic-bezier(.2,.9,.3,1.45) both;
}
[data-theme="light"] .aw-badge { border-color: #141414; box-shadow: 3px 3px 0 #141414; }
@keyframes awpop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .aw-badge { animation: none; } }
.aw-badge .aw-top { position: relative; line-height: 1; }
.aw-badge .aw-p { font-size: 1.75rem; display: block; }
/* the scope rides on the shoulder of the medal, like a pin on a rosette */
.aw-badge .aw-s { position: absolute; right: -2px; bottom: -4px; font-size: .95rem; }
.aw-badge .aw-when { font-weight: 900; font-size: .82rem; margin-top: 5px; }
.aw-badge .aw-where { font-size: .62rem; opacity: .75; line-height: 1.2; margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* one tint per scope, so rarity is visible before you read anything */
.aw-badge.aw-gold   { background: linear-gradient(160deg, #6b5300, #3d2f00); }
.aw-badge.aw-purple { background: linear-gradient(160deg, #4c2f8a, #2b1a4f); }
.aw-badge.aw-teal   { background: linear-gradient(160deg, #0f5f57, #083733); }
.aw-badge.aw-pink   { background: linear-gradient(160deg, #7a2352, #47142f); }
.aw-badge.aw-lime   { background: linear-gradient(160deg, #4a5c10, #2b360a); }
[data-theme="light"] .aw-badge.aw-gold   { background: #ffe27a; }
[data-theme="light"] .aw-badge.aw-purple { background: #d9c7ff; }
[data-theme="light"] .aw-badge.aw-teal   { background: #a9ecdf; }
[data-theme="light"] .aw-badge.aw-pink   { background: #ffc2de; }
[data-theme="light"] .aw-badge.aw-lime   { background: #e2f393; }
[data-theme="light"] .aw-badge { color: #141414; }
.aw-badge.aw-empty {
  background: transparent; border-style: dashed; opacity: .5; box-shadow: none;
}
.aw-link { display: block; width: 100%; margin-bottom: 12px; }

/* Spelling Bee keypad — replaces the phone keyboard (and its dictation mic). */
.keypad { margin: 8px 0 10px; user-select: none; -webkit-user-select: none; }
.kp-row { display: flex; justify-content: center; gap: 5px; margin-bottom: 6px; }
.kp {
  flex: 0 1 9.2%; min-width: 0; height: 44px; padding: 0; border-radius: 10px;
  border: 3px solid #111; background: #fff; font: inherit; font-weight: 900; font-size: 1.05rem;
  text-transform: uppercase; box-shadow: 3px 3px 0 #111; cursor: pointer; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.kp:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #111; }
.kp-wide { flex-basis: 19%; background: #D9E94B; }
