/* Playscape v3 website. One kid-sized frame that swaps screens. Single bright daytime look, committed on purpose. */
:root {
  color-scheme: light;
  --sky: #CFE8FF;          /* page ground, daytime city sky */
  --paper: #FFFFFF;
  --ink: #1D2340;          /* text, deep navy */
  --ink-soft: #5A6285;
  --line: #DCE3F2;
  --earn: #1FA35B;         /* green badge: you get this */
  --earn-soft: #DDF5E7;
  --spend: #F2701D;        /* orange badge: this costs */
  --spend-soft: #FFE6D5;
  --free: #5B7CFA;         /* blue badge: free to enjoy */
  --free-soft: #E3E9FF;
  --gem: #7A4DFF;          /* spendable currency */
  --star: #F5B700;         /* public score */
  --wrong: #E5484D;
  --wrong-soft: #FFE1E2;
  --admin: #2B3350;
  --display: "Baloo 2", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --body: "Lexend", "Segoe UI", system-ui, sans-serif;
  --r: 18px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { background: var(--sky); color: var(--ink); }
body { font-family: var(--body); font-size: 15px; line-height: 1.5; padding-inline: 16px; padding-block: 20px 48px; margin: 0; min-height: 100vh; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--gem); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; text-wrap: balance; margin: 0; }

/* ---------- device frame ---------- */
.device { max-width: 1120px; margin: 0 auto; background: var(--paper); border-radius: 28px; border: 3px solid var(--ink); overflow: hidden; box-shadow: 0 10px 0 var(--ink); position: relative; }
.screen { min-height: 560px; }

/* top bar */
.topbar { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "me wallet out"; align-items: center; gap: 12px 18px; padding: 12px 18px; border-bottom: 2px solid var(--line); }
.topbar[hidden] { display: none; }
.me { grid-area: me; display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 20px; min-width: 0; }
.me #meName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 20px; color: var(--paper); flex: none; }
/* Stats: three chips built the same way (icon, number, small label). Gems is the main one. */
.wallet { grid-area: wallet; justify-self: end; display: flex; align-items: stretch; gap: 10px; }
.stat { display: flex; align-items: center; gap: 8px; border: 2.5px solid var(--line); background: var(--paper); border-radius: 16px; padding: 6px 14px 6px 10px; min-width: 0; }
.stat[hidden] { display: none; }
.stat svg { flex: none; }
.stat .num { display: inline-block; transform-origin: 50% 50%; font-family: var(--display); font-weight: 800; font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat .lbl { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); line-height: 1.15; white-space: nowrap; }
.timeleft { border-color: #B9D9F5; background: #EEF7FF; color: var(--ink); }
.score { border-color: #F3D77A; background: #FFF8DC; }
.spendable { border-color: var(--gem); background: #F1EBFF; }
.spendable .num { color: var(--gem); font-size: 26px; }
.signout-btn { grid-area: out; border: 2.5px solid var(--ink); background: var(--wrong); color: var(--paper); border-radius: 14px; padding: 8px 16px; font-family: var(--display); font-weight: 800; font-size: 17px; box-shadow: 0 4px 0 var(--ink); white-space: nowrap; transition: transform .1s ease, box-shadow .1s ease; }
.signout-btn:hover { background: #D63B40; }
.signout-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
@media (max-width: 760px) {
  .topbar { grid-template-columns: 1fr auto; grid-template-areas: "me out" "wallet wallet"; }
  .wallet { justify-self: stretch; }
  .wallet .stat { flex: 1 1 0; justify-content: center; padding: 6px 8px; }
  .wallet .stat .lbl { white-space: normal; }
}
.bump { animation: bump .45s ease; }
@keyframes bump { 40% { transform: scale(1.25); } }
.dip { animation: dip .5s ease; }
@keyframes dip { 30% { transform: translateY(4px) scale(.92); color: var(--wrong); } }

/* home */
.home { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 20px; padding: 20px; }
.hello { font-size: 30px; font-weight: 800; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; }
.tile { border: 0; padding: 0; background: none; text-align: left; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; }
.cover { position: relative; aspect-ratio: 3 / 4; max-width: 100%; border-radius: 16px; overflow: hidden; border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink); transition: transform .15s ease, box-shadow .15s ease; display: flex; flex-direction: column; justify-content: flex-end; padding: 12px; color: var(--paper); }
.tile:hover .cover, .tile:focus-visible .cover { transform: translateY(-4px); box-shadow: 0 9px 0 var(--ink); }
/* A cover without a picture shows its kind's icon, big and faint. */
.cover .art { position: absolute; left: 50%; top: 42%; width: 46%; height: 46%; transform: translate(-50%, -50%); color: rgba(255,255,255,.4); }
.cover .ctitle { position: relative; font-family: var(--display); font-weight: 800; font-size: 19px; line-height: 1.05; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.cover .meter { position: relative; z-index: 1; height: 17px; margin-top: 8px; border-radius: 9px; background: rgba(0,0,0,.38); overflow: hidden; display: block; }
.cover .meter i { position: absolute; inset: 0 auto 0 0; background: var(--star); border-radius: 9px; }
.cover .meter b { position: relative; display: block; text-align: center; font-size: 10.5px; line-height: 17px; font-weight: 600; letter-spacing: .02em; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); font-variant-numeric: tabular-nums; }
.cover .meter.note { height: auto; padding: 1px 8px; font-size: 11px; line-height: 17px; color: #fff; text-align: center; }
/* What kind of collection a cover is, top left. */
.kind { display: inline-flex; align-items: center; gap: 4px; font-family: var(--display); font-weight: 800; font-size: 12.5px; line-height: 1; letter-spacing: .02em; color: #fff; padding: 5px 8px 4px 6px; border-radius: 999px; border: 2px solid var(--ink); background: var(--ink-soft); white-space: nowrap; }
.kind svg { flex: none; margin-top: -1px; }
.cover .kind { position: absolute; top: 8px; left: 8px; z-index: 2; }
.kind.k-channel { background: #E0393E; }
.kind.k-show, .kind.k-stream { background: #1E9A55; }
.kind.k-book { background: #3F63DB; }
.kind.k-group { background: #EE6A12; }
.kind.k-video { background: var(--gem); }
.kind.k-music { background: #D24C9A; }
.badge { position: absolute; top: 8px; right: 8px; z-index: 2; font-family: var(--display); font-weight: 800; font-size: 19px; line-height: 1; padding: 6px 10px 4px; border-radius: 999px; border: 2.5px solid var(--ink); font-variant-numeric: tabular-nums; }
.badge.earn { background: var(--earn); color: var(--paper); }
.badge.spend { background: var(--spend); color: var(--paper); }
.badge.free { background: var(--free); color: var(--paper); }

/* leaderboard */
.board { align-self: start; border: 2.5px solid var(--ink); border-radius: var(--r); overflow: hidden; }
.board h3 { font-size: 20px; padding: 10px 14px; background: var(--star); display: flex; align-items: center; gap: 8px; }
.board ol { list-style: none; margin: 0; padding: 6px 8px 8px; }
.board li { display: grid; grid-template-columns: 22px 30px minmax(0,1fr) auto; gap: 8px; align-items: center; padding: 7px 6px; border-radius: 12px; }
.board li.you { background: #FFF6D6; outline: 2px solid var(--star); }
.board .rank { font-family: var(--display); font-weight: 800; color: var(--ink-soft); }
.board .av { width: 30px; height: 30px; font-size: 14px; }
.board .nm { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .pts { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.board .vel { display: block; font-size: 11.5px; font-weight: 500; }
.vel.up { color: var(--earn); } .vel.down { color: var(--wrong); }
.board .foot { font-size: 11.5px; color: var(--ink-soft); padding: 0 14px 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 8px 0 16px; font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--ink-soft); }
.legend > span { display: inline-flex; align-items: center; gap: 7px; }
.legend .badge { position: static; font-size: 14px; padding: 4px 8px 2px; min-width: 42px; text-align: center; }

/* quiz */
.quiz { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; padding: 22px; }
.passage { background: #FFFBF0; border: 2px solid #F0E3BF; border-radius: var(--r); padding: 20px 22px; font-size: 17px; line-height: 1.75; }
.passage h2 { font-size: 28px; margin-bottom: 8px; }
.passage p { margin: 0 0 12px; max-width: 60ch; }
.qhead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.dots { display: flex; gap: 6px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--line); border: 2px solid var(--ink); }
.dots i.ok { background: var(--earn); } .dots i.bad { background: var(--wrong); } .dots i.now { background: var(--star); }
.worth { margin-left: auto; font-size: 13px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.question { font-family: var(--display); font-weight: 700; font-size: 27px; line-height: 1.2; display: flex; gap: 10px; align-items: flex-start; }
.speak { flex: none; border: 2px solid var(--ink); background: var(--sky); border-radius: 12px; width: 44px; height: 44px; display: grid; place-items: center; }
.choices { display: grid; gap: 12px; margin-top: 18px; }
.choice { border: 3px solid var(--ink); background: var(--paper); border-radius: 18px; padding: 14px 18px; font-size: 18px; font-weight: 500; text-align: left; box-shadow: 0 5px 0 var(--ink); transition: transform .1s ease, box-shadow .1s ease, background .2s ease; display: flex; align-items: center; gap: 14px; }
.choice:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.choice:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.choice .key { width: 34px; height: 34px; border-radius: 10px; background: var(--sky); display: grid; place-items: center; font-family: var(--display); font-weight: 800; flex: none; }
.choice.right { background: var(--earn-soft); border-color: var(--earn); box-shadow: 0 5px 0 var(--earn); }
.choice.right .key { background: var(--earn); color: #fff; }
.choice.wrong { background: var(--wrong-soft); border-color: var(--wrong); box-shadow: 0 5px 0 var(--wrong); animation: shake .4s ease; }
.choice.wrong .key { background: var(--wrong); color: #fff; }
.choice:disabled { cursor: default; }
@keyframes shake { 20%,60% { transform: translateX(-7px); } 40%,80% { transform: translateX(7px); } }
.feedback { min-height: 64px; margin-top: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cheer { font-family: var(--display); font-weight: 800; font-size: 26px; }
.cheer.ok { color: var(--earn); } .cheer.bad { color: var(--wrong); }
.next { margin-left: auto; border: 3px solid var(--ink); background: var(--star); border-radius: 16px; padding: 10px 22px; font-family: var(--display); font-weight: 800; font-size: 20px; box-shadow: 0 5px 0 var(--ink); }
.done { text-align: center; padding: 30px 10px; display: grid; gap: 12px; justify-items: center; }
.done h2 { font-size: 40px; }
.done .big { font-family: var(--display); font-weight: 800; font-size: 54px; color: var(--gem); display: flex; align-items: center; gap: 10px; }

/* flying gems */
.float { position: fixed; z-index: 51; pointer-events: none; font-family: var(--display); font-weight: 800; font-size: 30px; text-shadow: 0 2px 0 #fff, 0 -2px 0 #fff, 2px 0 0 #fff, -2px 0 0 #fff; }

/* reader */
.reader { padding: 22px; display: grid; gap: 16px; justify-items: center; }
.panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: 100%; max-width: 720px; }
.panel { aspect-ratio: 4 / 3; border: 3px solid var(--ink); border-radius: 10px; position: relative; display: grid; place-items: center; font-size: 56px; overflow: hidden; }
.panel .speech { position: absolute; left: 10px; top: 10px; right: 30%; background: #fff; border: 2px solid var(--ink); border-radius: 14px; font-family: var(--display); font-weight: 700; font-size: 15px; padding: 6px 10px; line-height: 1.2; }
.pager { display: flex; gap: 12px; align-items: center; }
.pager button { border: 3px solid var(--ink); background: var(--paper); border-radius: 14px; padding: 8px 18px; font-family: var(--display); font-weight: 800; font-size: 18px; box-shadow: 0 4px 0 var(--ink); }

/* video */
.video { padding: 22px; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 22px; }
.player { aspect-ratio: 16 / 9; background: #10142A; border-radius: var(--r); position: relative; display: grid; place-items: center; overflow: hidden; border: 3px solid var(--ink); }
.player .play { width: 84px; height: 84px; border-radius: 50%; background: var(--paper); display: grid; place-items: center; border: 0; }
.player .scrub { position: absolute; left: 16px; right: 16px; bottom: 16px; height: 8px; border-radius: 8px; background: rgba(255,255,255,.25); }
.player .scrub i { display: block; width: 22%; height: 100%; background: var(--spend); border-radius: 8px; }
.player .tag { position: absolute; top: 14px; left: 14px; color: #fff; font-size: 13px; background: rgba(255,255,255,.12); padding: 3px 10px; border-radius: 8px; }
.side { display: grid; gap: 14px; align-content: start; }
.side h2 { font-size: 30px; }
.upnext { font-size: 15px; color: var(--ink-soft); margin: 0; }
.room { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.room button { border: 2.5px solid var(--ink); border-radius: 14px; background: var(--paper); padding: 10px; text-align: left; font-size: 13px; line-height: 1.3; }
.room button b { display: block; font-family: var(--display); font-size: 17px; }
.room button[aria-pressed="true"] { background: var(--spend-soft); border-color: var(--spend); }
.cost { display: flex; align-items: center; gap: 10px; font-size: 14px; background: var(--spend-soft); border-radius: 14px; padding: 10px 12px; }

/* music */
.music { padding: 22px; display: grid; gap: 18px; }
.music .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.music .cover { aspect-ratio: 1; }
.nowplaying { display: flex; align-items: center; gap: 14px; background: var(--ink); color: var(--paper); border-radius: var(--r); padding: 12px 16px; flex-wrap: wrap; }
.eq { display: flex; gap: 3px; align-items: flex-end; height: 26px; }
.eq i { width: 5px; background: var(--star); border-radius: 3px; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; } .eq i:nth-child(3) { animation-delay: -.6s; } .eq i:nth-child(4) { animation-delay: -.15s; }
@keyframes eq { 0%,100% { height: 6px; } 50% { height: 26px; } }
.nowplaying .t { font-family: var(--display); font-weight: 700; font-size: 18px; }
.nowplaying .s { font-size: 12.5px; opacity: .75; }
.nowplaying .who { margin-left: auto; font-size: 12.5px; opacity: .8; }

/* sign in */
.signin { padding: 30px 22px; display: grid; gap: 22px; justify-items: center; text-align: center; }
.signin h2 { font-size: 40px; }
.kids { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; }
.kid-wrap { position: relative; }
.kid { border: 0; background: none; display: grid; gap: 6px; justify-items: center; font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--ink); padding: 4px; width: 112px; }
.kid .kname { line-height: 1.1; overflow-wrap: anywhere; }
.kid small { font-family: var(--body); font-weight: 500; font-size: 11.5px; color: var(--ink-soft); margin-top: -4px; }
.kid .avatar { width: 84px; height: 84px; font-size: 38px; border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink); transition: transform .12s ease, box-shadow .12s ease; }
.kid:hover .avatar { transform: translateY(-3px); box-shadow: 0 8px 0 var(--ink); }
.kid:active .avatar { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.kid[aria-pressed="true"] .avatar { outline: 5px solid var(--star); outline-offset: 3px; }
.kid.grown .avatar { border-radius: 24px; }
.kid.add .avatar.plus { background: var(--sky); color: var(--ink); border-style: dashed; box-shadow: none; font-size: 50px; font-weight: 800; padding-bottom: 4px; }
.kid.add:hover .avatar.plus { background: #B8DCFF; box-shadow: none; }
/* Remove-from-this-device button: on the picked profile (works on tablets), and on hover with a mouse. */
.forget { position: absolute; top: -2px; right: 6px; width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--ink); background: var(--wrong); color: var(--paper); font-family: var(--display); font-weight: 800; font-size: 22px; line-height: 1; display: grid; place-items: center; padding: 0 0 2px; opacity: 0; transform: scale(.6); pointer-events: none; transition: opacity .12s ease, transform .12s ease; }
.kid-wrap:has(.kid[aria-pressed="true"]) .forget { opacity: 1; transform: none; pointer-events: auto; }
@media (hover: hover) { .kid-wrap:hover .forget, .forget:focus-visible { opacity: 1; transform: none; pointer-events: auto; } }
.pin-ask { font-family: var(--display); font-weight: 700; font-size: 22px; margin: 0 0 -8px; }
.back-pill { border: 2.5px solid var(--ink); background: var(--paper); border-radius: 999px; padding: 6px 18px; font-family: var(--display); font-weight: 700; font-size: 17px; box-shadow: 0 3px 0 var(--ink); }
.signin .hint { color: var(--ink-soft); }
.pad button.go { background: var(--earn); color: var(--paper); }
.pin { display: flex; gap: 10px; }
.pin i { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--ink); }
.pin i.on { background: var(--ink); }
.pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px; }
.pad button { height: 64px; border: 3px solid var(--ink); border-radius: 18px; background: var(--paper); font-family: var(--display); font-weight: 800; font-size: 28px; box-shadow: 0 4px 0 var(--ink); }

/* modal */
.scrim { position: absolute; inset: 0; background: rgba(29,35,64,.55); display: grid; place-items: center; z-index: 20; padding: 16px; }
.modal { background: var(--paper); border: 3px solid var(--ink); border-radius: 24px; padding: 24px; max-width: 460px; width: 100%; text-align: center; display: grid; gap: 14px; box-shadow: 0 8px 0 var(--ink); }
.modal h2 { font-size: 32px; }
.boost { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.boost div { border: 2.5px solid var(--line); border-radius: 16px; padding: 12px 6px; display: grid; gap: 4px; justify-items: center; }
.boost .kind { font-size: 13px; color: var(--ink-soft); }
.boost .nums { font-family: var(--display); font-weight: 800; font-size: 28px; display: flex; align-items: center; gap: 8px; }
.boost .old { color: var(--ink-soft); text-decoration: line-through; font-size: 22px; }
.boost .new { color: var(--earn); }
.modal .go { border: 3px solid var(--ink); border-radius: 16px; background: var(--earn); color: #fff; font-family: var(--display); font-weight: 800; font-size: 21px; padding: 10px; box-shadow: 0 5px 0 var(--ink); }
.modal .go:disabled { background: var(--line); color: var(--ink-soft); cursor: wait; }

/* admin */
.admin { background: #F4F6FB; padding: 22px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 20px; font-size: 14px; }
.admin .card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.admin h2 { font-family: var(--body); font-weight: 600; font-size: 17px; }
.admin label { display: grid; gap: 4px; font-size: 12.5px; color: var(--ink-soft); }
.admin input, .admin select { font: inherit; color: var(--ink); border: 1px solid #C5CDE0; border-radius: 9px; padding: 8px 10px; background: var(--paper); }
.admin .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.admin .primary { border: 0; background: var(--admin); color: #fff; border-radius: 9px; padding: 10px; font-weight: 600; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; }
.feed li { display: grid; grid-template-columns: 74px minmax(0,1fr) auto; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); align-items: baseline; }
.feed .when { color: var(--ink-soft); font-size: 12px; font-variant-numeric: tabular-nums; }
.feed .what { min-width: 0; }
.feed .what small { display: block; color: var(--ink-soft); font-size: 12px; }
.feed .amt { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.amt.plus { color: var(--earn); } .amt.minus { color: var(--wrong); } .amt.spendonly { color: var(--spend); }
.chip { display: inline-block; font-size: 11px; border-radius: 6px; padding: 1px 6px; margin-right: 4px; font-weight: 500; }
.chip.award { background: #EEE7FF; color: var(--gem); }
.chip.q { background: var(--earn-soft); color: #137a42; }
.chip.w { background: var(--wrong-soft); color: #b3262b; }
.chip.s { background: var(--spend-soft); color: #b04b0c; }
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.totals div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.totals b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.totals span { font-size: 12px; color: var(--ink-soft); }
.values { display: grid; gap: 6px; }
.values div { display: grid; grid-template-columns: minmax(0,1fr) 70px; gap: 10px; align-items: center; }
.toast { background: var(--earn-soft); color: #137a42; border-radius: 9px; padding: 8px 10px; font-size: 13px; }

@media (max-width: 860px) {
  .home, .quiz, .video, .admin { grid-template-columns: minmax(0, 1fr); }
  .board { order: -1; }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .question { font-size: 22px; }
  .stat .num { font-size: 19px; }
  .spendable .num { font-size: 22px; }
  .stat svg { width: 18px; height: 18px; }
  .wallet .stat { flex-direction: column; gap: 2px; text-align: center; padding: 6px 4px; }
  .pad { grid-template-columns: repeat(3, 64px); }
  .room, .boost { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- v3 additions ---------- */
.cover .photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover.has-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,0) 55%); }
.cover.has-photo .ctitle { z-index: 1; }
.page { padding: 20px; display: grid; gap: 16px; }
.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.page-head h2 { font-size: 32px; font-weight: 800; }
.back { color: var(--ink); text-decoration: none; display: inline-block; border: 2.5px solid var(--ink); background: var(--paper); border-radius: 14px; padding: 6px 14px; font-family: var(--display); font-weight: 700; font-size: 16px; box-shadow: 0 3px 0 var(--ink); }
.empty { color: var(--ink-soft); padding: 30px 0; text-align: center; }
.error-box { background: var(--wrong-soft); color: #9b1c21; border-radius: 14px; padding: 12px 14px; }
.ytframe { width: 100%; aspect-ratio: 16 / 9; border: 3px solid var(--ink); border-radius: var(--r); background: #10142A; }
.passage h1, .passage h3 { font-family: var(--display); margin: 12px 0 6px; }
.player video, .player audio { width: 100%; height: 100%; background: #10142A; }
.music-player { display: grid; gap: 12px; }
.music-player audio { width: 100%; }
.kid-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--paper); border-radius: 18px; padding: 12px 20px; font-family: var(--display); font-weight: 700; font-size: 19px; box-shadow: 0 6px 0 rgba(0,0,0,.25); max-width: calc(100% - 32px); text-align: center; }
.signin form { display: grid; gap: 10px; width: min(320px, 100%); text-align: left; }
.signin input { font: inherit; border: 2.5px solid var(--ink); border-radius: 12px; padding: 10px 12px; }
.linkish { border: 0; background: none; color: var(--ink-soft); text-decoration: underline; font-size: 13px; }
.signin .go-btn { border: 3px solid var(--ink); background: var(--star); border-radius: 14px; padding: 10px; font-family: var(--display); font-weight: 800; font-size: 19px; box-shadow: 0 4px 0 var(--ink); }
.admin { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
.admin table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin th, .admin td { text-align: left; padding: 6px 6px; border-top: 1px solid var(--line); vertical-align: middle; }
.admin th { font-weight: 600; color: var(--ink-soft); font-size: 12px; border-top: 0; }
.admin td.num, .admin th.num { text-align: right; font-variant-numeric: tabular-nums; }
.admin tr.sel { background: #EEF2FF; }
.admin tr[data-student] { cursor: pointer; }
.admin .scroll { overflow-x: auto; max-height: 420px; overflow-y: auto; }
.admin .mini { border: 1px solid #C5CDE0; background: var(--paper); border-radius: 7px; padding: 3px 8px; font-size: 12px; }
.admin input.small { width: 70px; padding: 4px 6px; }
.admin .wide { grid-column: 1 / -1; }
.admin .hint { margin: 0; font-size: 12.5px; color: var(--ink-soft); }
.admin-top { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--line); background: #F4F6FB; }
.admin-top h1 { font-family: var(--body); font-weight: 600; font-size: 18px; }
.admin-top .spacer { flex: 1; }
.toast.err { background: var(--wrong-soft); color: #9b1c21; }

/* "Already done": finished covers, chapters and episodes, folded away at the bottom */
.done-box { margin-top: 26px; border-top: 2px dashed var(--line); padding-top: 16px; }
.done-box summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 10px; border: 2.5px solid var(--ink); background: var(--earn-soft); border-radius: 999px; padding: 8px 18px 8px 8px; font-family: var(--display); font-weight: 800; font-size: 20px; box-shadow: 0 4px 0 var(--ink); user-select: none; }
.done-box summary::-webkit-details-marker { display: none; }
.done-box summary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.done-box summary:focus-visible { outline: 3px solid var(--gem); outline-offset: 2px; }
.done-box .tick { width: 32px; height: 32px; border-radius: 50%; background: var(--earn); color: var(--paper); display: grid; place-items: center; font-size: 18px; }
.done-box .count { background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; padding: 0 10px; font-size: 16px; font-variant-numeric: tabular-nums; }
.done-box .chev { width: 10px; height: 10px; border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s ease; }
.done-box[open] .chev { transform: rotate(-135deg) translate(-2px, -2px); }
.done-box > .grid { margin-top: 18px; }
.done-box .tile { opacity: .8; }
.done-box .tile:hover, .done-box .tile:focus-visible { opacity: 1; }

/* "Show all": a collection's quizzes in play order. No pictures at this level. */
.count-note { margin-left: auto; color: var(--ink-soft); font-size: 14px; font-variant-numeric: tabular-nums; }
.qlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.qlist a { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; text-decoration: none; color: var(--ink); border: 2.5px solid var(--line); border-radius: 14px; padding: 9px 12px; background: var(--paper); transition: border-color .12s ease, transform .12s ease; }
.qlist a:hover, .qlist a:focus-visible { border-color: var(--ink); transform: translateX(2px); }
.qlist .num { width: 34px; height: 34px; border-radius: 10px; background: var(--sky); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }
.qlist .qt { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.qlist .qt small { display: block; color: var(--ink-soft); font-size: 12px; font-weight: 400; }
.qlist .qp { font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.qlist .qp .badge { position: static; font-size: 13px; padding: 3px 7px 1px; }
.qlist .is-done { background: #F6FBF8; }
.qlist .is-done .num { background: var(--earn); color: #fff; }
.qlist .is-done .qp { color: var(--earn); font-weight: 600; }
.qlist .is-next { border-color: var(--star); box-shadow: 0 0 0 3px #FFF1BF; }

/* quiz page: Home on the left, Show all on the right */
.quiz-head { padding: 16px 22px 0; }
.quiz-head .where { flex: 1; min-width: 0; text-align: center; font-family: var(--display); font-weight: 700; font-size: 17px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quiz.solo { grid-template-columns: minmax(0, 720px); justify-content: center; }
.solo-title { font-size: 28px; }
.done-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.done-actions .next { margin: 0; text-decoration: none; color: inherit; }
.next.alt { background: var(--paper); }

/* hold to pick (touch screens) */
.choice { position: relative; overflow: hidden; touch-action: manipulation; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.choice > * { position: relative; z-index: 1; }
.choice::after { content: ""; position: absolute; inset: 0; background: rgba(245,183,0,.38); transform: scaleX(0); transform-origin: left; pointer-events: none; }
.choice.holding::after { transform: scaleX(1); transition: transform var(--hold, 550ms) linear; }
.hold-hint { display: none; margin: 10px 0 0; font-size: 13px; color: var(--ink-soft); text-align: center; }
@media (hover: none) and (pointer: coarse) { .hold-hint { display: block; } }

/* gems that sprout from a right answer */
.pickup { position: fixed; z-index: 55; width: 34px; height: 34px; pointer-events: none; transform: scale(0); filter: drop-shadow(0 3px 0 rgba(29,35,64,.25)); }
.pickup.collecting { opacity: 0; transform: scale(.3) !important; transition: left .25s ease-in, top .25s ease-in, opacity .25s ease-out, transform .25s ease-in !important; }
.float.small { font-size: 20px; }

/* a wrong answer: the whole screen, the gem count drops */
.lose-screen { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: radial-gradient(circle at center, rgba(229,72,77,.55), rgba(120,16,24,.82)); animation: lose-in .2s ease-out; cursor: pointer; overflow: hidden; }
.lose-screen.out { animation: lose-out .25s ease-in forwards; }
.lose-card { display: grid; justify-items: center; gap: 4px; color: #fff; animation: lose-shake .45s ease .15s; }
.lose-gem { filter: grayscale(.4) drop-shadow(0 6px 0 rgba(0,0,0,.25)); }
.lose-num { font-family: var(--display); font-weight: 800; font-size: clamp(64px, 16vw, 128px); line-height: 1; font-variant-numeric: tabular-nums; text-shadow: 0 6px 0 rgba(0,0,0,.25); }
.lose-delta { font-family: var(--display); font-weight: 800; font-size: 28px; background: var(--paper); color: var(--wrong); border: 3px solid var(--ink); border-radius: 999px; padding: 4px 18px 2px; }
.shard { position: absolute; left: 50%; top: 45%; width: 34px; height: 34px; pointer-events: none; }
@keyframes lose-in { from { opacity: 0; } }
@keyframes lose-out { to { opacity: 0; } }
@keyframes lose-shake { 20%, 60% { transform: translateX(-12px); } 40%, 80% { transform: translateX(12px); } }
@media (max-width: 480px) {
  .cover { padding: 10px; }
  .cover .kind { top: 6px; left: 6px; font-size: 10.5px; padding: 4px 6px 3px 5px; gap: 3px; border-width: 1.5px; }
  .cover .kind svg { width: 11px; height: 11px; }
  .cover .badge { top: 6px; right: 6px; font-size: 14px; padding: 4px 7px 2px; border-width: 2px; }
  .cover .ctitle { font-size: 16px; }
}

/* quiz videos: questions wait until the video is watched */
.ytframe { overflow: hidden; }
.ytframe iframe, .ytframe > div { width: 100%; height: 100%; display: block; border: 0; }
.watch-lock { border: 3px dashed var(--line); border-radius: var(--r); padding: 26px 20px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.watch-lock .lock-icon { font-size: 40px; line-height: 1; }
.watch-lock h3 { font-size: 23px; }
.watch-lock p { margin: 0; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.watch-bar { width: min(320px, 100%); height: 14px; border-radius: 9px; background: var(--line); overflow: hidden; }
.watch-bar i { display: block; height: 100%; background: var(--earn); border-radius: 9px; transition: width .25s linear; }
.watch-lock .skip-note { color: var(--wrong); font-weight: 600; }
.back.locked { opacity: .55; cursor: not-allowed; box-shadow: none; }

/* reward channels: pay once per video before it plays */
.pay-card { display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; color: #fff; padding: 16px; }
.pay-card p { margin: 0; }
.pay-card .small { font-size: 13px; opacity: .8; max-width: 34ch; }
.pay-card .pay { margin: 0; display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.pay-card .pay .badge { position: static; font-size: 16px; }
