/* Spark — styles. Mobile-first, warm, calm. Light + dark aware. */
:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --ink: #1f2320;
  --muted: #6b716c;
  --line: rgba(0, 0, 0, 0.08);
  --brand: #2f6f4f;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.05);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --card: #1e2226;
    --ink: #eef1ee;
    --muted: #9aa2a0;
    --line: rgba(255, 255, 255, 0.09);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.4;
}
#app { max-width: 640px; margin: 0 auto; padding: 0 16px calc(96px + var(--safe-b)); }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
.muted { color: var(--muted); font-size: 13px; }
.link { color: var(--brand); font-weight: 600; font-size: 14px; padding: 0; }
.foot-hint { text-align: center; color: var(--muted); font-size: 13px; padding: 18px 0 8px; }

/* hero */
.hero { padding: 26px 4px 12px; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.spark-dot {
  width: 20px; height: 20px; border-radius: 6px;
  background: linear-gradient(135deg, #ffcf5c, #ff8a3d 55%, var(--brand));
  box-shadow: 0 0 0 4px rgba(255, 176, 60, 0.16);
}
.hero-sub { color: var(--muted); font-size: 15px; margin-top: 6px; max-width: 34ch; }
.page-hero { padding: 24px 4px 6px; }
.page-hero h1 { font-size: 26px; }
.page-hero p { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

/* week strip */
.weekstrip {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 8px; margin: 8px 0 4px; box-shadow: var(--shadow);
}
.wk-btn { width: 40px; height: 40px; border-radius: 10px; font-size: 22px; color: var(--brand); }
.wk-btn:active { background: var(--line); }
.wk-label { flex: 1; text-align: center; }
.wk-main { font-weight: 700; font-size: 15px; }
.wk-sub { font-size: 12px; color: var(--muted); }

/* sections */
.section { margin-top: 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 10px; }
.section-head h2 { font-size: 16px; }

/* contexts strip */
.ctx-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.ctx-strip.empty { color: var(--muted); font-size: 14px; background: var(--card); border: 1px dashed var(--line); border-radius: 12px; padding: 12px; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow); }

/* kid cards */
.kid-list { display: flex; flex-direction: column; gap: 12px; }
.kid-card {
  display: flex; align-items: center; gap: 14px; text-align: left; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kid-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--kid); }
.kid-card:active { transform: scale(0.995); }
.kid-emoji {
  width: 52px; height: 52px; flex: none; border-radius: 14px; display: grid; place-items: center;
  font-size: 26px; background: var(--kid-bg);
}
.kid-main { flex: 1; min-width: 0; }
.kid-name { font-weight: 700; font-size: 18px; }
.kid-meta { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.kid-tags { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--line); border-radius: 6px; padding: 3px 7px; }
.tag.tailored { color: var(--kid, var(--brand)); background: color-mix(in srgb, var(--kid, var(--brand)) 12%, transparent); }
.kid-ring { position: relative; flex: none; display: grid; place-items: center; }
.kid-count { position: absolute; bottom: -14px; font-size: 11px; color: var(--muted); width: 100%; text-align: center; }
.ring-t { font-size: 11px; font-weight: 700; fill: var(--ink); }

/* child hero */
.child-hero { padding: 16px; margin: 12px -16px 0; background: var(--kid-bg); border-bottom: 3px solid var(--kid); }
.back { color: var(--kid); font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.child-hero-row { display: flex; align-items: center; gap: 14px; }
.child-emoji { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 30px; background: rgba(255, 255, 255, 0.6); }
@media (prefers-color-scheme: dark) { .child-hero { color: #10130f; } .child-hero .back { color: #10130f; } .child-emoji { background: rgba(255,255,255,0.75); } .child-fw, .child-meta { color: #2a2f28 !important; } }
.child-name { font-size: 22px; font-weight: 800; }
.child-meta { font-size: 13px; color: #3a413a; }
.child-fw { font-size: 12px; color: #4a524a; margin-top: 2px; }
.child-ring { margin-left: auto; }

/* spotlight */
.spotlight { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 14px; padding: 14px; margin-top: 14px; box-shadow: var(--shadow); }
.spot-head { font-weight: 700; font-size: 15px; }
.spot-head span { color: var(--muted); font-weight: 600; }
.spot-list { margin: 10px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.spot-note { color: var(--muted); font-size: 12px; margin-top: 8px; }

/* areas */
.areas { display: flex; flex-direction: column; gap: 10px; }
.area { display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); }
.area.done { opacity: 0.62; }
.check {
  width: 28px; height: 28px; flex: none; border-radius: 9px; border: 2px solid var(--kid, var(--brand));
  color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 15px; margin-top: 2px;
}
.area.done .check { background: var(--kid, var(--brand)); }
.area-body { flex: 1; min-width: 0; }
.area-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.area-name { font-weight: 700; font-size: 15px; }
.strand { font-size: 12px; color: var(--muted); }
.activity { font-size: 14.5px; margin-top: 5px; }
.tailored-by { margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--kid, var(--brand)); background: color-mix(in srgb, var(--kid, var(--brand)) 10%, transparent); display: inline-block; padding: 4px 9px; border-radius: 8px; }

/* contexts page */
.ctx-rows { display: flex; flex-direction: column; gap: 12px; }
.ctx-row { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
.ctx-row.on { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.ctx-emoji { font-size: 26px; }
.ctx-info { flex: 1; }
.ctx-label { font-weight: 700; font-size: 15px; }
.ctx-blurb { font-size: 13px; color: var(--muted); margin-top: 2px; }
.ctx-scope { font-size: 11px; color: var(--muted); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.race { display: block; font-size: 12px; color: var(--muted); margin-top: 10px; }
.race input { display: block; margin-top: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--ink); }
.toggle { width: 48px; height: 28px; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background 0.15s; }
.toggle span { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left 0.15s; }
.toggle.on { background: var(--brand); }
.toggle.on span { left: 23px; }

/* map */
.pickrow { display: flex; gap: 8px; margin: 12px 0; }
.pick { flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 10px; font-weight: 600; font-size: 13px; background: var(--card); }
.pick.on { border-color: var(--kid); color: var(--kid); background: color-mix(in srgb, var(--kid) 8%, var(--card)); }
.mapweeks { display: flex; flex-direction: column; gap: 10px; }
.mapweek { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: var(--shadow); }
.mw-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.mw-n { font-weight: 800; font-size: 13px; color: var(--brand); }
.mw-date { font-size: 12px; color: var(--muted); }
.mw-foci { display: flex; flex-direction: column; gap: 4px; }
.mf { font-size: 13px; }
.mf b { font-weight: 700; margin-right: 4px; }

/* cards / more */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.card h3 { font-size: 16px; margin-bottom: 6px; }
.card p { font-size: 14px; color: var(--muted); margin: 0 0 12px; }
.card.danger { border-color: color-mix(in srgb, #d14343 30%, var(--line)); }
.field { display: block; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.field input, .card input[type="url"] { display: block; width: 100%; margin-top: 6px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font-size: 15px; }
.btn { background: var(--brand); color: #fff; font-weight: 700; padding: 11px 16px; border-radius: 11px; font-size: 14px; }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn.danger { background: #d14343; }
.btn:disabled { opacity: 0.4; }

/* tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + var(--safe-b));
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 14px; border-radius: 12px; color: var(--muted); }
.tab.on { color: var(--brand); }
.ti { font-size: 20px; }
.tl { font-size: 11px; font-weight: 600; }

/* worksheets */
.sheet-cta {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  margin-top: 14px; padding: 14px;
  background: linear-gradient(120deg, var(--kid-bg), var(--card) 70%);
  border: 2px solid var(--kid); border-radius: var(--radius); box-shadow: var(--shadow);
}
.sheet-cta:active { transform: scale(0.99); }
.sheet-cta-icon { font-size: 26px; width: 46px; height: 46px; flex: none; display: grid; place-items: center; background: var(--card); border-radius: 13px; box-shadow: var(--shadow); }
.sheet-cta-main { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.sheet-cta-title { font-weight: 800; font-size: 16px; }
.sheet-cta-sub { font-size: 12.5px; color: var(--muted); }
.sheet-cta-go { font-size: 24px; color: var(--kid); font-weight: 700; }

.ws-root { min-height: 70vh; }
.ws-head { padding: 16px 4px 6px; }
.ws-dots { display: flex; gap: 6px; margin: 12px 0 14px; }
.ws-dot {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: var(--line); display: grid; place-items: center;
  font-size: 13px; font-weight: 800; color: #fff; transition: all 0.2s;
}
.ws-dot.now { outline: 3px solid color-mix(in srgb, var(--kid) 45%, transparent); background: var(--kid); }
.ws-dot.done { background: color-mix(in srgb, var(--kid) 55%, var(--line)); }
.ws-dot.star { background: #f2b01e; }
.ws-area { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--kid); }
.ws-prompt { font-size: 21px; font-weight: 800; margin-top: 4px; line-height: 1.25; }
.ws-body { padding: 10px 0 20px; }
.ws-note { text-align: center; color: var(--muted); font-size: 14px; margin-top: 14px; }

.ws-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; margin-top: 14px; }
.ws-opt {
  background: var(--card); border: 2px solid var(--line); border-radius: 18px;
  min-height: 84px; font-size: 34px; font-weight: 800; box-shadow: var(--shadow);
  display: grid; place-items: center; padding: 12px; transition: transform 0.1s;
  word-break: break-word;
}
.ws-opt:active { transform: scale(0.97); }
.ws-opt.right { border-color: #2f9e57; background: color-mix(in srgb, #2f9e57 14%, var(--card)); }
.ws-opt.ws-big { font-size: 58px; }
.ws-opt.ws-small { font-size: 22px; }

.ws-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.ws-cell {
  position: relative; background: var(--card); border: 2px solid var(--line);
  border-radius: 18px; min-height: 84px; font-size: 36px; font-weight: 800;
  display: grid; place-items: center; box-shadow: var(--shadow);
}
.ws-cell.hit { border-color: #2f9e57; background: color-mix(in srgb, #2f9e57 16%, var(--card)); }
.ws-n {
  position: absolute; top: -8px; right: -6px; width: 28px; height: 28px;
  background: #2f9e57; color: #fff; border-radius: 50%; display: grid; place-items: center;
  font-size: 15px; font-weight: 800; box-shadow: var(--shadow);
}

.ws-word { display: flex; gap: 8px; justify-content: center; margin: 16px 0 20px; }
.ws-slot {
  width: 52px; height: 60px; border-radius: 12px; border: 2px dashed var(--line);
  display: grid; place-items: center; font-size: 30px; font-weight: 800;
  background: var(--card);
}
.ws-slot.fill { border-style: solid; border-color: #2f9e57; background: color-mix(in srgb, #2f9e57 12%, var(--card)); }
.ws-tiles { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.ws-tile {
  width: 58px; height: 58px; border-radius: 14px; background: var(--card);
  border: 2px solid var(--line); font-size: 26px; font-weight: 800; box-shadow: var(--shadow);
}
.ws-tile.used { opacity: 0.25; pointer-events: none; }

.ws-sort-item {
  text-align: center; font-size: 72px; margin: 18px 0 6px;
}
.ws-sort-name { font-size: 15px; font-weight: 700; color: var(--muted); margin-top: 2px; }
.ws-buckets { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.ws-bucket {
  min-height: 84px; border-radius: 18px; background: var(--card);
  border: 2px solid var(--line); font-size: 19px; font-weight: 800; box-shadow: var(--shadow);
}
.ws-bucket.right { border-color: #2f9e57; }

.ws-swarm { font-size: 40px; text-align: center; line-height: 1.35; margin-top: 8px; letter-spacing: 4px; }
.ws-blank { display: inline-grid; place-items: center; min-width: 42px; height: 46px; border-radius: 10px; border: 2px dashed var(--muted); font-size: 24px; vertical-align: middle; }
.ws-sum { font-size: 32px; font-weight: 800; text-align: center; margin-top: 10px; font-variant-numeric: tabular-nums; }
.ws-clock { width: 150px; display: block; margin: 8px auto 0; color: var(--ink); }

.pop { animation: ws-pop 0.5s ease; }
@keyframes ws-pop { 30% { transform: scale(1.12); } 60% { transform: scale(0.96); } }
.shake { animation: ws-shake 0.35s ease; }
@keyframes ws-shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }

.ws-end { text-align: center; padding: 60px 8px 20px; position: relative; }
.ws-end-emoji { font-size: 60px; }
.ws-end h2 { font-size: 26px; margin-top: 8px; }
.ws-stars { font-size: 34px; margin-top: 12px; letter-spacing: 4px; }
.ws-end-sub { color: var(--muted); font-weight: 600; margin-top: 6px; }
.ws-end-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }
.ws-burst { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.ws-confetti {
  position: absolute; top: -30px; left: calc((var(--i) * 7.1%) + 2%);
  font-size: 22px; animation: ws-fall 1.6s ease-in forwards;
  animation-delay: calc(var(--i) * 55ms);
}
@keyframes ws-fall {
  0% { transform: translateY(0) rotate(0); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateY(72vh) rotate(300deg); opacity: 0; }
}

/* toast */
#toast { position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translateX(-50%) translateY(10px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 40; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
