/* Knowledge Quizzes: one stylesheet. Tokens first, then components. */
:root {
  --bg: #fff8ec;
  --bg-2: #fdecd2;
  --card: #ffffff;
  --ink: #2b2118;
  --ink-soft: #6b5a4a;
  --line: #ecdcc4;
  --brand: #0f766e;        /* eucalyptus */
  --brand-ink: #ffffff;
  --brand-soft: #d9f0ec;
  --sun: #ffb703;
  --danger: #b42318;
  --ok: #1e7f36;
  --ok-soft: #dcf5e3;
  --bad-soft: #fde6e4;
  --gold: #f5b700; --silver: #b8c2cc; --bronze: #c9793a;
  /* Kiko */
  --kiko-cream: #f7efe1; --kiko-chest: #fbf6ee; --kiko-brown: #7a5230; --kiko-dark: #3b2a1d;
  --kiko-stripe: #5a3b22; --kiko-bill: #3d3029; --kiko-bill-low: #e9dcc5; --kiko-blue: #5b9bd5;
  --kiko-tail: #b5652b; --kiko-branch: #6b4a2b; --kiko-leaf: #5f8f4e;
  --radius: 18px;
  --shadow: 0 6px 0 rgba(43, 33, 24, 0.12);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1611; --bg-2: #241d16; --card: #2a221a; --ink: #f6efe4; --ink-soft: #c9b8a3;
    --line: #3f3326; --brand: #2bb3a3; --brand-ink: #0c1f1c; --brand-soft: #173a36;
    --ok: #4ccb6b; --ok-soft: #173a22; --bad-soft: #3d1c19; --danger: #ff8a7a;
    --kiko-cream: #efe4d0; --kiko-chest: #f5ecdc;
    --shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); color: var(--ink); background: var(--bg);
  background-image: radial-gradient(circle at 10% 0%, var(--bg-2) 0, transparent 45%),
                    radial-gradient(circle at 100% 100%, var(--bg-2) 0, transparent 40%);
  min-height: 100vh; min-height: 100dvh; line-height: 1.4; font-size: 17px;
  overflow-x: hidden; overflow-wrap: break-word;
}
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .4em; overflow-wrap: anywhere; }
.qtext, .tile, .explain, .namebadge, .chip, p, li, .who { overflow-wrap: anywhere; }
h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); letter-spacing: -0.02em; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 720px; margin: 0 auto; padding: 16px; }
.wide { max-width: 1100px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- controls ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 800;
  min-height: 48px; padding: 10px 20px; border-radius: 14px;
  background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; transition: transform .08s ease, filter .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(43,33,24,.12); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.big { min-height: 60px; font-size: 1.25rem; padding: 12px 28px; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.sun { background: var(--sun); color: #2b2118; }
.btn.danger { background: var(--danger); color: #fff; }
.soundbtn.pending { background: var(--sun); color: #2b2118; box-shadow: var(--shadow); white-space: nowrap; }
.btn.small { min-height: 48px; padding: 6px 12px; font-size: .92rem; border-radius: 10px; }
.btn.icon { min-width: 48px; padding: 8px; }
.btn.block { width: 100%; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }

label { font-weight: 700; display: block; margin-bottom: 4px; }
input, textarea, select {
  font: inherit; color: var(--ink); background: var(--card); width: 100%;
  border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; min-height: 48px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); outline: none; }
.code-input {
  font-size: 2rem; font-weight: 900; letter-spacing: .25em; text-align: center; text-transform: uppercase;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; min-height: 72px;
}
.card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border: 2px solid var(--line); }
.error { color: var(--danger); font-weight: 700; min-height: 1.4em; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--brand-soft); font-weight: 800; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-soft); font-weight: 700; }
.divider::before, .divider::after { content: ""; flex: 1; height: 2px; background: var(--line); }

/* ---------- header ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; flex-wrap: wrap; }
@media (max-width: 600px) { #joinpill { display: none !important; } }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 900; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.brand .kiko-wrap svg { width: 40px; height: 40px; }

/* ---------- code display ---------- */
.code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 900;
  letter-spacing: .12em; background: var(--card); border: 3px dashed var(--brand);
  border-radius: 16px; padding: 4px 14px; display: inline-block; white-space: nowrap;
}

/* ---------- Answer perches ---------- */
/* "Bush perches": neutral cream option cards, a lettered egg badge, and a small eucalyptus branch under each card. */
:root { --perch-bg: #fffdf7; --egg-bg: #fff8ec; --egg-ink: #0f766e; --perch-branch: #0f766e; --perch-fill: #e3f4ef; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --perch-bg: #2f261c; --egg-bg: #3a2f22; --egg-ink: #6fe0d2; --perch-branch: #2bb3a3; --perch-fill: #1d4640; } }
:root[data-theme="dark"] { --perch-bg: #2f261c; --egg-bg: #3a2f22; --egg-ink: #6fe0d2; --perch-branch: #2bb3a3; --perch-fill: #1d4640; }
.answers { display: grid; grid-template-columns: 1fr; gap: 20px; padding-bottom: 6px; isolation: isolate; }
@media (min-width: 861px) { .host .answers { grid-template-columns: 1fr 1fr; gap: 34px 28px; } }
.tile {
  position: relative; display: flex; align-items: center; gap: 14px; text-align: left;
  background: var(--perch-bg); color: var(--ink); border: 2px solid var(--line); border-radius: 16px;
  padding: 12px 16px 12px 14px; min-height: 68px; font: inherit; font-weight: 800; font-size: 1.05rem;
  cursor: pointer; box-shadow: var(--shadow); transition: transform .12s, opacity .25s, border-color .15s, background .15s;
  overflow-wrap: anywhere; width: 100%;
}
/* the branch the card perches on: decorative only */
.tile.perch::before {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -9px; height: 6px; border-radius: 3px;
  background: var(--perch-branch); opacity: .55; z-index: -1; pointer-events: none;
}
.tile .egg {
  flex: 0 0 auto; width: 40px; height: 48px; display: grid; place-items: center; font-size: 1.25rem; font-weight: 900; line-height: 1;
  background: var(--egg-bg); color: var(--egg-ink); border: 2px solid var(--perch-branch); border-radius: 50% 50% 50% 50% / 55% 55% 45% 45%;
  transition: background .15s, color .15s;
}
.tile .count { margin-left: auto; font-size: 1.3rem; font-weight: 900; padding-left: 8px; }
button.tile:hover:not(:disabled), button.tile:focus-visible { transform: translateY(-2px); border-color: var(--brand); }
button.tile:active:not(:disabled) { transform: translateY(1px); }
button.tile:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
.tile:disabled { cursor: default; }
.tile.dim { opacity: .45; }
.tile.picked { border: 3px solid var(--brand); padding: 11px 15px 11px 13px; background: var(--perch-fill); box-shadow: 0 0 0 4px var(--perch-fill), var(--shadow); }
.tile.picked .egg, .tile.right .egg { background: var(--brand); color: var(--brand-ink); }
.tile.right { border: 3px solid var(--brand); padding: 11px 15px 11px 13px; background: var(--perch-fill); }
.tile.answered { justify-content: flex-start; }
/* At reveal the count bar replaces the branch line, so there's one line per card. */
.tile.perch:has(.bar)::before { display: none; }
.tile .bar { position: absolute; left: 14px; bottom: 7px; height: 6px; max-width: calc(100% - 28px); background: var(--brand); opacity: .4; border-radius: 3px; transition: width .6s ease; }
.tile .perched { position: absolute; right: 18px; top: -48px; pointer-events: none; line-height: 0; }
@media (prefers-reduced-motion: reduce) { .tile, .tile .bar { transition: none; } button.tile:hover:not(:disabled) { transform: none; } }

/* ---------- timer ---------- */
.timerbar { height: 12px; background: var(--line); border-radius: 999px; overflow: hidden; }
.timerbar > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; transform-origin: left; }
.timerbar.low > span { background: var(--danger); }
.clock { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; font-size: 2.2rem; font-weight: 900;
  background: conic-gradient(var(--brand) var(--p, 100%), var(--line) 0); position: relative; flex: 0 0 auto; }
.clock::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--card); }
.clock > span { position: relative; }
.clock.low { background: conic-gradient(var(--danger) var(--p, 100%), var(--line) 0); }

/* ---------- player ---------- */
.player-main { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }
@media (hover: none) { .keytip { display: none; } }
.qhead { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink-soft); }
.qtext { font-size: clamp(1.15rem, 4.5vw, 1.5rem); font-weight: 800; }
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--bg);
  font-weight: 800; box-shadow: 0 -4px 16px rgba(0,0,0,.15);
}
.bottombar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.bottombar .score { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.bottombar .rank { background: var(--sun); color: #2b2118; border-radius: 999px; padding: 2px 10px; }
.result { text-align: center; padding: 26px 18px; border-radius: var(--radius); }
.result.good { background: var(--ok-soft); }
.result.bad { background: var(--bad-soft); }
.result .big { font-size: 2rem; font-weight: 900; }
.result .pts { font-size: 2.6rem; font-weight: 900; color: var(--ok); }
.namebadge { font-size: 1.6rem; font-weight: 900; display: inline-flex; align-items: center; gap: 10px; background: var(--card); padding: 10px 20px; border-radius: 999px; box-shadow: var(--shadow); border: 2px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { background: var(--card); border: 2px solid var(--line); border-radius: 999px; padding: 6px 14px; font-weight: 800; animation: pop .35s ease; }
button.chip { cursor: pointer; font: inherit; font-weight: 800; color: var(--ink); min-height: 44px; }
button.chip:hover { border-color: var(--danger); }
.chip.off, .board li.off { opacity: .5; }

/* ---------- leaderboard ---------- */
.board { list-style: none; margin: 0; padding: 0; }
.board li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; font-weight: 800; background: var(--card); margin-bottom: 6px; border: 2px solid var(--line); transition: transform .4s ease; }
.board li.me { border-color: var(--brand); background: var(--brand-soft); }
.board .r { width: 2.2em; text-align: center; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.board .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .s { font-variant-numeric: tabular-nums; }
.board .d { color: var(--ok); font-size: .85em; min-width: 3.5em; text-align: right; }
.board .tick { color: var(--ok); width: 1.2em; }
.board .up { color: var(--ok); } .board .down { color: var(--danger); }

/* ---------- podium ---------- */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 12px; margin: 10px 0 20px; }
.podium .spot { display: flex; flex-direction: column; align-items: center; width: min(30%, 200px); }
.podium .who { font-weight: 900; text-align: center; overflow-wrap: break-word; hyphens: auto; margin-bottom: 6px; max-width: 100%; }
@media (max-width: 520px) { .podium .who { font-size: .85rem; } .podium .medal { font-size: 2rem; } }
.podium .medal { font-size: 2.6rem; line-height: 1; animation: drop .7s cubic-bezier(.3,1.6,.5,1) both; }
.podium .block { width: 100%; border-radius: 14px 14px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 10px; font-weight: 900; font-size: 1.6rem; color: #2b2118; box-shadow: var(--shadow); animation: rise .8s ease both; transform-origin: bottom; }
.podium .p1 .block { height: 150px; background: var(--gold); animation-delay: .9s; }
.podium .p2 .block { height: 110px; background: var(--silver); animation-delay: .5s; }
.podium .p3 .block { height: 80px; background: var(--bronze); animation-delay: .1s; }
.podium .p1 .medal { animation-delay: 1.5s; } .podium .p2 .medal { animation-delay: 1.1s; } .podium .p3 .medal { animation-delay: .7s; }
.podium .pts { font-size: .95rem; }
.trophy { font-size: 1.1rem; }

/* ---------- host ---------- */
.host { display: grid; grid-template-columns: 1fr 300px; gap: 16px; padding: 0 16px 16px; min-height: calc(100vh - 70px); }
.host .stage { min-width: 0; }
.host .side { background: var(--card); border-radius: var(--radius); border: 2px solid var(--line); padding: 14px; max-height: calc(100vh - 90px); overflow: auto; position: sticky; top: 8px; }
.host.solo { grid-template-columns: 1fr; max-width: 1100px; margin: 0 auto; }
@media (max-width: 860px) { .host { grid-template-columns: 1fr; } .host .side { position: static; max-height: none; } }
.joinbox { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; }
@media (max-width: 640px) { .joinbox { grid-template-columns: 1fr; } }
.joinbox .code { font-size: clamp(2.4rem, 7vw, 4.6rem); }
.qr { width: 200px; height: 200px; background: #fff; border-radius: 12px; padding: 8px; }
.host .qtext { font-size: clamp(1.25rem, 2.3vw, 2rem); margin: 0; }
.host .tile { font-size: clamp(1rem, 1.6vw, 1.35rem); min-height: 84px; }
.host .tile .egg { width: 46px; height: 56px; font-size: 1.5rem; }
.countdown { font-size: 9rem; font-weight: 900; text-align: center; animation: pop .5s ease; }
.explain { background: var(--brand-soft); border-radius: 14px; padding: 12px 16px; font-weight: 600; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin-bottom: 14px; }
.tabs button { background: none; border: 0; font: inherit; font-weight: 800; padding: 10px 14px; cursor: pointer; color: var(--ink-soft); border-bottom: 4px solid transparent; min-height: 48px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--brand); }
.qlist { display: grid; gap: 12px; }
.qcard { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.qcard .info { flex: 1 1 260px; min-width: 0; }
.qedit { border: 2px solid var(--line); border-radius: 14px; padding: 14px; background: var(--bg); }
.optrow { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; margin-top: 8px; }
.optrow label.correct { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 700; white-space: nowrap; min-height: 44px; cursor: pointer; }
.optrow input[type=radio] { width: 22px; height: 22px; min-height: 0; }
.errors { background: var(--bad-soft); border-radius: 12px; padding: 10px 16px; }
.errors li { color: var(--danger); font-weight: 700; }
dialog { border: 0; border-radius: var(--radius); padding: 0; max-width: min(560px, calc(100vw - 32px)); width: 100%; background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(20, 14, 8, .55); }
dialog .card { box-shadow: none; border: 0; }
.share .code { font-size: 2.6rem; }
.linkbox { display: flex; gap: 8px; }
.linkbox input { font-family: ui-monospace, Menlo, monospace; font-size: .95rem; }
/* Small, bottom-anchored, never blocks taps; sits above the player's score bar when there is one. */
.toast { position: fixed; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100vw - 32px); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 999px; font-weight: 800; font-size: .9rem; z-index: 2147483647; pointer-events: none; text-align: center; animation: pop .25s ease; }
body:has(.bottombar:not(.hidden)) .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }

/* ---------- Kiko the Kookaburra ---------- */
.kiko-wrap { display: inline-block; line-height: 0; }
.kiko-wrap svg { overflow: visible; }
.kiko .k-body, .kiko .k-head, .kiko .k-jaw, .kiko .k-lid, .kiko .k-ha, .kiko .k-wing { transform-box: fill-box; }
.kiko .k-head { transform-origin: 70% 90%; }
.kiko .k-jaw { transform-origin: 100% 0%; }
.kiko .k-wing { transform-origin: 30% 10%; }
.kiko .k-lid { transform-origin: 50% 0%; transform: scaleY(0); }
.kiko .k-ha { opacity: 0; }
.kiko.is-idle .k-all { animation: bob 3.2s ease-in-out infinite; }
.kiko.is-idle .k-lid { animation: blink 5s infinite; }
.kiko.is-laugh .k-head { animation: laugh-head .9s ease-in-out infinite; }
.kiko.is-laugh .k-jaw { animation: jaw .16s ease-in-out infinite alternate; }
.kiko.is-laugh .k-body { animation: shake .16s ease-in-out infinite alternate; }
.kiko.is-laugh .k-ha { animation: ha 1.2s ease-out infinite; }
.kiko.is-laugh .k-ha.h2 { animation-delay: .3s; } .kiko.is-laugh .k-ha.h3 { animation-delay: .6s; }
.kiko.is-cheer .k-all { animation: hop .5s ease 2; }
.kiko.is-cheer .k-wing { animation: flap .25s ease-in-out 4 alternate; }
.kiko.is-think .k-head { animation: tilt 2.4s ease-in-out infinite; }
.kiko.is-think .k-lid { animation: blink 3s infinite; }
@keyframes bob { 50% { transform: translateY(-3px); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(0); } 95% { transform: scaleY(1); } }
@keyframes laugh-head { 0%, 100% { transform: rotate(0); } 30%, 70% { transform: rotate(14deg); } }
@keyframes jaw { from { transform: rotate(0); } to { transform: rotate(-24deg); } }
@keyframes shake { from { transform: translateY(0); } to { transform: translateY(1.5px); } }
@keyframes ha { 0% { opacity: 0; transform: translate(0, 4px) scale(.6); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(-14px, -22px) scale(1.15); } }
@keyframes hop { 40% { transform: translateY(-14px); } }
@keyframes flap { to { transform: rotate(-28deg); } }
@keyframes tilt { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-9deg); } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes drop { from { transform: translateY(-60px) scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }

/* confetti (host podium) */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 40; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .kiko.is-laugh .k-jaw { transform: rotate(-20deg); }
  .kiko.is-laugh .k-ha { opacity: 1; }
  .confetti { display: none; }
}

/* ---------- v0.2 admin: sign-in + folders ---------- */
.signin { max-width: 420px; margin: 24px auto; }
.useremail { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: .92rem; }
.linklike { background: none; border: 0; font: inherit; font-size: .95rem; color: var(--brand); text-decoration: underline; cursor: pointer; min-height: 48px; padding: 0 12px; }
.qlayout { display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 760px) { .qlayout { grid-template-columns: minmax(0, 1fr); } }
.fside { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px; min-width: 0; }
.ftree { display: grid; gap: 2px; }
.trow { --ind: 16px; display: grid; grid-template-columns: 36px minmax(0, 1fr) 40px 40px 40px 40px; align-items: center; gap: 2px; min-width: 0; margin-left: calc(var(--d, 0) * var(--ind)); position: relative; }
.trow.nested::before { content: ""; position: absolute; left: calc(var(--ind) * -1 + 6px); top: 0; bottom: 0; width: 1px; background: var(--line); }
@media (max-width: 480px) { .trow { --ind: 10px; gap: 0; grid-template-columns: 30px minmax(0, 1fr) 34px 34px 34px 34px; } .trow .btn.tact { border-color: transparent; padding: 0; font-size: .95rem; width: 100%; min-width: 0; } .frow { padding: 6px 4px; } }
/* Folder actions (rename/move/delete) appear only on the selected folder, or on hover or
   keyboard focus, so names get the full width. On touch screens: tap a folder, then act. */
.trow:not(.top) { grid-template-columns: 36px minmax(0, 1fr); }
.trow .tact { display: none; }
.trow.sel, .trow:not(.top):hover, .trow:not(.top):focus-within { grid-template-columns: 36px minmax(0, 1fr) 40px 40px 40px 40px; }
.trow.sel .tact, .trow:hover .tact, .trow:focus-within .tact { display: inline-flex; }
@media (max-width: 480px) {
  .trow:not(.top) { grid-template-columns: 30px minmax(0, 1fr); }
  .trow.sel, .trow:not(.top):hover, .trow:not(.top):focus-within { grid-template-columns: 30px minmax(0, 1fr) 34px 34px 34px 34px; }
}
.tspace { display: block; }
.trow.top { display: block; margin-left: 0; }
.trow.top > .frow { width: 100%; }
.ttoggle { width: 100%; min-height: 48px; background: none; border: 0; font: inherit; font-size: 1.1rem; color: var(--ink-soft); cursor: pointer; border-radius: 10px; }
.ttoggle:hover { background: var(--brand-soft); }
.frow { display: flex; align-items: center; gap: 6px; min-width: 0; min-height: 48px; padding: 6px 8px; text-align: left; font: inherit; font-weight: 700; color: var(--ink); background: none; border: 2px solid transparent; border-radius: 12px; cursor: pointer; }
.frow:hover { background: var(--bg-2); }
.frow[aria-current="true"] { background: var(--brand-soft); border-color: var(--brand); }
.frow .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
.frow .fcount { flex: 0 0 auto; font-size: .85rem; color: var(--ink-soft); background: var(--bg); border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums; }
.trow .btn.tact { width: 100%; min-width: 0; min-height: 48px; box-shadow: none; padding: 4px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; text-align: left; gap: 0 2px; margin-bottom: 12px; font-weight: 700; }
.crumbs .sep { color: var(--ink-soft); padding: 0 2px; }
.crumb { background: none; border: 0; font: inherit; font-weight: 700; color: var(--brand); text-decoration: underline; cursor: pointer; min-height: 48px; padding: 0 6px; }
.movelist { border: 0; padding: 0; margin: 0; max-height: 50vh; overflow: auto; display: grid; gap: 2px; }
.moveopt { display: flex; align-items: center; gap: 10px; min-height: 48px; margin: 0; padding-right: 12px; border-radius: 12px; cursor: pointer; font-weight: 700; }
.moveopt:hover { background: var(--bg-2); }
.moveopt input { width: 22px; height: 22px; min-height: 0; flex: 0 0 auto; }
.usage { font-weight: 800; background: var(--brand-soft); border-radius: 12px; padding: 8px 14px; }
#folder-dialog .card, #move-dialog .card, #folder-move-dialog .card, #confirm-dialog .card { min-width: 0; }

/* v0.2 admin: neutral lettered "egg" badge on answer-option rows (no colors or shapes) */
:root { --opt-egg-bg: #fff8ec; --opt-egg-ink: #0f766e; --opt-egg-line: #0f766e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --opt-egg-bg: #2a221a; --opt-egg-ink: #2bb3a3; --opt-egg-line: #2bb3a3; } }
.optrow .egg { width: 32px; height: 40px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; display: grid; place-items: center; background: var(--opt-egg-bg); color: var(--opt-egg-ink); border: 2px solid var(--opt-egg-line); font-weight: 900; font-size: 1rem; }

/* small crumbs: allow long names to wrap inside the crumb, not overflow */
.crumbs .crumb, .crumbs strong { overflow-wrap: anywhere; text-align: left; }
.crumbs strong { padding: 0 6px; }
.moveopt.disabled { opacity: .5; cursor: not-allowed; }

/* ---------- v0.3 editor: settings panel + topic tags ---------- */
.settings fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.settings legend { font-weight: 800; padding: 0; margin-bottom: 6px; }
.choicerow { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.choice { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; margin: 0; padding: 0 14px 0 10px; border: 2px solid var(--line); border-radius: 999px; background: var(--card); cursor: pointer; font-weight: 700; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice:has(input:focus-visible) { outline: 3px solid var(--sun); outline-offset: 3px; }
.choice input, .checkline input { width: 22px; height: 22px; min-height: 0; flex: 0 0 auto; accent-color: var(--brand); }
.passvalue { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.passvalue label { margin: 0; }
.passvalue input { width: 110px; }
.checkline { display: flex; align-items: center; gap: 10px; min-height: 48px; margin: 0; cursor: pointer; }
.hint { font-size: .92rem; margin: 6px 0 0; }
.tagedit > label { font-weight: 700; }
.tagchips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; padding: 0; }
.tagchips:empty { display: none; }
.tagchip { display: inline-flex; align-items: center; gap: 2px; background: var(--brand-soft); border: 2px solid var(--brand); border-radius: 999px; padding: 0 0 0 12px; font-weight: 800; font-size: .95rem; max-width: 100%; }
.tagchip span { overflow-wrap: anywhere; }
.tagx { appearance: none; background: none; border: 0; font: inherit; font-size: 1.2rem; font-weight: 900; color: var(--ink); min-width: 44px; min-height: 44px; border-radius: 999px; cursor: pointer; }
.tagx:hover { background: var(--card); }
.tagrow { display: flex; gap: 8px; }
.tagrow input { flex: 1; min-width: 0; }
.tagrow .btn { flex: 0 0 auto; }

/* ---------- v0.3 pass marks on the final screens (text first; color is only a hint) ---------- */
.passrate { text-align: center; font-weight: 800; font-size: 1.15rem; background: var(--brand-soft); border-radius: 14px; padding: 10px 16px; margin: 0 auto 16px; max-width: 640px; }
.passbox { text-align: center; border-radius: var(--radius); padding: 16px 18px; border: 2px solid var(--line); }
.passbox .verdict { font-size: 1.8rem; font-weight: 900; display: block; }
.passbox.pass { background: var(--ok-soft); border-color: var(--ok); }
.passbox.notyet { background: var(--bg-2); }
.passbox p { margin: 6px 0 0; }

/* ---------- v0.3 solo quizzes: taker page (/s/<CODE>) ---------- */
.solo-main { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.solo-main:focus { outline: none; }
.solo-main h1:focus, .solo-main h1:focus-visible { outline: none; }   /* focused only to move the reading position */
.small { font-size: .92rem; }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.facts li { display: grid; grid-template-columns: 1.6em minmax(0, 1fr); gap: 8px; align-items: start; font-weight: 700; }
.linkstate h1 { font-size: 1.6rem; }
.pastlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pastlist li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; border-top: 2px solid var(--line); padding-top: 8px; }
.pastlist li:first-child { border-top: 0; padding-top: 0; }
.notice { background: var(--bg-2); border-radius: 12px; padding: 10px 14px; font-weight: 700; margin: 0; }
.saved { font-weight: 900; font-size: 1.15rem; color: var(--brand); }
.qhead .secs { font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; }
.scoreline { font-size: 1.25rem; font-weight: 900; margin: 0; }
.pctbox { text-align: center; }
.pctbox .pctline { font-size: 1.2rem; font-weight: 800; margin: 6px 0; }
.statlist, .topiclist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.statlist li { background: var(--brand-soft); border-radius: 12px; padding: 10px 14px; font-weight: 700; }
.topiclist li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; font-weight: 700; }
.topiclist .n { overflow-wrap: anywhere; }
.topiclist .band { background: var(--bg-2); border-radius: 999px; padding: 2px 10px; font-size: .9rem; white-space: nowrap; }
@media (max-width: 420px) { .topiclist li { grid-template-columns: minmax(0, 1fr) auto; } .topiclist .band { grid-column: 1 / -1; justify-self: start; } }
.rvopts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rvopts li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 4px 10px; align-items: center; border: 2px solid var(--line); border-radius: 12px; padding: 8px 10px; background: var(--perch-bg); }
.rvopts li .egg { width: 32px; height: 40px; display: grid; place-items: center; font-weight: 900; background: var(--egg-bg); color: var(--egg-ink); border: 2px solid var(--perch-branch); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }
.rvopts li .t { font-weight: 700; overflow-wrap: anywhere; }
.rvopts li .tags { grid-column: 2; font-size: .88rem; font-weight: 800; color: var(--ink-soft); }
.rvopts li .tags:empty { display: none; }
.rvopts li.right { border: 3px solid var(--brand); background: var(--perch-fill); }
.rvopts li.right .egg { background: var(--brand); color: var(--brand-ink); }
.rvopts li.you:not(.right) { border-style: dashed; }
.done { font-weight: 800; }

/* ---------- v0.3 solo links (creator) ---------- */
dialog.solo-dialog { max-width: min(720px, calc(100vw - 32px)); }
.solo-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .solo-dates { grid-template-columns: 1fr; } }
.sololink { border: 2px solid var(--line); border-radius: 14px; padding: 12px; background: var(--bg); }
.sololink .row { gap: 8px; }
.sololink .lbl { font-weight: 900; overflow-wrap: anywhere; min-width: 0; }
.sololink .state { font-size: .9rem; }
.sololink .state.paused, .sololink .state.closed, .sololink .state.ended, .sololink .state.not_yet { background: var(--bg-2); }
.sololink .qr { width: 180px; height: 180px; display: block; margin: 8px auto 0; }
/* An empty error line takes no space (it stays in the DOM so role="alert" still announces). */
.stack > .error:empty { min-height: 0; margin-top: 0; }

/* ---------- v0.3 results dashboard (creator, js/stats.js) ---------- */
.results-top { align-items: flex-start; margin-bottom: 12px; }
.results-head { min-width: 0; flex: 1; }
.results-head h1 { font-size: 1.8rem; margin: 0; }
.results-head h1:focus { outline: none; }
.results-sub { margin: 2px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px; align-items: end; padding: 14px; }
.filters .ffield { min-width: 0; }
.filters label { display: block; font-weight: 800; margin-bottom: 4px; }
.filters select, .filters input { width: 100%; min-width: 0; min-height: 48px; font: inherit; padding: 8px 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); color: var(--ink); }
.filters .hint { margin: 0; font-size: .85rem; grid-column: 1 / -1; }
.filters .freset { align-self: end; }
.exportrow { margin: 12px 0; gap: 8px; }
#stats-body[aria-busy="true"] { opacity: .6; }
.statnotes .notice { font-weight: 600; }
.stats-section h2 { font-size: 1.35rem; margin: 0; }
.stats-section h3 { font-size: 1.1rem; margin: 0 0 6px; }
.stats-section .hint { margin: 0; font-size: .92rem; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 128px), 1fr)); gap: 10px; }
.tile-stat { display: flex; flex-direction: column; gap: 2px; background: var(--brand-soft); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.tile-stat .tv { font-size: 1.7rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile-stat .tl { font-weight: 800; }
.tile-stat .tn { font-size: .85rem; }
.distgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 18px; }
.dist, .chartbox { min-width: 0; margin: 0; }
.statdl { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); gap: 6px 12px; margin: 0 0 8px; }
.statdl div { min-width: 0; }
.statdl dt { font-size: .85rem; color: var(--ink-soft); font-weight: 700; }
.statdl dd { margin: 0; font-weight: 900; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.chart { display: block; width: 100%; max-width: 540px; height: auto; }
.chart text { fill: var(--ink-soft); font-size: 13px; font-family: var(--font); font-weight: 700; }
.chart text.val { fill: var(--ink); }
.chart .bar { fill: var(--brand); }
.chart .hit { fill: transparent; }
.chart .axis { stroke: var(--ink-soft); stroke-width: 1; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--brand); stroke: var(--card); stroke-width: 2; }
.chartbox figcaption { font-size: .85rem; margin-top: 2px; }
.tablealt summary { cursor: pointer; font-weight: 800; min-height: 44px; display: flex; align-items: center; }
.bucketpick { border: 0; padding: 0; margin: 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bucketpick legend { font-weight: 800; float: left; margin-right: 8px; padding: 0; }
.tablewrap { max-width: 100%; overflow-x: auto; border: 2px solid var(--line); border-radius: 12px; }
.tablewrap:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.stats-table { border-collapse: collapse; width: 100%; font-size: .92rem; font-variant-numeric: tabular-nums; }
.stats-table caption { text-align: left; font-weight: 800; padding: 8px 10px; }
.stats-table th, .stats-table td { padding: 8px 10px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.stats-table thead th { background: var(--bg-2); white-space: nowrap; }
.stats-table tbody th { font-weight: 800; }
.qtable .qcell { min-width: 220px; max-width: 360px; }
.qtable .qt { display: block; font-weight: 700; }
.qtable .qopts, .qtable .qver { display: block; font-size: .82rem; margin-top: 2px; }
.qtable td.pick { white-space: nowrap; }
.qtable td.pick.key { font-weight: 900; color: var(--brand); }
.qtable .flags { min-width: 200px; }
.flaglist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.flag { background: var(--bad-soft); border-radius: 8px; padding: 2px 8px; font-weight: 700; }
.topicbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.topicbars li { display: grid; grid-template-columns: minmax(90px, 180px) minmax(0, 1fr); gap: 4px 12px; align-items: center; }
.topicbars .tname { font-weight: 800; overflow-wrap: anywhere; }
.topicbars .tval { grid-column: 2; font-weight: 700; font-size: .92rem; }
.tbar { position: relative; height: 18px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.tbar.empty { background: repeating-linear-gradient(135deg, var(--bg-2) 0 6px, transparent 6px 12px); }
.tfill { position: absolute; inset: 0 auto 0 0; background: var(--brand); border-radius: 999px; }
.tfill.band-needs-work { background: var(--ink-soft); }
.tfill.band-developing { background: var(--sun); }
.tmark { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); opacity: .5; }
@media (max-width: 520px) { .topicbars li { grid-template-columns: minmax(0, 1fr); } .topicbars .tval { grid-column: 1; } }
dialog.stats-dialog { max-width: min(900px, calc(100vw - 24px)); width: 100%; padding: 0; border: 0; border-radius: var(--radius); background: var(--card); color: var(--ink); }
dialog.stats-dialog .card { min-width: 0; }
.empty-results .kiko-wrap { margin: 0 auto; }
.tile-stat .tl, .tile-stat .tn { overflow-wrap: normal; word-break: normal; hyphens: auto; }
@media (max-width: 420px) { .tile-stat { padding: 10px; } .tile-stat .tv { font-size: 1.45rem; } .tile-stat .tl { font-size: .92rem; } }
/* Chart text is in viewBox units: larger on narrow screens so it renders at 12 px or more. */
@media (max-width: 480px) { .chart text { font-size: 16px; } }
.filters .ferr { grid-column: 1 / -1; margin: 0; }
.filters .ferr:empty { display: none; }
.peoplecount { margin: 0; }

/* ---------- sharing (docs/AUTH.md §9) ---------- */
.pill.role { padding: 2px 10px; font-size: .85rem; font-weight: 800; background: var(--brand-soft); color: var(--ink); border: 1px solid var(--brand); }
.pill.role-use { background: var(--bg-2); border-color: var(--line); }
.sharedby { margin: 6px 0 0; font-size: .92rem; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.sharednote { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; overflow-wrap: anywhere; }
.trow.shared-head { margin-top: 10px; padding-top: 10px; border-top: 2px solid var(--line); }
.trow.shared-row > .frow { width: 100%; padding-left: 20px; }
.frow .frole { flex: 0 0 auto; font-size: .8rem; font-weight: 800; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; }
.sharedgroup + .sharedgroup { margin-top: 22px; }
.sharedfrom { font-size: 1.1rem; margin: 0; overflow-wrap: anywhere; }
dialog.access-dialog { max-width: min(640px, calc(100vw - 32px)); }
.rolepick { border: 0; padding: 0; margin: 0; min-width: 0; }
.rolepick legend { font-weight: 800; margin-bottom: 6px; padding: 0; }
.access-result { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.access-result:empty { display: none; }
.access-result li { background: var(--bg-2); border-radius: 12px; padding: 8px 12px; overflow-wrap: anywhere; }
.access-result li.status-limit, .access-result li.status-full, .access-result li.status-owner, .access-result li.status-self { background: var(--bad-soft); }
.accessrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border: 2px solid var(--line); border-radius: 14px; padding: 8px 12px; background: var(--bg); }
.accessrow .who { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; }
.accessrow .email { font-weight: 800; overflow-wrap: anywhere; }
.accessrow.inherited { border-style: dashed; }
.rolesel { min-height: 48px; width: auto; min-width: 7.5em; }
fieldset.readonly { border: 0; padding: 0; margin: 0; min-width: 0; }
/* View-only fields stay readable (full contrast), and say they're not editable by their cursor. */
fieldset.readonly input:disabled, fieldset.readonly textarea:disabled, fieldset.readonly select:disabled { opacity: 1; color: var(--ink); -webkit-text-fill-color: var(--ink); background: var(--bg-2); cursor: default; }
fieldset.readonly button:disabled { opacity: .5; }
ul.activity { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
ul.activity li { padding: 10px 14px; display: grid; gap: 2px; overflow-wrap: anywhere; }

/* ---------- public catalog (docs/SPEC.md §17) ---------- */
.tabs { flex-wrap: wrap; }
.catsearch { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)) auto; gap: 10px; align-items: end; margin-bottom: 6px; }
.catsearch label { margin-bottom: 4px; }
.catsearch select, .catsearch input { width: 100%; min-width: 0; }
@media (max-width: 820px) { .catsearch { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .catsearch .catq { grid-column: 1 / -1; } .catsearch .catgo { grid-column: 1 / -1; } }
@media (max-width: 420px) { .catsearch { grid-template-columns: minmax(0, 1fr); } }
.catcard .cattitle { font-size: 1.2rem; margin: 0 0 4px; overflow-wrap: anywhere; }
.catmeta { margin: 0; font-size: .95rem; overflow-wrap: anywhere; }
.catdesc { margin: 6px 0 0; overflow-wrap: anywhere; }
.cattags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; }
.cattags li { background: var(--brand-soft); border: 1px solid var(--brand); border-radius: 999px; padding: 1px 10px; font-weight: 800; font-size: .88rem; overflow-wrap: anywhere; max-width: 100%; }
.catstatus { margin-top: 8px; font-weight: 700; }
.catstatus.status-removed { background: var(--bad-soft); }
.catpages { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 12px 0; flex-wrap: wrap; }
.catpages:empty { display: none; }
.catempty { text-align: center; }
.credit { margin: 6px 0 0; font-size: .92rem; overflow-wrap: anywhere; }
p.notice.credit { font-weight: 600; margin: 0; }
.folderbar { margin-bottom: 10px; }
dialog.entry-dialog, dialog.publish-dialog { max-width: min(720px, calc(100vw - 32px)); }
.pvnote { font-weight: 600; }
.pvbody { max-height: min(55vh, 520px); overflow: auto; padding-right: 4px; }
.pvlist { margin: 0; padding-left: 1.4em; display: grid; gap: 12px; }
.pvlist.compact { gap: 4px; font-size: .95rem; overflow-wrap: anywhere; }
.pvq .pvtext { font-weight: 800; margin: 0 0 6px; overflow-wrap: anywhere; }
.pvopts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pvopts li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; align-items: center; border: 2px solid var(--line); border-radius: 12px; padding: 6px 10px; background: var(--perch-bg); }
.pvopts .egg { width: 30px; height: 38px; display: grid; place-items: center; font-weight: 900; background: var(--egg-bg); color: var(--egg-ink); border: 2px solid var(--perch-branch); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }
.pvopts .t { font-weight: 700; overflow-wrap: anywhere; }
.pvtags { margin: 4px 0 0; font-size: .88rem; }
.pubpreview summary { cursor: pointer; font-weight: 800; padding: 10px 0; }
.pubpreview .pvquiz + .pvquiz { margin-top: 10px; }
.confirmline { background: var(--bg-2); border-radius: 12px; padding: 6px 12px; font-weight: 800; }
#publish-name-box.needs input { border-color: var(--brand); }
.modreports { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.modreports li { background: var(--bg-2); border-radius: 12px; padding: 8px 12px; overflow-wrap: anywhere; }
/* Dark mode: dark text on the light-coral danger colour (white on it is under 3:1; WCAG AA). */
@media (prefers-color-scheme: dark) { .btn.danger { color: #2b0d09; } }
.pill.official { margin-left: 8px; padding: 1px 10px; font-size: .8rem; vertical-align: middle; background: var(--brand); color: var(--brand-ink); }
.catstatus.status-pending_review { background: var(--brand-soft); }

/* ---------- result digests: recipients and their status (docs/SPEC.md §18) ---------- */
.digest-settings { border: 0; padding: 0; margin: 8px 0 0; }
.digest-settings > legend { font-size: 1.1rem; font-weight: 800; padding: 0; margin-bottom: 4px; }
.recipients { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.recipient { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; }
.recipient .remail { font-weight: 700; overflow-wrap: anywhere; min-width: 0; }
.pill.rstatus { padding: 2px 10px; font-size: .85rem; font-weight: 800; color: var(--ink); border: 1px solid var(--line); background: var(--bg-2); }
.pill.rstatus-confirmed { background: var(--brand-soft); border-color: var(--brand); }
.pill.rstatus-unsubscribed { background: transparent; border-style: dashed; }
/* Narrow screens: the add-recipient box gets its own full-width line, the button wraps below it. */
@media (max-width: 480px) {
  .tagrow.addrecipient { flex-wrap: wrap; }
  .tagrow.addrecipient input { flex: 1 1 100%; }
}

/* Utilities (formerly inline style attributes: the CSP allows no inline styles). !important keeps inline-style precedence. */
.pill-center { display: table; margin: 0 auto !important; }
.m0 { margin: 0 !important; }
.m-8-0-0 { margin: 8px 0 0 !important; }
.mt-24 { margin-top: 24px !important; }
.mt-28 { margin-top: 28px !important; }
.mt-32 { margin-top: 32px !important; }
.mb-8 { margin-bottom: 8px !important; }
.pad-bar { padding: 10px 16px !important; }
.fs-16 { font-size: 1.6rem !important; }
.fs-12 { font-size: 1.2rem !important; }
.jc-between { justify-content: space-between !important; }
.jc-center { justify-content: center !important; }
.block-center { margin: 0 auto !important; display: block !important; }
.ta-left { text-align: left !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* v0.3 hardening: site footer, privacy page, Account tab, backups, the person check. */
.sitefoot { text-align: center; padding: 24px 16px 32px; color: var(--ink-soft); font-size: .95rem; }
.sitefoot a { color: var(--brand); display: inline-block; padding: 12px 6px; min-height: 44px; }
.dangerzone { border-color: var(--danger); }
.backup { border-top: 1px solid var(--line); padding-top: 10px; }
.backup summary { cursor: pointer; font-weight: 700; padding: 10px 0; min-height: 44px; }
.backupfiles { margin: 0; padding-left: 20px; columns: 2 220px; }
.backupfiles a { display: inline-block; padding: 6px 0; overflow-wrap: anywhere; }
.humancheck:empty { display: none; }
.humancheck { display: flex; justify-content: center; }
.privacy h2 { margin-top: 28px; font-size: 1.35rem; }
.privacy h3 { margin-top: 18px; font-size: 1.1rem; }
.privacy table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.privacy th, .privacy td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.privacy .tablewrap { overflow-x: auto; }
.privacy li + li { margin-top: 6px; }
.privacy .updated { font-size: .92rem; }
.solo-delete { border-color: var(--line); }
/* The player footer sits under the join screen only: during a game the score bar owns the bottom edge. */
body:has(.bottombar:not(.hidden)) .playfoot { display: none; }
.ftree .fhint { font-size: .8rem; margin-left: 6px; white-space: nowrap; }
.ftree .trow.loose { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 4px; }

/* ---------- v0.4: reveal controls, sources, per-answer feedback, review, study guide (docs/PLAN-v0.4.md §4) ---------- */
.fw8 { font-weight: 800; }
.source { margin: 0; color: var(--ink-soft); font-weight: 600; overflow-wrap: anywhere; }
.source a { color: var(--brand); font-weight: 700; display: inline-block; min-height: 24px; }
.hostctl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.revealclock { font-weight: 900; font-variant-numeric: tabular-nums; }
.waiting { background: var(--sun); color: #2b2118; }
.pausedpill { background: var(--bg-2); color: var(--ink); }
.feedback .big { font-size: 1.6rem; font-weight: 900; }
.reviewlist > h2 { margin-top: 18px; }
.guidetools .row { gap: 8px; }
.hostreview .qtext { font-size: clamp(1.25rem, 2.3vw, 2rem); margin: 0; }
.hostreview .rvopts li { font-size: clamp(1rem, 1.6vw, 1.35rem); }
.hostreview .rvopts li .count { grid-column: 2; font-weight: 800; color: var(--ink-soft); }
/* The print view (Save as PDF): on screen, a full-page sheet over the app; in print, the only thing shown. */
.printview { position: fixed; inset: 0; z-index: 100; overflow: auto; background: var(--bg); padding: 16px; }
.printbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; max-width: 760px; margin: 0 auto 12px; }
.printpage { max-width: 760px; margin: 0 auto; background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 20px; }
.printpage h1 { font-size: 1.8rem; }
.printpage h1:focus { outline: none; }
.printpage .quiz { font-size: 1.2rem; font-weight: 800; }
.printlist { list-style: none; margin: 16px 0 0; padding: 0; }
.printlist > li { border-top: 2px solid var(--line); padding: 12px 0; }
.printq h2 { font-size: 1rem; margin: 0 0 4px; color: var(--ink-soft); }
.printopts { list-style: none; margin: 8px 0; padding: 0; }
.printopts li { padding: 4px 8px; border-radius: 8px; overflow-wrap: anywhere; }
.printopts li.right { border: 2px solid var(--brand); font-weight: 800; }
.printopts li.you:not(.right) { border: 2px dashed var(--ink-soft); }
.printfoot { color: var(--ink-soft); border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
@media print {
  @page { margin: 15mm; }
  body.printing { background: #fff; color: #000; font-size: 11pt; }
  body.printing > *:not(#print-view) { display: none !important; }
  .printview { position: static; overflow: visible; padding: 0; background: #fff; }
  .printpage { border: 0; padding: 0; max-width: none; background: #fff; color: #000; }
  .no-print { display: none !important; }
  .printlist > li { break-inside: avoid; page-break-inside: avoid; }
  .printopts li.right { border-color: #000; }
  .printview a { color: #000; }
  .printview a[href]::after { content: " (" attr(href) ")"; font-size: 9pt; }
  .printview .sr-only { display: none; }
}

/* ---------- weekly series (/w/<slug>, docs/SPEC.md §21) ---------- */
.series-main { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.series-main:focus, .series-main h1:focus, .series-main h1:focus-visible { outline: none; }
.series-hero { border-color: var(--brand); }
.series-you { align-self: center; }
.sgrid { margin: 0; font-size: 1.8rem; letter-spacing: .1em; line-height: 1.2; }
.sgrid .sq { display: inline-block; }
.sharetext { margin: 0; padding: 12px; border-radius: 12px; border: 2px dashed var(--line); background: var(--bg); white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-weight: 700; }
.hist, .qpct { list-style: none; margin: 0; padding: 0; }
.hist li { display: grid; grid-template-columns: minmax(0, 7.5em) minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 3px 0; font-variant-numeric: tabular-nums; }
.hist .hl { font-size: .9rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.hist .hbar { height: 14px; border-radius: 7px; background: var(--bg-2); overflow: hidden; }
.hist .hfill { display: block; height: 100%; border-radius: 7px; background: var(--brand); }
.hist .hn { font-size: .9rem; white-space: nowrap; }
.qpct li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.topboard li { font-weight: 700; }
.series-admin .seriesrow { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.series-admin .seriesrow .t { flex: 1 1 12em; min-width: 0; overflow-wrap: anywhere; font-weight: 800; }
.series-admin .qrow { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.series-admin .qrow .t { flex: 1 1 12em; min-width: 0; overflow-wrap: anywhere; }
.series-admin .formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px 14px; }
.series-admin .formgrid > div { min-width: 0; }
.series-admin .formgrid select, .series-admin .formgrid input { width: 100%; }
