:root {
  --bg: #0f2a1f;
  --bg-deep: #081a12;
  --card: #fffaf0;
  --card-2: #f6eedc;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e7dcc4;
  --red: #c8102e;
  --red-dark: #9b0d23;
  --gold: #f4c430;
  --green: #1f7a3a;
  --green-light: #dcfce7;
  --blue: #1d4ed8;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .28);
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Nunito, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(ellipse at top, #1b4d37 0%, var(--bg) 45%, var(--bg-deep) 100%) fixed;
  background-color: var(--bg);
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  -webkit-tap-highlight-color: transparent;
}
body.playing { padding-bottom: 24px; }
body.playing .bottom-nav { display: none; }

#snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 100; width: 100vw; height: 100vh; }

h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; }
h1 { font-family: "Mountains of Christmas", Georgia, serif; font-size: 2.1rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { line-height: 1.5; margin: 0 0 .8em; }
a { color: inherit; }
button { font: inherit; color: inherit; }
img { max-width: 100%; }

.container { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; padding: 12px 16px; outline: none; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.grow { flex: 1; min-width: 0; }
.link { color: #fde68a; font-weight: 700; }
.card .link { color: var(--red); }
.stack { display: grid; gap: 12px; margin-top: 12px; }
.stack .btn.big { margin-top: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 800; color: var(--red); margin-bottom: .4em; }
.page-title { color: #fff; text-align: center; margin: 8px 0 14px; text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.section-title { color: #fff; font-family: "Mountains of Christmas", Georgia, serif; font-size: 1.7rem; text-align: center; margin: 22px 0 10px; }
.tag { background: var(--gold); color: #3b2f00; font-size: .65rem; font-weight: 800; padding: 2px 6px; border-radius: 6px; margin-left: 6px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  background: rgba(8, 26, 18, .82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  color: #fff;
}
.brand { flex: 1 1 auto; min-width: 0; font-family: "Mountains of Christmas", Georgia, serif; font-weight: 700; font-size: clamp(1.02rem, 4.7vw, 1.25rem); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.family-chip { flex: none; min-width: 0; display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: .9rem; max-width: 52%; white-space: nowrap; }
.family-chip > span { flex: none; }
.family-chip > span:nth-child(2) { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.family-chip .avatar { font-size: 1.3rem; }
.family-chip .tag { margin-left: 0; }

/* Bottom nav */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(255, 250, 240, .97);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px rgba(0,0,0,.18);
}
.bottom-nav[hidden] { display: none; }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; font-size: .75rem; font-weight: 700; color: var(--muted); }
.bottom-nav a span { font-size: 1.35rem; }
.bottom-nav a.active { color: var(--red); }

/* Cards & buttons */
.card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 14px; position: relative; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 10px 18px; border-radius: 999px; border: 2px solid transparent;
  font-weight: 800; font-size: 1rem; text-decoration: none; cursor: pointer; user-select: none;
  transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--red); color: #fff; box-shadow: 0 4px 0 var(--red-dark); }
.btn.primary:hover { background: #d9163a; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost.on-dark { border-color: rgba(255,255,255,.45); color: #fff; }
.btn.big { width: 100%; min-height: 56px; font-size: 1.1rem; margin-top: 8px; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .85rem; }
.hero-emoji { font-size: 3rem; line-height: 1.1; margin-bottom: 6px; }
.spin { animation: spin 3s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Login */
.login { padding-top: 10px; }
.login-hero { text-align: center; color: #fff; padding: 20px 0 10px; }
.login-hero h1 { font-size: 2.6rem; text-shadow: 0 3px 12px rgba(0,0,0,.5); }
.login-hero .lead { color: #e7f5ec; font-size: 1.05rem; }
.login-card label { display: block; font-weight: 800; margin-bottom: 8px; }
.login-card input, .caption-input, .tp-input, .field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 1.2rem; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--line); background: #fff; color: var(--ink);
}
.login-card .muted { margin: 16px 0 0; text-align: center; }
.login-card input { text-transform: uppercase; letter-spacing: .08em; font-weight: 800; text-align: center; }
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(200, 16, 46, .35); border-color: var(--red); }

/* Home */
.hero-card { text-align: center; background: linear-gradient(160deg, #fffaf0, #f7ecd6); }
.big-countdown { font-size: 2.6rem; font-weight: 800; color: var(--red); margin: 6px 0 10px; font-variant-numeric: tabular-nums; }
.today .today-row { display: flex; align-items: center; gap: 14px; text-align: left; margin: 6px 0 4px; }
.today-icon { font-size: 2.8rem; width: 70px; height: 70px; flex: none; display: grid; place-items: center; background: #fff; border-radius: 20px; box-shadow: inset 0 0 0 2px var(--line); }
.today h2 { margin-bottom: 4px; }
.done-line { color: var(--green); font-weight: 800; margin: 0; }
.vote-card { display: flex; align-items: center; gap: 12px; text-decoration: none; background: #fff7d6; border: 2px solid var(--gold); }
.vote-icon { font-size: 2rem; }
.chev { margin-left: auto; font-size: 1.8rem; color: var(--muted); }

.advent { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.advent + .muted { margin-top: 16px; color: #cfe3d7; }
.door {
  position: relative; aspect-ratio: 1; border-radius: 14px; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #b3122f, #7d0b1f); color: #fff; font-weight: 800;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.18), 0 4px 10px rgba(0,0,0,.3);
  transition: transform .12s ease;
}
.door:nth-child(3n) { background: linear-gradient(145deg, #1f7a3a, #0f4d23); }
.door:nth-child(4n) { background: linear-gradient(145deg, #1d3f8a, #102455); }
.door:active { transform: scale(.95); }
.door-num { font-size: 1.4rem; font-family: "Mountains of Christmas", Georgia, serif; }
.door-num.small { font-size: .85rem; font-family: Nunito, sans-serif; opacity: .85; }
.door-icon { font-size: 1.6rem; line-height: 1.1; }
.door.locked { opacity: .82; }
.door.locked::after { content: ""; position: absolute; inset: 6px; border: 2px dashed rgba(255,255,255,.25); border-radius: 10px; }
.door.open, .door.done { background: #fffaf0; color: var(--ink); }
.door.missed { background: #3b4a42; color: #cbd5d0; opacity: .7; }
.door.today { outline: 3px solid var(--gold); outline-offset: 2px; animation: glow 2s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 22px rgba(244, 196, 48, .8); } }
.badge { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; font-size: .75rem; display: grid; place-items: center; box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.badge.ok { background: var(--green); color: #fff; }
.badge.warn { background: var(--gold); color: #3b2f00; }
.badge.vote { background: #fff; }

/* Intro & results */
.intro { text-align: center; }
.intro-icon { font-size: 3.4rem; }
.prompt-box { display: grid; gap: 2px; background: #fff; border: 2px dashed var(--gold); border-radius: 14px; padding: 12px 14px; margin: 10px 0 14px; text-align: center; }
.prompt-box strong { font-size: 1.15rem; }
.prompt-box .muted.small { color: var(--muted); margin: 0; }
.facts { list-style: none; padding: 0; margin: 12px 0; text-align: left; display: grid; gap: 8px; }
.facts li { background: var(--card-2); padding: 10px 12px; border-radius: 12px; }
.result-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.result-stats > div { background: #fff; border-radius: 14px; padding: 12px; display: grid; gap: 4px; box-shadow: inset 0 0 0 2px var(--line); }
.stat { font-size: 1.15rem; font-weight: 800; }
.rank-line { background: var(--green-light); border-radius: 12px; padding: 10px; }
.entry-preview { border-radius: 14px; box-shadow: var(--shadow); max-height: 60vh; object-fit: contain; background: #fff; }
.caption { font-style: italic; }

/* Play screen */
.play-bar {
  position: sticky; top: 56px; z-index: 15;
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: 14px; padding: 8px 12px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.play-back { font-size: 1.8rem; text-decoration: none; line-height: 1; padding: 0 4px; color: var(--muted); }
.play-title { flex: 1; min-width: 0; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.play-timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.25rem; background: var(--ink); color: #fff; border-radius: 10px; padding: 4px 10px; }
.play-timer.low { background: var(--red); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.07); } }
.penalty { text-align: center; color: #fecaca; font-weight: 800; font-size: .85rem; margin: -4px 0 8px; }
.game { position: relative; }
.game-help { color: #e7f5ec; text-align: center; font-size: .9rem; margin: 0 0 8px; }
.quiz-meta { color: #e7f5ec; font-weight: 700; text-align: center; margin: 6px 0 10px; }
.progress { height: 8px; background: rgba(255,255,255,.18); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--gold); transition: width .3s ease; }
.shake { animation: shake .3s ease; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.miss-mark { animation: fade .6s ease forwards; }
@keyframes fade { to { opacity: 0; } }

/* Word search */
.ws-board { position: relative; background: var(--card); border-radius: 14px; padding: 6px; box-shadow: var(--shadow); touch-action: none; user-select: none; -webkit-user-select: none; }
.ws-grid { display: grid; grid-template-columns: repeat(var(--n), 1fr); }
.ws-cell { aspect-ratio: 1; display: grid; place-items: center; font-weight: 800; font-size: clamp(.9rem, calc(80vw / var(--n) * .55), 1.5rem); cursor: pointer; }
.ws-lines { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); pointer-events: none; }
.ws-words { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.ws-word { background: var(--card); padding: 5px 10px; border-radius: 999px; font-weight: 800; font-size: .85rem; letter-spacing: .04em; }
.ws-word.found { background: var(--green); color: #fff; text-decoration: line-through; }
.ws-count { color: #fff; font-weight: 800; padding: 5px 8px; }

/* Spot the difference */
.sd-status { display: flex; justify-content: space-between; align-items: center; color: #fff; margin-bottom: 8px; gap: 8px; }
.sd-status .muted { color: #cfe3d7; }
.sd-pics { display: grid; gap: 8px; }
@media (min-width: 900px) { .container:has(.sd) { max-width: 1100px; } .sd-pics { grid-template-columns: 1fr 1fr; } }
.sd-svg { display: block; width: 100%; height: auto; border-radius: 12px; box-shadow: var(--shadow); cursor: crosshair; touch-action: manipulation; }

/* Hidden objects */
.ho-targets { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 8px; }
.ho-target { display: inline-flex; align-items: center; gap: 4px; background: var(--card); border-radius: 999px; padding: 4px 10px 4px 6px; font-weight: 800; font-size: .8rem; }
.ho-emoji { font-size: 1.4rem; }
.ho-icon { width: 28px; height: 28px; flex: none; display: block; }
.ho-target.found .ho-icon { opacity: .7; }
.ho-target.found { background: var(--green); color: #fff; }
.ho-target.found .ho-emoji { filter: grayscale(.2); }
.ho-target.found .ho-name { text-decoration: line-through; }
.ho-tools { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ho-tools .muted { color: #cfe3d7; }
.ho-tools .btn.ghost { background: var(--card); }
.ho-scroll { border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.ho-scroll.zoomed { overflow: auto; max-height: 70vh; -webkit-overflow-scrolling: touch; }
.ho-svg { display: block; width: 100%; height: auto; touch-action: manipulation; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; user-select: none; -webkit-user-select: none; }

/* Quiz & text puzzles */
.quiz, .tp { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.quiz .quiz-meta, .tp .quiz-meta { color: var(--muted); }
.quiz .progress, .tp .progress { background: var(--card-2); }
.quiz-q { font-size: 1.3rem; text-align: center; margin: 10px 0 16px; }
.quiz-options { display: grid; gap: 10px; }
.quiz-opt {
  display: flex; align-items: center; gap: 10px; text-align: left; width: 100%;
  min-height: 54px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-weight: 700; font-size: 1.02rem; cursor: pointer;
}
.opt-letter { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); font-weight: 800; }
.quiz-opt.chosen { border-color: var(--blue); }
.quiz-opt.right { background: var(--green); border-color: var(--green); color: #fff; }
.quiz-opt.wrong { background: var(--red); border-color: var(--red); color: #fff; }
.tp-clue { text-align: center; margin: 16px 0 8px; }
.tiles { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.tile { width: clamp(28px, 8vw, 40px); aspect-ratio: 1; display: grid; place-items: center; background: var(--gold); color: #3b2f00; font-weight: 800; font-size: clamp(1rem, 5vw, 1.4rem); border-radius: 8px; box-shadow: 0 3px 0 #b8901c; }
.emoji-clue { font-size: clamp(2.2rem, 12vw, 3.4rem); letter-spacing: .1em; }
.tp-hint { text-align: center; color: var(--muted); font-weight: 700; }
.tp-form { display: flex; gap: 8px; margin-top: 12px; }
.tp-input { flex: 1; min-width: 0; font-size: 1.1rem; }
.tp-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.tp-flash { min-height: 28px; text-align: center; margin-top: 10px; font-weight: 800; }
.good { color: var(--green); }
.bad { color: var(--red); }

/* Memory */
.mem-grid { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 8px; max-width: 460px; margin: 0 auto; }
.mem-card { aspect-ratio: 3 / 4; perspective: 600px; border: 0; background: none; padding: 0; cursor: pointer; }
.mem-inner { position: relative; display: block; width: 100%; height: 100%; transition: transform .35s ease; transform-style: preserve-3d; }
.mem-card.flipped .mem-inner { transform: rotateY(180deg); }
.mem-back, .mem-front { position: absolute; inset: 0; border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: grid; place-items: center; }
.mem-back { background: repeating-linear-gradient(45deg, #b3122f 0 10px, #9b0d23 10px 20px); box-shadow: inset 0 0 0 3px #fff, 0 4px 8px rgba(0,0,0,.3); }
.mem-back::after { content: "🎄"; font-size: 1.6rem; }
.mem-front { background: #fff; transform: rotateY(180deg); font-size: clamp(1.8rem, 9vw, 2.6rem); box-shadow: 0 4px 8px rgba(0,0,0,.3); }
.mem-card.matched .mem-front { background: var(--green-light); box-shadow: inset 0 0 0 3px var(--green); }

/* Sliding puzzle */
.sl-tools { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sl-tools .btn.ghost { background: var(--card); }
.sl-board { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 3px; background: var(--card); padding: 3px; border-radius: 12px; box-shadow: var(--shadow); max-width: 480px; margin: 0 auto; position: relative; }
.sl-tile { aspect-ratio: 1; padding: 0; border: 0; border-radius: 6px; overflow: hidden; position: relative; cursor: pointer; background: #ddd; }
.sl-tile svg { display: block; width: 100%; height: 100%; }
.sl-tile.blank { background: rgba(0,0,0,.12); cursor: default; }
.sl-tile.home { outline: 2px solid rgba(34, 197, 94, .8); outline-offset: -2px; }
.sl-board:not(.numbered) .sl-num { display: none; }
.sl-num { position: absolute; top: 3px; left: 3px; background: rgba(0,0,0,.6); color: #fff; font-size: .75rem; font-weight: 800; padding: 1px 6px; border-radius: 6px; }
.sl-peek { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.75); display: grid; place-items: center; padding: 20px; }
.sl-peek[hidden] { display: none; }
.sl-peek svg { width: min(90vw, 480px); border-radius: 12px; }

/* Catch */
.catch canvas { display: block; width: 100%; border-radius: 14px; box-shadow: var(--shadow); touch-action: none; }
.catch .muted { color: #cfe3d7; margin-top: 8px; }

/* Count */
.count-svg { display: block; width: 100%; height: auto; border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 12px; }
.count-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.count-icon svg { width: 34px; height: 34px; display: block; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--card-2); font-size: 1.3rem; font-weight: 800; cursor: pointer; }
.stepper input { width: 58px; text-align: center; font: inherit; font-weight: 800; font-size: 1.2rem; padding: 6px; border-radius: 10px; border: 2px solid var(--line); }

/* Drawing */
.draw .prompt-box { margin-top: 0; }
#draw-canvas { display: block; width: 100%; max-width: 560px; margin: 0 auto; aspect-ratio: 1; background: #fff; border-radius: 14px; box-shadow: var(--shadow); touch-action: none; cursor: crosshair; }
.draw-tools { background: var(--card); border-radius: 14px; padding: 10px; margin: 10px auto; max-width: 560px; display: grid; gap: 10px; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.swatch { aspect-ratio: 1; border-radius: 50%; border: 3px solid #fff; background: var(--c); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch.active { box-shadow: 0 0 0 3px var(--ink); }
.draw-row { display: flex; gap: 6px; justify-content: space-between; }
.size, .tool { flex: 1; height: 44px; border-radius: 12px; border: 2px solid var(--line); background: #fff; cursor: pointer; display: grid; place-items: center; font-size: 1.2rem; }
.size span { width: var(--s); height: var(--s); border-radius: 50%; background: var(--ink); display: block; }
.size.active, .tool.active { border-color: var(--red); background: #fff1f2; }
.caption-input { font-size: 1rem; margin: 6px 0; }
.draw .btn.big, .photo .btn.big { max-width: 560px; }
.draw, .photo { display: grid; justify-items: stretch; }

/* Photo */
.photo-drop { display: grid; place-items: center; text-align: center; min-height: 220px; background: var(--card); border: 3px dashed var(--gold); border-radius: var(--radius); padding: 16px; cursor: pointer; }
.photo-drop img { max-height: 55vh; border-radius: 12px; margin-bottom: 6px; }
.photo-drop span { display: grid; gap: 4px; justify-items: center; }
.photo .muted { color: #cfe3d7; margin-top: 10px; }

/* Voting & galleries */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 560px) { .gallery { grid-template-columns: repeat(3, 1fr); } }
.gallery.results { grid-template-columns: 1fr; }
@media (min-width: 560px) { .gallery.results { grid-template-columns: 1fr 1fr; } }
.entry { position: relative; background: var(--card); border: 3px solid transparent; border-radius: 14px; padding: 6px; margin: 0; text-align: left; cursor: pointer; box-shadow: var(--shadow); display: grid; gap: 6px; }
.entry img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: #fff; }
.gallery.results .entry img { aspect-ratio: auto; max-height: 420px; object-fit: contain; }
.entry-label { font-size: .8rem; font-weight: 700; }
.entry.picked { border-color: var(--gold); background: #fff7d6; }
.entry.me { border-color: var(--green); }
.medal { position: absolute; top: -10px; right: -8px; font-size: 2rem; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }
.entry figcaption { padding: 4px 6px 6px; }
.sticky-actions { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); z-index: 5; }

/* Leaderboard */
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: rgba(0,0,0,.25); border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.tabs a { text-align: center; padding: 10px; border-radius: 999px; text-decoration: none; color: #e7f5ec; font-weight: 800; }
.tabs a.active { background: var(--card); color: var(--ink); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,.12); color: #fff; text-decoration: none; font-weight: 800; font-size: .9rem; }
.chip.active { background: var(--gold); color: #3b2f00; }
.list { padding: 6px 14px; }
.row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row.me { background: var(--green-light); margin: 0 -14px; padding: 10px 14px; }
.pos { width: 26px; text-align: center; font-weight: 800; color: var(--muted); }
.row .avatar { font-size: 1.6rem; }
.pts { font-weight: 800; font-size: 1.2rem; color: var(--red); }
.live { color: var(--green); font-weight: 800; font-size: .85rem; }
.podium { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: end; gap: 8px; margin: 8px 0 16px; text-align: center; color: #fff; }
.podium-avatar { font-size: 2.2rem; }
.podium-name { font-weight: 800; font-size: .85rem; margin: 2px 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-block { border-radius: 12px 12px 0 0; padding: 10px 4px; font-weight: 800; font-size: 1.3rem; color: #3b2f00; display: grid; }
.podium-block small { font-size: .75rem; }
.p1 .podium-block { background: linear-gradient(#ffe27a, var(--gold)); height: 110px; }
.p2 .podium-block { background: linear-gradient(#f1f5f9, #cbd5e1); height: 84px; }
.p3 .podium-block { background: linear-gradient(#f5c89a, #d08c4f); height: 66px; }
.p1 .podium-avatar::before { content: "👑"; display: block; font-size: 1.4rem; }

/* How to play */
.prose h3 { margin-top: 1.2em; }
.prose h3:first-child { margin-top: 0; }
.prose ul { padding-left: 1.2em; line-height: 1.5; }
.prose li { margin-bottom: .4em; }
.points-table { display: flex; flex-wrap: wrap; gap: 6px; }
.points-table span { background: var(--card-2); padding: 4px 10px; border-radius: 999px; font-size: .9rem; }

/* Modal & toast */
.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 16px; animation: fadein .15s ease; }
@keyframes fadein { from { opacity: 0; } }
.modal { background: var(--card); border-radius: var(--radius); padding: 22px; width: min(420px, 100%); box-shadow: var(--shadow); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 18px); z-index: 70;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; max-width: calc(100vw - 32px); text-align: center;
  transition: opacity .2s ease, transform .2s ease; box-shadow: var(--shadow);
}
body.playing .toast { bottom: 24px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: var(--green); }
.toast.error { background: var(--red); }
.toast.warn { background: #b45309; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Post-game review */
.review h2 { text-align: center; }
.score-meter { position: relative; height: 38px; background: var(--card-2); border-radius: 999px; overflow: hidden; margin: 6px 0 10px; }
.score-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--green), #34c26a); border-radius: 999px; transition: width .6s ease; }
.score-meter span { position: relative; display: grid; place-items: center; height: 100%; font-weight: 800; }
.review-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.review-list li { display: flex; gap: 10px; align-items: flex-start; background: #fff; border-radius: 12px; padding: 10px 12px; box-shadow: inset 0 0 0 2px var(--line); }
.review-list li.ok { box-shadow: inset 0 0 0 2px #bbf7d0; }
.review-list li.miss { box-shadow: inset 0 0 0 2px #fecaca; }
.review-list .grow { display: grid; gap: 2px; }
.review-label { font-weight: 700; }
.review-mark { flex: none; }
.answer { color: var(--green); }
.reveal-note { background: #fff7d6; border: 2px solid var(--gold); border-radius: 12px; padding: 10px 12px; margin: 12px 0 0; text-align: center; }
.review-img { margin-top: 10px; border-radius: 12px; }
.review .sd-pics { margin-top: 10px; }
.review-ws { margin-top: 10px; box-shadow: none; border: 2px solid var(--line); touch-action: auto; }
.review-ws .ws-cell { cursor: default; }

/* Christmas countdowns */
.countdowns { display: grid; gap: 10px; margin-bottom: 14px; }
@media (min-width: 560px) { .countdowns { grid-template-columns: 1fr 1fr; } }
.cd-card { background: linear-gradient(160deg, #b3122f, #7d0b1f); color: #fff; border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.cd-card:nth-child(2) { background: linear-gradient(160deg, #1f7a3a, #0f4d23); }
.cd-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cd-head strong { display: block; font-size: 1.05rem; }
.cd-sub { display: block; font-size: .8rem; opacity: .85; }
.cd-icon { font-size: 1.8rem; }
.cd-units { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cd-unit { background: rgba(255, 255, 255, .14); border-radius: 12px; padding: 8px 4px; text-align: center; display: grid; }
.cd-unit b { font-size: 1.6rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.cd-unit small { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; opacity: .85; }

/* Quick quiz: joining, the waiting room and the round screens */
.play-round { flex: none; font-weight: 800; font-size: .8rem; background: var(--card-2); border-radius: 8px; padding: 4px 8px; color: var(--muted); font-variant-numeric: tabular-nums; }
.join-card input { text-transform: none; letter-spacing: 0; }
.join-label { font-weight: 800; margin: 16px 0 8px; }
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 8px; }
.avatar-opt { aspect-ratio: 1; min-height: 44px; font-size: 1.5rem; line-height: 1; padding: 0; background: #fff; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; }
.avatar-opt[aria-checked="true"] { border-color: var(--red); background: #fff1f2; box-shadow: 0 0 0 2px var(--red); }
.link-btn { background: none; border: 0; padding: 6px; font: inherit; color: var(--red); font-weight: 700; text-decoration: underline; cursor: pointer; }
.q-players { display: flex; flex-wrap: wrap; gap: 6px; }
.center .q-players { justify-content: center; margin-top: 12px; }
.q-player { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 11px 5px 8px; border-radius: 999px; background: var(--card-2); font-weight: 700; font-size: .92rem; overflow-wrap: anywhere; }
.q-player.me { box-shadow: inset 0 0 0 2px var(--gold); background: #fff7d6; }
.q-player.playing { background: #fff7d6; }
.q-player.done { background: var(--green-light); color: #14532d; }
.q-num { display: inline-block; min-width: 1.7em; padding: 1px 8px; border-radius: 999px; background: var(--red); color: #fff; font-family: inherit; font-size: .9rem; text-align: center; vertical-align: middle; }
.q-wait { margin: 14px 0 0; font-weight: 800; color: var(--green); animation: q-breathe 1.8s ease-in-out infinite; }
@keyframes q-breathe { 50% { opacity: .45; } }
.q-rounds { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; counter-reset: q; }
.q-rounds li { display: flex; align-items: center; gap: 12px; counter-increment: q; }
.q-rounds li::before { content: counter(q); flex: none; width: 1.4em; text-align: center; font-weight: 800; color: var(--muted); }
.q-round-icon { flex: none; width: 44px; height: 44px; display: grid; place-items: center; font-size: 1.5rem; background: #fff; border-radius: 12px; box-shadow: inset 0 0 0 2px var(--line); }
.q-go { font-size: 5rem; line-height: 1.1; font-weight: 800; color: var(--red); font-variant-numeric: tabular-nums; margin: 6px 0; }
.card .q-list { padding: 0; }
.card .q-list .row.me { margin: 0 -10px; padding: 10px; border-radius: 12px; }

/* Practice content (test families, quick-quiz rehearsals) and notes about dealt content */
.practice-note { background: #eef6ff; border: 2px dashed #7fb2e6; border-radius: 12px; padding: 8px 12px; font-size: .9rem; font-weight: 700; color: #1d4f80; }
.practice-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: #eef6ff; border: 2px dashed #7fb2e6; border-radius: 14px; padding: 10px 14px; margin: 6px 0 12px; color: #1d4f80; }
.practice-bar > div { flex: 1 1 320px; }
.practice-bar.live { background: #fdecec; border: 2px solid #e39a9a; color: #7a1f1f; }
.note-box { background: #f3f6f1; border: 2px solid #c9d8c5; border-radius: 12px; padding: 10px 12px; margin: 10px 0; font-size: .92rem; }
.note-box p { margin: 0 0 8px; }
.note-box .actions { margin: 0; }
