/* Launchpad: a game designer's graph-paper notebook with sticker-style controls.
   Fonts: Bricolage Grotesque (display) + Atkinson Hyperlegible (body, built for readability). */

:root {
  --paper: #f3f6fb;
  --grid: rgba(47, 91, 255, 0.07);
  --card: #ffffff;
  --ink: #1a2340;
  --ink-2: #3a4566;
  --muted: #5a6684;
  --line: #cdd6e8;
  --blue: #2f5bff;
  --sun: #ffc53d;
  --tomato: #ff5b45;
  --mint: #15b385;
  --grape: #7b5cff;
  --gold: #e0a100;
  --accent: var(--blue);
  --accent-ink: #fff;
  --ok: #0f8f69;
  --bad: #d63b27;
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hard: 4px 4px 0 var(--ink);
  --hard-sm: 2px 2px 0 var(--ink);
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 9px;
}
[data-theme="tomato"] { --accent: var(--tomato); }
[data-theme="mint"] { --accent: var(--mint); }
[data-theme="grape"] { --accent: var(--grape); }
[data-theme="gold"] { --accent: var(--gold); --accent-ink: var(--ink); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 17px/1.55 var(--body);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 26px 26px;
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.12; margin: 0; letter-spacing: -0.01em; }
p { margin: 0 0 0.7em; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 99; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
small { font-size: 0.86rem; }
code { font-size: 0.92em; background: #e8edf8; padding: 1px 6px; border-radius: 6px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px;
  padding: 22px 16px; border-right: 2px solid var(--ink); background: var(--card);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 800 1.45rem/1 var(--display); padding: 4px 8px; }
.brand-mark { width: 38px; height: 38px; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-md);
  text-decoration: none; font-weight: 700; color: var(--ink-2); border: 2px solid transparent;
}
.nav a:hover { background: var(--paper); }
.nav a.on { background: var(--accent); color: var(--accent-ink); border-color: var(--ink); box-shadow: var(--hard-sm); }
.nav .ni { width: 22px; text-align: center; }
.nav-dad { margin-top: 10px; }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding: 12px; border: 2px solid var(--ink); border-radius: var(--r-md); background: var(--paper); }
.me { display: flex; gap: 10px; align-items: center; }
.me-av { font-size: 1.6rem; }
.me small { display: block; color: var(--muted); }
.sync { color: var(--muted); }
.sync.ok { color: var(--ok); }

main { padding: 34px clamp(18px, 4vw, 52px) 110px; max-width: 1180px; width: 100%; outline: none; }
.tabbar { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  main { padding: 22px 16px 110px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 10px calc(10px + env(safe-area-inset-bottom)) 10px;
    background: var(--card); border: 2px solid var(--ink); border-radius: 18px; box-shadow: var(--hard); z-index: 20; overflow: hidden;
  }
  .tabbar a { display: grid; place-items: center; gap: 1px; padding: 8px 2px; font-size: 0.74rem; font-weight: 700; text-decoration: none; color: var(--ink-2); }
  .tabbar a span { font-size: 1.15rem; }
  .tabbar a.on { background: var(--accent); color: var(--accent-ink); }
}

/* ---------- Buttons, chips, fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 12px; border: 2px solid var(--ink); background: var(--card);
  font-weight: 700; text-decoration: none; cursor: pointer; box-shadow: var(--hard-sm);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { box-shadow: none; background: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--card); box-shadow: none; transform: none; }
.btn.danger { color: var(--bad); border-color: var(--bad); box-shadow: none; }
.btn.big { padding: 14px 26px; font-size: 1.08rem; border-radius: 14px; box-shadow: var(--hard); }
.btn.sm { padding: 6px 12px; font-size: 0.9rem; border-radius: 10px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.filebtn { cursor: pointer; }

.chip {
  display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 999px; border: 2px solid var(--ink);
  background: var(--wc, var(--accent)); color: #fff; font-weight: 700; font-size: 0.82rem; white-space: nowrap;
}
.chip.ghost { background: var(--card); color: var(--ink); border-color: var(--line); }

.field { display: grid; gap: 6px; }
.field > span { font-weight: 700; font-size: 0.95rem; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 13px; border: 2px solid var(--line); border-radius: 12px; background: #fff; resize: vertical;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }
.row.wrap { flex-wrap: wrap; }
.okline { color: var(--ok); font-weight: 700; }
.okline::before { content: "✓ "; }
.empty { color: var(--muted); font-style: italic; }
.warn { color: var(--bad); font-weight: 700; font-size: 0.9rem; }
.tiny { font-weight: 400; font-size: 0.8rem; color: var(--muted); }

.panel { background: var(--card); border: 2px solid var(--ink); border-radius: var(--r-lg); padding: 20px 22px; margin-bottom: 20px; }
.panel h3 { font-size: 1.2rem; margin-bottom: 12px; }
.phead { margin-bottom: 24px; }
.phead h1 { font-size: clamp(2rem, 4.2vw, 2.9rem); font-weight: 800; }
.phead p { color: var(--muted); max-width: 62ch; margin-top: 8px; font-size: 1.05rem; }

.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px; border: 2px dashed var(--ink); border-radius: var(--r-md); background: #fff8e1; margin-bottom: 18px; }

/* ---------- XP bar ---------- */
.xpbar { height: 14px; border: 2px solid var(--ink); border-radius: 99px; background: #fff; overflow: hidden; margin-top: 8px; }
.xpbar i { display: block; height: 100%; background: repeating-linear-gradient(-45deg, var(--accent), var(--accent) 8px, color-mix(in srgb, var(--accent) 80%, #fff) 8px, color-mix(in srgb, var(--accent) 80%, #fff) 16px); transition: width 0.6s; }
.xpbar.sm { height: 9px; margin: 0; }

/* ---------- Today ---------- */
.today-head { display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center; margin-bottom: 26px; }
.th-av { width: 76px; height: 76px; display: grid; place-items: center; font-size: 2.6rem; background: var(--sun); border: 2px solid var(--ink); border-radius: 22px; box-shadow: var(--hard); transform: rotate(-4deg); }
.today-head h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); font-weight: 800; }
.today-head p { margin: 4px 0 0; color: var(--muted); }
.today-head .xpbar { max-width: 420px; }
.countdown { text-align: center; padding: 10px 18px; background: var(--ink); color: #fff; border-radius: var(--r-md); transform: rotate(2deg); }
.countdown b { display: block; font: 800 2.6rem/1 var(--display); color: var(--sun); }
.countdown span { font-size: 0.82rem; }

.today-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.hero-mission {
  --wc: var(--blue);
  position: relative; padding: 28px 30px 30px; border: 2px solid var(--ink); border-radius: 26px; background: var(--card);
  box-shadow: 8px 8px 0 var(--wc); margin-bottom: 26px;
}
.hero-mission .hm-top { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.hero-mission h2 { font-size: clamp(2rem, 4.6vw, 3.3rem); font-weight: 800; max-width: 18ch; }
.hero-mission > p { font-size: 1.12rem; color: var(--ink-2); max-width: 52ch; margin: 12px 0 18px; }
.hm-steps { display: flex; align-items: center; gap: 6px; margin-bottom: 22px; }
.hm-steps small { margin-left: 8px; color: var(--muted); }
.pip { width: 26px; height: 12px; border-radius: 99px; border: 2px solid var(--ink); background: #fff; }
.pip.on { background: var(--wc); }
.done-all { --wc: var(--mint); }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list a { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 11px 14px; border: 2px solid var(--line); border-radius: 12px; text-decoration: none; font-weight: 700; }
.list a:hover { border-color: var(--ink); }
.list small { color: var(--muted); font-weight: 400; }
.list.big a { font-size: 1.1rem; padding: 16px; background: var(--card); }
.list.plain li { padding: 10px 0; border-bottom: 1px solid var(--line); margin: 0; }
.list.plain li:last-child { border-bottom: 0; }

.week { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.wk { display: grid; place-items: center; padding: 8px 0; border-radius: 12px; border: 2px solid var(--line); background: #fff; }
.wk span { font-size: 0.78rem; color: var(--muted); }
.wk b { font: 700 1.15rem var(--display); }
.wk.done { background: var(--mint); border-color: var(--ink); color: #fff; }
.wk.done span { color: #fff; }
.wk.today { border-color: var(--ink); box-shadow: var(--hard-sm); background: var(--sun); }
.wk.missed { border-style: dashed; }
.wk.none { opacity: 0.4; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 2px solid var(--ink); border-radius: var(--r-md); padding: 12px 14px; }
.stat .si { font-size: 1.2rem; }
.stat b { display: block; font: 800 1.7rem/1.1 var(--display); }
.stat small { color: var(--muted); }

.spin-panel { text-align: center; }
.wheel-wrap { position: relative; width: 220px; margin: 4px auto 16px; }
.wheel { width: 220px; height: 220px; display: block; }
.wheel text { font: 700 9.5px var(--body); fill: var(--ink); }
.wheel-pointer { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); width: 0; height: 0; border-left: 12px solid transparent; border-right: 12px solid transparent; border-top: 22px solid var(--ink); z-index: 2; }

@media (max-width: 980px) {
  .today-grid { grid-template-columns: 1fr; }
  .col-side { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .col-side .stats { margin: 0; align-self: start; }
}
@media (max-width: 640px) {
  .today-head { grid-template-columns: auto 1fr; }
  .countdown { grid-column: 1 / -1; display: flex; gap: 10px; align-items: baseline; justify-content: center; transform: none; }
  .countdown b { display: inline; font-size: 1.8rem; }
  .th-av { width: 60px; height: 60px; font-size: 2rem; }
  .col-side { grid-template-columns: 1fr; }
  .hero-mission { padding: 22px; box-shadow: 6px 6px 0 var(--wc); }
}

/* ---------- World colors ---------- */
.w-blue { --wc: var(--blue); }
.w-grape { --wc: var(--grape); }
.w-mint { --wc: var(--mint); }
.w-tomato { --wc: var(--tomato); }

/* ---------- Quest map (the signature element) ---------- */
.map { display: grid; gap: 30px; }
.world { background: var(--card); border: 2px solid var(--ink); border-radius: 28px; padding: 24px 24px 10px; box-shadow: 6px 6px 0 var(--wc); }
.world-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.world-head h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; }
.world-head p { color: var(--muted); margin-top: 4px; }
.world-head .chip { background: var(--wc); }
.trail { position: relative; margin: 10px auto 0; max-width: 640px; }
.trail-path { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.trail-path path { fill: none; stroke: var(--wc); stroke-width: 5; stroke-dasharray: 2 12; stroke-linecap: round; opacity: 0.7; }
.node { position: absolute; transform: translate(-50%, -50%); text-decoration: none; display: block; }
.nd {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--ink);
  background: #fff; font: 800 1.35rem var(--display); box-shadow: var(--hard); position: relative; z-index: 1;
}
.node.boss .nd { width: 78px; height: 78px; border-radius: 22px; transform: rotate(45deg); font-size: 1.6rem; }
.node.done .nd { background: var(--wc); color: #fff; }
.node.today .nd { background: var(--sun); }
.node.today .nd::after { content: ""; position: absolute; inset: -10px; border-radius: inherit; border: 3px solid var(--sun); animation: ping 1.8s ease-out infinite; }
.node.locked .nd { background: #eef1f7; color: #9aa4bd; border-color: #9aa4bd; box-shadow: none; }
.node a:hover .nd, a.node:hover .nd { filter: brightness(1.05); }
a.node:hover .nd { transform: translateY(-2px); }
a.node.boss:hover .nd { transform: rotate(45deg) translateY(-2px); }
.nl { position: absolute; top: 50%; transform: translateY(-50%); width: max-content; max-width: 220px; display: grid; }
.nl.right { left: calc(100% + 14px); }
.nl.left { right: calc(100% + 14px); text-align: right; }
.nl b { font: 700 1.02rem/1.2 var(--display); }
.nl small { color: var(--muted); }
.node.locked .nl b { color: var(--muted); }
@keyframes ping { 0% { opacity: 0.9; transform: scale(0.9); } 100% { opacity: 0; transform: scale(1.35); } }
@media (max-width: 640px) {
  .world { padding: 18px 12px 6px; }
  .nd { width: 52px; height: 52px; font-size: 1.1rem; }
  .node.boss .nd { width: 60px; height: 60px; }
  .nl { max-width: 140px; }
  .nl b { font-size: 0.9rem; }
}

.nd em { font-style: normal; }
.node.boss .nd em { transform: rotate(-45deg); }

/* ---------- Mission ---------- */
.back { display: inline-block; margin-bottom: 16px; font-weight: 700; color: var(--muted); text-decoration: none; }
.back::before { content: "‹ "; }
.mhead { margin-bottom: 26px; }
.mh-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.mhead h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 800; max-width: 20ch; }
.mhead > p { font-size: 1.12rem; color: var(--ink-2); margin: 10px 0 0; max-width: 60ch; }
.mprog { display: flex; align-items: center; gap: 12px; max-width: 460px; }
.mprog .xpbar { flex: 1; }
.mprog i { background: var(--wc) !important; }
.mprog small { margin-top: 8px; color: var(--muted); white-space: nowrap; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; counter-reset: none; }
.step { background: var(--card); border: 2px solid var(--ink); border-radius: var(--r-lg); overflow: hidden; }
.step.done { border-color: color-mix(in srgb, var(--ink) 35%, transparent); }
.sh { display: flex; gap: 14px; align-items: center; padding: 16px 22px; border-bottom: 2px dashed var(--line); }
.sh-n { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; border: 2px solid var(--ink); font: 800 1.05rem var(--display); background: #fff; }
.step.done .sh-n { background: var(--wc); color: #fff; }
.sh small { color: var(--muted); font-weight: 700; }
.sh h2 { font-size: 1.32rem; font-weight: 700; }
.sb { padding: 18px 22px 22px; }
.prose { max-width: 66ch; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 0.8em; }
.prose li { margin-bottom: 0.35em; }
.defs { display: grid; gap: 10px; margin: 0 0 0.8em; }
.defs dt { font: 700 1.06rem var(--display); }
.defs dd { margin: 2px 0 0; color: var(--ink-2); }
.note { background: #fff8e1; border-left: 5px solid var(--sun); padding: 10px 14px; border-radius: 0 10px 10px 0; }
.ask { font-weight: 700; font-size: 1.08rem; }

.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.checks label { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; }
.checks input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--wc); flex: none; }
.checks input:checked + span { text-decoration: line-through; color: var(--muted); }
.t-dad .sb { background: repeating-linear-gradient(135deg, transparent 0 14px, color-mix(in srgb, var(--sun) 10%, transparent) 14px 28px); }

.quiz { display: grid; gap: 16px; }
.q { border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px 16px; margin: 0; }
.q legend { font-weight: 700; font-size: 1.06rem; padding: 0 6px; }
.q.right { border-color: var(--ok); }
.q.wrong { border-color: var(--bad); }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin-top: 8px; }
.opt { text-align: left; padding: 11px 14px; border-radius: 12px; border: 2px solid var(--ink); background: #fff; cursor: pointer; font-weight: 700; box-shadow: var(--hard-sm); }
.opt:hover:not(:disabled) { background: color-mix(in srgb, var(--wc, var(--accent)) 12%, #fff); }
.opt:disabled { cursor: default; box-shadow: none; opacity: 0.6; }
.opt.correct { background: var(--ok); color: #fff; opacity: 1; }
.opt.picked { background: var(--bad); color: #fff; opacity: 1; }
.why { margin: 12px 0 0; }

.boss-intro { display: flex; gap: 20px; align-items: center; }
.boss-face { font-size: 3.4rem; line-height: 1; width: 92px; height: 92px; display: grid; place-items: center; background: var(--ink); border-radius: 24px; flex: none; }
.boss-face.sm { width: 50px; height: 50px; font-size: 1.8rem; border-radius: 14px; }
.boss-arena { background: var(--ink); color: #fff; border-radius: 18px; padding: 18px; }
.boss-arena .q { border-color: #46507a; }
.boss-arena .q.right { border-color: var(--mint); }
.boss-arena .q.wrong { border-color: var(--tomato); }
.boss-arena .opt { color: var(--ink); box-shadow: 2px 2px 0 #000; }
.boss-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.boss-top small { white-space: nowrap; color: #c8cfe6; }
.hp { flex: 1; height: 18px; border-radius: 99px; background: #2c3558; border: 2px solid #fff; overflow: hidden; }
.hp i { display: block; height: 100%; background: linear-gradient(90deg, var(--tomato), var(--sun)); transition: width 0.4s; }
.boss-arena.end { text-align: center; padding: 30px 18px; }
.boss-arena.end .boss-face { margin: 0 auto 12px; background: #2c3558; }
.boss-arena.end h3 { font-size: 1.8rem; margin-bottom: 6px; }
.boss-arena.win h3 { color: var(--sun); }

.pb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pb-preview { margin-top: 14px; border: 2px solid var(--ink); border-radius: 14px; background: var(--ink); color: #e9edff; padding: 12px 16px; }
.pb-preview small { color: var(--sun); font-weight: 700; }
.pb-preview pre, .prompts pre { white-space: pre-wrap; font: 0.98rem/1.5 var(--body); margin: 6px 0 0; }
@media (max-width: 640px) { .pb-grid { grid-template-columns: 1fr; } .opts { grid-template-columns: 1fr; } .boss-intro { flex-direction: column; align-items: flex-start; } }

.complete-card { margin-top: 22px; padding: 16px 20px; border: 2px solid var(--ink); border-radius: var(--r-md); background: var(--mint); color: #fff; box-shadow: var(--hard); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; flex-wrap: wrap; }

/* ---------- Workbook ---------- */
.wb-actions { margin: -8px 0 22px; }
.wb-sec { background: var(--card); border: 2px solid var(--ink); border-radius: var(--r-lg); padding: 22px; margin-bottom: 22px; }
.wb-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.wb-head h2 { font-size: 1.6rem; font-weight: 800; }
.wb-head p { color: var(--muted); margin: 4px 0 0; }
.wb-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .wb-fields { grid-template-columns: 1fr; } }
.namelab { margin-top: 22px; padding-top: 18px; border-top: 2px dashed var(--line); }
.namelab h3 { font-size: 1.3rem; }
.names { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.names li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 2px solid var(--line); border-radius: 12px; }
.nm { flex: 1; font: 700 1.08rem var(--display); }
.star { background: none; border: 0; font-size: 1.4rem; color: #cfd6e6; cursor: pointer; padding: 0 2px; }
.star.on { color: var(--sun); -webkit-text-stroke: 1px var(--ink); }
.x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; }

/* ---------- Idea board ---------- */
.addidea { margin: -6px 0 20px; }
.addidea .field { margin: 0; }
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.board .b-none { grid-column: 1 / -1; }
.board .b-none ul { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); align-items: start; }
@media (max-width: 600px) { .board { grid-template-columns: 1fr; } }
.col { background: color-mix(in srgb, var(--card) 70%, transparent); border: 2px solid var(--ink); border-radius: 20px; padding: 14px; }
.col header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.col h2 { font-size: 1.25rem; }
.col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.b-must { border-top: 8px solid var(--tomato); }
.b-should { border-top: 8px solid var(--sun); }
.b-later { border-top: 8px solid var(--grape); }
.b-none { border-top: 8px solid var(--line); }
.idea { background: #fffbe6; border: 2px solid var(--ink); border-radius: 6px 14px 14px 14px; padding: 10px 12px; box-shadow: var(--hard-sm); }
.idea:nth-child(2n) { background: #eef6ff; }
.idea:nth-child(3n) { background: #eefbf4; }
.idea p { margin: 4px 0 8px; font-size: 0.98rem; }
.tag { font-size: 0.75rem; font-weight: 700; color: var(--muted); }
.moves { display: flex; gap: 6px; flex-wrap: wrap; }
.mv { border: 1.5px solid var(--ink); background: #fff; border-radius: 8px; padding: 2px 9px; font-size: 0.82rem; font-weight: 700; cursor: pointer; }
.mv:hover { background: var(--ink); color: #fff; }

/* ---------- Prompts ---------- */
.prompts { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.prompts li { border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.ph { display: flex; justify-content: space-between; align-items: center; }
.result { margin: 10px 0 0; }

/* ---------- Toolkit ---------- */
.setup { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.setup li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px; }
.setup label { display: flex; gap: 10px; align-items: center; cursor: pointer; font-weight: 700; }
.setup input { width: 20px; height: 20px; accent-color: var(--accent); }
.setup li.on .st { text-decoration: line-through; color: var(--muted); }
.setup small { grid-column: 1 / -1; color: var(--muted); padding-left: 30px; }
.owner { font-size: 0.8rem; font-weight: 700; padding: 2px 10px; border-radius: 99px; border: 2px solid var(--ink); }
.o-logan { background: var(--sun); }
.o-dad { background: var(--ink); color: #fff; }
.o-together { background: var(--mint); color: #fff; }
.gloss { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin: 0; }
.gloss div { padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; }
.gloss dt { font: 700 1.05rem var(--display); }
.gloss dd { margin: 4px 0 0; color: var(--ink-2); font-size: 0.95rem; }

/* ---------- Trophies & shop ---------- */
.trophy-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.trophy-top .stats { margin: 0; }
.lvl { display: flex; gap: 18px; align-items: center; background: var(--card); border: 2px solid var(--ink); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--hard); }
.lvl > div { flex: 1; }
.lvl b { font: 800 1.6rem var(--display); display: block; }
.lvl small { color: var(--muted); }
.lvl-n { width: 84px; height: 84px; display: grid; place-items: center; font: 800 2.6rem var(--display); background: var(--accent); color: var(--accent-ink); border: 3px solid var(--ink); border-radius: 50%; flex: none; }
@media (max-width: 760px) { .trophy-top { grid-template-columns: 1fr; } }
.badges { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.badges li { display: grid; gap: 2px; justify-items: center; text-align: center; padding: 16px 10px; border: 2px dashed var(--line); border-radius: 16px; color: var(--muted); }
.badges li.got { border: 2px solid var(--ink); color: var(--ink); background: #fffbe6; box-shadow: var(--hard-sm); }
.bg { font-size: 2.2rem; }
.shop { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.shop li { display: grid; gap: 8px; justify-items: center; padding: 14px 8px; border: 2px solid var(--line); border-radius: 16px; text-align: center; }
.shop li.on { border-color: var(--ink); background: color-mix(in srgb, var(--accent) 12%, #fff); }
.shop .av { font-size: 2.3rem; }
.shop small { color: var(--muted); font-weight: 700; }
.themes { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.sw { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--ink); }
.sw-blue { background: var(--blue); } .sw-tomato { background: var(--tomato); } .sw-mint { background: var(--mint); } .sw-grape { background: var(--grape); } .sw-gold { background: var(--gold); }

/* ---------- Dad ---------- */
.lockpanel { text-align: center; padding: 40px; }
.toggle { display: flex; gap: 10px; align-items: center; font-weight: 700; cursor: pointer; }
.toggle input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ---------- Toasts & modals ---------- */
.toasts { position: fixed; right: 18px; top: 18px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--ink); color: #fff; border-radius: 14px; padding: 10px 16px; box-shadow: 4px 4px 0 var(--accent); display: grid; min-width: 200px; transition: opacity 0.4s, transform 0.4s; }
.toast strong { color: var(--sun); font-family: var(--display); font-size: 1.05rem; }
.toast span { font-size: 0.88rem; }
.toast.out { opacity: 0; transform: translateX(20px); }
@media (max-width: 860px) { .toasts { left: 12px; right: 12px; } }

.modal-back { position: fixed; inset: 0; background: rgba(26, 35, 64, 0.55); display: grid; place-items: center; z-index: 60; padding: 18px; }
.modal { background: var(--card); border: 2px solid var(--ink); border-radius: var(--r-lg); padding: 24px; width: min(420px, 100%); box-shadow: var(--hard); }
.modal h2 { font-size: 1.6rem; margin-bottom: 8px; }
.err { color: var(--bad); font-weight: 700; margin-top: 8px; }

.stamp { position: relative; background: var(--sun); border: 3px solid var(--ink); border-radius: 30px; padding: 34px 30px 26px; width: min(400px, 100%); text-align: center; box-shadow: 8px 8px 0 var(--ink); animation: stampIn 0.45s cubic-bezier(.2, 1.6, .4, 1); }
.stamp h2 { font-size: 2.2rem; font-weight: 800; margin: 8px 0 6px; }
.stamp p { font-size: 1.08rem; }
.stamp-face { font-size: 3.6rem; }
.stamp-burst { position: absolute; inset: 0; pointer-events: none; }
.stamp-burst i { position: absolute; left: 50%; top: 30%; width: 12px; height: 12px; border: 2px solid var(--ink); border-radius: 3px; background: var(--accent); opacity: 0; animation: burst 0.9s ease-out forwards; }
.stamp-burst i:nth-child(3n) { background: var(--tomato); border-radius: 50%; }
.stamp-burst i:nth-child(3n+1) { background: var(--mint); }
.stamp-burst i:nth-child(1) { --dx: -150px; --dy: -90px; } .stamp-burst i:nth-child(2) { --dx: 150px; --dy: -80px; }
.stamp-burst i:nth-child(3) { --dx: -170px; --dy: 30px; } .stamp-burst i:nth-child(4) { --dx: 170px; --dy: 40px; }
.stamp-burst i:nth-child(5) { --dx: -90px; --dy: -150px; } .stamp-burst i:nth-child(6) { --dx: 90px; --dy: -150px; }
.stamp-burst i:nth-child(7) { --dx: -130px; --dy: 130px; } .stamp-burst i:nth-child(8) { --dx: 130px; --dy: 130px; }
.stamp-burst i:nth-child(9) { --dx: 0; --dy: -180px; } .stamp-burst i:nth-child(10) { --dx: -200px; --dy: -20px; }
.stamp-burst i:nth-child(11) { --dx: 200px; --dy: -10px; } .stamp-burst i:nth-child(12) { --dx: 20px; --dy: 170px; }
@keyframes stampIn { from { transform: scale(1.4) rotate(-6deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes burst { 0% { opacity: 1; transform: translate(-50%, -50%) rotate(0); } 100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(260deg); } }

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

@media print {
  body { background: #fff; }
  .side, .tabbar, .wb-actions, .namelab form, .x, .star, .toasts { display: none !important; }
  .shell { display: block; }
  main { padding: 0; }
  .wb-sec { border: 0; padding: 0; }
  textarea { border: 0 !important; resize: none; }
}

/* ---------- Step header extras ---------- */
.sh-t { flex: 1; min-width: 0; }
.hint { margin: 2px 0 0; color: var(--muted); font-size: 0.92rem; }
.askthis { flex: none; align-self: flex-start; border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font-weight: 700; font-size: 0.85rem; cursor: pointer; color: var(--ink-2); }
.askthis::before { content: "✨ "; }
.askthis:hover { border-color: var(--ink); color: var(--ink); }
@media (max-width: 640px) { .askthis { font-size: 0; padding: 6px 9px; } .askthis::before { font-size: 1rem; content: "✨"; } }
.t-action .sb { background: color-mix(in srgb, var(--sun) 12%, #fff); }

/* ---------- Nav extras ---------- */
.badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--tomato); color: #fff; font: 700 0.78rem/22px var(--body); text-align: center; border: 2px solid var(--ink); }
.tabbar a { position: relative; }
.tabbar .badge { position: absolute; top: 3px; right: calc(50% - 22px); margin: 0; min-width: 18px; height: 18px; line-height: 14px; font-size: 0.7rem; }
.side-links { display: grid; gap: 2px; margin-top: 4px; }
.side-links a, .linkbtn { color: var(--muted); font-size: 0.86rem; text-align: left; background: none; border: 0; padding: 2px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.small-gap { margin-top: 10px; }
.stats.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) { .stats.four { grid-template-columns: 1fr 1fr; } }
.alertbar { padding: 12px 16px; margin-bottom: 18px; border: 2px solid var(--bad); background: #fff1ef; border-radius: var(--r-md); }

/* ---------- Messages ---------- */
.thread { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bubble { max-width: min(520px, 85%); padding: 10px 14px 8px; border: 2px solid var(--ink); border-radius: 18px 18px 18px 6px; background: #fff; }
.bubble p { margin: 2px 0 4px; white-space: pre-wrap; }
.bubble .who { font-weight: 700; color: var(--ink-2); }
.bubble .meta { color: var(--muted); font-size: 0.78rem; }
.bubble.mine { justify-self: end; border-radius: 18px 18px 6px 18px; background: var(--accent); color: var(--accent-ink); }
.bubble.mine .who, .bubble.mine .meta { color: inherit; opacity: 0.85; }
.bubble.from-mom.theirs { background: #ffeef6; }
.bubble.from-dad.theirs { background: #eef6ff; }
.thread-panel { max-height: 60vh; overflow-y: auto; }
.msg-compose { display: grid; gap: 12px; }
.to { border: 0; padding: 0; margin: 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.to legend { font-weight: 700; margin-bottom: 6px; }
.pill input { position: absolute; opacity: 0; }
.pill span { display: inline-block; padding: 7px 16px; border: 2px solid var(--ink); border-radius: 99px; font-weight: 700; cursor: pointer; background: #fff; }
.pill input:checked + span { background: var(--ink); color: #fff; }
.pill input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Parents' chat log ---------- */
.chatlog { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 60vh; overflow-y: auto; }
.chatlog li { padding: 8px 12px; border-radius: 12px; border: 2px solid var(--line); }
.chatlog li.user { background: #f6f8fd; }
.chatlog li.flag { border-color: var(--bad); background: #fff1ef; }
.chatlog small { color: var(--muted); font-weight: 700; }
.chatlog p { margin: 2px 0 0; white-space: pre-wrap; }

/* ---------- Ask Claude ---------- */
.askbtn {
  position: fixed; right: 22px; bottom: 22px; z-index: 30; display: inline-flex; gap: 6px; align-items: center;
  padding: 12px 20px; border-radius: 999px; border: 2px solid var(--ink); background: var(--ink); color: #fff;
  font: 700 1rem var(--display); cursor: pointer; box-shadow: 4px 4px 0 var(--accent);
}
.askbtn:hover { transform: translate(-1px, -1px); }
body.chat-open .askbtn { display: none; }
@media (max-width: 860px) { .askbtn { right: 14px; bottom: calc(92px + env(safe-area-inset-bottom)); padding: 10px 16px; } }

.chat {
  position: fixed; right: 18px; bottom: 18px; top: 18px; width: min(420px, calc(100vw - 24px)); z-index: 40;
  display: flex; flex-direction: column; background: var(--card); border: 2px solid var(--ink); border-radius: 22px; box-shadow: 8px 8px 0 var(--ink); overflow: hidden;
}
.chat[hidden] { display: none; }
@media (max-width: 860px) { .chat { inset: 8px 8px calc(8px + env(safe-area-inset-bottom)) 8px; width: auto; } }
.chat-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 16px 18px 12px; background: var(--ink); color: #fff; }
.chat-head h2 { font-size: 1.35rem; }
.chat-head small { color: #c8cfe6; }
.iconbtn { background: none; border: 2px solid #fff; color: #fff; border-radius: 10px; width: 34px; height: 34px; cursor: pointer; flex: none; }
.chat-ctx { padding: 8px 18px; background: #fff8e1; border-bottom: 2px solid var(--line); font-size: 0.9rem; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: grid; align-content: start; gap: 10px; }
.cm p { margin: 0; padding: 10px 13px; border-radius: 16px; max-width: 88%; line-height: 1.45; }
.cm.user { justify-self: end; }
.cm.user p { background: var(--accent); color: var(--accent-ink); border-radius: 16px 16px 4px 16px; }
.cm.assistant p { background: #f1f4fb; border: 2px solid var(--line); border-radius: 16px 16px 16px 4px; }
.typing p { display: flex; gap: 5px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; } .typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
.chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px 10px; }
.chipbtn { border: 2px solid var(--ink); background: #fff; border-radius: 999px; padding: 5px 11px; font-weight: 700; font-size: 0.85rem; cursor: pointer; }
.chipbtn:hover { background: var(--sun); }
.chat-form { display: flex; gap: 8px; padding: 12px 14px 14px; border-top: 2px solid var(--line); align-items: flex-end; }
.chat-form textarea { flex: 1; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: none; }
.chat-form textarea:focus { border-color: var(--ink); outline: none; }

/* ---------- Tour ---------- */
.tour-dim { position: fixed; inset: 0; background: rgba(26, 35, 64, 0.6); z-index: 70; }
.tour-spot { position: fixed; z-index: 70; border-radius: 18px; box-shadow: 0 0 0 4px var(--sun), 0 0 0 9999px rgba(26, 35, 64, 0.6); pointer-events: none; transition: all 0.25s; }
.tour-card { position: fixed; z-index: 71; background: var(--card); border: 3px solid var(--ink); border-radius: 20px; padding: 18px 20px; box-shadow: 6px 6px 0 var(--ink); }
.tour-card.center { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 24px)); }
.tour-card small { color: var(--muted); font-weight: 700; }
.tour-card h2 { font-size: 1.45rem; margin: 4px 0 8px; }
.tour-card .row { margin-top: 10px; }
.tour-dots { display: flex; gap: 5px; margin-top: 4px; }
.tour-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.tour-dots i.on { background: var(--accent); width: 20px; border-radius: 99px; }
body.touring .askbtn { z-index: 69; }

.tour-card .row .row { margin-top: 0; }
body.chat-open .toasts { right: 460px; }
@media (max-width: 860px) { body.chat-open .toasts { right: 12px; top: auto; bottom: 110px; } }

/* ---------- Sign-in and roles ---------- */
body.signed-out .side, body.signed-out .tabbar, body.signed-out .askbtn { display: none !important; }
body.signed-out .shell { grid-template-columns: 1fr; }
body.signed-out main { max-width: none; padding: 0; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(420px, 100%); background: var(--card); border: 2px solid var(--ink); border-radius: 26px; padding: 30px 28px; box-shadow: 8px 8px 0 var(--accent); }
.login-brand { display: flex; align-items: center; gap: 10px; font: 800 1.4rem var(--display); margin-bottom: 18px; }
.login-brand .brand-mark { width: 40px; height: 40px; }
.login-card h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: 16px; }
.login-form { display: grid; gap: 14px; }
.login-form .btn { width: 100%; margin-top: 4px; }
.login-help { margin: 16px 0 0; font-size: 0.92rem; }
body.role-student .nav-dad, body.role-student a[href="#/parents"] { display: none !important; }
body.role-parent .askbtn, body.role-parent [data-action="tour"], body.role-parent .askthis { display: none !important; }
