/* Smart Owl Quiz — "exercise book" look: navy ink, blue-ruled paper, a red margin line, coloured book covers
   for the games and gold merit stickers for answer streaks. */

@font-face { font-family: 'Young Serif'; font-weight: 400; font-display: swap; src: url(../fonts/young-serif-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Young Serif'; font-weight: 400; font-display: swap; src: url(../fonts/young-serif-latin-ext-400-normal.woff2) format('woff2');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Andika'; font-weight: 400; font-display: swap; src: url(../fonts/andika-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Andika'; font-weight: 400; font-display: swap; src: url(../fonts/andika-latin-ext-400-normal.woff2) format('woff2');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Andika'; font-weight: 700; font-display: swap; src: url(../fonts/andika-latin-700-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Andika'; font-weight: 700; font-display: swap; src: url(../fonts/andika-latin-ext-700-normal.woff2) format('woff2');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --ink: #14284B;        /* Oxford navy: text, header */
  --ink2: #3A4E72;       /* softer ink for secondary text */
  --desk: #E9EEF5;       /* the desk the book sits on */
  --paper: #FCFCF9;      /* exercise-book paper */
  --rule: #D5E1EE;       /* blue ruled lines */
  --margin: #D9534A;     /* red margin line, wrong answers */
  --leaf: #1E7A52;       /* correct answers */
  --leaf-bg: #E3F3EA;
  --red-bg: #FBE7E5;
  --brass: #C9A227;      /* merit stickers, medals */
  --brass-dk: #8C6D0E;
  --sky: #2F6FA8;        /* links, focus */
  --line: #C9D3E1;
  --serif: 'Young Serif', Georgia, 'Times New Roman', serif;
  --sans: 'Andika', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --r: 10px;
  --lh: 28px;            /* ruled line spacing */
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--desk); color: var(--ink);
  font: 400 1.0625rem/1.55 var(--sans);
  padding-bottom: env(safe-area-inset-bottom);
}
img, svg { max-width: 100%; }
a { color: var(--sky); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.005em; }
h1 { font-size: clamp(1.9rem, 6vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 4.4vw, 1.9rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: #fff; padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { top: 8px; }
.muted { color: var(--ink2); }
.small { font-size: .9rem; }

/* ---------------------------------------------------------------- header */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(8px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  background: var(--ink); color: #fff; box-shadow: 0 2px 0 rgba(20, 40, 75, .15);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font: 400 1.25rem var(--serif); }
.brand img { width: 40px; height: 40px; background: #fff; border-radius: 50%; padding: 3px; }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a { color: #DDE6F3; text-decoration: none; padding: 8px 10px; border-radius: 8px; font-weight: 700; font-size: .95rem; }
.topnav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .12); }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: #DDE6F3; cursor: pointer; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: rgba(255, 255, 255, .12); }
@media (max-width: 420px) { .brand span { font-size: 1.05rem; } .topnav a { padding: 8px 7px; font-size: .9rem; } }

/* ---------------------------------------------------------------- the page: one sheet of exercise-book paper */
main { display: block; outline: none; }
.sheet {
  position: relative; max-width: 860px; margin: 18px auto; padding: 22px 20px 26px 56px;
  background-color: var(--paper);
  background-image: linear-gradient(to right, transparent 39px, var(--margin) 39px, var(--margin) 41px, transparent 41px),
    repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--lh) - 1px), var(--rule) calc(var(--lh) - 1px), var(--rule) var(--lh));
  background-position: 0 0, 0 14px;
  border-radius: 4px; box-shadow: 0 1px 0 var(--line), 0 10px 30px -18px rgba(20, 40, 75, .45);
}
@media (max-width: 600px) {
  .sheet { margin: 0; border-radius: 0; padding: 18px 14px 24px 34px; min-height: calc(100vh - 56px);
    background-image: linear-gradient(to right, transparent 21px, var(--margin) 21px, var(--margin) 23px, transparent 23px),
      repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--lh) - 1px), var(--rule) calc(var(--lh) - 1px), var(--rule) var(--lh)); }
}
.loading, .nojs { max-width: 860px; margin: 40px auto; padding: 0 20px; color: var(--ink2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px;
  border: 2px solid var(--ink); border-radius: var(--r); background: #fff; color: var(--ink); font-weight: 700; text-decoration: none; cursor: pointer;
  box-shadow: 0 3px 0 var(--ink); transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.gold { background: var(--brass); border-color: var(--brass-dk); color: #1d1600; box-shadow: 0 3px 0 var(--brass-dk); }
.btn.ghost { box-shadow: none; border-color: var(--line); }
.btn[disabled] { opacity: .5; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }

/* ---------------------------------------------------------------- home: the shelf of exercise books */
.hello { display: grid; grid-template-columns: 1fr auto; gap: 8px 20px; align-items: center; margin-bottom: 8px; }
.hello img { width: 104px; height: 104px; }
.hello p { max-width: 46ch; color: var(--ink2); }
@media (max-width: 520px) { .hello { grid-template-columns: 1fr 72px; } .hello img { width: 72px; height: 72px; } }

.daily {
  position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; margin: 10px 0 22px;
  padding: 16px 18px; border-radius: var(--r); background: var(--ink); color: #fff; text-decoration: none;
  box-shadow: 0 4px 0 #0b1830;
}
.daily .seal { width: 64px; height: 64px; }
.daily b { display: block; font: 400 1.35rem var(--serif); }
.daily small { color: #C9D6EA; font-size: .92rem; display: block; }
.daily .go { font-weight: 700; padding: 10px 16px; border-radius: 99px; background: var(--brass); color: #1d1600; white-space: nowrap; }
.daily.done-today .go { background: #fff; color: var(--ink); }
@media (max-width: 520px) { .daily { grid-template-columns: auto 1fr; } .daily .go { grid-column: 1 / -1; text-align: center; } }

.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; margin: 6px 0 10px; }
@media (max-width: 400px) { .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
.book {
  --cover: #2B5D8C;
  position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 200px; padding: 16px 12px 12px 22px;
  border-radius: 4px 10px 10px 4px; background: var(--cover); color: #fff; text-decoration: none; overflow: hidden;
  box-shadow: inset 8px 0 0 rgba(0, 0, 0, .18), 0 4px 0 rgba(0, 0, 0, .25); transition: transform .12s;
}
.book::before { /* the cover's grain */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .18;
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .25) 0 1px, transparent 1px 6px);
}
.book:hover { transform: translateY(-3px) rotate(-.6deg); }
.book .label {
  position: relative; background: #FDFDFB; color: var(--ink); border-radius: 6px; padding: 9px 10px 10px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .2);
  background-image: repeating-linear-gradient(to bottom, transparent 0 21px, #DCE5F0 21px 22px); background-position: 0 6px;
}
.book .label b { display: block; font: 400 1.15rem/1.2 var(--serif); overflow-wrap: anywhere; }
.book .label small { display: block; color: var(--ink2); font-size: .85rem; line-height: 1.35; margin-top: 4px; }
.book .ico { position: relative; width: 52px; height: 52px; color: rgba(255, 255, 255, .92); margin-bottom: 10px; }
.book .best { position: relative; margin-top: 10px; font-size: .82rem; color: rgba(255, 255, 255, .9); font-weight: 700; }
.book.classic  { --cover: #2B5D8C; }
.book.clock    { --cover: #B4462F; }
.book.lives    { --cover: #1E7A52; }
.book.sudden   { --cover: #5B3A82; }
.book.tf       { --cover: #0F7C84; }
.book.ladder   { --cover: #8C6D0E; }
.book.practice { --cover: #59657A; }
@media (prefers-reduced-motion: reduce) { .book, .book:hover { transition: none; transform: none; } }

/* ---------------------------------------------------------------- set-up */
.setup h1 { margin-bottom: .2em; }
.field { margin: 18px 0; border: 0; padding: 0; min-width: 0; }
.field > legend, .field > .lbl { font: 400 1.2rem var(--serif); margin-bottom: 8px; padding: 0; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.choices.ages { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
@media (max-width: 400px) { .choices, .choices.ages { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.choice { position: relative; display: block; cursor: pointer; min-width: 0; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: flex; flex-direction: column; justify-content: center; min-height: 52px; height: 100%; padding: 8px 12px; border-radius: var(--r);
  border: 2px solid var(--line); background: #fff; line-height: 1.25; overflow-wrap: anywhere;
}
.choice span b { font-weight: 700; }
.choice span small { color: var(--ink2); font-size: .82rem; }
.choice input:checked + span { border-color: var(--ink); background: #EDF2FA; box-shadow: inset 0 0 0 1px var(--ink); }
.choice input:focus-visible + span { outline: 3px solid var(--sky); outline-offset: 2px; }
.select { width: 100%; max-width: 420px; min-height: 48px; padding: 8px 12px; border-radius: var(--r); border: 2px solid var(--line); background: #fff; }
.hint { color: var(--ink2); font-size: .9rem; margin-top: 6px; }

/* ---------------------------------------------------------------- playing */
.hud { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 12px; }
.hud .pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: #fff; border: 1px solid var(--line); font-weight: 700; font-size: .92rem; }
.hud .pill svg { width: 18px; height: 18px; }
.hud .score { margin-left: auto; font: 400 1.4rem var(--serif); }
.hud .hearts { display: inline-flex; gap: 2px; }
.hud .hearts svg { width: 20px; height: 20px; }
.hud .hearts .lost { opacity: .22; }
.hud .streak.hot { background: #FFF6D8; border-color: var(--brass); }
.quit { border: 0; background: none; color: var(--ink2); text-decoration: underline; cursor: pointer; padding: 6px; font-size: .9rem; }

.timer { position: relative; height: 10px; border-radius: 99px; background: #E3E9F2; overflow: hidden; margin: 2px 0 16px; }
.timer i { position: absolute; inset: 0; transform-origin: left center; background: var(--ink); border-radius: 99px; }
.timer.low i { background: var(--margin); }
.clockface { font: 400 1.4rem var(--serif); min-width: 3ch; text-align: right; }

.qcard { position: relative; }
.qmeta { color: var(--ink2); font-size: .92rem; margin-bottom: 4px; }
.qtext { font: 400 clamp(1.35rem, 4.6vw, 1.9rem)/1.3 var(--serif); margin: 0 0 18px; overflow-wrap: anywhere; }
.claim { margin: -6px 0 18px; padding: 12px 14px; border-radius: var(--r); border: 2px dashed var(--ink); background: #fff; font-size: 1.15rem; }
.claim b { font: 400 1.3rem var(--serif); }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opts.tf { grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .opts { grid-template-columns: 1fr; } .opts.tf { grid-template-columns: 1fr 1fr; } }
.opt {
  position: relative; display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 10px; min-height: 60px; padding: 8px 14px 8px 8px;
  border: 2px solid var(--ink); border-radius: var(--r); background: #fff; text-align: left; cursor: pointer; font-size: 1.08rem; line-height: 1.3;
  box-shadow: 0 3px 0 var(--ink); transition: transform .08s, box-shadow .08s, background .15s;
  overflow-wrap: anywhere;
}
.opt .k { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: #fff; font: 400 1.05rem var(--serif); }
.opts.tf .opt { grid-template-columns: 1fr; text-align: center; font: 400 1.35rem var(--serif); min-height: 72px; }
.opts.tf .opt .k { display: none; }
.opt:not([disabled]):hover { background: #F3F6FB; }
.opt:not([disabled]):active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.opt[disabled] { cursor: default; }
.opt.gone { visibility: hidden; }
.opt.right { background: var(--leaf-bg); border-color: var(--leaf); box-shadow: 0 3px 0 var(--leaf); }
.opt.right .k { background: var(--leaf); }
.opt.wrong { background: var(--red-bg); border-color: var(--margin); box-shadow: 0 3px 0 var(--margin); }
.opt.wrong .k { background: var(--margin); }
.opt.dim { opacity: .55; }
.opt .mark { position: absolute; right: 10px; top: 50%; width: 30px; height: 30px; margin-top: -15px; }
.mark path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .35s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.feedback { margin-top: 16px; padding: 12px 14px; border-radius: var(--r); background: #fff; border: 1px solid var(--line); }
.feedback.ok { border-left: 6px solid var(--leaf); }
.feedback.no { border-left: 6px solid var(--margin); }
.feedback b { font: 400 1.15rem var(--serif); }
.feedback p { margin: 4px 0 0; }
.next-row { margin-top: 14px; display: flex; justify-content: flex-end; }

.helps { display: flex; gap: 8px; margin: -4px 0 14px; }
.helps .btn { min-height: 40px; padding: 6px 14px; font-size: .95rem; }
.ladder-rail { display: flex; gap: 3px; margin: 0 0 14px; }
.ladder-rail i { flex: 1; height: 8px; border-radius: 2px; background: #E3E9F2; }
.ladder-rail i.done { background: var(--brass); }
.ladder-rail i.now { background: var(--ink); }

/* ---------------------------------------------------------------- merit stickers (answer streaks) */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.sticker {
  position: absolute; left: 50%; top: 38%; width: min(64vw, 300px); aspect-ratio: 1; margin-left: calc(min(64vw, 300px) / -2);
  display: grid; place-items: center; text-align: center;
  animation: stick 1.6s cubic-bezier(.2, 1.4, .4, 1) forwards;
}
.sticker svg { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 6px 10px rgba(20, 40, 75, .35)); }
.sticker .words { position: relative; padding: 0 16%; color: #3B2A00; font: 400 clamp(1.6rem, 8vw, 2.5rem)/1.05 var(--serif); }
.sticker .words small { display: block; font: 700 clamp(.85rem, 3.4vw, 1rem) var(--sans); margin-top: 6px; opacity: .85; }
.sticker.silver .words { color: #23324D; }
.sticker.blue .words, .sticker.green .words, .sticker.purple .words { color: #fff; }
@keyframes stick {
  0% { transform: translateY(-50%) scale(2.2) rotate(-24deg); opacity: 0; }
  18% { transform: translateY(-50%) scale(.94) rotate(-8deg); opacity: 1; }
  28% { transform: translateY(-50%) scale(1) rotate(-8deg); }
  80% { transform: translateY(-50%) scale(1) rotate(-8deg); opacity: 1; }
  100% { transform: translateY(-60%) scale(.9) rotate(-8deg); opacity: 0; }
}
.star-bit { position: absolute; width: 18px; height: 18px; animation: fall 1.4s ease-in forwards; }
@keyframes fall { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }
.pop-pts { position: absolute; font: 400 1.6rem var(--serif); color: var(--leaf); animation: rise 1s ease-out forwards; }
@keyframes rise { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-60px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .sticker { animation: fadeonly 1.6s forwards; transform: translateY(-50%) rotate(-8deg); }
  @keyframes fadeonly { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
  .star-bit { display: none; }
  .mark path { animation: none; stroke-dashoffset: 0; }
}

/* ---------------------------------------------------------------- report card (results) */
.report { display: grid; gap: 18px; }
.report-head { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.grade {
  display: grid; place-items: center; width: 108px; height: 108px; border-radius: 50%; border: 4px double var(--margin); color: var(--margin);
  font: 400 3.2rem var(--serif); transform: rotate(-8deg); background: rgba(255, 255, 255, .6);
}
.grade small { display: block; font: 700 .7rem var(--sans); margin-top: -18px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .report-head { grid-template-columns: 1fr 88px; } .grade { width: 88px; height: 88px; font-size: 2.6rem; } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.stat b { display: block; font: 400 1.6rem var(--serif); }
.stat span { color: var(--ink2); font-size: .88rem; }
.comment { font-style: italic; color: var(--ink2); border-left: 4px solid var(--brass); padding-left: 12px; }
.save-box { background: #fff; border: 2px solid var(--ink); border-radius: var(--r); padding: 14px; }
.save-box form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.save-box input { flex: 1 1 200px; min-height: 48px; padding: 8px 12px; border-radius: var(--r); border: 2px solid var(--line); background: #fff; }
.save-box .err { color: var(--margin); font-weight: 700; margin: 8px 0 0; }
.ranks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ranks span { padding: 6px 12px; border-radius: 99px; background: #FFF6D8; border: 1px solid var(--brass); font-weight: 700; }
.review { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.review li { display: grid; grid-template-columns: 28px 1fr; gap: 8px; padding: 10px 12px; border-radius: var(--r); background: #fff; border: 1px solid var(--line); }
.review li svg { width: 22px; height: 22px; margin-top: 2px; }
.review .q { font-weight: 700; }
.review .a { color: var(--ink2); font-size: .95rem; }
details.review-box summary { cursor: pointer; font: 400 1.2rem var(--serif); padding: 6px 0; }

/* ---------------------------------------------------------------- leaderboards */
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: #E3E9F2; margin: 6px 0 12px; overflow-x: auto; }
.tabs button { flex: 1 0 auto; min-height: 44px; padding: 6px 14px; border: 0; border-radius: 9px; background: transparent; font-weight: 700; cursor: pointer; color: var(--ink2); }
.tabs button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(20, 40, 75, .2); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters .select { flex: 1 1 180px; max-width: none; }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 8px; margin: 18px 0 8px; }
.podium div { text-align: center; padding: 10px 6px 12px; border-radius: 10px 10px 4px 4px; background: #fff; border: 1px solid var(--line); min-width: 0; }
.podium .p1 { padding-top: 18px; border-color: var(--brass); background: #FFFBEA; }
.podium .medal { width: 42px; height: 42px; margin: 0 auto 4px; }
.podium b { display: block; overflow-wrap: anywhere; }
.podium span { font: 400 1.25rem var(--serif); }
.board { width: 100%; border-collapse: collapse; margin-top: 8px; background: #fff; border-radius: var(--r); overflow: hidden; }
.board th, .board td { padding: 9px 10px; text-align: left; border-bottom: 1px solid #E8EDF4; vertical-align: middle; }
.board th { font-size: .85rem; color: var(--ink2); font-weight: 700; background: #F5F8FC; }
.board td.n { width: 3ch; font: 400 1.05rem var(--serif); }
.board td.s { text-align: right; font: 400 1.1rem var(--serif); white-space: nowrap; }
.board td.nick { overflow-wrap: anywhere; font-weight: 700; }
.board tr.me td { background: #FFF6D8; }
.board .sub { display: block; font-weight: 400; color: var(--ink2); font-size: .82rem; }
@media (max-width: 520px) { .board .wide { display: none; } }
.empty { text-align: center; padding: 26px 10px; color: var(--ink2); }
.empty img { width: 80px; opacity: .8; }

/* ---------------------------------------------------------------- about + footer */
.about { max-width: 860px; margin: 26px auto; padding: 0 20px; color: var(--ink); }
.about h2 { margin-top: 10px; }
.about-modes { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.about-modes dt { font-weight: 700; }
.about-modes dd { margin: 0; color: var(--ink2); }
@media (max-width: 560px) { .about-modes { grid-template-columns: 1fr; } .about-modes dd { margin-bottom: 8px; } }
.foot { max-width: 860px; margin: 0 auto; padding: 10px 20px 30px; color: var(--ink2); font-size: .9rem; }
body.playing .about, body.playing .foot { display: none; }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; max-width: calc(100vw - 32px); }
.brand span { white-space: nowrap; }
@media (max-width: 480px) { .topnav a[data-nav="home"] { display: none; } .brand img { width: 36px; height: 36px; } }
@media (max-width: 340px) { .brand span { font-size: .95rem; } }
/* numbers read best in the plain typeface */
.hud .score, .stat b, .podium span, .board td.s, .board td.n, .clockface { font-family: var(--sans); font-weight: 700; font-variant-numeric: tabular-nums; }
.hud .score { font-size: 1.35rem; }
.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: visible; }
.tabs button { padding: 6px 4px; font-size: .95rem; line-height: 1.15; }
@media (max-width: 380px) { .tabs button { font-size: .85rem; } }
.podium > div[aria-hidden="true"] { visibility: hidden; }
@media (max-width: 370px) { .brand span { display: none; } }

/* ---------------------------------------------------------------- top navigation (the same links as the quiz maker) */
.top-right { display: flex; align-items: center; gap: 4px; }
.lb-link { display: inline-flex; align-items: center; gap: 6px; color: #DDE6F3; text-decoration: none; font-weight: 700; font-size: .95rem; padding: 8px 10px; border-radius: 8px; }
.lb-link svg { width: 20px; height: 20px; }
.lb-link[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .12); }
.sitenav { display: flex; justify-content: center; gap: 2px;
  padding: 4px max(12px, env(safe-area-inset-left)); background: #fff; border-bottom: 1px solid var(--line); }
.sitenav a { padding: 8px 12px; border-radius: 8px; color: var(--ink2); text-decoration: none; font-weight: 700; font-size: .95rem; white-space: nowrap; }
.sitenav a:hover { background: #EEF2F8; color: var(--ink); }
.sitenav a[aria-current="page"] { color: var(--ink); background: #E3EAF5; box-shadow: inset 0 -3px 0 var(--brass); }
.sitenav .ns { display: none; }
@media (max-width: 640px) {
  .sitenav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 4px 6px; }
  .sitenav a { text-align: center; padding: 8px 2px; font-size: .88rem; }
  .sitenav .nl { display: none; } .sitenav .ns { display: inline; }
}
@media (max-width: 480px) { .lb-link span { display: none; } .lb-link { padding: 8px; } }
@media (max-width: 370px) { .brand span { display: inline; font-size: 1rem; } }

/* ---------------------------------------------------------------- answering */
.opt.chosen { background: #EDF2FA; }
.opt.checking .k { animation: pulse .7s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 1; } to { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .opt.checking .k { animation: none; } }
/* quick-fire games: the result of the answer just given, under the timer */
.last { display: flex; align-items: center; gap: 6px; min-height: 0; font-weight: 700; font-size: .95rem; opacity: 0; transition: opacity .15s; }
.last svg { width: 20px; height: 20px; }
.last.show { opacity: 1; }
.last.ok { color: var(--leaf); }
.last.no { color: var(--margin); }
.sheet.quick .last { min-height: 26px; margin: -8px 0 6px; }

/* ---------------------------------------------------------------- set-up: the rules of the game */
.rules { list-style: none; margin: 4px 0 6px; padding: 12px 14px; display: grid; gap: 6px; background: #fff; border: 2px dashed var(--line); border-radius: var(--r); }
.rules li { position: relative; padding-left: 24px; }
.rules li::before { content: ''; position: absolute; left: 4px; top: .55em; width: 10px; height: 10px; border-radius: 50%; background: var(--brass); }

/* ---------------------------------------------------------------- 3, 2, 1, Go! */
.countdown { display: grid; place-items: center; min-height: 340px; }
.cd-card { text-align: center; }
.cd-game { font: 400 1.6rem var(--serif); margin: 0; }
.cd-sub { color: var(--ink2); margin: 2px 0 10px; }
.cd-num { font: 400 6rem/1 var(--serif); color: var(--ink); }
.cd-num.go { color: var(--leaf); }
.cd-num.pop { animation: cdpop .5s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes cdpop { from { transform: scale(1.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------------------------------------------------------------- progress dots (ten-question games) */
.dots { display: flex; gap: 6px; margin: 0 0 14px; flex-wrap: wrap; }
.dots i { width: 14px; height: 14px; border-radius: 50%; background: #E3E9F2; border: 2px solid #E3E9F2; }
.dots i.now { border-color: var(--ink); background: #fff; }
.dots i.ok { background: var(--leaf); border-color: var(--leaf); }
.dots i.no { background: var(--margin); border-color: var(--margin); }

/* ---------------------------------------------------------------- answering */
.qcard.enter { animation: qin .22s ease-out; }
@keyframes qin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.opt.chosen { background: #EDF2FA; border-color: var(--sky); box-shadow: 0 3px 0 var(--sky); }
.opt.chosen .k { background: var(--sky); }
.reveal { min-height: 3.2em; margin-top: 14px; padding: 10px 14px; border-radius: var(--r); visibility: hidden; }
.reveal.show { visibility: visible; background: #fff; border: 1px solid var(--line); }
.reveal.ok { border-left: 6px solid var(--leaf); }
.reveal.no { border-left: 6px solid var(--margin); }
.reveal b { font: 400 1.15rem var(--serif); }
.reveal .note { display: block; margin-top: 4px; color: var(--ink2); }
.last .pen { margin-left: 6px; padding: 1px 8px; border-radius: 99px; background: var(--margin); color: #fff; font-size: .85rem; }
.clockpill.hit { animation: hit .5s ease-out; }
@keyframes hit { 0% { background: var(--margin); color: #fff; transform: scale(1.15); } 100% { background: #fff; color: inherit; transform: none; } }
.wait { padding: 40px 0; text-align: center; }
@media (prefers-reduced-motion: reduce) { .qcard.enter, .cd-num.pop, .clockpill.hit { animation: none; } }

/* ---------------------------------------------------------------- the end stamp */
.endstamp { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(233, 238, 245, .55); }
.endstamp span { padding: 14px 28px; border: 6px double var(--margin); border-radius: 14px; color: var(--margin); background: rgba(255, 255, 255, .92);
  font: 400 clamp(2rem, 9vw, 3.4rem)/1.1 var(--serif); text-align: center; transform: rotate(-8deg); animation: stamp .45s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes stamp { from { transform: rotate(-20deg) scale(2.2); opacity: 0; } to { transform: rotate(-8deg) scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .endstamp span { animation: none; } }

/* ---------------------------------------------------------------- report */
.linkish { border: 0; background: none; color: var(--sky); text-decoration: underline; cursor: pointer; padding: 8px 4px; font-weight: 700; }
.save-box.quiet { border-style: dashed; border-color: var(--line); color: var(--ink2); }
.save-box.quiet p { margin: 0; }
.review-box { display: grid; gap: 10px; }
.review-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px; }
.review-head h2 { margin: 0; }
.review-head .check { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; }
.review-head .check input { width: 20px; height: 20px; accent-color: var(--ink); }
.review .note { margin-top: 4px; color: var(--ink2); font-size: .92rem; font-style: italic; }
.review li.no { border-left: 4px solid var(--margin); }
.review li.ok { border-left: 4px solid var(--leaf); }
.actions .btn { flex: 1 1 auto; }
@media (min-width: 640px) { .actions .btn { flex: 0 0 auto; } }
.sheet.quick .reveal { display: none; }
.partner-sites h3 { font-size: 1.05rem; margin: 6px 0 4px; }
.partner-sites p { margin: 0 0 10px; }
