/* liddat.com's own copies of the fonts (shared/fonts), with size-matched fallbacks so nothing shifts when they load */
@font-face { font-family: 'Fredoka'; font-weight: 400 700; font-display: swap; src: url(/shared/fonts/fredoka-v17.woff2) format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 500 900; font-display: swap; src: url(/shared/fonts/nunito-v32.woff2) format('woff2'); }
@font-face { font-family: 'Fredoka fallback'; src: local('Arial'), local('ArialMT'); size-adjust: 102%; ascent-override: 95.5%; descent-override: 23.1%; line-gap-override: 0%; }
@font-face { font-family: 'Nunito fallback'; src: local('Arial'), local('ArialMT'); size-adjust: 98.1%; ascent-override: 103.1%; descent-override: 36%; line-gap-override: 0%; }

:root {
  --pink: #ff4d8d; --orange: #ff9f1c; --yellow: #ffd166; --teal: #06d6a0; --blue: #4cc9f0; --purple: #9b5de5;
  --ink: #1b1b3a; --paper: #fffaf3; --water: #a8e4ff; --land: #fff8e7;
  --shadow: 0 10px 0 rgba(27, 27, 58, .18);
  --radius: 22px;
  --font: 'Fredoka', 'Fredoka fallback', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--ink); -webkit-font-smoothing: antialiased;
  background: linear-gradient(135deg, #ff4d8d 0%, #ff9f1c 35%, #ffd166 55%, #06d6a0 80%, #4cc9f0 100%);
  background-attachment: fixed; min-height: 100%;
}
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .25;
  background-image: radial-gradient(circle at 20% 20%, #fff 0 2px, transparent 3px), radial-gradient(circle at 80% 60%, #fff 0 2px, transparent 3px), radial-gradient(circle at 50% 90%, #fff 0 2px, transparent 3px);
  background-size: 180px 180px, 240px 240px, 300px 300px;
}
button { font-family: inherit; cursor: pointer; }
.screen { display: none; position: relative; z-index: 1; min-height: 100vh; }
.screen.active { display: block; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

/* ---------- Home ---------- */
#screen-home { padding: 24px 16px 60px; max-width: 1100px; margin: 0 auto; }
.hero { text-align: center; padding: 20px 0 10px; }
.logo { display: inline-flex; align-items: center; gap: 10px; transform: rotate(-2deg); }
.logo .pin { font-size: 56px; animation: bob 2.4s ease-in-out infinite; display: inline-block; filter: drop-shadow(0 6px 0 rgba(0,0,0,.2)); }
.logo h1 { margin: 0; font-size: clamp(48px, 10vw, 96px); font-weight: 700; letter-spacing: -2px; color: #fff; text-shadow: 0 6px 0 var(--ink), 0 12px 24px rgba(0,0,0,.25); line-height: .95; }
.logo h1 .lid { color: var(--yellow); }
.tag { font-size: clamp(18px, 3vw, 24px); color: #fff; font-weight: 500; text-shadow: 0 2px 0 rgba(0,0,0,.25); margin: 14px auto 0; max-width: 620px; }
.tag em { font-style: normal; color: var(--yellow); font-weight: 700; }
.stats-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.stat { background: rgba(255,255,255,.85); border-radius: 999px; padding: 6px 14px; font-weight: 600; font-size: 14px; box-shadow: 0 3px 0 rgba(27,27,58,.15); }
.section-title { text-align: center; color: #fff; font-size: 26px; margin: 30px 0 14px; text-shadow: 0 3px 0 rgba(0,0,0,.25); }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
/* app.js draws the stats and the grid at the end of the page's scripts: until then hold the stats' row and the level
   chip's (shared/xp.js), and leave the Questions and footer out, so they appear below the grid instead of being shoved
   down it (a layout shift) */
.stats-row:empty { min-height: 32px; }
.xp-where { min-height: 50px; margin-bottom: 10px; } /* margin as shared/xp.css gives it, there before xp.css loads */
.theme-grid:empty ~ .faq, .theme-grid:empty ~ .foot { display: none; }
.theme-card {
  position: relative; background: var(--paper); border: 4px solid var(--ink); border-radius: var(--radius); padding: 18px 14px 14px; text-align: left;
  box-shadow: var(--shadow); transition: transform .12s ease, box-shadow .12s ease; overflow: hidden; min-height: 160px; display: flex; flex-direction: column; gap: 6px;
}
.theme-card:hover, .theme-card:focus-visible { transform: translateY(-4px) rotate(-1deg); box-shadow: 0 14px 0 rgba(27,27,58,.18); outline: none; }
.theme-card:active { transform: translateY(4px); box-shadow: 0 4px 0 rgba(27,27,58,.18); }
.theme-card .emoji { font-size: 44px; line-height: 1; filter: drop-shadow(0 3px 0 rgba(0,0,0,.15)); }
.theme-card .name { font-size: 20px; font-weight: 700; color: var(--ink); }
.theme-card .blurb { font-size: 13px; color: #555; font-family: 'Nunito', 'Nunito fallback', sans-serif; font-weight: 600; flex: 1; }
.theme-card .meta { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: #666; margin-top: 4px; }
.theme-card .best { color: var(--ink); background: var(--yellow); border-radius: 999px; padding: 1px 8px; }
.theme-card::after { content: ''; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--c, var(--pink)); opacity: .9; z-index: 0; }
.theme-card > * { position: relative; z-index: 1; }
.theme-card.daily { background: var(--ink); color: #fff; border-color: var(--yellow); grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 16px; min-height: 0; }
.theme-card.daily .name, .theme-card.daily .blurb { color: #fff; }
.theme-card.daily .blurb { color: #ddd; }
.theme-card.daily .meta { color: #bbb; flex-direction: column; align-items: flex-end; gap: 4px; margin: 0; }
.theme-card.daily::after { background: var(--yellow); opacity: .25; }
.theme-card.daily > div:not(.emoji):not(.meta) { flex: 1; }
.theme-card.daily .emoji { font-size: 48px; }
@media (max-width: 600px) { .theme-card.daily { flex-wrap: wrap; } .theme-card.daily .blurb { display: block; font-size: 12px; } .theme-card.daily .meta { flex-direction: row; width: 100%; justify-content: space-between; } }
.theme-card.new .emoji::after { content: 'NEW'; font-size: 10px; font-weight: 900; background: var(--pink); color: #fff; border-radius: 6px; padding: 2px 5px; margin-left: 6px; vertical-align: top; }
@media (max-width: 600px) {
  .theme-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .theme-card { min-height: 0; padding: 12px 10px 10px; border-width: 3px; }
  .theme-card .emoji { font-size: 34px; }
  .theme-card .name { font-size: 17px; }
  .theme-card .blurb { display: none; }
  .theme-card::after { width: 60px; height: 60px; right: -20px; top: -20px; }
  .diff-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .diff-card .d-desc { min-height: 0; }
  .diff-card .d-preview { height: 54px; }
}
.faq { max-width: 760px; margin: 40px auto 0; background: var(--paper); border: 4px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.faq h2 { margin: 0 0 6px; font-size: 22px; }
.faq details { border-top: 2px solid rgba(27,27,58,.12); padding: 10px 0; }
.faq details:first-of-type { border-top: 0; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq p { margin: 8px 0 0; line-height: 1.5; font-family: 'Nunito', 'Nunito fallback', sans-serif; font-weight: 600; }
.foot { text-align: center; margin-top: 40px; color: #fff; font-weight: 600; font-size: 14px; text-shadow: 0 2px 0 rgba(0,0,0,.2); }
.link { background: none; border: 0; color: #fff; font-weight: 700; text-decoration: underline; font-size: 14px; padding: 4px; }

/* ---------- Difficulty ---------- */
#screen-diff { padding: 20px 16px 60px; max-width: 1000px; margin: 0 auto; }
.back { position: absolute; left: 14px; top: 14px; background: var(--paper); border: 3px solid var(--ink); border-radius: 999px; padding: 8px 14px; font-weight: 700; box-shadow: 0 4px 0 var(--ink); z-index: 2; }
.back:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.diff-head { text-align: center; padding-top: 50px; color: #fff; }
.diff-head h2 { font-size: clamp(30px, 6vw, 48px); margin: 12px 0 4px; text-shadow: 0 4px 0 rgba(0,0,0,.25); }
.muted { opacity: .85; font-weight: 500; }
.theme-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 999px; padding: 4px 14px 4px 8px; font-weight: 700; box-shadow: 0 3px 0 var(--ink); }
.theme-chip.big { font-size: 20px; padding: 8px 20px 8px 12px; }
.diff-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-top: 22px; }
.diff-card { background: var(--paper); border: 4px solid var(--ink); border-radius: var(--radius); padding: 14px; text-align: center; box-shadow: var(--shadow); transition: transform .12s; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.diff-card:hover { transform: translateY(-4px) rotate(1deg); }
.diff-card:active { transform: translateY(4px); box-shadow: 0 4px 0 rgba(27,27,58,.18); }
.diff-card .d-emoji { font-size: 40px; }
.diff-card .d-name { font-size: 20px; font-weight: 700; }
.diff-card .d-desc { font-size: 12px; color: #555; font-family: 'Nunito', 'Nunito fallback', sans-serif; font-weight: 600; min-height: 48px; }
.diff-card .d-mult { background: var(--ink); color: var(--yellow); border-radius: 999px; padding: 2px 10px; font-weight: 700; font-size: 14px; }
.diff-card .d-preview { width: 100%; height: 70px; border-radius: 12px; border: 2px solid var(--ink); background: var(--water); overflow: hidden; position: relative; }
.diff-card .d-preview svg { width: 100%; height: 100%; display: block; }
.diff-card .d-best { font-size: 12px; color: #666; font-weight: 700; }
.rounds-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 24px; color: #fff; font-weight: 700; font-size: 18px; text-shadow: 0 2px 0 rgba(0,0,0,.2); }
.rounds-pick { display: flex; align-items: center; gap: 10px; }
.rounds-pick[hidden], .rounds-endless[hidden], .hud-btn[hidden] { display: none; }
.rounds-endless { text-align: center; max-width: 560px; font-size: 16px; }
.seg { display: inline-flex; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; background: var(--paper); box-shadow: 0 3px 0 var(--ink); }
.seg button { border: 0; background: transparent; padding: 6px 16px; font-weight: 700; font-size: 16px; color: var(--ink); }
.seg button.on { background: var(--ink); color: var(--yellow); }

/* ---------- Game ---------- */
#screen-game { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; overflow: clip; }
#map { position: absolute; inset: 0; background: var(--water); z-index: 1; cursor: crosshair; }
#map.locked { cursor: default; }
.leaflet-container { font-family: var(--font); background: var(--water); }
/* Tourist zoomed in (and every reveal): OneMap's street map shows through our land, town and reservoir fills */
.z-tiles path.fill { fill-opacity: 0; stroke-opacity: .35; }
.leaflet-control-attribution { font-size: 10px; border-radius: 8px 8px 0 0; }
.leaflet-top.leaflet-right { top: 58px; }
.leaflet-bar { border: 3px solid var(--ink) !important; border-radius: 12px !important; box-shadow: 0 3px 0 var(--ink) !important; overflow: hidden; }
.leaflet-bar a { background: var(--paper) !important; color: var(--ink) !important; font-weight: 700; border-bottom-color: var(--ink) !important; }
.hud { position: absolute; top: 0; left: 0; right: 0; z-index: 5; display: flex; justify-content: space-between; align-items: flex-start; padding: 10px 12px; pointer-events: none; gap: 8px; }
.hud > * { pointer-events: auto; }
.hud-left, .hud-right { display: flex; align-items: center; gap: 8px; }
.hud-btn { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--ink); background: var(--paper); font-size: 18px; font-weight: 700; box-shadow: 0 3px 0 var(--ink); display: grid; place-items: center; }
.hud-btn:active { transform: translateY(3px); box-shadow: none; }
.hud-mid span { display: inline-block; background: var(--ink); color: #fff; border-radius: 999px; padding: 8px 16px; font-weight: 700; box-shadow: 0 3px 0 rgba(0,0,0,.3); white-space: nowrap; }
.score-pill { background: var(--yellow); border: 3px solid var(--ink); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 18px; box-shadow: 0 3px 0 var(--ink); }
.score-pill.bump { animation: bump .35s ease; }
.qcard {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(680px, calc(100% - 24px)); z-index: 6;
  background: var(--paper); border: 4px solid var(--ink); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .2s;
}
.qcard.hidden { transform: translate(-50%, 140%); opacity: 0; pointer-events: none; }
.qcard-top { display: flex; gap: 8px; justify-content: space-between; margin-bottom: 6px; }
.diff-chip, .mult-chip { font-size: 12px; font-weight: 800; border-radius: 999px; padding: 2px 10px; background: var(--ink); color: #fff; }
.mult-chip { background: var(--teal); color: var(--ink); }
.zoom-chip { font-size: 12px; font-weight: 800; border-radius: 999px; padding: 2px 10px; background: var(--orange); color: var(--ink); margin-left: auto; }
.qtext { font-size: clamp(17px, 2.6vw, 22px); font-weight: 600; margin: 4px 0 10px; line-height: 1.3; }
.qactions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hint { font-size: 14px; color: #666; font-weight: 600; font-family: 'Nunito', 'Nunito fallback', sans-serif; }
.cta { background: var(--pink); color: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 10px 22px; font-size: 18px; font-weight: 700; box-shadow: 0 5px 0 var(--ink); transition: transform .1s, box-shadow .1s, filter .2s; }
.cta:hover { filter: brightness(1.08); }
.cta:active { transform: translateY(5px); box-shadow: none; }
.cta:disabled { background: #ccc; color: #777; cursor: not-allowed; filter: none; }
.cta.alt { background: var(--blue); color: var(--ink); }
.cta.ghost { background: var(--paper); color: var(--ink); }
.cta.ready { animation: wiggle .6s ease infinite; }
.qbtns { display: flex; gap: 8px; align-items: center; }
.cta.small-cta { font-size: 14px; padding: 8px 12px; }
.cta.used { background: #eee; color: #999; cursor: default; }
.hint-area { stroke: #ff4d8d; stroke-width: 4; stroke-dasharray: 10 6; fill: #ff4d8d; fill-opacity: .18; animation: hintpulse 1.2s ease-in-out infinite; }
@keyframes hintpulse { 0%, 100% { fill-opacity: .12; } 50% { fill-opacity: .3; } }
.lbl.hintlbl { font-size: 14px; color: #ff4d8d; text-transform: uppercase; letter-spacing: 1px; text-shadow: 0 0 4px #fff, 0 0 4px #fff, 0 2px 0 #fff; }
.reveal { position: absolute; left: 50%; bottom: 18px; transform: translate(-50%, 160%); width: min(640px, calc(100% - 24px)); z-index: 7; transition: transform .45s cubic-bezier(.34,1.56,.64,1); }
.reveal.show { transform: translate(-50%, 0); }
.reveal-inner { background: var(--paper); border: 4px solid var(--ink); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); text-align: center; }
.reveal-grade { font-size: clamp(22px, 5vw, 34px); font-weight: 700; }
.reveal-pts { font-size: clamp(44px, 9vw, 64px); font-weight: 700; color: var(--pink); line-height: 1; text-shadow: 0 4px 0 var(--ink); margin: 6px 0; }
.reveal-pts small { font-size: 18px; color: var(--ink); text-shadow: none; }
.reveal-dist { font-weight: 700; font-size: 16px; color: #555; }
.reveal-answer { margin-top: 8px; font-size: 18px; }
.reveal-fact { font-family: 'Nunito', 'Nunito fallback', sans-serif; font-weight: 600; color: #444; font-size: 15px; margin: 8px 0 14px; line-height: 1.4; }
.legend { position: absolute; left: 12px; top: 62px; z-index: 4; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.legend span { background: rgba(255,250,243,.9); border: 2px solid var(--ink); border-radius: 8px; padding: 2px 8px; font-size: 11px; font-weight: 700; }
.legend i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }
/* desktop: cards sit in the bottom-right corner so the island stays visible (breakpoint mirrors DESKTOP in app.js) */
@media (min-width: 900px) and (min-height: 520px) {
  .qcard, .reveal { left: auto; right: 18px; width: 440px; }
  .qcard { transform: none; }
  .qcard.hidden { transform: translateY(140%); }
  .reveal { transform: translateY(160%); }
  .reveal.show { transform: none; }
  .qtext { font-size: 19px; }
}
@media (max-width: 720px) { .legend { display: none; } .hud-mid span { padding: 6px 10px; font-size: 14px; } }

/* map labels */
.lbl { font-family: var(--font); font-weight: 700; color: #6b4a1f; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; white-space: nowrap; pointer-events: none; text-align: center; }
.lbl.area { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: #7a5a2a; opacity: .85; }
.lbl.stn { font-size: 10px; color: #333; font-weight: 600; }
.lbl.water { font-size: 10px; color: #2b6cb0; font-style: italic; }
.lbl.road { font-size: 10px; background: #ffd166; color: var(--ink); border: 1.5px solid var(--ink); border-radius: 6px; padding: 0 5px; text-shadow: none; }
.guess-pin { display: block; filter: drop-shadow(0 3px 1px rgba(0,0,0,.3)); transform: translate(-50%, -100%); transform-origin: 50% 100%; animation: drop .35s cubic-bezier(.34,1.56,.64,1); }
.answer-pin { display: block; filter: drop-shadow(0 3px 1px rgba(0,0,0,.3)); transform: translate(-50%, -50%); animation: pop .45s cubic-bezier(.34,1.56,.64,1); }
.dist-label { background: var(--ink); color: #fff; border-radius: 999px; padding: 2px 10px; font-weight: 700; font-size: 13px; white-space: nowrap; box-shadow: 0 2px 0 rgba(0,0,0,.3); }

/* ---------- Results ---------- */
#screen-results { display: none; padding: 24px 16px 60px; }
#screen-results.active { display: flex; align-items: center; justify-content: center; }
.results-card { background: var(--paper); border: 4px solid var(--ink); border-radius: 28px; padding: 26px 22px; width: min(560px, 100%); text-align: center; box-shadow: var(--shadow); }
.results-rank { font-size: 72px; line-height: 1; animation: bob 2s ease-in-out infinite; }
.results-card h2 { font-size: clamp(28px, 6vw, 40px); margin: 8px 0 2px; }
.results-score { font-size: clamp(48px, 10vw, 72px); font-weight: 700; color: var(--pink); text-shadow: 0 4px 0 var(--ink); line-height: 1; margin: 10px 0; }
.results-score small { font-size: 18px; color: var(--ink); text-shadow: none; }
.results-best { font-weight: 700; color: #555; min-height: 22px; }
.results-best.newbest { color: var(--ink); background: var(--yellow); display: inline-block; padding: 2px 12px; border-radius: 999px; animation: bump .5s ease; }
.results-rounds { list-style: none; padding: 0; margin: 14px 0; text-align: left; display: grid; gap: 6px; max-height: 40vh; overflow: auto; }
.results-rounds li { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 6px 10px; font-size: 14px; font-weight: 600; }
.results-rounds li .n { font-weight: 800; color: #999; }
.results-rounds li .p { font-weight: 800; color: var(--pink); }
.results-rounds li .d { font-size: 12px; color: #777; font-weight: 600; }
.results-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ---------- Leaderboard & account ---------- */
.home-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.home-actions .cta { font-size: 16px; padding: 8px 18px; }
.results-rank-line { font-weight: 700; color: var(--ink); margin-top: 6px; min-height: 20px; }
.results-rank-line .rk { background: var(--teal); border-radius: 999px; padding: 2px 10px; }
#screen-board { padding: 20px 16px 60px; }
.board-wrap { max-width: 640px; margin: 0 auto; padding-top: 46px; }
.board-title { text-align: center; color: #fff; font-size: clamp(30px, 6vw, 44px); margin: 0 0 4px; text-shadow: 0 4px 0 rgba(0,0,0,.25); }
.board-sub { text-align: center; color: #fff; margin: 0 0 14px; font-size: 14px; text-shadow: 0 2px 0 rgba(0,0,0,.2); }
.board-tabs { display: flex; flex-wrap: wrap; justify-content: center; margin: 0 auto 12px; width: fit-content; max-width: 100%; }
.board-tabs button { padding: 6px 12px; font-size: 14px; }
.board-you { text-align: center; color: var(--ink); background: var(--yellow); border: 3px solid var(--ink); border-radius: 999px; padding: 6px 16px; font-weight: 700; margin: 0 auto 12px; width: fit-content; box-shadow: 0 3px 0 var(--ink); }
.board-you:empty { display: none; }
.board-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.board-list li { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; background: var(--paper); border: 3px solid var(--ink); border-radius: 14px; padding: 8px 12px; font-weight: 700; box-shadow: 0 3px 0 rgba(27,27,58,.2); }
.board-list li.you { background: var(--yellow); }
.board-list li .rk { font-size: 18px; color: #888; text-align: center; }
.board-list li:nth-child(1) .rk, .board-list li:nth-child(2) .rk, .board-list li:nth-child(3) .rk { font-size: 22px; }
.board-list li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list li .nm small { display: block; font-size: 11px; color: #777; font-weight: 600; }
.board-list li .sc { color: var(--pink); font-size: 18px; }
.board-empty { text-align: center; color: #fff; font-weight: 700; text-shadow: 0 2px 0 rgba(0,0,0,.2); }
.board-empty:empty { display: none; }
.modal-p { font-family: 'Nunito', 'Nunito fallback', sans-serif; font-weight: 600; color: #444; line-height: 1.45; margin: 0 0 12px; }
.modal-card label { display: block; font-weight: 700; margin: 10px 0; font-size: 14px; }
.modal-card label small { color: #777; font-weight: 600; }
.modal-card input { display: block; width: 100%; margin-top: 4px; font-family: inherit; font-size: 18px; font-weight: 600; padding: 10px 12px; border: 3px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink); }
.modal-card input:focus { outline: none; box-shadow: 0 0 0 3px var(--yellow); }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.modal-actions .cta { font-size: 16px; padding: 9px 18px; }
.cta.small { font-size: 13px !important; padding: 6px 12px !important; margin-left: auto; }
.form-err { color: #d62828; font-weight: 700; font-size: 14px; min-height: 18px; margin-top: 6px; }
.link.dark { color: var(--ink); display: block; margin: 12px auto 0; font-size: 13px; }
.prof-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.prof-stats span { background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 700; }
.player-chip { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(27,27,58,.6); display: none; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal.show { display: flex; }
.modal-card { background: var(--paper); border: 4px solid var(--ink); border-radius: 24px; padding: 22px; width: min(520px, 100%); box-shadow: var(--shadow); }
.modal-card h3 { margin: 0 0 10px; font-size: 26px; }
.modal-card ol { font-family: 'Nunito', 'Nunito fallback', sans-serif; font-weight: 600; line-height: 1.5; padding-left: 20px; }

/* ---------- Animations ---------- */
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.25) rotate(-3deg); } 100% { transform: scale(1); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-2deg) scale(1.03); } 75% { transform: rotate(2deg) scale(1.03); } }
@keyframes drop { 0% { transform: translate(-50%, -300%) scale(.6); opacity: 0; } 70% { transform: translate(-50%, -95%) scale(1.1); opacity: 1; } 100% { transform: translate(-50%, -100%) scale(1); } }
@keyframes pop { 0% { transform: translate(-50%, -50%) scale(0); } 100% { transform: translate(-50%, -50%) scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.shake { animation: shake .4s ease; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* theme picker (switch theme mid-run) */
.theme-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; max-height: min(60vh, 520px); overflow-y: auto; padding: 4px 2px 6px; }
.theme-pick { display: flex; align-items: center; gap: 10px; text-align: left; background: #fff; border: 3px solid var(--ink); border-left: 10px solid var(--c, var(--pink)); border-radius: 14px; padding: 8px 10px; font-weight: 700; font-size: 15px; color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.theme-pick:active { transform: translateY(3px); box-shadow: none; }
.theme-pick.on { background: var(--yellow); }
.theme-pick .e { font-size: 22px; }
.theme-pick .n { flex: 1; }
.theme-pick .l { font-size: 12px; color: #666; white-space: nowrap; }

/* ---------- Multiplayer rooms ---------- */
.cta.duel-btn { background: #8547d6; } /* a deeper --purple, so its white text reads (5.4:1) */
.score-pill.place { background: var(--purple); color: #fff; font-size: 16px; display: flex; gap: 4px; align-items: baseline; }
.score-pill.place small { font-size: 12px; opacity: .8; }
.score-pill.place[hidden] { display: none; }
button.score-pill.place { font-family: inherit; color: #fff; cursor: pointer; }
button.score-pill.place:active { transform: translateY(3px); box-shadow: none; }
/* multiplayer: the live scoreboard under the HUD */
.duel-board { position: absolute; top: 62px; right: 12px; /* top set by placeBoard() */ z-index: 5; width: 230px; background: var(--paper); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink); padding: 6px 8px 8px; }
.duel-board[hidden] { display: none; }
.db-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #666; margin: 0 2px 4px; }
.duel-board ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; max-height: 40vh; overflow-y: auto; }
.duel-board li { display: flex; align-items: center; gap: 6px; background: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 2px 8px; font-size: 14px; }
.duel-board li.me { background: #fff0f6; }
.duel-board li.left { opacity: .5; }
.duel-board .rk { width: 14px; font-weight: 700; text-align: center; }
.duel-board i { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--ink); flex: none; }
.duel-board .nm { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duel-board .st { font-size: 13px; }
.duel-board .sc { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; line-height: 1.1; }
.duel-board .sc small { display: block; font-size: 10px; color: #2a9d8f; font-family: 'Nunito', 'Nunito fallback', sans-serif; }
@media (max-width: 720px) { .duel-board { right: 8px; width: 190px; } .duel-board li { font-size: 13px; padding: 1px 6px; } }
@media (max-width: 600px) { .hud.duel { flex-wrap: wrap; row-gap: 8px; } .hud.duel .hud-mid { flex: 1; text-align: center; } .hud.duel .hud-right { margin-left: auto; } }
.round-timer { background: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 5px 12px; font-weight: 700; font-size: 17px; box-shadow: 0 3px 0 var(--ink); font-variant-numeric: tabular-nums; min-width: 72px; text-align: center; }
.round-timer[hidden] { display: none; }
.round-timer.low { background: var(--pink); color: #fff; animation: bump .5s ease infinite; }
@media (max-width: 720px) { .score-pill { font-size: 15px; padding: 5px 10px; } .round-timer { font-size: 15px; padding: 4px 9px; min-width: 60px; } }
.q-opp { font-size: 13px; font-weight: 700; color: #2b6cb0; margin: -4px 0 8px; font-family: 'Nunito', 'Nunito fallback', sans-serif; }
.q-opp[hidden] { display: none; }
.q-opp.hot { color: #c2185b; animation: bump .4s ease; }
.guess-pin.opp { filter: drop-shadow(0 3px 1px rgba(0,0,0,.3)) saturate(1.1); }
.opp-tag { position: absolute; left: 12px; top: -46px; background: var(--blue); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; padding: 1px 8px; font-weight: 700; font-size: 12px; white-space: nowrap; box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.duel-wait {
  position: absolute; left: 50%; bottom: 18px; transform: translate(-50%, 160%); width: min(560px, calc(100% - 24px)); z-index: 7;
  background: var(--paper); border: 4px solid var(--ink); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; transition: transform .35s cubic-bezier(.34,1.56,.64,1);
}
.duel-wait.show { transform: translate(-50%, 0); }
.duel-wait .dw-lock { font-size: 30px; animation: bob 1.6s ease-in-out infinite; }
.duel-wait .dw-body { flex: 1; font-size: 16px; min-width: 180px; }
.duel-wait .dw-body span { font-family: 'Nunito', 'Nunito fallback', sans-serif; font-weight: 700; color: #555; }
@media (min-width: 900px) and (min-height: 520px) {
  .duel-wait { left: auto; right: 18px; width: 440px; transform: translateY(160%); }
  .duel-wait.show { transform: none; }
}
.round-vs { margin: 10px 0 4px; }
.round-vs[hidden] { display: none; }
.round-board { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 168px; overflow-y: auto; }
.round-board li { display: flex; align-items: center; gap: 8px; background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 3px 10px; font-size: 14px; }
.round-board li.me { background: #fff0f6; }
.round-board li:first-child { background: var(--yellow); }
.round-board i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); flex: none; }
.round-board .nm { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.round-board .d { color: #666; font-family: 'Nunito', 'Nunito fallback', sans-serif; font-weight: 700; font-size: 13px; white-space: nowrap; }
.round-board b { min-width: 52px; text-align: right; }
.vs-verdict { font-weight: 700; font-size: 17px; margin-top: 6px; }
#res-duel { display: none; }
.standings { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 6px; }
#screen-results.duel #res-duel { display: grid; }
.standings li { display: flex; align-items: center; gap: 10px; background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 6px 14px; font-size: 18px; }
.standings li.me { background: #fff0f6; box-shadow: inset 6px 0 0 var(--pink); }
.standings li.left { opacity: .55; }
.standings .rk { font-size: 22px; min-width: 30px; text-align: center; font-weight: 700; }
.standings .nm { flex: 1; font-weight: 700; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.standings .nm small { font-size: 12px; color: #777; font-family: 'Nunito', 'Nunito fallback', sans-serif; }
.standings .sc { font-size: 22px; font-weight: 700; }
#screen-results.duel .results-score, #screen-results.duel .results-best, #screen-results.duel .results-rank-line { display: none; }
.results-rounds li.duel-row .p { text-align: right; line-height: 1.1; }
.results-rounds li.duel-row .p small { display: block; color: #2b8fb8; font-size: 13px; }
.results-rounds li.duel-row.me .p { color: var(--pink); }
.results-rounds li.duel-row.me { border-left: 6px solid var(--pink); }
.results-rounds li.duel-row.them { border-left: 6px solid var(--blue); }
.results-rounds li.duel-row.them .p { color: #999; }
.modal-card select { display: block; width: 100%; margin-top: 4px; font-family: inherit; font-size: 17px; font-weight: 600; padding: 9px 10px; border: 3px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink); }
.duel-field { font-weight: 700; font-size: 14px; margin: 10px 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.duel-field .seg button { padding: 5px 10px; font-size: 15px; }
.duel-diff button span { font-size: 13px; }
@media (max-width: 520px) { .duel-diff button span { display: none; } .duel-diff button { font-size: 20px !important; } }
.code-in { text-transform: uppercase; letter-spacing: 8px; font-size: 26px !important; text-align: center; }
.duel-code { font-size: 64px; font-weight: 700; letter-spacing: 12px; text-align: center; color: var(--pink); text-shadow: 0 4px 0 var(--ink); margin: 4px 0; }
.duel-what { text-align: center; font-weight: 700; margin: 4px 0; }
.duel-link { text-align: center; font-family: 'Nunito', 'Nunito fallback', sans-serif; font-weight: 700; color: #555; word-break: break-all; margin: 4px 0; font-size: 14px; }
.mp-kicker { display: inline-block; background: var(--purple); color: #fff; border-radius: 999px; padding: 2px 12px; font-weight: 700; font-size: 13px; letter-spacing: .5px; text-transform: uppercase; margin-bottom: 6px; }
#modal-duel .modal-card { max-height: calc(100dvh - 32px); overflow-y: auto; }
.lobby-head { display: flex; justify-content: space-between; align-items: baseline; margin: 12px 0 4px; font-size: 15px; }
.lobby-players { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.lobby-players li { display: flex; align-items: center; gap: 8px; background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 4px 10px; font-weight: 700; }
.lobby-players li.off { opacity: .55; }
.lobby-players .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); flex: none; }
.lobby-players li.off .dot { background: #bbb; }
.lobby-players .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-players .nm small { color: #777; font-weight: 600; }
.lobby-players .tag { font-size: 12px; background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; padding: 0 8px; white-space: nowrap; }
.lobby-settings { border-top: 3px dashed #d8cbb5; margin-top: 12px; padding-top: 4px; }
.modal-actions.tight { justify-content: center; margin-top: 6px; }
.modal-card label.check { display: flex; align-items: center; gap: 8px; font-family: 'Nunito', 'Nunito fallback', sans-serif; }
.modal-card label.check input { display: inline; width: auto; margin: 0; }
.duel-waiting { text-align: center; font-weight: 700; color: var(--ink); margin: 10px 0 0; }
.dots i { font-style: normal; animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
.toast { position: fixed; left: 50%; top: 16px; transform: translate(-50%, -150%); z-index: 70; background: var(--ink); color: #fff; border: 3px solid var(--yellow); border-radius: 999px; padding: 8px 18px; font-weight: 700; box-shadow: 0 4px 0 rgba(0,0,0,.25); transition: transform .3s cubic-bezier(.34,1.56,.64,1); pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
.toast.show { transform: translate(-50%, 0); }
