/* My Backpack Pal: teal + purple, big soft targets, no red anywhere. iPad first (kid), phone first (parent). */
:root {
  --teal: #14b8a6; --teal-deep: #0f766e; --teal-ink: #134e4a; --mint: #ccfbf1; --mint-soft: #f0fdfa;
  --purple: #8b5cf6; --purple-deep: #6d28d9; --lavender: #ede9fe; --lavender-soft: #f5f3ff;
  --sun: #fbbf24; --ink: #1e1b4b; --ink-soft: #5b5785; --card: #ffffff; --bar: rgba(255, 255, 255, 0.92);
  --radius: 24px; --shadow: 0 6px 20px rgba(76, 29, 149, 0.08), 0 1px 3px rgba(15, 118, 110, 0.08);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 20px; line-height: 1.4; color: var(--ink);
  background: linear-gradient(160deg, var(--mint-soft) 0%, var(--card) 45%, var(--lavender-soft) 100%) fixed;
  min-height: 100vh; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
a { color: var(--purple-deep); }
h1 { font-size: 32px; line-height: 1.2; margin: 8px 0 16px; letter-spacing: -0.01em; }
h2 { font-size: 22px; margin: 0 0 12px; color: var(--teal-deep); }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { font-size: max(16px, 1em); }
button { cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.center { text-align: center; }
.inline { display: inline; margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 4px solid var(--purple); outline-offset: 3px; }

/* ---------- kid layout ---------- */
.kid .wrap {
  max-width: 820px; margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) calc(130px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}
.kid.plain .wrap { padding-bottom: 40px; }
.kid .wrap.narrow { max-width: 560px; padding-top: max(48px, env(safe-area-inset-top)); }
.grownup-bar { text-align: right; margin: 0 0 8px; font-size: 16px; }
.hello h1 { font-size: 40px; margin-bottom: 4px; }
.hello .date { margin: 0 0 20px; color: var(--ink-soft); font-size: 22px; }
.back { display: inline-flex; align-items: center; min-height: 64px; font-size: 20px; text-decoration: none; font-weight: 600; }

/* bottom bar: Today · Week · + Add */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; gap: 12px; justify-content: center;
  padding: 10px max(16px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: var(--bar); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--lavender); box-shadow: 0 -4px 20px rgba(76, 29, 149, 0.06);
}
.tab {
  flex: 1; max-width: 220px; min-height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 20px; text-decoration: none; color: var(--ink-soft); font-weight: 700; font-size: 18px;
}
.tab-icon { font-size: 28px; line-height: 1; }
.tab.on { background: var(--mint); color: var(--teal-ink); }
.tab:last-child.on, .tab:last-child:hover { background: var(--lavender); color: var(--purple-deep); }

/* buttons */
.primary, .soft, .pbtn, .key, .toast-undo, .banner-btn { -webkit-appearance: none; appearance: none; border: 0; text-decoration: none; }
.primary {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 80px; margin: 12px 0;
  border-radius: 24px; background: linear-gradient(135deg, var(--teal) 0%, var(--purple) 100%); color: #fff;
  font-size: 24px; font-weight: 800; box-shadow: 0 8px 20px rgba(109, 40, 217, 0.25); transition: transform 0.12s ease;
}
.primary:active, .soft:active, .key:active, .tile:active, .circle:active { transform: scale(0.96); }
.soft {
  display: inline-flex; align-items: center; justify-content: center; min-height: 64px; padding: 0 24px; margin: 6px 0;
  border-radius: 20px; background: var(--lavender); color: var(--purple-deep); font-weight: 700; font-size: 20px;
}
.soft.wide { display: flex; width: 100%; }
.link { background: none; border: 0; color: var(--ink-soft); text-decoration: underline; min-height: 48px; padding: 0 8px; font-size: 16px; }

/* groups + cards */
.group { margin: 0 0 28px; }
.group h2 { font-size: 24px; margin-left: 4px; }
.empty { background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); font-size: 22px; margin: 0; }
.card {
  position: relative; display: flex; gap: 16px; align-items: flex-start; background: var(--card); border-radius: var(--radius);
  padding: 16px 20px 16px 12px; margin: 0 0 12px; box-shadow: var(--shadow); border-left: 8px solid var(--teal);
}
.card:nth-child(3n) { border-left-color: var(--purple); }
.card.is-done { opacity: 0.75; border-left-color: var(--mint); }
.card-body { flex: 1; min-width: 0; padding-top: 6px; }
.card-title { font-size: 28px; line-height: 1.2; margin: 0 0 8px; overflow-wrap: anywhere; color: var(--ink); }
.is-done .card-title { text-decoration: line-through; text-decoration-color: var(--teal); text-decoration-thickness: 3px; }
.kind-icon { margin-right: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.chip { display: inline-block; padding: 4px 14px; border-radius: 999px; background: var(--mint); color: var(--teal-ink); font-size: 17px; font-weight: 700; }
.chip.time, .chip.type { background: var(--lavender); color: var(--purple-deep); }
.chip.wait { background: #fef3c7; color: #92400e; }
.started { margin: 4px 0 0; font-weight: 700; color: var(--teal-deep); font-size: 20px; }

/* the done circle: 72px hit area */
.done-form { flex: 0 0 72px; margin: 0; }
.circle {
  position: relative; width: 72px; height: 72px; border-radius: 50%; border: 5px solid var(--teal); background: var(--card);
  color: #fff; font-size: 34px; font-weight: 900; display: grid; place-items: center; padding: 0;
  transition: background 0.2s ease, transform 0.2s ease;
}
.circle:hover { background: var(--mint); }
.circle.filled, .circle.popping { background: var(--teal); }
.circle.popping { animation: pop 0.45s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* steps */
.steps { list-style: none; padding: 0; margin: 4px 0 12px; }
.steps li { display: flex; align-items: center; gap: 12px; min-height: 64px; font-size: 20px; }
.steps li.step-done span:last-child { text-decoration: line-through; color: var(--ink-soft); }
.mini {
  width: 48px; height: 48px; min-width: 48px; border-radius: 50%; border: 4px solid var(--purple); background: var(--card); padding: 0;
  display: inline-grid; place-items: center; color: #fff; font-weight: 900; margin: 8px;
}
.mini.filled { background: var(--purple); }

/* drafts banner on Today */
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 24px; padding: 16px 20px;
  border-radius: var(--radius); background: linear-gradient(135deg, var(--lavender) 0%, var(--mint) 100%); color: var(--ink);
  text-decoration: none; font-size: 22px; font-weight: 700; box-shadow: var(--shadow);
}
.banner-btn { display: inline-flex; align-items: center; min-height: 64px; padding: 0 24px; border-radius: 20px; background: var(--purple); color: #fff; }

/* Done group (collapsed) */
.done-group summary {
  list-style: none; cursor: pointer; min-height: 72px; display: flex; align-items: center; padding: 0 20px; border-radius: var(--radius);
  background: var(--mint); color: var(--teal-ink); font-weight: 800; font-size: 22px; margin-bottom: 12px;
}
.done-group summary::-webkit-details-marker { display: none; }
.dump-link { text-align: center; margin: 24px 0; }
.dump-link a { display: inline-flex; align-items: center; min-height: 64px; padding: 0 28px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); text-decoration: none; font-weight: 800; }

/* toast + confetti */
.toast {
  position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 16px; padding: 12px 12px 12px 24px; border-radius: 999px; max-width: calc(100% - 32px);
  background: var(--ink); color: #fff; font-size: 22px; font-weight: 700; box-shadow: 0 12px 30px rgba(30, 27, 75, 0.3);
  animation: rise 0.35s ease;
}
.toast.hide { opacity: 0; transform: translate(-50%, 20px); transition: opacity 0.4s ease, transform 0.4s ease; pointer-events: none; }
.toast-undo { min-height: 64px; padding: 0 20px; border-radius: 999px; background: var(--sun); color: var(--ink); font-weight: 800; font-size: 18px; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }
.confetti { position: fixed; z-index: 30; width: 12px; height: 16px; border-radius: 3px; pointer-events: none; animation: burst 0.9s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
.confetti.c0 { background: var(--teal); } .confetti.c1 { background: var(--purple); } .confetti.c2 { background: var(--sun); } .confetti.c3 { background: #38bdf8; }
@keyframes burst {
  from { transform: translate(0, 0) rotate(0); opacity: 1; }
  to { transform: translate(var(--dx, 0), var(--dy, 0)) rotate(var(--rot, 360deg)); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } .circle.popping, .toast { animation: none; } }

/* week */
.week-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.week-head h1 { margin: 0; text-align: center; font-size: 28px; }
.arrow {
  width: 80px; height: 80px; border-radius: 50%; display: grid; place-items: center; background: var(--card); box-shadow: var(--shadow);
  text-decoration: none; font-size: 30px; color: var(--purple-deep);
}
.week { display: grid; gap: 12px; }
.day {
  display: flex; gap: 16px; align-items: center; min-height: 88px; padding: 12px 20px; border-radius: var(--radius); background: var(--card);
  box-shadow: var(--shadow); text-decoration: none; color: var(--ink);
}
.day.is-today { background: linear-gradient(135deg, var(--mint) 0%, var(--lavender) 100%); outline: 3px solid var(--teal); }
.day-name { flex: 0 0 90px; font-size: 18px; color: var(--ink-soft); font-weight: 700; display: flex; flex-direction: column; }
.day-name b { font-size: 30px; color: var(--ink); }
.day-chips { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.day-chips .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.faded { opacity: 0.55; text-decoration: line-through; }
.more { font-size: 17px; font-weight: 700; color: var(--purple-deep); align-self: center; }
@media (orientation: landscape) and (min-width: 900px) {
  .kid .wrap { max-width: 1180px; }
  .week { grid-template-columns: repeat(7, 1fr); }
  .day { flex-direction: column; align-items: stretch; min-height: 260px; padding: 14px; }
  .day-name { flex: 0 0 auto; }
  .day-chips { flex-direction: column; flex-wrap: nowrap; }
  .day-chips .chip { white-space: normal; }
}

/* add */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 16px; }
.tile {
  min-height: 180px; border-radius: 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; font-size: 28px; font-weight: 800; color: var(--ink); background: var(--card); box-shadow: var(--shadow); transition: transform 0.12s ease;
}
.tile-icon { font-size: 64px; line-height: 1; }
.tile-assignment { background: linear-gradient(160deg, var(--card) 0%, var(--mint) 100%); }
.tile-test { background: linear-gradient(160deg, var(--card) 0%, var(--lavender) 100%); }
.tile-event { background: linear-gradient(160deg, var(--card) 0%, #e0f2fe 100%); }
.tile-note { background: linear-gradient(160deg, var(--card) 0%, #fef9c3 100%); }
@media (min-width: 900px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.yay {
  margin: 0 0 20px; padding: 20px 24px; border-radius: var(--radius); background: var(--mint); color: var(--teal-ink);
  font-size: 24px; font-weight: 800; text-align: center;
}
.notice {
  margin: 0 0 16px; padding: 16px 20px; border-radius: 20px; background: var(--lavender); color: var(--purple-deep);
  border: 2px solid #c4b5fd; font-weight: 700;
}
.big-form fieldset { border: 0; padding: 0; margin: 20px 0 0; }
.q, .big-form legend { display: block; font-size: 24px; font-weight: 800; margin-bottom: 10px; color: var(--teal-deep); }
.field { display: block; }
.field input:not([type=radio]):not([type=checkbox]), .field textarea {
  display: block; width: 100%; min-height: 72px; padding: 14px 20px; border-radius: 20px; border: 3px solid var(--mint);
  background: var(--card); font-size: 24px; outline: none; transition: border-color 0.15s ease;
}
.field textarea { min-height: 200px; line-height: 1.4; }
.field input:focus, .field textarea:focus { border-color: var(--purple); }
.field.small { margin-top: 14px; }
.field.small span { display: block; font-size: 18px; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; }
.field.small input { min-height: 64px; font-size: 20px; }
.hint { margin: 8px 4px 0; color: var(--ink-soft); font-size: 18px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 12px; }
.pick { position: relative; }
.pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pick span {
  display: inline-flex; align-items: center; min-height: 64px; padding: 0 22px; border-radius: 999px; background: var(--card);
  border: 3px solid var(--mint); font-weight: 700; font-size: 20px; cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease;
}
.pick input:checked + span { background: var(--teal); border-color: var(--teal); color: #fff; }
.pick input[type=checkbox]:checked + span { background: var(--purple); border-color: var(--purple); }
.pick input:focus-visible + span { outline: 4px solid var(--purple); outline-offset: 3px; }
.pick.small span { min-height: 48px; padding: 0 14px; font-size: 16px; }
.repeat { margin: 20px 0 8px; }
.repeat summary { min-height: 64px; display: inline-flex; align-items: center; cursor: pointer; font-size: 22px; font-weight: 800; color: var(--purple-deep); }
.repeat .chip-row { margin-top: 8px; }

/* drafts */
.draft { background: var(--card); border-radius: var(--radius); padding: 20px 24px; margin: 0 0 16px; box-shadow: var(--shadow); border-top: 8px solid var(--purple); }
.draft-title { font-size: 28px; color: var(--ink); margin: 0 0 10px; overflow-wrap: anywhere; }
.from { color: var(--ink-soft); margin: 0 0 8px; font-size: 18px; }
.draft-actions { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; align-items: center; }
.draft-actions .inline { display: block; }
.draft-actions .primary, .draft-actions .soft { width: 100%; margin: 0; }
.draft-actions .primary { min-height: 72px; font-size: 22px; }
@media (max-width: 600px) { .draft-actions { grid-template-columns: 1fr; } }

/* pair + number pad */
.pair-form { max-width: 380px; margin: 0 auto; }
.code {
  display: block; width: 100%; text-align: center; font-size: 44px; letter-spacing: 0.4em; font-weight: 800; min-height: 88px;
  border-radius: 24px; border: 4px solid var(--mint); background: var(--card); margin-bottom: 20px; padding: 0 0 0 0.4em;
}
.keypad { display: none; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.js .keypad { display: grid; }
.js .nojs-only { display: none; }
.key { min-height: 80px; border-radius: 24px; background: var(--card); box-shadow: var(--shadow); font-size: 34px; font-weight: 800; color: var(--ink); }
.key-soft { background: var(--lavender); color: var(--purple-deep); }
.key-go { background: linear-gradient(135deg, var(--teal) 0%, var(--purple) 100%); color: #fff; font-size: 26px; }

/* setup (notifications) */
.setup { text-align: center; max-width: 600px; margin: 24px auto 0; }
.setup h1 { font-size: 36px; }
.big { font-size: 24px; font-weight: 700; color: var(--teal-deep); margin: 0 0 16px; }
.safe { background: var(--lavender); border-radius: 20px; padding: 14px 20px; font-size: 20px; color: var(--purple-deep); font-weight: 700; margin: 0 0 20px; }

/* install steps (login) */
.install { list-style: none; padding: 0; margin: 0 0 28px; display: grid; gap: 12px; }
.install li { display: flex; align-items: center; gap: 16px; background: var(--card); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); font-size: 22px; }
.num { flex: 0 0 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--teal), var(--purple)); color: #fff; font-weight: 800; }
.grownups { font-size: 18px; background: rgba(255, 255, 255, 0.7); border-radius: 20px; padding: 8px 16px; }
.grownups summary { min-height: 56px; display: flex; align-items: center; cursor: pointer; color: var(--ink-soft); font-weight: 700; }
.small-form .primary { min-height: 64px; font-size: 20px; }

/* ---------- parent (plain, phone first) ---------- */
.parent { font-size: 17px; background: #f8fafc; }
.ptop {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px; background: #fff; border-bottom: 1px solid #e2e8f0;
}
.brand { font-weight: 800; color: var(--teal-deep); text-decoration: none; font-size: 20px; }
.ptop nav { display: flex; gap: 4px; flex-wrap: wrap; }
.ptop nav a { padding: 10px 12px; border-radius: 10px; text-decoration: none; font-weight: 600; }
.ptop nav a:hover { background: var(--lavender-soft); }
.pwrap { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); }
.pcard { background: #fff; border-radius: 16px; padding: 16px 18px; margin: 0 0 16px; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08); }
.pcard h2 { font-size: 19px; }
.pcard h3 { font-size: 16px; margin: 14px 0 6px; color: var(--ink-soft); }
.plist { list-style: none; padding: 0; margin: 0; }
.plist li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid #f1f5f9; flex-wrap: wrap; }
.plist li:first-child { border-top: 0; }
.muted { color: #64748b; }
.pbtn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; margin: 2px; border-radius: 12px;
  background: var(--lavender-soft); color: var(--purple-deep); font-weight: 700; font-size: 16px; border: 1px solid #ddd6fe; text-decoration: none;
}
.pbtn.primary { width: auto; min-height: 44px; margin: 2px; font-size: 16px; border: 0; background: var(--teal-deep); color: #fff; box-shadow: none; display: inline-flex; }
.pbtn.big { min-height: 52px; padding: 0 22px; }
.flag { border-left: 5px solid var(--purple); padding-left: 12px !important; }
.flag.sev-high { border-left-color: var(--purple-deep); background: var(--lavender-soft); }
.flag.sev-low { border-left-color: #c4b5fd; }
.tag { display: inline-block; font-size: 13px; padding: 1px 8px; border-radius: 999px; background: var(--lavender); color: var(--purple-deep); text-transform: uppercase; font-weight: 700; }
.flag small { display: block; }
.pform { display: grid; gap: 12px; }
.pform label { display: grid; gap: 4px; font-weight: 600; }
.pform input:not([type=checkbox]), .pform select, .pform textarea { padding: 10px 12px; border-radius: 10px; border: 1px solid #cbd5e1; background: #fff; min-height: 44px; }
.pform fieldset { border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; }
.pform .check, label.check { display: flex; align-items: center; gap: 10px; font-weight: 600; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--teal-deep); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row input { padding: 10px 12px; border-radius: 10px; border: 1px solid #cbd5e1; min-height: 44px; }
.series { border-top: 1px solid #f1f5f9; padding: 8px 0; }
.series summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; font-weight: 600; }
.series .pform { margin: 8px 0; }
.paircode { font-size: 48px; font-weight: 800; letter-spacing: 0.25em; color: var(--purple-deep); margin: 8px 0; font-variant-numeric: tabular-nums; }
.token { display: block; padding: 10px; background: var(--lavender-soft); border-radius: 10px; overflow-wrap: anywhere; user-select: all; }
.parent .notice { font-size: 16px; }
/* review + consent (parent) */
.review h1 { font-size: 26px; margin: 8px 0; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 0 0 16px; }
.filters label { display: grid; gap: 4px; font-weight: 600; flex: 1 1 140px; }
.filters select, .filters input { padding: 10px 12px; border-radius: 10px; border: 1px solid #cbd5e1; background: #fff; min-height: 44px; font: inherit; }
.timeline, .transcript, .cards { list-style: none; padding: 0; margin: 0; }
.entry, .msg { background: #fff; border-radius: 12px; padding: 10px 14px; margin: 0 0 10px; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08); }
.entry p, .msg p { margin: 4px 0; }
.entry-ai, .msg-assistant { border-left: 5px solid #c4b5fd; }
.msg-user { border-left: 5px solid var(--teal); }
.when, .who, .chan { font-size: 14px; color: var(--ink-soft); }
.detail, .content { overflow-wrap: anywhere; }
.content { white-space: pre-wrap; }
.pager { display: flex; justify-content: space-between; gap: 10px; margin: 16px 0; }
.pager a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; font-weight: 600; }
.consent { max-width: 560px; }
.consent h1 { font-size: 24px; }
.consent-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.consent-actions .pbtn { min-height: 48px; flex: 1 1 140px; }

/* ---------- spelling practice (kid) ---------- */
.spell { display: flex; flex-direction: column; align-items: stretch; gap: 16px; text-align: center; }
.spell-count { color: var(--ink-soft); font-size: 18px; font-weight: 700; }
.spell-say { width: 100%; min-height: 88px; font-size: 26px; }
.spell-form { margin-top: 8px; display: grid; gap: 12px; }
.spell-input {
  text-align: center; font-size: 30px; letter-spacing: 2px; min-height: 72px; width: 100%;
  border-radius: 18px; border: 2px solid var(--lavender); background: var(--card); color: var(--ink); padding: 8px 12px; font-family: inherit;
}
.spell-input:focus { outline: 3px solid var(--teal); border-color: var(--teal); }
.spell-feedback { font-size: 22px; font-weight: 700; color: var(--teal-deep); min-height: 1.5em; }
.spell-show {
  font-size: 30px; font-weight: 800; color: var(--purple-deep); letter-spacing: 3px;
  background: var(--lavender-soft); border-radius: 18px; padding: 12px 16px; overflow-wrap: anywhere;
}

/* ---------- homework coach ---------- */
.coach-form input[type="file"] { font-size: 18px; max-width: 100%; }
.coach-preview { display: block; max-width: 100%; max-height: 320px; margin: 12px 0; border-radius: var(--radius); box-shadow: var(--shadow); }
.coach-preview[hidden] { display: none; }
.chat { display: flex; flex-direction: column; gap: 12px; margin: 0 0 20px; }
.bubble { max-width: 85%; margin: 0; padding: 14px 18px; border-radius: var(--radius); box-shadow: var(--shadow); white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: var(--mint); color: var(--teal-ink); border-bottom-right-radius: 8px; }
.bubble.coach { align-self: flex-start; background: var(--lavender); color: var(--ink); border-bottom-left-radius: 8px; }
.coach-links { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- joy: star jar, check-ins, badges, project party (kid only) ---------- */
.joy { margin: 0 0 24px; }
.jar-card {
  display: flex; align-items: center; gap: 20px; padding: 16px 20px; border-radius: var(--radius); background: var(--card);
  box-shadow: var(--shadow); text-decoration: none; color: var(--ink); min-height: 120px;
}
.jar {
  flex: 0 0 96px; height: 112px; display: flex; flex-wrap: wrap-reverse; align-content: flex-start; justify-content: center; gap: 1px;
  padding: 6px; overflow: hidden; border: 4px solid var(--teal); border-top-width: 10px; border-radius: 14px 14px 32px 32px; background: var(--mint-soft);
}
.jar i { font-style: normal; font-size: 15px; line-height: 1; animation: drop 0.5s ease both; }
@keyframes drop { from { transform: translateY(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
.jar-msg { font-size: 24px; font-weight: 800; }
.checkins { margin: 12px 4px 0; font-size: 20px; font-weight: 700; color: var(--teal-deep); }
.checkins b { color: var(--purple-deep); }
.new-badge { display: block; margin: 12px 0 0; text-decoration: none; }
.badges { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 10px; border-radius: var(--radius); background: var(--card);
  box-shadow: var(--shadow); text-align: center; font-weight: 800; font-size: 18px;
}
.badge-icon { font-size: 44px; line-height: 1; }
.badge.soon { opacity: 0.5; box-shadow: none; font-weight: 600; color: var(--ink-soft); }
.swatch { display: inline-block; width: 24px; height: 24px; margin-right: 10px; border-radius: 50%; border: 2px solid var(--card); }
.swatch-teal { background: linear-gradient(135deg, #14b8a6, #8b5cf6); }
.swatch-ocean { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.swatch-sunset { background: linear-gradient(135deg, #f59e0b, #ec4899); }
.swatch-forest { background: linear-gradient(135deg, #22c55e, #65a30d); }
.swatch-galaxy { background: linear-gradient(135deg, #1e1b4b, #a78bfa); }
.celebrate {
  position: fixed; left: 50%; top: 30%; z-index: 25; transform: translate(-50%, -50%); width: min(90%, 520px); padding: 28px 24px;
  border-radius: 32px; background: linear-gradient(135deg, var(--mint) 0%, var(--lavender) 100%); box-shadow: 0 20px 50px rgba(30, 27, 75, 0.25);
  text-align: center; font-size: 30px; font-weight: 900; color: var(--ink); pointer-events: none; animation: party 4.5s ease forwards;
}
.celebrate p { margin: 0; position: relative; }
@keyframes party { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); } 10%, 80% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); } }
.burst { position: absolute; left: 50%; top: 50%; }
.burst i { position: absolute; width: 14px; height: 18px; border-radius: 3px; background: var(--teal); animation: fly 1.2s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
.burst i:nth-child(3n+1) { background: var(--purple); } .burst i:nth-child(3n+2) { background: var(--sun); }
.burst i:nth-child(1) { --dx: 220px; --dy: -120px; } .burst i:nth-child(2) { --dx: -220px; --dy: -110px; } .burst i:nth-child(3) { --dx: 160px; --dy: 140px; }
.burst i:nth-child(4) { --dx: -170px; --dy: 150px; } .burst i:nth-child(5) { --dx: 40px; --dy: -200px; } .burst i:nth-child(6) { --dx: -60px; --dy: 190px; }
.burst i:nth-child(7) { --dx: 260px; --dy: 20px; } .burst i:nth-child(8) { --dx: -260px; --dy: -10px; } .burst i:nth-child(9) { --dx: 120px; --dy: -190px; }
.burst i:nth-child(10) { --dx: -130px; --dy: -180px; } .burst i:nth-child(11) { --dx: 200px; --dy: 170px; } .burst i:nth-child(12) { --dx: -210px; --dy: 80px; }
@keyframes fly { from { transform: translate(0, 0) rotate(0); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) rotate(540deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .jar i, .burst i { animation: none; } .burst { display: none; } .celebrate { animation: fade 4.5s linear forwards; } }
@keyframes fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- her colors: body.kid.theme-<name> (teal is the default above) ---------- */
.kid.theme-ocean {
  --teal: #0ea5e9; --teal-deep: #0369a1; --teal-ink: #0c4a6e; --mint: #e0f2fe; --mint-soft: #f0f9ff;
  --purple: #6366f1; --purple-deep: #4338ca; --lavender: #e0e7ff; --lavender-soft: #eef2ff;
}
.kid.theme-sunset {
  --teal: #f59e0b; --teal-deep: #b45309; --teal-ink: #78350f; --mint: #ffedd5; --mint-soft: #fff7ed;
  --purple: #ec4899; --purple-deep: #be185d; --lavender: #fce7f3; --lavender-soft: #fdf2f8;
}
.kid.theme-forest {
  --teal: #22c55e; --teal-deep: #15803d; --teal-ink: #14532d; --mint: #dcfce7; --mint-soft: #f0fdf4;
  --purple: #65a30d; --purple-deep: #3f6212; --lavender: #ecfccb; --lavender-soft: #f7fee7;
}
.kid.theme-galaxy {
  color-scheme: dark;
  --teal: #0d9488; --teal-deep: #5eead4; --teal-ink: #ccfbf1; --mint: #134e4a; --mint-soft: #0f0c29;
  --purple: #a78bfa; --purple-deep: #ddd6fe; --lavender: #3b3470; --lavender-soft: #1a1640;
  --ink: #ede9fe; --ink-soft: #c4b5fd; --card: #272356; --bar: rgba(30, 27, 75, 0.94);
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.kid.theme-galaxy .toast { background: #4c1d95; }
.kid.theme-galaxy .toast-undo { color: #1e1b4b; }
.kid.theme-galaxy .tile-event, .kid.theme-galaxy .tile-note { background: linear-gradient(160deg, var(--card) 0%, var(--lavender) 100%); }
.kid.theme-galaxy .chip.wait { background: #78350f; color: #fef3c7; }

.pairqr{display:block;width:240px;height:240px;margin:12px auto;image-rendering:pixelated;background:#fff;border-radius:12px}
