:root {
  --bg: #f3f5f9; --card: #fff; --text: #1d2330; --muted: #6b7385; --accent: #2f6fed;
  --ok: #1f9d55; --bad: #d64545; --border: #dde2ec;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141821; --card: #1e2430; --text: #e8ecf4; --muted: #9aa3b5; --accent: #5b8cff; --border: #2e3646; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.4 system-ui, sans-serif; background: var(--bg); color: var(--text); }
header { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; }
header h1 { margin: 0; font-size: 1.4rem; }
.view { max-width: 960px; margin: 0 auto; padding: 0 16px 40px; }
.hidden { display: none !important; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 1.1rem; }
.cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 720px) { .cols { grid-template-columns: 1fr; } }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
input { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); }
#name { flex: 1; min-width: 160px; }
#rounds { width: 80px; }
button { font: inherit; padding: 8px 16px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; }
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
button:disabled { opacity: .5; cursor: default; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.checks label { display: flex; gap: 6px; align-items: center; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.board { counter-reset: n; }
.board li::before { counter-increment: n; content: counter(n) "."; color: var(--muted); width: 1.8em; }
.board li .name { flex: 1; }
.board li.empty::before { content: none; }
.muted { color: var(--muted); }
.error { max-width: 960px; margin: 0 auto 12px; padding: 10px 16px; background: var(--bad); color: #fff; border-radius: 8px; }

.game-top { display: flex; justify-content: space-between; font-weight: 600; }
.timer { font-variant-numeric: tabular-nums; }
.timebar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin: 8px 0 4px; }
.timebar div { height: 100%; background: var(--accent); width: 100%; }
.country { text-align: center; font-size: 2rem; margin: 16px 0 0; }
#prompt { text-align: center; margin: 4px 0 16px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 46px 16px; max-width: min(100%, 86vh); margin: 0 auto; }
.options button { background: var(--card); border: 3px solid var(--border); padding: 10px; border-radius: 12px; }
.options button { position: relative; }
@media (hover: hover) { .options button:not(:disabled):hover { border-color: var(--accent); } }
.options button:focus { outline: none; }
.options button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.options img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
.options button:disabled { opacity: 1; } /* only the flag image dims, never the avatar heads on it */
.options button.picked { border-color: var(--accent); }
.options button.correct { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok); }
.options button.wrong { border-color: var(--bad); }
/* after answering: the other flags dim; on the reveal: every wrong flag dims, including your own pick */
.options:not(.revealed) button:disabled:not(.picked) > img,
.options.revealed button:not(.correct) > img { opacity: .4; }
.status { text-align: center; min-height: 2.5em; margin: 14px 0; }
.status .ok { color: var(--ok); font-weight: 600; }
.status .bad { color: var(--bad); font-weight: 600; }
.scores { margin-top: 8px; }
.scores h3 { margin: 0 0 4px; font-size: 1rem; }
#winner { font-size: 1.5rem; }

/* reactions: a bar of emoji during the reveal; each one floats up from the player's avatar */
#game { position: relative; }
.reactions { display: flex; justify-content: center; gap: 6px; margin: -4px 0 8px; }
.reactions button { font-size: 1.5rem; line-height: 1; padding: 6px 8px; background: var(--card); border: 1px solid var(--border); }
.reactions button:active { transform: scale(.9); }
.float-reaction { position: absolute; z-index: 5; pointer-events: none; display: flex; flex-direction: column; align-items: center;
  animation: float-up 2.2s ease-out forwards; }
.float-reaction .emoji { font-size: 2.2rem; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
@keyframes float-up { 0% { transform: translate(-50%, 0) scale(.6); opacity: 0; } 12% { transform: translate(-50%, -20px) scale(1.1); opacity: 1; }
  100% { transform: translate(-50%, -170px) scale(1); opacity: 0; } }
.gain { color: var(--ok); font-weight: 600; }
.tag.out { color: var(--bad); }
.tag.fire { color: #ff8a00; font-weight: 600; }
#rounds:disabled { opacity: .5; }

.avatar { border-radius: 50%; vertical-align: middle; flex: none; }
.who { display: inline-flex; align-items: center; gap: 8px; }
.avatar-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.avatar-picker button { padding: 3px; background: transparent; border: 3px solid transparent; border-radius: 50%; line-height: 0; }
.avatar-picker button[aria-checked="true"] { border-color: var(--accent); }
select { font: inherit; padding: 7px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); }
.hint-row { text-align: center; margin-top: 14px; }
.options button.removed > img { opacity: .12 !important; filter: grayscale(1); }
.mini-avatars { display: inline-flex; gap: 2px; vertical-align: middle; }
.tag { font-size: .8rem; color: var(--muted); }
.tag.done { color: var(--ok); font-weight: 600; }
/* header */
.logo { background: none; color: var(--text); padding: 0; font: inherit; font-size: 1.4rem; font-weight: 700; }
.profile-btn { display: flex; align-items: center; gap: 6px; background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 12px 4px 4px; }
.profile-btn .edit { font-size: .8rem; opacity: .7; }
header h1 { margin: 0; }

/* profile */
.profile-card { max-width: 560px; margin: 24px auto; }
.profile-card #name { font-size: 1.1rem; }
.profile-card .avatar-picker { margin: 12px 0; }

/* home */
.home-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 8px 0 16px; }
.big-action { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 22px; font-size: 1.3rem; font-weight: 700; border-radius: 14px; }
.big-action.secondary { background: var(--card); }
.big-action .icon { font-size: 1.8rem; }
.cols { grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .home-actions { grid-template-columns: 1fr; } }
.back-btn { background: none; color: var(--accent); padding: 0; margin-bottom: 8px; }

/* learn */
#learn { max-width: 1200px; }
.learn-top { display: flex; align-items: baseline; gap: 16px; }
.learn-top h2 { margin: 0 0 8px; }
.learn-layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.learn-side { position: sticky; top: 8px; display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 24px); padding: 12px; }
.learn-side input, .learn-side select { width: 100%; }
.learn-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.learn-list button { width: 100%; display: flex; align-items: center; gap: 8px; text-align: left; background: none; color: var(--text);
  padding: 6px 8px; border-radius: 8px; font-size: .95rem; }
.learn-list button:hover { background: var(--bg); }
.learn-list button[aria-current="true"] { background: var(--accent); color: #fff; }
.learn-list img { width: 24px; height: 18px; object-fit: cover; border-radius: 2px; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.learn-detail { min-width: 0; }
.learn-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.learn-head img { width: 84px; height: 63px; object-fit: cover; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0,0,0,.2); }
.learn-head h2 { margin: 0; font-size: 1.8rem; }
.learn-maps { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-bottom: 14px; }
.learn-section { margin: 14px 0; }
.learn-section h3 { margin: 0 0 6px; font-size: 1.05rem; }
.learn-section p { margin: 0; line-height: 1.55; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin: 0 0 10px; }
.facts div { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.facts dt { font-size: .78rem; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; }
.source { font-size: .8rem; color: var(--muted); }
.source a, .credit a { color: inherit; }
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.photos figure { margin: 0; }
.photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: var(--bg); }
.photos figcaption { font-weight: 600; margin-top: 4px; }
.photos .credit { font-size: .75rem; color: var(--muted); font-weight: 400; }
.photos .none { aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--bg); color: var(--muted); }
.learn-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
.learn-nav button { display: flex; align-items: center; gap: 8px; }
.learn-nav button:disabled { visibility: hidden; }
@media (max-width: 760px) {
  .learn-layout { grid-template-columns: 1fr; }
  .learn-side { position: static; max-height: none; }
  .learn-list { max-height: 32vh; }
  .learn-maps, .photos { grid-template-columns: 1fr; }
}

.small { font-size: .85rem; margin: 8px 0 0; }
/* round layout: maps on the left (1/3), flags on the right (2/3); on phones the two maps sit side by side above the flags */
#game { max-width: 1100px; }
.round-body { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; align-items: start; margin-top: 12px; }
.maps { display: flex; flex-direction: column; gap: 12px; }
.map-box { background: var(--sea); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.map-box svg { display: block; width: 100%; height: auto; background: var(--sea); }
.map-box .land { fill: var(--map-land); stroke: var(--map-border); stroke-width: .8; vector-effect: non-scaling-stroke; }
.map-box .land.here { fill: var(--map-here); }
.map-box .ring { fill: none; stroke: var(--map-here); stroke-width: 3; vector-effect: non-scaling-stroke; }
.map-box .dot { fill: var(--map-here); }

#prompt { margin-top: 0; }
@media (max-width: 700px) and (orientation: portrait), (max-width: 480px) {
  .round-body { grid-template-columns: 1fr; gap: 12px; }
  .maps { flex-direction: row; }
  .maps .map-box { flex: 1; min-width: 0; }
}
/* maps stay light in both themes so countries are easy to see */
:root { --sea: #5a9fd4; --map-land: #eef0f3; --map-border: #9aa6b6; --map-here: #e0457b; }
.pickers { position: absolute; left: 0; right: 0; bottom: 0; transform: translateY(50%); display: flex; justify-content: center; }
.pickers { gap: 4px; padding: 0 6px; }
/* heads side by side; they shrink evenly if many players picked the same flag */
.pickers span { flex: 0 1 72px; min-width: 0; }
.pickers img { display: block; width: 100%; height: auto; }
@media (max-width: 480px) {
  .options { row-gap: 32px; }
  .pickers span { flex-basis: 48px; }
}

/* Individual / Team toggle */
.segmented { display: flex; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.segmented .seg { flex: 1; border-radius: 0; background: transparent; color: var(--text); padding: 10px; font-weight: 600; }
.segmented .seg + .seg { border-left: 1px solid var(--border); }
.segmented .seg[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* teams */
:root { --red: #e5484d; --blue: #3b82f6; }
.team-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 8px; }
.team-col { border: 2px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.team-col.red { border-color: var(--red); }
.team-col.blue { border-color: var(--blue); }
.team-col h3 { margin: 0 0 4px; font-size: 1rem; }
.team-col .worth { color: var(--muted); font-weight: 400; font-size: .85rem; }
.team-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.team-dot.red { background: var(--red); }
.team-dot.blue { background: var(--blue); }
.team-totals { display: flex; justify-content: center; gap: 18px; font-weight: 700; font-size: 1.1rem; margin: 2px 0 6px; }
.team-totals .red { color: var(--red); }
.team-totals .blue { color: var(--blue); }
.learn-maps .map-box svg { height: 100%; } /* close-up fills the same height as the world map */
.photos figcaption a { color: var(--accent); }

/* ---------- Flag Dojo: header nav, home mode boxes, custom page, auth popup ---------- */
.top-nav { display: flex; align-items: center; gap: 8px; }
.nav-btn { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; }
.link-btn { background: none; color: var(--accent); padding: 0; font: inherit; text-decoration: underline; }
.page-title { margin: 4px 0 12px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 16px; box-shadow: 0 6px 24px rgba(0,0,0,.3); }

.mode-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 12px 0; }
.mode-box { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 10px; min-height: 260px; }
.mode-top { display: flex; gap: 14px; align-items: flex-start; }
.mode-icon { font-size: 2.6rem; line-height: 1; }
.mode-box h2 { margin: 0 0 4px; font-size: 1.5rem; }
.mode-box p { margin: 0; }
.my-rank { font-size: .95rem; color: var(--muted); margin-top: auto !important; }
.mode-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.play-col { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.play-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.q-info { font-size: .85rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.q-info b { color: var(--text); }
.play { min-width: 150px; font-weight: 700; padding: 10px 16px; }
.play:not(.ranked) { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.play.ranked { background: linear-gradient(135deg, #f5b301, #e07a00); color: #1d1300; }
.play.queued { background: var(--bad) !important; color: #fff !important; border-color: var(--bad) !important; }
.play-row.in-queue .q-info { color: var(--text); font-weight: 600; }
.custom-btn { padding: 10px 14px; }
@media (max-width: 820px) {
  .mode-boxes { grid-template-columns: 1fr; }
  .mode-bottom { flex-direction: column-reverse; align-items: stretch; }
  .play-row { justify-content: space-between; }
  .q-info { text-align: left; }
}

.code-row { margin-top: 12px; }
.code-row input { width: 9em; text-transform: uppercase; letter-spacing: .1em; }
#create-form .segmented { margin-bottom: 10px; }
.invite { margin: 4px 0 12px; }
.invite .row { margin: 4px 0 0; }
.invite input { flex: 1; min-width: 200px; }
.requests:not(:empty) { margin: 8px 0; padding: 4px 10px; border: 1px dashed var(--accent); border-radius: 10px; }
.requests li .row { margin: 0; }

/* "Name the country": the flag is the question, the options are names */
.quiz-flag { display: flex; justify-content: center; margin: 0 0 6px; }
.quiz-flag img { width: min(100%, 360px); aspect-ratio: 4 / 3; object-fit: contain; border-radius: 8px; box-shadow: 0 2px 12px rgba(0,0,0,.25); }
.name-mode .options { grid-template-columns: 1fr 1fr; gap: 30px 12px; }
.options .name-opt { min-height: 64px; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--text); }
.options .name-opt .opt-text { font-size: 1.1rem; font-weight: 600; }
.options.revealed button.name-opt:not(.correct) .opt-text { opacity: .4; }
.options button.name-opt.removed .opt-text { opacity: .15; text-decoration: line-through; }
.maps.maps-hidden .map-box { visibility: hidden; }
.maps.maps-hidden { position: relative; }
.maps.maps-hidden::before { content: attr(data-hint); /* set in app.js, in the player's language */ position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; text-align: center; color: var(--muted); font-size: .9rem; padding: 12px; }

.rating-change { font-size: 1.1rem; margin: 0 0 10px; }
.rating-change .ok { color: var(--ok); }
.rating-change .bad { color: var(--bad); }

.dialog { border: 1px solid var(--border); border-radius: 14px; background: var(--card); color: var(--text); padding: 20px 22px; width: min(92vw, 400px); }
.dialog::backdrop { background: rgba(0,0,0,.55); }
.dialog h2 { margin: 0 0 8px; }
.dialog-x { position: absolute; top: 10px; right: 10px; background: none; color: var(--muted); padding: 4px 8px; font-size: 1.1rem; }
.auth-form { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.auth-form label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }
.auth-form input { width: 100%; }
.auth-msg { color: var(--bad); min-height: 1.2em; margin: 10px 0 0; }
#verify-box p { line-height: 1.5; }
.footer { text-align: center; padding: 18px; font-size: .8rem; }
.footer a { color: var(--muted); }
.maps.maps-hidden { min-height: 220px; border: 2px dashed var(--border); border-radius: 12px; }
@media (max-width: 700px) and (orientation: portrait), (max-width: 480px) { .maps.maps-hidden { min-height: 90px; } }
/* name mode: the heads sit inside the option, on the right, so they don't cover the row below */
.options .name-opt { padding-right: 12px; }
.options .name-opt .pickers { left: auto; right: 6px; bottom: 50%; transform: translateY(50%); justify-content: flex-end; max-width: 55%; }
.options .name-opt .pickers span { flex: 0 1 36px; }
.name-mode .options { gap: 14px 12px; }
.logo { white-space: nowrap; }
@media (max-width: 480px) {
  header { padding: 10px 12px; gap: 8px; }
  .logo { font-size: 1.1rem; }
  .top-nav { gap: 6px; }
  .nav-btn { padding: 6px 10px; font-size: .9rem; white-space: nowrap; }
  .profile-btn { padding: 3px 8px 3px 3px; }
  .profile-btn .who span:last-child { max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .profile-btn .edit { display: none; }
}
@media (max-width: 480px) { .nav-label { display: none; } }

/* "+N" after the first 5 heads on an option, the same size as a head */
.pickers .more { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; aspect-ratio: 1; width: 72px;
  border-radius: 50%; background: var(--card); border: 2px solid var(--border); color: var(--text); font-weight: 700; font-size: 1.35rem; }
.options .name-opt .pickers .more { width: 36px; font-size: .85rem; flex-basis: 36px; }
@media (max-width: 480px) { .pickers .more { width: 48px; font-size: 1rem; } }
.play:disabled { opacity: .4; cursor: not-allowed; }
.mode-top h2 { margin: 0 0 6px; }
.mode-box .mode-top { display: block; }
/* the "+N" badge shrinks together with the heads, so it's always the same size as them */
.pickers .more { flex: 0 1 72px; width: auto; min-width: 0; font-size: clamp(.7rem, 1.5vw, 1.35rem); }
.options .name-opt .pickers .more { flex: 0 1 36px; width: auto; font-size: .8rem; }
@media (max-width: 480px) { .pickers .more { flex-basis: 48px; width: auto; } }

/* account fields on the profile page */
.account-fields { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px 12px; margin: 8px 0; display: flex; flex-direction: column; gap: 8px; }
.account-fields legend { color: var(--muted); font-size: .85rem; padding: 0 6px; }
.account-fields label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }
.account-fields input { width: 100%; }

.badge { display: inline-block; font-size: .72rem; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: #fff; margin-left: 4px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.stat { background: var(--bg); border-radius: 12px; padding: 14px; }
.stat-value { font-size: 1.8rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: .9rem; }
.bar { display: inline-block; width: 70px; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; vertical-align: middle; }
.bar span { display: block; height: 100%; background: var(--accent); }

.optional { font-weight: 400; color: var(--muted); font-size: .85em; }

/* name mode: taller options, the name at the top and the heads in their own row underneath, so they never cover it */
.options .name-opt { min-height: 116px; flex-direction: column; justify-content: flex-start; gap: 10px; padding: 14px 10px 10px; }
.options .name-opt .opt-text { line-height: 1.25; }
.options .name-opt .pickers { position: static; transform: none; max-width: none; justify-content: center; gap: 4px; }
.options .name-opt .pickers span { flex: 0 1 40px; }
.options .name-opt .pickers .more { flex: 0 1 40px; font-size: .85rem; }
.name-mode .options { gap: 14px 12px; }
@media (max-width: 480px) { .options .name-opt { min-height: 104px; } .options .name-opt .pickers span, .options .name-opt .pickers .more { flex-basis: 32px; } }

/* ---------- Minigames home: hero, filter chips, live game cards, coming-soon grid ---------- */
#home { max-width: 1120px; }
.hero { text-align: center; padding: 18px 0 6px; }
.hero h1 { margin: 0 0 8px; font-size: clamp(1.6rem, 4vw, 2.5rem); line-height: 1.15; letter-spacing: -.02em;
  background: linear-gradient(90deg, var(--accent), #a855f7 55%, #ec4899); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0 auto; max-width: 560px; font-size: 1.05rem; }
.chips { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 18px 0 8px; }
.chip { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 7px 16px; font-weight: 600; font-size: .92rem;
  transition: background .15s, color .15s, border-color .15s; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
@media (hover: hover) { .chip:not([aria-pressed="true"]):hover { border-color: var(--accent); } }
.section-label { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; font-size: .8rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); }
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.no-games { text-align: center; margin: 30px 0; }

/* live games */
.mode-boxes { margin: 0; }
.game-card { padding: 0; overflow: hidden; gap: 12px; min-height: 0; transition: transform .2s, box-shadow .2s; }
@media (hover: hover) { .game-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(20, 30, 60, .14); } }
.game-card > :not(.game-art) { margin-left: 20px !important; margin-right: 20px !important; }
.game-card .mode-bottom { margin-bottom: 20px; }
.game-card h2 { font-size: 1.45rem; }
.game-art { position: relative; height: 150px; display: flex; align-items: center; justify-content: center; }
.flag-art { background: linear-gradient(135deg, #2f6fed, #7c3aed); }
.name-art { background: linear-gradient(135deg, #0ea5a4, #2f6fed); }
.art-flags { display: grid; grid-template-columns: repeat(4, 64px); gap: 10px; }
.art-flags img, .art-name img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 5px; box-shadow: 0 4px 12px rgba(0,0,0,.25), 0 0 0 2px rgba(255,255,255,.9); }
.art-flags img:nth-child(2) { filter: hue-rotate(150deg); }
.art-flags img:nth-child(3) { filter: hue-rotate(260deg) saturate(1.3); }
.art-flags img:nth-child(4) { filter: hue-rotate(70deg); }
.art-flags img:nth-child(1) { transform: translateY(-6px); box-shadow: 0 8px 18px rgba(0,0,0,.3), 0 0 0 3px #4ade80; }
.art-name { display: flex; align-items: center; gap: 18px; }
.art-name img { width: 104px; }
.art-pills { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.art-pills span { width: 64px; height: 20px; border-radius: 6px; background: rgba(255,255,255,.85); }
.art-pills span:first-child { background: #4ade80; }
.live-badge { position: absolute; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: rgba(0,0,0,.35); color: #fff; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; backdrop-filter: blur(4px); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 0 rgba(74,222,128,.7); animation: live-pulse 1.8s infinite; }
@keyframes live-pulse { 70% { box-shadow: 0 0 0 7px rgba(74,222,128,0); } 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); } }

/* coming soon */
.soon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; } /* as the game boxes */
.soon-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.soon-art { height: 150px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, hsl(var(--hue) 85% 62%), hsl(calc(var(--hue) + 40) 80% 52%)); }
.soon-art span { font-size: 4rem; filter: drop-shadow(0 4px 8px rgba(0,0,0,.2)); transition: transform .25s; }
@media (hover: hover) { .soon-card:hover .soon-art span { transform: scale(1.15) rotate(-6deg); } }
.soon-body { padding: 14px 20px 17px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.soon-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.soon-head h3 { margin: 0; font-size: 1.45rem; }
.soon-badge { flex: none; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; }
.soon-body p { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.45; flex: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pill { font-size: .75rem; background: var(--bg); border-radius: 999px; padding: 3px 9px; color: var(--muted); }
@media (max-width: 520px) {
  .art-flags { grid-template-columns: repeat(4, 54px); gap: 8px; }
  .soon-grid { grid-template-columns: 1fr; }
}

/* ---------- new games: card art ---------- */
.mode-boxes[data-grid] { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.outline-art { background: linear-gradient(135deg, #f97316, #db2777); }
.zoom-art { background: linear-gradient(135deg, #7c3aed, #0ea5e9); }
.pin-art { background: linear-gradient(135deg, #0284c7, #0d9488); overflow: hidden; }
.paint-art { background: linear-gradient(135deg, #ec4899, #f59e0b); }
.chain-art { background: linear-gradient(135deg, #16a34a, #0891b2); }
.art-outline { width: 104px; height: 78px; }
.art-outline path { fill: #fff; filter: drop-shadow(0 4px 8px rgba(0,0,0,.3)); }
.art-zoom { width: 140px; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.3), 0 0 0 2px #fff; }
.art-zoom img { width: 100%; height: 100%; object-fit: cover; display: block; transform-origin: 30% 35%; animation: art-zoom 6s ease-in-out infinite; }
@keyframes art-zoom { 0%, 15% { transform: scale(5); } 70%, 100% { transform: scale(1); } }
.art-lens { position: absolute; right: 22%; bottom: 14px; font-size: 2.2rem; filter: drop-shadow(0 3px 6px rgba(0,0,0,.35)); }
.art-world { position: absolute; inset: 0; width: 100%; height: 100%; }
.art-world path { fill: rgba(255,255,255,.55); }
.art-pin { position: relative; font-size: 2.6rem; animation: pin-drop 2.4s ease-in-out infinite; filter: drop-shadow(0 6px 6px rgba(0,0,0,.35)); }
@keyframes pin-drop { 0% { transform: translateY(-40px); opacity: 0; } 25% { transform: translateY(0); opacity: 1; } 32% { transform: translateY(-8px); } 40%, 85% { transform: translateY(0); opacity: 1; } 100% { opacity: 0; } }
.art-paint { display: grid; grid-template-columns: repeat(3, 34px); height: 78px; border-radius: 5px; overflow: hidden; box-shadow: 0 4px 14px rgba(0,0,0,.3), 0 0 0 2px #fff; }
.art-paint span { background: #fff; }
.art-paint .painting { background: linear-gradient(#fff 0 0) bottom / 100% 0% no-repeat, #fff; animation: art-paint 3s ease-in-out infinite; }
@keyframes art-paint { 0%, 20% { background: #fff; } 60%, 100% { background: #ef4135; } }
.art-palette { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-left: 18px; }
.art-palette i { width: 22px; height: 22px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.9); }
.art-chain { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 1.3rem; }
.art-chain img { width: 54px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; box-shadow: 0 3px 10px rgba(0,0,0,.3), 0 0 0 2px #fff; }
.art-chain span { width: 54px; aspect-ratio: 4 / 3; border-radius: 4px; border: 2px dashed #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.solo-badge { background: rgba(0,0,0,.3); }
.solo-card .mode-bottom { justify-content: flex-end; margin-top: auto; }
.solo-card .my-rank { margin-top: 0 !important; }
@media (max-width: 520px) {
  .mode-boxes[data-grid] { grid-template-columns: 1fr; }
  .art-chain img, .art-chain span { width: 44px; }
}

/* ---------- Outline Quiz / Zoom Out / Map Pin rounds ---------- */
.outline-svg { width: min(100%, 360px); height: 220px; display: block; }
.outline-svg path { fill: var(--text); stroke: none; transition: fill .3s; }
.outline-svg.revealed path { fill: var(--ok); }
.zoom-frame { width: min(100%, 360px); aspect-ratio: 4 / 3; overflow: hidden; border-radius: 8px; box-shadow: 0 2px 12px rgba(0,0,0,.25); }
.zoom-frame img { display: block; width: 100% !important; height: 100%; object-fit: cover; border-radius: 0 !important; box-shadow: none !important; will-change: transform; }
#zoom-points { color: var(--accent); font-size: 1.1em; }
.pin-mode .round-body { grid-template-columns: 1fr; }
.pin-mode .maps { display: none; }
.pin-map { position: relative; aspect-ratio: 2000 / 1001; cursor: crosshair; margin: 0 auto; max-width: 980px; }
.pin-map svg { position: absolute; inset: 0; width: 100%; height: 100% !important; }
.pin-map.revealed { cursor: default; }
.pins { position: absolute; inset: 0; pointer-events: none; }
.my-pin { position: absolute; transform: translate(-50%, -92%); font-size: 1.9rem; line-height: 1; filter: drop-shadow(0 3px 3px rgba(0,0,0,.4)); }
.pin-head { position: absolute; transform: translate(-50%, -50%); line-height: 0; border-radius: 50%; box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0,0,0,.4);
  animation: pop-in .3s ease-out; }
.pin-head.mine { box-shadow: 0 0 0 3px var(--accent), 0 2px 6px rgba(0,0,0,.4); z-index: 1; }
@keyframes pop-in { from { transform: translate(-50%, -50%) scale(0); } }
.pin-row { display: flex; justify-content: center; margin-top: 12px; }
.pin-row button { min-width: 200px; font-weight: 700; padding: 10px 18px; }

/* ---------- solo games ---------- */
#paint, #chain { max-width: 820px; }
.solo-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.solo-top .back-btn { margin: 0; }
.solo-card-main { padding: 20px; }
.solo-title { text-align: center; font-size: 1.5rem !important; margin: 0 0 6px !important; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.center { text-align: center; margin-top: 0; }
.center-row { justify-content: center; }
.mini-flag { width: 32px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.2); vertical-align: middle; }
.paint-board { display: flex; justify-content: center; margin: 12px 0; }
.paint-board svg { width: min(100%, 480px); height: auto; aspect-ratio: 4 / 3; border-radius: 6px; box-shadow: 0 2px 14px rgba(0,0,0,.2); }
.paint-board [data-r] { cursor: pointer; }
.paint-board [data-r]:hover { opacity: .85; }
.paint-palette { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 8px 0 14px; }
.swatch { width: 44px; height: 44px; padding: 0; border-radius: 50%; background: var(--c); border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--border), 0 2px 6px rgba(0,0,0,.2); transition: transform .12s; }
.swatch[aria-checked="true"] { transform: scale(1.15); box-shadow: 0 0 0 3px var(--accent), 0 2px 8px rgba(0,0,0,.3); }
.paint-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 12px 0; }
.paint-compare figure, .paint-summary figure { margin: 0; text-align: center; }
.paint-compare img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; box-shadow: 0 2px 12px rgba(0,0,0,.2); }
.paint-compare figcaption, .paint-summary figcaption { margin-top: 6px; font-weight: 600; }
.paint-score { text-align: center; font-size: 1.25rem; margin: 8px 0; }
.paint-summary { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin: 12px 0; }
.paint-summary .mini-flag { width: 80px; }
.chain-map { margin: 12px 0; }
.chain-map svg { aspect-ratio: 2 / 1; }
.chain-map .land.step { fill: var(--ok); }
.chain-map .land.start { fill: var(--accent); }
.chain-map .land.target { fill: var(--bad); }
.chain-map .land.answer { fill: #f5b301; }
.chain-path { list-style: none; padding: 0; margin: 8px 0 14px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; }
.chain-path li { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border-radius: 999px; padding: 4px 10px 4px 4px; font-weight: 600; font-size: .92rem; }
.chain-path li + li::before { content: '→'; color: var(--muted); margin: 0 4px 0 -2px; font-weight: 400; }
.chain-path li.start { box-shadow: inset 0 0 0 2px var(--accent); }
.chain-path li.target { box-shadow: inset 0 0 0 2px var(--bad); }
.chain-path li.gap { background: none; color: var(--muted); padding: 4px; }
.chain-path .mini-flag { width: 26px; border-radius: 50% / 40%; }
#chain-input { flex: 1; min-width: 200px; max-width: 340px; }
.share-btn { padding: 4px 10px; font-size: .85rem; margin-left: 6px; }
.per-game { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 2px 10px; font-size: .82rem; white-space: nowrap; }
.per-game b { font-weight: 600; color: var(--muted); }
#chain-tabs .seg { white-space: nowrap; }
/* Map Pin: the continent's shape decides the map's; never taller than ~62% of the screen */
.pin-map { --ratio: 2; aspect-ratio: var(--ratio); width: min(100%, calc(62vh * var(--ratio))); overflow: hidden; }

/* game boxes: Solo just left of Play, both on the right */
.game-card .mode-bottom { justify-content: flex-end; margin-top: auto; }
.game-card .play-row { width: 100%; justify-content: flex-end; gap: 10px; }
.game-card .play { min-width: 120px; }
.game-card .play[data-queue], .game-card .play[data-go] { background: var(--accent); color: #fff; border: 0; }
.game-card .solo-btn { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
@media (max-width: 420px) { .game-card .play { min-width: 0; flex: 1; } }

/* ---------- Capitals / Last Man Standing / Pictionary / Daily Puzzle: card art ---------- */
.capital-art { background: linear-gradient(135deg, #b45309, #e11d48); }
.royale-art { background: linear-gradient(135deg, #1e293b, #a16207); overflow: hidden; }
.draw-art { background: linear-gradient(135deg, #f59e0b, #10b981); }
.daily-art { background: linear-gradient(135deg, #2563eb, #9333ea); }
.art-royale { display: grid; grid-template-columns: repeat(6, 34px); gap: 8px; }
.art-royale span { line-height: 0; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.8); }
.art-royale span.out { opacity: .28; filter: grayscale(1); box-shadow: none; }
.art-royale span.winner { box-shadow: 0 0 0 3px #facc15, 0 0 18px #facc15; transform: scale(1.15); }
.art-crown { position: absolute; top: 14px; left: calc(50% + 6px); font-size: 1.4rem; animation: crown 2.6s ease-in-out infinite; }
@keyframes crown { 0%, 100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-4px) rotate(8deg); } }
.art-draw svg { width: 128px; height: 96px; border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.3); background: #fff; }
.art-draw-fill { animation: art-draw 3.2s ease-in-out infinite; transform-origin: left; }
@keyframes art-draw { 0%, 15% { transform: scaleY(0); } 60%, 100% { transform: scaleY(1); } }
.art-pencil { position: absolute; right: 26%; bottom: 18px; font-size: 2.1rem; animation: pencil 1.6s ease-in-out infinite; filter: drop-shadow(0 3px 6px rgba(0,0,0,.35)); }
@keyframes pencil { 0%, 100% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(-10px, -6px) rotate(-10deg); } }
.capital-art .art-lens { right: 18%; }
.art-daily { display: grid; grid-template-columns: repeat(3, 46px); gap: 8px; }
.art-daily span { height: 46px; border-radius: 10px; background: rgba(255,255,255,.92); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; box-shadow: 0 3px 10px rgba(0,0,0,.2); }
.art-daily span.closed { background: rgba(255,255,255,.22); color: #fff; font-weight: 700; border: 2px dashed rgba(255,255,255,.7); }
@media (max-width: 520px) { .art-royale { grid-template-columns: repeat(6, 28px); gap: 6px; } }

/* ---------- Pictionary rounds ---------- */
.draw-mode .round-body { grid-template-columns: 1fr; }
.draw-mode .maps { display: none; }
.draw-area { display: grid; grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr); gap: 16px; align-items: start; }
.draw-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.draw-word { text-align: center; font-size: 1.15rem; min-height: 1.6em; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.draw-word .mask { font-family: ui-monospace, Menlo, monospace; letter-spacing: .35em; font-size: 1.35rem; font-weight: 700; }
.draw-board { position: relative; width: min(100%, calc(60vh * 4 / 3)); aspect-ratio: 4 / 3; margin: 0 auto; border-radius: 10px; overflow: hidden;
  box-shadow: 0 0 0 1px var(--border), 0 4px 18px rgba(0,0,0,.15); background: #fff; }
.draw-board canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.draw-board canvas.can-draw { cursor: crosshair; }
.draw-board canvas.can-draw.fill-tool { cursor: cell; }
.draw-sketch { position: absolute; inset: 0; pointer-events: none; }
.draw-sketch svg { width: 100%; height: 100%; display: block; filter: url(#sketchy); }
.draw-sketch .draw-answer { width: 100%; height: 100%; object-fit: cover; display: block; animation: fade-in .4s ease-out; }
@keyframes fade-in { from { opacity: 0; } }
.draw-tools { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.draw-colors { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.draw-colors .swatch { width: 34px; height: 34px; }
.draw-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.tool-btn { padding: 6px 12px; }
.tool-btn[aria-pressed="true"] { background: var(--accent); color: #fff; }
.draw-sizes { display: inline-flex; gap: 6px; }
.size-btn { width: 38px; height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--card); border: 2px solid var(--border); }
.size-btn i { width: var(--s); height: var(--s); max-width: 26px; max-height: 26px; border-radius: 50%; background: var(--text); }
.size-btn[aria-pressed="true"] { border-color: var(--accent); }
.draw-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.guess-feed { list-style: none; margin: 0; padding: 8px 10px; height: min(46vh, 380px); overflow-y: auto; background: var(--bg); border-radius: 10px; font-size: .92rem; }
.guess-feed li { display: flex; align-items: center; gap: 6px; padding: 3px 0; overflow-wrap: anywhere; }
.guess-feed li img { flex: none; }
.guess-feed .close-guess { color: #d97706; font-weight: 600; }
.guess-form { display: flex; gap: 6px; }
.guess-form input { flex: 1; min-width: 0; }
.draw-tag { background: #fef3c7 !important; color: #92400e !important; }
@media (max-width: 760px) {
  .draw-area { grid-template-columns: 1fr; }
  .guess-feed { height: 140px; }
  .draw-side { order: -1; }
  .draw-side .guess-feed { order: 1; }
}

/* ---------- Daily Puzzle ---------- */
#daily { max-width: 720px; }
.daily-clues { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.clue { display: flex; gap: 10px; align-items: flex-start; background: var(--bg); border-radius: 12px; padding: 10px 12px; min-height: 62px; animation: fade-in .35s ease-out; }
.clue.locked { opacity: .55; align-items: center; animation: none; }
.clue-icon { font-size: 1.4rem; line-height: 1.2; }
.clue small { font-size: .78rem; }
.clue-colors { display: flex; gap: 6px; margin: 4px 0 2px; flex-wrap: wrap; }
.clue-colors i { width: 22px; height: 22px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.clue-outline { width: 150px; height: 90px; display: block; }
.clue-outline path { fill: var(--text); }
.clue-flag { width: 120px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
#daily-input { flex: 1; min-width: 200px; max-width: 340px; }
.daily-guesses { list-style: none; padding: 0; margin: 8px auto; max-width: 440px; display: flex; flex-direction: column; gap: 6px; }
.daily-guesses li { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 999px; padding: 4px 14px 4px 6px; }
.daily-guesses li b { flex: 1; }
.daily-guesses li.right { box-shadow: inset 0 0 0 2px var(--ok); }
@media (max-width: 560px) { .daily-clues { grid-template-columns: 1fr; } }

/* the logo: a little world with someone planting a sky-blue flag on top */
.logo { display: inline-flex; align-items: center; gap: 6px; }
.logo-mark { width: 2.1em; height: 2.1em; flex: none; margin: -0.45em 0; color: var(--text); }

/* World Tour: one tile per game in it */
.mix-art { background: linear-gradient(135deg, #0ea5e9, #7c3aed 55%, #db2777); }
.art-mix { display: flex; gap: 8px; }
.art-mix span { width: 48px; height: 48px; border-radius: 10px; background: rgba(255,255,255,.92); display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; box-shadow: 0 3px 10px rgba(0,0,0,.25); overflow: hidden; animation: mix-hop 5s ease-in-out infinite; }
.art-mix span img { width: 40px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 3px; }
.art-mix span:nth-child(2) { animation-delay: 1s; } .art-mix span:nth-child(3) { animation-delay: 2s; }
.art-mix span:nth-child(4) { animation-delay: 3s; } .art-mix span:nth-child(5) { animation-delay: 4s; }
@keyframes mix-hop { 0%, 14%, 100% { transform: translateY(0); } 7% { transform: translateY(-8px); } }
@media (max-width: 420px) { .art-mix span { width: 40px; height: 40px; font-size: 1.2rem; } }

/* the logo sits in a div (the page's h1 is the hero line) */
.brand { margin: 0; font-size: 1.4rem; }
@media (max-width: 480px) { .brand { font-size: 1.1rem; } }
.footer .about { max-width: 640px; margin: 0 auto 10px; color: var(--muted); line-height: 1.5; }

/* quick name dialog */
.quick-row { display: flex; align-items: center; gap: 8px; }
.quick-row input { flex: 1; min-width: 0; }
.quick-avatar { line-height: 0; cursor: pointer; border-radius: 50%; }
/* a game box pointed at from its landing page */
.game-card.spotlight { animation: spotlight 1.6s ease-out 2; }
@keyframes spotlight { 0% { box-shadow: 0 0 0 0 var(--accent); } 40% { box-shadow: 0 0 0 6px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* today's results under the daily puzzles */
.day-board:not(:empty) { max-width: 440px; margin: 14px auto 6px; }
.day-board .beat { text-align: center; font-size: 1.1rem; margin: 0 0 10px; }
.day-title { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px; text-align: center; }
.day-top { list-style: none; padding: 0; margin: 0; counter-reset: n; display: flex; flex-direction: column; gap: 4px; }
.day-top li { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 999px; background: var(--bg); font-size: .92rem; }
.day-top li::before { counter-increment: n; content: counter(n); width: 1.4em; color: var(--muted); font-variant-numeric: tabular-nums; }
.day-top li b { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-top li span { color: var(--muted); font-size: .85rem; }
.day-top li.me { box-shadow: inset 0 0 0 2px var(--accent); }

/* ⓘ on each game box: opens the game's landing page */
.info-btn { position: absolute; top: 10px; right: 10px; z-index: 2; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.32); color: #fff; font: italic 700 15px/1 Georgia, 'Times New Roman', serif; text-decoration: none; backdrop-filter: blur(4px);
  box-shadow: 0 0 0 1.5px rgba(255,255,255,.75); transition: background .15s, transform .15s; }
.info-btn:hover, .info-btn:focus-visible { background: rgba(0,0,0,.55); transform: scale(1.08); }

/* landing pages (lib/pages.js) */
.landing { max-width: 760px; margin: 0 auto; padding: 0 16px 24px; display: flex; flex-direction: column; gap: 16px; }
.crumbs { font-size: .9rem; color: var(--muted); }
.crumbs a { color: var(--accent); }
.landing-hero { text-align: center; padding: 28px 22px; }
.landing-hero h1 { font-size: clamp(1.6rem, 4.5vw, 2.3rem); line-height: 1.15; margin: 14px 0 10px; letter-spacing: -.02em; }
.landing-hero .lead { font-size: 1.08rem; line-height: 1.55; max-width: 580px; margin: 0 auto 18px; }
.landing-flags { display: flex; justify-content: center; gap: 10px; }
.landing-flags img { width: 64px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 5px; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.play-link { display: inline-block; background: var(--accent); color: #fff; font-weight: 700; font-size: 1.1rem; padding: 12px 28px; border-radius: 10px; text-decoration: none; }
.play-link:hover { filter: brightness(1.08); }
.landing h2 { margin: 0 0 10px; font-size: 1.2rem; }
.how { margin: 0; padding-left: 1.2em; line-height: 1.7; }
.more-games { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.more-games a { display: block; padding: 8px 12px; border-radius: 8px; background: var(--bg); color: var(--text); text-decoration: none; font-weight: 600; }
.more-games a:hover { color: var(--accent); }
@media (max-width: 480px) { .landing-flags img { width: 52px; } }

/* coming-soon cards: a mystery, with a slow wobble */
.soon-art span { animation: mystery 3.2s ease-in-out infinite; }
.soon-card:nth-child(2) .soon-art span { animation-delay: -1.6s; }
@keyframes mystery { 0%, 100% { transform: rotate(-8deg) scale(1); } 50% { transform: rotate(8deg) scale(1.08); } }

.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #1f9d55; margin-right: 6px; animation: live 1.6s ease-in-out infinite; }
@keyframes live { 50% { opacity: .3; } }
/* top bar links on the game pages look like the home page's buttons */
a.nav-btn, a.profile-btn { text-decoration: none; display: inline-flex; align-items: center; }
.soon-bottom { display: flex; justify-content: flex-end; margin-top: auto; } /* where Play is on the game boxes */
.soon-bottom button:disabled { opacity: .5; cursor: default; }
.soon-card { min-height: 324px; } /* as tall as a game box (art, title, text, buttons) */

/* a game's leaderboard: my place above the top 10 */
.board li.my-place { border: 2px solid var(--accent); border-radius: 10px; padding: 6px 10px; margin-bottom: 6px; }
.board li.my-place::before { content: none; }
.board li.my-place .place { display: flex; flex-direction: column; align-items: center; font-weight: 800; min-width: 2.6em; line-height: 1.1; }
.board li.my-place .place small { font-weight: 400; font-size: .7rem; color: var(--muted); }
.board li.me .name { font-weight: 700; }
/* a player's result (public/result-card.js): the end of a match and a shared result's page (/s/<id>) */
.result-card { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 4px 0 14px; text-align: center; }
.result-card .rc-who { display: flex; align-items: center; gap: 10px; }
.result-card .rc-who img { border-radius: 50%; }
/* the laurel around a top-three avatar (result card and leaderboard): see wreathed() in result-card.js */
.wreathed { position: relative; display: inline-grid; place-items: center; flex: none; width: var(--wreath); height: var(--wreath); }
.wreathed .rc-laurel { position: absolute; inset: 0; width: 100%; height: 100%; }
.wreathed img { position: relative; }
.wreath-slot { display: inline-grid; place-items: center; flex: none; width: var(--wreath); height: var(--wreath); }
#final .wreathed, #final .wreath-slot { margin: -10px 0; } /* the rows stay about as tall: the wreath spills into the padding */
.result-card .rc-name { font-size: 1.25rem; }
.result-card .rc-points { display: flex; align-items: baseline; gap: 8px; }
.result-card .rc-points b { font-size: 3rem; font-weight: 800; line-height: 1; color: var(--accent); }
.result-card .rc-points span { font-size: 1.1rem; color: var(--muted); }
.result-card .rc-facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.result-card .rc-facts span { border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: .9rem; }
.result-card .rc-rank { font-weight: 700; }
.share-page { max-width: 560px; }
.share-hero { text-align: center; margin-top: 16px; }
.share-hero .play-link { margin: 6px 0 10px; }
/* end of a match: my row boxed in the leaderboard */
#final li.me { border: 2px solid var(--accent); border-radius: 10px; padding-left: 10px; padding-right: 10px; background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* colour-blind friendly colours (profile setting): blue for right, orange for wrong */
:root.cvd { --ok: #0072b2; --bad: #d55e00; }
@media (prefers-color-scheme: dark) { :root.cvd { --ok: #56b4e9; --bad: #e69f00; } }
.check-row { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); margin: 6px 0; cursor: pointer; }
/* right and wrong carry a mark too, not only a colour */
.options.revealed button.correct::after, .options.revealed button.wrong::after {
  position: absolute; top: -10px; right: -10px; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 15px; line-height: 1; z-index: 2; }
.options.revealed button.correct::after { content: '✓'; background: var(--ok); }
.options.revealed button.wrong::after { content: '✗'; background: var(--bad); }
/* keys 1–4 in the options' corner, on computers */
.options button .key { display: none; }
@media (hover: hover) and (pointer: fine) {
  .options button .key { display: flex; position: absolute; top: 6px; left: 6px; width: 20px; height: 20px; border-radius: 5px; align-items: center; justify-content: center;
    font: 700 12px/1 system-ui, sans-serif; color: var(--muted); background: var(--bg); border: 1px solid var(--border); z-index: 1; }
  .options.revealed button .key { display: none; }
}

/* the Daily Puzzle streak in the top bar; dimmed until today's puzzle is played */
.streak-btn { display: inline-flex; align-items: center; gap: 3px; font-weight: 800; text-decoration: none; color: var(--text); }
.streak-btn.pending { opacity: .55; }
.streak-line { text-align: center; margin: 4px 0 10px; font-size: 1.05rem; }
.share-row { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-left: 6px; vertical-align: middle; }
/* soft sign-up reminder */
.signup-perks { list-style: none; padding: 0; margin: 10px 0 16px; display: grid; gap: 6px; }
.signup-perks li { background: var(--bg); border-radius: 10px; padding: 8px 12px; }
/* footer: language and installing the app */
.footer-tools { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; margin: 8px 0; }
/* the language picker in the top bar: a pill like the other buttons */
.nav-lang { display: inline-flex; align-items: center; gap: 4px; background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 6px 2px 10px; cursor: pointer; }
.nav-lang select { background: transparent; color: inherit; border: 0; font: inherit; padding: 4px 2px; cursor: pointer; max-width: 9em; }
.nav-lang select:focus-visible { outline: 2px solid var(--accent); border-radius: 6px; }
.nav-lang option { background: var(--card); color: var(--text); }
@media (max-width: 480px) { .nav-lang { padding: 2px 4px 2px 8px; font-size: .9rem; } .nav-lang span { display: none; } }
.nav-lang { position: relative; }
.nav-lang-code { display: none; font-size: .85rem; letter-spacing: .03em; }
@media (max-width: 420px) {
  .nav-lang { padding: 6px 10px; gap: 3px; }
  .nav-lang span, .nav-lang-code { display: inline; }
  .nav-lang select { position: absolute; inset: 0; width: 100%; max-width: none; opacity: 0; }
}
/* phones: the top bar keeps to the screen, with the 🔥 streak too (the profile shows just the avatar; on the
   narrowest the language menu just the code) */
@media (max-width: 420px) {
  .profile-btn .who span:last-child { display: none; }
  .profile-btn { padding: 3px; }
}
@media (max-width: 360px) {
  .nav-lang { padding: 6px 8px; }
  .nav-lang span { display: none; }
}

/* Higher or Lower: two country cards side by side */
.hilo-pair { display: flex; align-items: stretch; justify-content: center; gap: 10px; width: 100%; max-width: 520px; }
.hilo-card { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--border); box-shadow: 0 2px 10px rgba(0,0,0,.08); text-align: center; }
.quiz-flag .hilo-card img { width: 100%; max-width: 150px; box-shadow: 0 1px 6px rgba(0,0,0,.25); border-radius: 6px; }
.hilo-name { font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.hilo-value { font-size: 1.15rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.hilo-b .hilo-value { color: var(--muted); }
.hilo-b.shown .hilo-value { color: var(--accent); }
.hilo-vs { align-self: center; font-weight: 800; color: var(--muted); text-transform: uppercase; font-size: .85rem; }
@media (max-width: 420px) { .hilo-card { padding: 8px 6px; } .hilo-value { font-size: 1rem; } .hilo-pair { gap: 6px; } }
.hilo-art { background: linear-gradient(135deg, #0d9488, #2f6fed); }
.art-hilo { display: flex; align-items: center; gap: 14px; }
.art-hilo img { width: 92px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 5px; box-shadow: 0 4px 12px rgba(0,0,0,.25), 0 0 0 2px rgba(255,255,255,.9); }
.art-hilo .art-arrows { display: flex; flex-direction: column; gap: 6px; font-size: 1.6rem; line-height: 1; }

/* Rooms: the box on the home page, the create dialog and the room itself */
.rooms-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin: 0 0 18px; padding: 14px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.rooms-text h2 { margin: 0 0 2px; font-size: 1.15rem; }
.rooms-text p { margin: 0; }
.rooms-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.rooms-join { display: flex; gap: 6px; min-width: 0; }
.rooms-join input { width: 9.5em; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; }
.rooms-join input::placeholder { text-transform: none; letter-spacing: normal; font-weight: 400; }
@media (max-width: 560px) { .rooms-actions { width: 100%; } .rooms-join { flex: 1; } .rooms-join input { flex: 1; width: 0; min-width: 0; } .rooms-or { display: none; } #room-create-btn { width: 100%; } }
.room-dialog label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.room-dialog select { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); }
.room-label { display: block; font-weight: 600; margin-bottom: 4px; }
.room-dialog .segmented { margin-bottom: 4px; }
.room-details { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; margin: 6px 0 14px; }
.room-code-big { display: flex; flex-direction: column; }
.room-code-big b { font-size: 2rem; letter-spacing: .18em; color: var(--accent); font-variant-numeric: tabular-nums; }
.room-facts { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; }
.room-facts dt { font-size: .8rem; color: var(--muted); }
.room-facts dd { margin: 0; font-weight: 700; }
.room-players-title { margin: 6px 0 4px; font-size: 1rem; }
.room-board { list-style: none; padding-left: 0; }
.board.room-board li::before { content: none; }
.final-room .place-medal { min-width: 2em; text-align: center; font-weight: 800; font-size: 1.3rem; }
.end-room-title { margin: -4px 0 10px; }

/* new games paused before an update (the lobby's "paused"): a friendly banner on the home page */
.paused-note { display: flex; align-items: center; gap: 16px; max-width: 640px; margin: 0 auto 18px; padding: 16px 20px; text-align: left;
  border-radius: 16px; border: 2px solid transparent;
  background: linear-gradient(var(--card), var(--card)) padding-box, linear-gradient(135deg, #f5a623, #e0457b, #6a5cff) border-box; }
.paused-note h2 { margin: 0 0 4px; font-size: 1.25rem; background: linear-gradient(90deg, #f5a623, #e0457b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.paused-note p { margin: 0 0 4px; }
.paused-icon { font-size: 2.4rem; flex: none; animation: paused-wobble 2.4s ease-in-out infinite; }
@keyframes paused-wobble { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }
@media (prefers-reduced-motion: reduce) { .paused-icon { animation: none; } }
