/* Kids Plans: tokens, fonts, reset, layout. Direction B (playful stickers). */

@font-face { font-family: "ABC Repro"; src: url("/assets/fonts/ABCRepro-Black.woff2") format("woff2"); font-weight: 900; font-style: normal; font-display: swap; }
@font-face { font-family: "ABC Whyte"; src: url("/assets/fonts/ABCWhyte-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "ABC Whyte"; src: url("/assets/fonts/ABCWhyte-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

/* Boot mark shown by index.html until main.js renders (here, not inline: the CSP blocks inline styles). */
html, body { background: #FFF8EC; }
.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot-mark { width: 64px; height: 64px; border: 2px solid #1D1A3A; border-radius: 18px; background: #FF8A5B; box-shadow: 4px 4px 0 #1D1A3A; animation: boot 1s ease-in-out infinite alternate; }
@keyframes boot { to { transform: rotate(-6deg) translate(-2px, -2px); box-shadow: 6px 6px 0 #1D1A3A; } }
@media (prefers-reduced-motion: reduce) { .boot-mark { animation: none; } }

:root {
  --ground: #FFF8EC;
  --paper: #FFFFFF;
  --ink: #1D1A3A;
  --ink-2: #4A4570;
  --ink-3: #9B97B8;
  --line: #E9E1D2;
  --orange: #FF8A5B;
  --lilac: #C3B5FF;
  --cyan: #8FE3F0;
  --yellow: #FFD166;
  --mint: #7BE0AD;
  --blue: #6C8CFF;
  --red: #E5484D;

  --display: "ABC Repro", "Arial Black", system-ui, sans-serif;
  --text: "ABC Whyte", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", sans-serif;

  --r-s: 14px;
  --r-m: 18px;
  --r-l: 24px;
  --bw: 2px;
  --shadow: 4px 4px 0 var(--ink);
  --shadow-s: 2px 2px 0 var(--ink);

  --gutter: 20px;
  --col: 520px;
  --tabbar-h: 64px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  --ease: cubic-bezier(.2, .8, .2, 1);
  --t-fast: 120ms;
  --t-med: 240ms;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--ground); }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/1.4 var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
a { color: var(--ink); }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 900; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Type ---------- */
.display { font-family: var(--display); font-weight: 900; letter-spacing: -0.01em; line-height: .95; }
.d-xl { font-size: clamp(40px, 12vw, 52px); }
.d-l { font-size: clamp(30px, 9vw, 38px); }
.d-m { font-size: 24px; line-height: 1.02; }
.d-s { font-size: 19px; line-height: 1.05; }
.eyebrow { font: 700 11px/1.2 var(--text); letter-spacing: .14em; text-transform: uppercase; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- App frame ---------- */
#app { min-height: 100dvh; }
.frame {
  max-width: var(--col);
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(var(--safe-t) + 18px) calc(var(--gutter) + var(--safe-r)) calc(var(--tabbar-h) + var(--safe-b) + 28px) calc(var(--gutter) + var(--safe-l));
  position: relative;
}
.frame.no-tabs { padding-bottom: calc(var(--safe-b) + 28px); }
@media (max-width: 374px) { :root { --gutter: 16px; } }
@media (min-width: 700px) {
  body { background: var(--ground) radial-gradient(circle at 1px 1px, rgba(29, 26, 58, .09) 1px, transparent 0) 0 0 / 22px 22px; }
  .frame { background: var(--ground); border-left: var(--bw) solid var(--ink); border-right: var(--bw) solid var(--ink); }
}

.screen > :empty { display: none; }
.screen { display: flex; flex-direction: column; gap: 22px; animation: screen-in var(--t-med) var(--ease); }
@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.topbar .titles { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rule { height: 0; border-top: var(--bw) solid var(--ink); margin: 4px 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center;
  background: var(--paper);
  border-top: var(--bw) solid var(--ink);
  padding: 6px calc(8px + var(--safe-r)) calc(6px + var(--safe-b)) calc(8px + var(--safe-l));
}
.tabbar-inner { width: 100%; max-width: var(--col); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 52px; border-radius: 12px; text-decoration: none; color: var(--ink-2);
  font: 400 12px/1 var(--text); letter-spacing: .02em;
  transition: background var(--t-fast) var(--ease), color var(--t-fast);
}
.tab svg { width: 22px; height: 22px; }
.tab[aria-current="page"] { background: var(--yellow); color: var(--ink); font-weight: 700; box-shadow: inset 0 0 0 var(--bw) var(--ink); }

/* ---------- Banners ---------- */
.offline-banner {
  position: sticky; top: 0; z-index: 40;
  background: var(--ink); color: var(--ground);
  font: 700 12px/1.2 var(--text); letter-spacing: .08em; text-transform: uppercase;
  text-align: center; padding: calc(var(--safe-t) + 8px) 16px 8px;
}
.mock-badge {
  position: fixed; z-index: 35; right: calc(10px + var(--safe-r)); bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px);
  background: var(--paper); border: var(--bw) solid var(--ink); border-radius: 999px; padding: 4px 10px;
  font: 700 10px/1.2 var(--text); letter-spacing: .14em; text-transform: uppercase; box-shadow: var(--shadow-s);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
