/* Orin's Adventures
   Layout: a sticky top bar, then a single column that widens into grids on tablets and desktops.
   Type: Lexend for everything people read (designed and tested for reading ease, with a clear I, l and 1),
   Fredoka for headings, buttons and speech bubbles (rounded and friendly, for personality).
   Rules (CONNIE): no text under 14px, child-facing text 18px+, no ALL CAPS, tap targets 44px+. */

@font-face { font-family: "Lexend"; src: url(fonts/lexend.woff2) format("woff2"); font-weight: 300 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Fredoka"; src: url(fonts/fredoka.woff2) format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }

:root {
  --bg: #EAF3FA;
  --surface: #FFFFFF;
  --surface-2: #F2F7FB;
  --ink: #14273B;
  --muted: #586B7E;
  --line: #CFDDEA;
  --stadium: #D7262F;
  --dino: #2E8B57;
  --park: #6C4BD8;
  --gold: #E9A800;
  --good: #1B8F52;
  --good-bg: #E3F6EC;
  --bad: #C2384C;
  --bad-bg: #FCE8EC;
  --warn: #B86E00;
  --warn-bg: #FFF2DC;
  --c-reading: #2F6FB0;
  --c-writing: #B83A84;
  --c-maths: #A85400;
  --c-science: #0F7266;
  --star: #B07D00;
  --good-ink: #146B3E;
  --warn-ink: #874E00;
  --c-mixed: #9C5E00;
  --focus: #1F6FEB;
  --shadow: 0 1px 0 rgba(20, 39, 59, .06), 0 6px 18px rgba(20, 39, 59, .08);
  --font-display: "Fredoka", "Lexend", system-ui, sans-serif;
  --font-body: "Lexend", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1723; --surface: #14243A; --surface-2: #1A2D46; --ink: #E7EFF7; --muted: #9DB1C5; --line: #2A4059;
    --stadium: #FF5C65; --dino: #4DC487; --park: #A28CFF; --gold: #FFD24D;
    --good: #5FD996; --good-bg: #133A2A; --bad: #FF7C8F; --bad-bg: #42202A; --warn: #FFB54D; --warn-bg: #3D2C12;
    --c-reading: #73AEEB; --c-writing: #F082C2; --c-maths: #FFA552; --c-science: #4FD1C1; --focus: #79B0FF; --star: #FFD24D; --c-mixed: #FFD24D; --good-ink: #5FD996; --warn-ink: #FFB54D;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 22px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C1723; --surface: #14243A; --surface-2: #1A2D46; --ink: #E7EFF7; --muted: #9DB1C5; --line: #2A4059;
  --stadium: #FF5C65; --dino: #4DC487; --park: #A28CFF; --gold: #FFD24D;
  --good: #5FD996; --good-bg: #133A2A; --bad: #FF7C8F; --bad-bg: #42202A; --warn: #FFB54D; --warn-bg: #3D2C12;
  --c-reading: #73AEEB; --c-writing: #F082C2; --c-maths: #FFA552; --c-science: #4FD1C1; --focus: #79B0FF; --star: #FFD24D; --c-mixed: #FFD24D; --good-ink: #5FD996; --warn-ink: #FFB54D;
  --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 22px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 18px; line-height: 1.6; letter-spacing: -0.005em;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; margin: 0; text-wrap: balance; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 12px;
  padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.topbar .btn, .topbar .pill { white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; min-width: 44px; text-decoration: none; color: inherit; background: none; border: 0; padding: 0; }
.brand-mark { width: 44px; height: 44px; image-rendering: pixelated; image-rendering: crisp-edges; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; }
.spacer { flex: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; min-height: 44px;
  background: var(--surface); border: 1px solid var(--line); font-weight: 700; font-size: 1rem; white-space: nowrap;
}
.pill .star { color: var(--star); }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); display: inline-block; }
.sync-dot.offline { background: var(--warn); }
.sync-dot.error { background: var(--bad); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px; border-radius: 14px; border: 2px solid transparent;
  background: var(--ink); color: var(--bg); font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; letter-spacing: .01em; text-decoration: none; text-align: center;
  transition: transform .12s ease, filter .12s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost { background: transparent; color: var(--ink); border-color: transparent; }
.btn.small { min-height: 44px; padding: 8px 16px; font-size: 1rem; border-radius: 12px; }
.btn.big { min-height: 64px; font-size: 1.2rem; padding: 14px 28px; border-radius: 18px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- page ---------- */
main {
  max-width: 1120px; margin: 0 auto;
  padding-block: 20px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.stack { display: flex; flex-direction: column; gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.eyebrow { font-size: .9rem; font-weight: 700; color: var(--muted); }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; padding: 20px; }
.orin-stage { position: relative; display: grid; place-items: center; }
.orin-canvas { width: 224px; height: 208px; image-rendering: pixelated; image-rendering: crisp-edges; cursor: pointer; touch-action: manipulation; }
.bubble {
  position: absolute; left: 62%; top: 4px; width: max-content; max-width: 190px; padding: 8px 12px; border-radius: 14px 14px 14px 4px;
  background: var(--surface); border: 2px solid var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; line-height: 1.25;
  box-shadow: 3px 3px 0 var(--ink); animation: pop .25s ease-out; white-space: normal; z-index: 2;
}
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.hero h1 { font-size: clamp(1.8rem, 4.5vw, 2.8rem); font-weight: 600; }
.hero-copy { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.warmup-card { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; padding: 14px 16px; border-radius: 16px; background: var(--surface-2); border: 1px dashed var(--line); }
.warmup-card .grow { flex: 1 1 200px; min-width: 0; }
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: .95rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); }
.badge.locked { color: var(--muted); background: transparent; border-style: dashed; }

/* ---------- worlds ---------- */
.worlds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.world { overflow: hidden; display: flex; flex-direction: column; }
.world-banner { height: 120px; position: relative; color: #fff; display: flex; align-items: flex-end; padding: 14px 16px; }
.world-banner { height: 140px; background: var(--surface-2); overflow: hidden; padding: 0; }
.world-banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.world-banner h2 { position: relative; font-size: 1.6rem; font-weight: 600; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.world[data-world="stadium"] { --w: var(--stadium); }
.world[data-world="dino"] { --w: var(--dino); }
.world[data-world="park"] { --w: var(--park); }
.world-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.mission-btn {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; text-align: left;
  width: 100%; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface);
  min-height: 64px; transition: border-color .15s ease, transform .12s ease;
}
.mission-btn:hover { border-color: var(--w); }
.mission-btn:active { transform: scale(.985); }
.mission-btn .title { font-weight: 700; font-size: 1.05rem; line-height: 1.25; }
.mission-btn .stars { grid-row: span 2; font-size: 1.1rem; letter-spacing: 1px; white-space: nowrap; }
.stars .on { color: var(--star); }
.stars .off { color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; font-weight: 700; color: var(--subj, var(--muted)); }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--subj, var(--muted)); }
[data-subject="reading"] { --subj: var(--c-reading); }
[data-subject="writing"] { --subj: var(--c-writing); }
[data-subject="maths"] { --subj: var(--c-maths); }
[data-subject="science"] { --subj: var(--c-science); }
[data-subject="mixed"] { --subj: var(--c-mixed); }

/* ---------- mission player ---------- */
.player { --w: var(--gold); display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.player[data-world="stadium"] { --w: var(--stadium); }
.player[data-world="dino"] { --w: var(--dino); }
.player[data-world="park"] { --w: var(--park); }
.guide { position: sticky; top: calc(76px + env(safe-area-inset-top, 0px)); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.guide .orin-canvas { width: 196px; height: 182px; }
.guide-text { font-size: 1.05rem; }
.progress { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px 3px; margin-top: 2px; }
.progress span { width: 20px; height: 10px; border-radius: 6px; background: var(--line); }
.progress span.done { background: var(--w); }
.progress span.miss { background: color-mix(in srgb, var(--w) 45%, var(--line)); }
.progress span.now { outline: 2px solid var(--w); outline-offset: 2px; background: var(--surface); }
.activity { padding: 22px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.question { font-family: var(--font-body); font-weight: 600; font-size: clamp(1.35rem, 3.2vw, 1.75rem); line-height: 1.25; }
.passage { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; font-size: 1.15rem; line-height: 1.65; }
.passage h3 { font-size: 1.3rem; }
.passage details summary { cursor: pointer; font-weight: 700; color: var(--w); }
.passage p { max-width: 64ch; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.option {
  min-height: 68px; padding: 14px 18px; border-radius: 16px; border: 3px solid var(--line); background: var(--surface-2);
  font-size: 1.15rem; font-weight: 700; text-align: left; transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.option:hover:not([disabled]) { border-color: var(--w); transform: translateY(-1px); }
.option.right { border-color: var(--good); background: var(--good-bg); }
.option.wrong { border-color: var(--bad); background: var(--bad-bg); animation: shake .35s; }
.option[disabled] { cursor: default; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.answer-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.answer-input {
  width: 160px; font-size: 2rem; font-weight: 700; text-align: center; padding: 8px 12px; border-radius: 14px; border: 3px solid var(--line); background: var(--surface-2);
  font-variant-numeric: tabular-nums;
}
.answer-input.right { border-color: var(--good); background: var(--good-bg); }
.answer-input.wrong { border-color: var(--bad); background: var(--bad-bg); animation: shake .35s; }
.keypad { display: grid; grid-template-columns: repeat(3, 80px); gap: 8px; }
.keypad button { height: 60px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-size: 1.6rem; font-weight: 700; }
.keypad button.word { font-size: 1.05rem; }
.keypad button:active { background: var(--surface-2); }
.tiles { display: flex; flex-direction: column; gap: 10px; }
.tile {
  padding: 12px 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface-2); text-align: left; font-weight: 700; font-size: 1.05rem; min-height: 54px;
  display: flex; gap: 12px; align-items: center;
}
.tile .n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--w); color: #fff; font-size: .95rem; flex: none; }
.tile.placed { border-color: var(--w); background: var(--surface); }
.tile.slot { border-style: dashed; color: var(--muted); font-weight: 400; }
.tile.right { border-color: var(--good); background: var(--good-bg); }
.tile.wrong { border-color: var(--bad); background: var(--bad-bg); }
.order-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.sort-row { display: grid; grid-template-columns: minmax(110px, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface-2); }
.sort-row.right { border-color: var(--good); background: var(--good-bg); }
.sort-row.wrong { border-color: var(--bad); background: var(--bad-bg); }
.sort-row .item { font-weight: 700; font-size: 1.1rem; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { min-height: 48px; padding: 6px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; font-size: 1.05rem; }
.seg button[aria-pressed="true"] { background: var(--w); border-color: var(--w); color: #fff; }
.write-area {
  width: 100%; min-height: 200px; resize: vertical; padding: 16px; border-radius: 16px; border: 3px solid var(--line); background: var(--surface-2);
  font-size: 1.35rem; line-height: 1.7; font-family: var(--font-body);
}
.write-area:focus { border-color: var(--w); outline: none; }
.hints { display: flex; flex-direction: column; gap: 6px; padding-left: 0; margin: 0; list-style: none; }
.hints li { padding: 8px 12px; border-radius: 12px; background: var(--surface-2); font-size: 1.1rem; }
.checks { display: flex; flex-direction: column; gap: 8px; }
.checks label { display: flex; gap: 12px; align-items: center; font-size: 1.05rem; min-height: 44px; cursor: pointer; }
.checks input { width: 28px; height: 28px; accent-color: var(--good); flex: none; }
.feedback { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; padding: 16px 18px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface-2); }
.feedback.good { border-color: var(--good); background: var(--good-bg); }
.feedback.bad { border-color: var(--bad); background: var(--bad-bg); }
.feedback.info { border-color: var(--warn); background: var(--warn-bg); }
.feedback .msg { flex: 1 1 240px; min-width: 0; }
.feedback strong { font-family: var(--font-display); font-size: 1.25rem; display: block; }
.toolrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* visuals */
.visual { display: flex; justify-content: flex-start; overflow-x: auto; }
.visual table { border-collapse: collapse; font-size: 1.05rem; }
.visual th, .visual td { border: 2px solid var(--line); padding: 8px 14px; text-align: left; }
.visual th { background: var(--surface-2); }
.picto { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; align-items: center; padding: 12px 16px; border-radius: 14px; background: var(--surface-2); border: 2px solid var(--line); }
.picto .icons { display: flex; gap: 4px; flex-wrap: wrap; }
.tenframe { display: grid; grid-template-columns: repeat(5, 34px); gap: 4px; padding: 6px; border-radius: 10px; background: var(--surface-2); border: 2px solid var(--line); }
.tenframe span { width: 34px; height: 34px; border-radius: 6px; border: 2px solid var(--line); display: grid; place-items: center; }
.tenframe span.on::after { content: ""; width: 22px; height: 22px; border-radius: 50%; background: var(--c-maths); }
.tenframe span.on2::after { content: ""; width: 22px; height: 22px; border-radius: 50%; background: var(--c-reading); }
.blocks { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 10px; border-radius: 12px; background: var(--surface-2); border: 2px solid var(--line); }
.rod { width: 14px; height: 140px; background: repeating-linear-gradient(to bottom, var(--c-maths) 0 12px, color-mix(in srgb, var(--c-maths) 70%, #000) 12px 14px); border-radius: 3px; }
.cube { width: 14px; height: 14px; background: var(--c-reading); border-radius: 3px; }
.cubes { display: grid; grid-template-columns: repeat(2, 14px); gap: 2px; align-self: flex-end; }

/* end screen */
.finish { text-align: center; padding: 28px 22px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.finish h2 { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 600; }
.big-stars { font-size: 3rem; letter-spacing: 6px; }
.big-stars span { display: inline-block; animation: starpop .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.big-stars span:nth-child(2) { animation-delay: .25s; }
.big-stars span:nth-child(3) { animation-delay: .5s; }
@keyframes starpop { from { transform: scale(0) rotate(-40deg); } to { transform: scale(1) rotate(0); } }
.extension { text-align: left; padding: 16px 18px; border-radius: 16px; background: var(--surface-2); border: 1px dashed var(--line); max-width: 640px; }

/* ---------- grown-ups ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.tabs button { min-height: 44px; font-size: 1rem; padding: 6px 14px; border-radius: 12px; border: 1px solid transparent; background: transparent; font-weight: 700; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: var(--shadow); }
.adult { font-size: 16px; }
.adult h1 { font-size: 1.9rem; }
.adult h2 { font-size: 1.3rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.stat { padding: 14px 16px; }
.stat .v { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .l { font-size: .95rem; color: var(--muted); }
.section { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 70px; gap: 12px; align-items: center; font-size: .95rem; }
.bar { height: 14px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.bar i.sec { background: var(--subj); }
.bar i.pra { background: color-mix(in srgb, var(--subj) 35%, transparent); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .9rem; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--k); }
.table-wrap { overflow-x: auto; }
table.obj { width: 100%; border-collapse: collapse; font-size: 1rem; }
table.obj th { text-align: left; font-size: .875rem; color: var(--muted); padding: 8px; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.obj td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.obj td.t { min-width: 220px; }
table.obj select { min-height: 44px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); padding: 4px 8px; }
.status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .875rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.status.secure { background: var(--good-bg); color: var(--good-ink); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.status.practising { background: var(--warn-bg); color: var(--warn-ink); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.status.look { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.status.none { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.year { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: .875rem; white-space: nowrap; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); }
.list { display: flex; flex-direction: column; gap: 10px; }
.entry { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.entry .meta { font-size: .9rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.entry blockquote { margin: 0; padding: 10px 14px; border-left: 4px solid var(--c-writing); background: var(--surface); border-radius: 0 10px 10px 0; font-size: 1.1rem; white-space: pre-wrap; }
.form { display: grid; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: .9rem; }
.form input, .form textarea, .form select { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 400; font-size: 1rem; min-height: 44px; }
.form textarea { min-height: 90px; resize: vertical; }
.form > *, .form label, .form-row > * { min-width: 0; }
.form select, .form input:not([type=checkbox]), .form textarea { width: 100%; max-width: 100%; }
.form label.check-row { flex-direction: row; align-items: center; gap: 12px; min-height: 44px; font-size: 1.05rem; cursor: pointer; }
.form label.check-row input { width: 24px; height: 24px; min-height: 0; padding: 0; flex: none; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.toggles button { min-height: 44px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 1rem; font-weight: 700; }
.toggles button[aria-pressed="true"] { background: var(--subj, var(--ink)); color: var(--bg); border-color: transparent; }

/* modal + toast */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(8, 16, 26, .55); display: grid; place-items: center; padding: 16px; }
.modal { width: min(440px, 100%); padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 12px; font-weight: 700; max-width: calc(100% - 32px); }

/* login */
.login { max-width: 420px; margin: 6vh auto 0; padding: 26px; display: flex; flex-direction: column; gap: 16px; align-items: stretch; text-align: center; }
.login .orin-canvas { margin: 0 auto; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; width: 100%; height: 100%; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .worlds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .player { grid-template-columns: 1fr; }
  .guide { position: static; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 12px; }
  .guide .orin-stage { width: 100%; justify-items: start; }
  .guide .orin-canvas { width: 140px; height: 130px; }
  .guide .guide-info { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
  .guide .bubble { left: 140px; top: 16px; font-size: 1rem; max-width: 170px; border-radius: 14px 14px 14px 4px; }
}
@media (max-width: 640px) {
  body { font-size: 17px; }
  .worlds { grid-template-columns: 1fr; }
  .hero { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding: 16px; }
  .hero-copy { width: 100%; }
  .hero-copy { align-items: center; }
  .warmup-card { text-align: left; }
  .orin-canvas { width: 168px; height: 156px; }
  .order-cols { grid-template-columns: 1fr; }
  .activity { padding: 16px; }
  .bar-row { grid-template-columns: 1fr 60px; }
  .bar-row .bar { grid-column: 1 / -1; grid-row: 2; }
  .brand-name { display: none; }
  .topbar-inner { gap: 8px; }
  .keypad { grid-template-columns: repeat(3, minmax(0, 76px)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.help { font-size: 1rem; color: var(--muted); }
.help.bad { color: var(--bad); font-weight: 700; }
.sync-label { font-size: .9rem; font-weight: 700; }
@media (max-width: 440px) { .stars-pill-label { display: none; } .topbar .pill, .topbar .btn.small { padding-left: 10px; padding-right: 10px; } }
@media (max-width: 360px) { .sync-label { display: none; } .topbar-inner { gap: 6px; } }

/* ---------- the family (Mum, Dad, Proodles, Jasper) ---------- */
.family-row { display: flex; align-items: flex-end; justify-content: center; gap: 0; --px: 3px; }
.family-row canvas, .family-pic { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
.family-row .person { width: calc(24 * var(--px)); height: calc(48 * var(--px)); margin: 0 calc(-3 * var(--px)); }
.family-row .orin-canvas { width: calc(56 * var(--px)); height: calc(52 * var(--px)); margin: 0 calc(-10 * var(--px)); cursor: pointer; }
.family-cheer { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.family-cheer .family-row { --px: 2px; }
.with-family { display: flex; align-items: center; gap: 10px; margin-bottom: -4px; }
.with-family .who { display: flex; align-items: flex-end; }
.with-family .family-pic { width: 36px; height: 72px; margin: -14px -4px -6px; }
.with-family span { font-size: .95rem; font-weight: 700; color: var(--muted); }
.birthday { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 16px; background: var(--warn-bg); border: 2px solid var(--c-mixed); font-weight: 700; font-size: 1.15rem; }
.birthday .family-pic { width: 48px; height: 96px; margin: -24px 0 -8px; }
.credits li { margin: 4px 0; }
.credits a { display: inline-flex; align-items: center; min-height: 44px; }
@media (max-width: 440px) { .family-row { --px: 2px; } }
@media (max-width: 600px) {
  .guide { padding: 12px 14px; gap: 6px; }
  .guide .orin-stage { height: 104px; }
  .guide .orin-canvas { width: 112px; height: 104px; }
  .guide .bubble { left: 112px; top: 8px; }
  .guide-text { font-size: 1rem; }
}

/* ---------- polish: tidy rows, no stranded buttons ---------- */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.card-head-left { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.card-head > .btn { flex: none; margin-left: auto; }
.number-pad { display: grid; gap: 12px; justify-content: center; grid-template-columns: min(100%, 256px); }
.number-pad .answer-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; flex-wrap: nowrap; }
.number-pad .answer-input { width: 100%; }
.number-pad .keypad { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.guide .toolrow { display: block; }
.guide .toolrow .btn { width: 100%; }
@media (max-width: 600px) {
  .warmup-card .btn, .hero-copy > .btn, .finish .toolrow .btn, .login .btn { width: 100%; }
  .warmup-card { padding: 14px; }
  .finish .toolrow { flex-direction: column; align-items: stretch; width: 100%; }
  .card-head { align-items: flex-start; }
}
.next-up { align-self: flex-start; }
@media (max-width: 960px) { .next-up { align-self: stretch; } }
p, li, .question { text-wrap: pretty; }
/* Hero: give Orin's speech bubble its own room so it never covers the greeting. */
@media (min-width: 601px) {
  .hero .orin-stage { width: 290px; justify-items: start; align-self: center; }
  .hero .bubble { left: 150px; top: 14px; max-width: 140px; }
}
/* Grown-ups tabs: one tidy row; on phones it scrolls sideways instead of breaking into two uneven rows. */
@media (max-width: 600px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: none; }
}
/* Mission panel: keep Orin's speech bubble inside the card. */
@media (min-width: 961px) { .guide .bubble { left: auto; right: 0; top: 0; max-width: 130px; } }
.q-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.q-row .question { flex: 1 1 auto; min-width: 0; }
.q-row > .btn { flex: none; margin-top: 2px; }
@media (max-width: 600px) { .q-row { flex-direction: column; gap: 12px; } .q-row > .btn { align-self: stretch; } }
@media (min-width: 961px) { .guide .bubble { top: -6px; right: -4px; font-size: .95rem; } }
@media (max-width: 600px) { .feedback > .btn { width: 100%; } .feedback .msg { flex: 1 1 100%; } }

/* ---------- Season plan: today's session, the session player, Big Book of Wow, grown-ups plan ---------- */
[data-world="stadium"] { --w: var(--stadium); }
[data-world="dino"] { --w: var(--dino); }
[data-world="park"] { --w: var(--park); }
.note { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 1rem; text-align: left; }
.session-card { --w: var(--gold); display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 18px; background: var(--surface); border: 3px solid var(--w); box-shadow: 0 4px 0 color-mix(in srgb, var(--w) 30%, transparent); }
.session-card .eyebrow { color: var(--ink); }
.session-title { font-size: clamp(1.4rem, 3.4vw, 1.8rem); line-height: 1.15; }
.session-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 10px; }
.session-choice .btn { flex-direction: column; gap: 2px; line-height: 1.15; padding-block: 10px; }
.session-choice .btn small { font-family: var(--font-body); font-weight: 500; font-size: .875rem; opacity: .9; }
.warmup-card .btn { flex: none; }

.mode-line { font-size: .95rem; color: var(--muted); font-weight: 600; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.steps li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: .875rem; font-weight: 600; color: var(--muted); }
.steps .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--line); color: var(--ink); font-size: .875rem; }
.steps li.done { color: var(--ink); }
.steps li.done .dot { background: var(--w); color: var(--surface); }
.steps li.now { color: var(--ink); border-color: var(--w); background: color-mix(in srgb, var(--w) 12%, var(--surface)); }
.steps li.now .dot { background: var(--surface); outline: 2px solid var(--w); }
.step-card { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.step-card h2 { font-size: clamp(1.5rem, 3.6vw, 2rem); line-height: 1.2; }
.step-card h2.mystery { font-family: var(--font-body); font-weight: 600; font-size: clamp(1.35rem, 3.2vw, 1.7rem); }
.step-text { font-size: 1.3rem; font-weight: 500; line-height: 1.45; }
.step-intro { font-weight: 600; font-size: 1.1rem; }
.step-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 600px) { .step-actions { flex-direction: column; } .step-actions .btn { width: 100%; } .step-card { padding: 18px 16px; } }
.move-timer { height: 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.move-timer i { display: block; height: 100%; width: 100%; background: var(--w); transform-origin: left; animation: move-fill 60s linear both; }
@keyframes move-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .move-timer { display: none; } }
.proodles-intro { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; background: var(--surface); border: 2px solid var(--w); font-weight: 600; }
.proodles-intro .family-pic { flex: none; }
.skip-row { display: flex; justify-content: center; border-top: 1px dashed var(--line); padding-top: 12px; }
.skip-btn { color: var(--muted); }
@media (max-width: 600px) { .skip-row .btn { width: 100%; } }

.hands-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.hands-on h3, .lab-book h3, .carried h3, .get-ready h3, .mastery-group h3 { font-size: 1.1rem; margin-bottom: 6px; }
.hands-on ul, .hands-on ol, .get-ready ol, .grown-card ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.ask { padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--w) 10%, var(--surface)); border-left: 4px solid var(--w); }
.carried { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; border-top: 1px dashed var(--line); }
.carried details, .week, .grown-card { border-radius: 12px; }
.carried summary, .week > summary, .grown-card > summary, .get-ready summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.carried details { padding: 0 12px 12px; background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.carried details ul { margin: 0 0 10px; }
.done-note { color: var(--good-ink); font-weight: 700; }

.lab-book { padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.lab-head { font-weight: 700; font-size: .95rem; display: block; margin-bottom: 6px; }
.lab-rows { display: flex; flex-direction: column; gap: 8px; }
.lab-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 8px; }
.lab-chart { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.lab-bar { display: grid; grid-template-columns: minmax(0, 8em) minmax(0, 1fr) 3em; gap: 10px; align-items: center; font-size: .95rem; }
.lab-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lab-track { height: 18px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.lab-track i { display: block; height: 100%; background: var(--w); border-radius: 6px; min-width: 4px; }
.lab-val { text-align: right; font-weight: 700; }

.feel-block { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.seg.feel { justify-content: center; }
.wow-step .wow-text, .wow-card p:not(.eyebrow) { font-size: 1.25rem; font-weight: 500; line-height: 1.45; }
.wow-saved { font-weight: 600; color: var(--muted); }
.wow-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.wow-card { --w: var(--gold); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 16px; border-radius: 16px; background: var(--surface); border: 2px solid var(--line); border-top: 6px solid var(--w); }
.wow-card.own { border-top-color: var(--c-writing); }
.wow-card p:not(.eyebrow) { font-size: 1.1rem; }
.wow-card .meta { font-size: .9rem; color: var(--muted); }
.wow-head h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); }

.get-ready { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px dashed var(--line); }
.catchup p { margin: 0; }
.nudge { border-left: 5px solid var(--line); }
.nudge.up { border-left-color: var(--good); }
.nudge.ease { border-left-color: var(--warn); }
.nudge.info { border-left-color: var(--c-reading); }
.checkin { display: flex; flex-direction: column; gap: 8px; }
.mastery-group { margin-top: 6px; }
.mastery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 10px; }
.m-cell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.m-about, .m-ev { font-size: .9rem; color: var(--muted); }
.status.emerging { background: var(--warn-bg); color: var(--warn-ink); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.status.mastered { background: var(--good); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .status.mastered { color: #0B1A12; } }
:root[data-theme="dark"] .status.mastered { color: #0B1A12; }
.signals { display: grid; gap: 8px; }
.signal { display: grid; grid-template-columns: 10em minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 600px) { .signal { grid-template-columns: 1fr; gap: 2px; } }
.weeks { display: flex; flex-direction: column; gap: 8px; }
.week { border: 1px solid var(--line); background: var(--surface); padding: 0 12px; }
.week > summary { justify-content: space-between; flex-wrap: wrap; padding: 6px 0; }
.week[open] { padding-bottom: 12px; }
.grown-card { background: var(--surface); border: 1px solid var(--line); padding: 0 12px; }
.grown-card[open] { padding-bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.entry.weekend { border-style: dashed; }
.carried summary::before, .week > summary::before, .grown-card > summary::before, .get-ready summary::before { content: "▸"; display: inline-block; width: 1em; color: var(--muted); transition: transform .15s; }
.carried details[open] > summary::before, .week[open] > summary::before, .grown-card[open] > summary::before, .get-ready details[open] > summary::before { transform: rotate(90deg); }
.week > summary > span:first-child { flex: 1 1 auto; }
/* Phones: the step strip shrinks to numbered dots plus the current step's name, so the question stays near the top. */
@media (max-width: 600px) {
  .steps { gap: 4px; }
  .steps li:not(.now) { padding: 3px; gap: 0; }
  .steps li:not(.now) .step-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .mode-line { display: none; }
}
.book-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.loop { margin: 0; padding-left: 24px; display: flex; flex-direction: column; gap: 6px; font-size: 1.1rem; }
.wow-card.idea { border-top-color: var(--c-science); }
.wow-card.idea p:not(.eyebrow) { font-size: 1.05rem; }
