/* Layout: one phone-width column like a fridge chore chart; coins are gold, kids each get
   their own magnet color, grown-up screens are calmer and denser. */
:root {
  --paper: #f2f5fb;
  --card: #ffffff;
  --ink: #1b2340;
  --ink-soft: #5a6383;
  --line: #dde3f0;
  --gold: #f5b301;
  --gold-deep: #b07d00;
  --berry: #e8467c;
  --go: #1f9d55;
  --go-ink: #ffffff;
  --wait: #ffb020;
  --warn-bg: #fff1e6;
  --warn-ink: #9a3412;
  --danger: #d6334d;
  --sky: #2f6fed;
  --shadow: 0 1px 0 rgba(27, 35, 64, 0.06), 0 6px 18px rgba(27, 35, 64, 0.07);
  --display: 'Baloo 2', 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
  --body: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #11162a;
    --card: #1b2240;
    --ink: #eef1fb;
    --ink-soft: #a6aecb;
    --line: #2c3558;
    --gold: #ffc533;
    --gold-deep: #ffd666;
    --berry: #ff6b98;
    --go: #2fbf6e;
    --go-ink: #0b1a12;
    --wait: #ffbf47;
    --warn-bg: #3a2414;
    --warn-ink: #ffcfa8;
    --danger: #ff5c74;
    --sky: #6b9bff;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --paper: #11162a;
  --card: #1b2240;
  --ink: #eef1fb;
  --ink-soft: #a6aecb;
  --line: #2c3558;
  --gold: #ffc533;
  --gold-deep: #ffd666;
  --berry: #ff6b98;
  --go: #2fbf6e;
  --go-ink: #0b1a12;
  --wait: #ffbf47;
  --warn-bg: #3a2414;
  --warn-ink: #ffcfa8;
  --danger: #ff5c74;
  --sky: #6b9bff;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.45 var(--body);
  -webkit-tap-highlight-color: transparent;
}
#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 12px 24px;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0; text-wrap: balance; }
h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0; }
small { color: var(--ink-soft); font-size: 0.82rem; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.fine { color: var(--ink-soft); font-size: 0.88rem; }
.eyebrow { color: var(--ink-soft); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.error { color: var(--danger); font-weight: 700; }
.empty { color: var(--ink-soft); text-align: center; padding: 32px 8px; }
.note { background: var(--warn-bg); color: var(--warn-ink); padding: 12px 14px; border-radius: 14px; font-weight: 700; }

/* Buttons */
.btn {
  appearance: none;
  border: 2px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  transition: transform 0.08s ease;
}
.btn:active { transform: scale(0.97); }
.btn.big { min-height: 60px; font-size: 1.15rem; font-family: var(--display); border-radius: 18px; }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: 0.92rem; }
.btn.primary { background: var(--go); border-color: var(--go); color: var(--go-ink); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.ghost { background: transparent; }
.link { appearance: none; border: 0; background: none; color: var(--sky); font-weight: 700; cursor: pointer; padding: 6px 4px; }
.file-btn { display: inline-flex; align-items: center; }

/* Coin */
.coin {
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  border-radius: 50%;
  vertical-align: -0.12em;
  margin-right: 0.25em;
  background: radial-gradient(circle at 35% 35%, #fff6c8 0 18%, var(--gold) 19% 62%, var(--gold-deep) 63%);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.08);
}
.num { font-variant-numeric: tabular-nums; }

/* Welcome */
.welcome { min-height: 88vh; display: flex; flex-direction: column; justify-content: center; gap: 36px; text-align: center; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.brand h1 { font-size: 2.8rem; }
.lede { font-size: 1.1rem; color: var(--ink-soft); max-width: 30ch; }
.badge-big {
  width: 104px; height: 104px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #fff6c8 0 14%, var(--gold) 15% 64%, var(--gold-deep) 65%);
  box-shadow: 0 10px 0 -2px var(--berry);
  animation: bob 3s ease-in-out infinite;
}
.badge-big span { font-size: 56px; color: #fff; text-shadow: 0 2px 0 var(--gold-deep); line-height: 1; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-4deg); } }

/* Bars */
.bar { display: flex; align-items: center; gap: 10px; padding-block: 6px 14px; }
.bar h2 { flex: 1; }
.sheet .kid-row { border: 2px dashed var(--line); border-radius: var(--r); padding: 12px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.kid-row legend { font-weight: 700; padding: 0 6px; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 0.92rem; }
input:not([type='radio']):not([type='checkbox']), select, textarea {
  width: 100%;
  border: 2px solid var(--line);
  background: var(--card);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 46px;
  font-weight: 400;
}
textarea { min-height: 72px; font-size: 0.85rem; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--go); }
fieldset.plain { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
fieldset.plain legend { font-weight: 700; font-size: 0.92rem; padding: 0; margin-bottom: 8px; }

/* Emoji and option pickers share one look: a chip with a hidden input. */
.emoji-pick, .amounts, .reasons, .choose-kid { display: flex; flex-wrap: wrap; gap: 8px; }
.emo input, .amt-opt input, .reason-opt input, .kid-opt input { position: absolute; opacity: 0; pointer-events: none; }
.emo span, .amt-opt span, .reason-opt span, .kid-opt span {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 2px solid var(--line); background: var(--card); border-radius: 12px; cursor: pointer;
}
.emo span { width: 46px; height: 46px; font-size: 1.5rem; }
.amt-opt span { min-width: 62px; height: 46px; font-weight: 800; font-family: var(--display); font-size: 1.1rem; }
.reason-opt span, .kid-opt span { padding: 8px 12px; min-height: 42px; font-weight: 700; }
.emo input:checked + span, .amt-opt input:checked + span, .reason-opt input:checked + span { border-color: var(--sky); background: color-mix(in srgb, var(--sky) 14%, var(--card)); }
.kid-opt input:checked + span { border-color: var(--kid); background: color-mix(in srgb, var(--kid) 18%, var(--card)); }
.emo input:focus-visible + span, .amt-opt input:focus-visible + span, .reason-opt input:focus-visible + span, .kid-opt input:focus-visible + span { outline: 3px solid var(--sky); outline-offset: 2px; }
.amounts input[type='number'] { width: 100px; flex: 0 0 100px; }

/* Who's here */
.picker { display: flex; flex-direction: column; gap: 22px; padding-top: 18px; }
.hello h1 { font-size: 2.4rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.tile {
  appearance: none; border: 0; cursor: pointer;
  background: var(--card); border-radius: 24px; padding: 18px 12px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  box-shadow: var(--shadow); border-top: 8px solid var(--kid, var(--line));
}
.tile:active { transform: scale(0.97); }
.tile.grown { --kid: var(--ink-soft); }
.tile-name { font-family: var(--display); font-weight: 800; font-size: 1.3rem; }
.tile-sub { font-weight: 700; font-size: 1.05rem; }
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; font-size: 1.5rem; border-radius: 50%; background: color-mix(in srgb, var(--kid, var(--gold)) 22%, var(--card)); }
.avatar.lg { width: 56px; height: 56px; font-size: 2.1rem; }
.avatar.xl { width: 84px; height: 84px; font-size: 3.2rem; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; background: var(--line); }
.pill.hot { background: var(--berry); color: #fff; }
.pill.good { background: var(--go); color: var(--go-ink); }

/* PIN */
.pin { display: flex; flex-direction: column; gap: 18px; }
.pin-box { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; padding-top: 12px; }
.dots { display: flex; gap: 14px; }
.dot { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--ink-soft); }
.dot.on { background: var(--ink); border-color: var(--ink); }
.shake { animation: shake 0.3s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 320px; width: 100%; margin: 0 auto; }
.key { appearance: none; border: 0; background: var(--card); box-shadow: var(--shadow); border-radius: 50%; aspect-ratio: 1; max-width: 100%; font-size: 1.8rem; font-family: var(--display); font-weight: 700; cursor: pointer; }
.key:active { background: var(--line); }

/* Kid shell */
.kid-shell { display: flex; flex-direction: column; gap: 14px; padding-bottom: 92px; }
.kid-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 4px; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who h1 { font-size: 1.9rem; }
.level { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 700; color: var(--ink-soft); flex-wrap: wrap; }
.meter { width: 84px; height: 10px; border-radius: 6px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--kid); border-radius: 6px; }
.streak { color: var(--berry); }
.wallet {
  display: flex; gap: 12px; align-items: stretch;
  background: var(--card); border-radius: 22px; padding: 14px 16px; box-shadow: var(--shadow);
  border-left: 8px solid var(--kid);
}
.wallet-main { flex: 1; display: flex; flex-direction: column; }
.wallet .label { font-size: 0.78rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; }
.amount { font-family: var(--display); font-size: 2.6rem; line-height: 1; font-weight: 800; }
.wallet-side { display: flex; flex-direction: column; justify-content: center; text-align: right; min-width: 0; max-width: 40%; }
.wallet-side .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wallet-side b { font-family: var(--display); font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.section { margin-top: 6px; margin-bottom: 10px; }

.chores { display: flex; flex-direction: column; gap: 12px; }
.chore { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: var(--r); padding: 12px; box-shadow: var(--shadow); }
.chore.finished { opacity: 0.72; }
.chore.late { box-shadow: 0 0 0 3px var(--berry), var(--shadow); }
.late-note { display: block; color: var(--berry); font-weight: 700; font-size: 0.85rem; margin-top: 2px; }
.score-facts .late-note { font-size: inherit; }
.timer-note { margin: 0 16px 8px; padding: 10px 14px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); font-size: 1.05rem; }
.chore-emoji { font-size: 2.2rem; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 16px; background: color-mix(in srgb, var(--kid, var(--gold)) 16%, var(--card)); flex: none; }
.chore-emoji.sm { width: 42px; height: 42px; font-size: 1.6rem; border-radius: 12px; }
.chore-text { flex: 1; min-width: 0; }
.week { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.week i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); }
.week i.done { background: var(--go); border-color: var(--go); }
.week i.wait { background: var(--wait); border-color: var(--wait); }
.chore-go { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.plus { font-family: var(--display); font-weight: 800; color: var(--gold-deep); font-size: 1.15rem; }
.done-btn { background: var(--go); border-color: var(--go); color: var(--go-ink); font-family: var(--display); font-size: 1.15rem; min-width: 88px; min-height: 50px; border-radius: 16px; }
.all-done { color: var(--go); font-weight: 800; font-size: 0.9rem; }

.rewards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.reward { background: var(--card); border-radius: var(--r); padding: 14px 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.reward-emoji { font-size: 2.6rem; }
.reward h3 { font-size: 1rem; min-height: 2.2em; display: grid; place-items: center; }
.price { font-family: var(--display); font-weight: 800; font-size: 1.25rem; }
.need { color: var(--ink-soft); font-size: 0.85rem; font-weight: 700; min-height: 44px; display: grid; place-items: center; }
.get-btn { background: var(--gold); border-color: var(--gold); color: #3a2a00; width: 100%; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list > li { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--card); border-radius: 14px; padding: 10px 12px; }
.list > li > span { min-width: 0; }
.list small { display: block; }
.plain-list > li { padding: 0; background: none; display: block; }
.ledger .amt { font-family: var(--display); font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.amt.up { color: var(--go); }
.amt.down { color: var(--ink-soft); }

.card { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.goal { display: flex; gap: 18px; align-items: center; }
.jar { position: relative; width: 110px; height: 140px; flex: none; border: 4px solid var(--ink-soft); border-top-width: 10px; border-radius: 18px 18px 30px 30px; overflow: hidden; background: var(--paper); }
.jar-fill { position: absolute; left: 0; right: 0; bottom: 0; background: repeating-linear-gradient(0deg, var(--gold) 0 12px, var(--gold-deep) 12px 14px); transition: height 0.6s cubic-bezier(.2,1.4,.4,1); }
.jar-emoji { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.6rem; }
.big-num { font-family: var(--display); font-weight: 800; font-size: 2.2rem; line-height: 1.1; }
.big-num small { font-size: 1rem; }
.save-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.save-row .btn { flex: 1 1 30%; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center; gap: 4px;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px max(16px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.tab { appearance: none; border: 0; background: none; flex: 1; max-width: 130px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 14px; font-weight: 700; font-size: 0.85rem; color: var(--ink-soft); cursor: pointer; }
.tab span { font-size: 1.5rem; line-height: 1; }
.tab.on { color: var(--ink); background: color-mix(in srgb, var(--kid) 18%, var(--card)); }

/* Grown-up screens */
.parent-shell { display: flex; flex-direction: column; gap: 12px; }
.parent-bar { justify-content: space-between; }
.parent-bar h1 { font-size: 1.7rem; }
.ptabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.ptab { appearance: none; border: 2px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.ptab.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.parent-body { display: flex; flex-direction: column; gap: 12px; }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.row-head .section { margin-bottom: 0; }
.cards > li.ask { flex-wrap: wrap; box-shadow: var(--shadow); }
.ask > div:first-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cost { color: var(--ink-soft); font-weight: 700; }
.chip { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; padding: 2px 10px 2px 4px; border-radius: 999px; font-weight: 700; font-size: 0.85rem; background: color-mix(in srgb, var(--kid) 20%, var(--card)); }
.yesno { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kid-card { display: flex; flex-direction: column; gap: 10px; border-left: 6px solid var(--kid); }
.kid-line { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0; }
.stats div { background: var(--paper); border-radius: 12px; padding: 8px; text-align: center; }
.stats dt { font-size: 0.72rem; color: var(--ink-soft); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.stats dd { margin: 0; font-family: var(--display); font-weight: 800; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.line-card { display: flex; align-items: center; gap: 12px; }
.line-card small { display: block; }
.plain-list { gap: 10px; }

/* Overlays */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 30;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  max-width: min(92vw, 440px); padding: 12px 18px; border-radius: 16px;
  background: var(--ink); color: var(--paper); font-weight: 700; box-shadow: var(--shadow);
  animation: pop 0.25s ease-out;
}
.toast.warn { background: var(--warn-bg); color: var(--warn-ink); border: 2px solid var(--warn-ink); }
@keyframes pop { from { transform: translate(-50%, 12px); opacity: 0; } }
.modal-back { position: fixed; inset: 0; z-index: 40; background: rgba(10, 14, 30, 0.5); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--card); border-radius: 22px; padding: 20px; max-width: 380px; width: 100%; display: flex; flex-direction: column; gap: 16px; font-weight: 700; }
.modal .yesno { justify-content: flex-end; }
.preview-tag { position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); right: max(8px, env(safe-area-inset-right, 0px)); z-index: 20; background: var(--berry); color: #fff; font-size: 0.72rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; letter-spacing: 0.06em; text-transform: uppercase; pointer-events: none; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 3px; animation: fall 1.4s ease-in forwards; }
@keyframes fall { to { transform: translate(var(--drift), 105vh) rotate(var(--spin)); opacity: 0.6; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 380px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .two { grid-template-columns: 1fr; }
}

/* Picture PIN (synced families): nine big pictures, tapped in order */
.pic-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 320px; width: 100%; margin: 0 auto; }
.pic { appearance: none; border: 3px solid transparent; background: var(--card); box-shadow: var(--shadow); border-radius: 22px; aspect-ratio: 1; font-size: 2.6rem; line-height: 1; cursor: pointer; }
.pic:active { background: var(--line); border-color: var(--kid, var(--gold)); }
.pin-set .pic-pad { max-width: 260px; }
.pin-set .pic { font-size: 2rem; border-radius: 16px; }
.pin-set .center { font-size: 1.6rem; min-height: 2rem; }

/* Invite and device codes: big, spaced, easy to read out */
.code { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 1.7rem; font-weight: 700; letter-spacing: 0.12em; text-align: center; background: var(--paper); border: 2px dashed var(--line); border-radius: 14px; padding: 12px; user-select: all; overflow-wrap: anywhere; }

/* Offline banner on synced families */
.offline { background: var(--warn-bg); color: var(--warn-ink); padding: 10px 14px; border-radius: 14px; font-weight: 700; font-size: 0.92rem; }
.pin-set { margin-top: 18px; padding-top: 16px; border-top: 2px solid var(--line); }
.pin-set .dots { justify-content: center; }

/* Week summary (v0.3) */
.seg { display: flex; gap: 6px; }
.seg .btn.on { background: var(--ink); color: var(--card); }
.totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.totals div { background: var(--card); border-radius: 14px; padding: 10px 6px; text-align: center; box-shadow: var(--shadow); }
.totals b { display: block; font-size: 1.5rem; }
.totals span { font-size: 0.82rem; color: var(--ink-soft); }
.week-kid { border-left: 8px solid var(--kid, var(--line)); }

/* Alerts card (v0.3) */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

/* v0.4: set days, family goal, badges and the 8-week chart */
.sr { position: absolute; left: 0; top: 0; width: 1px; height: 1px; min-width: 0; padding: 0; border: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chore-note { display: block; color: var(--ink-soft); font-size: 0.82rem; margin-top: 2px; }
.days .reason-opt span { min-width: 48px; justify-content: center; }
.fam-head { display: flex; align-items: center; gap: 12px; }
.fam-head small { display: block; color: var(--ink-soft); font-size: 0.88rem; }
.meter.wide { width: 100%; height: 14px; border-radius: 8px; --kid: var(--go); }
.badges { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.badges li { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); text-align: center; opacity: 0.4; filter: grayscale(1); }
.badges li.got { opacity: 1; filter: none; }
.badges li span[aria-hidden] { font-size: 1.6rem; }
.badges small { font-size: 0.72rem; line-height: 1.15; color: var(--ink-soft); }
.trend { list-style: none; margin: 0; padding: 0; display: flex; align-items: flex-end; gap: 6px; height: 160px; }
.trend li { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.trend-bar { width: 100%; min-height: 4px; border-radius: 8px 8px 3px 3px; background: var(--gold); display: flex; justify-content: center; align-items: flex-start; }
.trend-bar b { font-size: 0.75rem; transform: translateY(-1.3em); color: var(--ink); }
.trend small { font-size: 0.7rem; color: var(--ink-soft); white-space: nowrap; }

/* v0.5: the wall-tablet scoreboard, readable from across the kitchen */
#app:has(.scoreboard) { max-width: 1280px; }
.scoreboard { display: flex; flex-direction: column; gap: 18px; padding-top: 12px; cursor: pointer; min-height: calc(100vh - 36px); }
.score-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.score-top h1 { font-size: clamp(2.4rem, 6vw, 4rem); }
.score-top .pill { font-size: 1rem; padding: 6px 14px; }
.score-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.score-card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); border-top: 8px solid var(--kid); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.score-head { display: flex; align-items: center; gap: 14px; }
.score-head h2 { font-size: 2rem; }
.score-head p { margin: 2px 0 0; color: var(--ink-soft); font-weight: 700; }
.score-coins { display: flex; align-items: center; gap: 10px; margin: 0; font-family: var(--display); font-size: 2.6rem; font-weight: 800; }
.score-coins small { font-family: var(--body); font-size: 0.95rem; font-weight: 400; color: var(--ink-soft); }
.score-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 1.1rem; }
.score-goal { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 18px; font-size: 1.2rem; }
.score-goal small { color: var(--ink-soft); }
.score-goal .meter { margin-top: 8px; display: block; }

/* Photo proof (v0.5) */
.photo-pick { position: relative; cursor: pointer; }
.proof { display: block; max-width: 100%; max-height: 320px; margin-top: 8px; border-radius: 12px; object-fit: contain; background: var(--card, #fff); }
.list li .actions { display: inline-flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* v1.0.1: Help, training slides and setup guides */
.help { display: flex; flex-direction: column; gap: 14px; }
.help-list { display: flex; flex-direction: column; gap: 12px; }
.help-tile { flex-direction: row; justify-content: flex-start; text-align: left; gap: 14px; padding: 14px 16px; min-height: 64px; }
.help-tile > span:last-child { display: flex; flex-direction: column; }
.help-tile .tile-name { font-size: 1.15rem; }
.help-tile .tile-sub { font-weight: 400; font-size: 0.9rem; color: var(--ink-soft); }
.slide { display: flex; flex-direction: column; text-align: center; align-items: center; gap: 12px; padding: 24px 18px; }
.slide-emoji { font-size: 4rem; line-height: 1; }
.slide h3 { font-size: 1.6rem; }
.slide p { margin: 0; max-width: 34em; font-size: 1.08rem; }
.slide .yesno { justify-content: center; }
.dots { display: flex; gap: 6px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--gold); }
.guide h3 { font-size: 1.25rem; }
.steps { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 8px; }
.snippet { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.snippet pre { margin: 0; width: 100%; overflow-x: auto; padding: 12px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); font-size: 0.82rem; line-height: 1.4; }
.events { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.events td { padding: 5px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.events code { font-size: 0.76rem; white-space: nowrap; }

/* Launch screen (v1.3.0, decision 0015): the logo pops open, the coin flips in, the star
   twinkles, and four chores get ticked off while the app gets ready. 2.2 seconds, once per launch;
   a tap skips it (js/launch.js). It fades by itself too, so it never stays if a script fails. */
.launch {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--paper); color: var(--ink); cursor: pointer; -webkit-user-select: none; user-select: none;
  animation: launch-leave 0.3s ease-in 1.9s forwards;
}
.launch.out { animation: launch-leave 0.25s ease-in forwards; }
@keyframes launch-leave { to { opacity: 0; visibility: hidden; } }
.launch-logo { width: min(38vw, 150px); height: auto; overflow: visible; filter: drop-shadow(0 10px 18px rgba(232, 70, 124, 0.3)); }
.launch-logo * { transform-box: fill-box; transform-origin: center; }
.launch-tile { animation: launch-open 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.launch-coin { animation: launch-flip 0.55s cubic-bezier(0.34, 1.4, 0.64, 1) 0.18s both; }
.launch-star { animation: launch-star 0.5s cubic-bezier(0.34, 1.8, 0.64, 1) 0.42s both; }
@keyframes launch-open { from { transform: scale(0.2) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes launch-flip { from { transform: scaleX(0) scaleY(0.6); } to { transform: none; } }
@keyframes launch-star { 0% { transform: scale(0) rotate(-90deg); } 70% { transform: scale(1.15) rotate(8deg); } 100% { transform: none; } }
.launch-name { font-family: var(--display); font-weight: 800; font-size: 2.2rem; line-height: 1; animation: launch-rise 0.4s ease-out 0.35s both; }
@keyframes launch-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.launch-chores { display: flex; gap: 10px; margin-top: 8px; }
.launch-chore {
  position: relative; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--card); box-shadow: var(--shadow); font-size: 24px;
  animation: launch-rise 0.3s ease-out calc(0.5s + var(--i) * 0.08s) both;
}
.launch-emoji { display: inline-block; animation: launch-wiggle 0.36s ease-in-out calc(0.75s + var(--i) * 0.16s) 2; }
@keyframes launch-wiggle { 25% { transform: rotate(-14deg) translateY(-3px); } 75% { transform: rotate(14deg) translateY(-3px); } }
.launch-tick {
  position: absolute; right: -6px; top: -6px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--go); color: var(--go-ink); font: 800 13px/1 var(--body);
  animation: launch-tick 0.3s cubic-bezier(0.34, 1.8, 0.64, 1) calc(0.95s + var(--i) * 0.16s) both;
}
@keyframes launch-tick { from { transform: scale(0); } to { transform: none; } }
.launch-note { color: var(--ink-soft); font-size: 0.95rem; animation: launch-rise 0.4s ease-out 0.6s both; }
@media (prefers-reduced-motion: reduce) {
  .launch *, .launch-logo * { animation: none !important; }
  .launch { animation-delay: 1.2s; }
}

/* Basstion Forge, the maker (v1.3.0, decision 0015) */
/* The maker's credit, at the end of Help and Settings */
.maker { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 28px; text-align: center; }
.maker-link { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; padding: 6px 10px; border-radius: 12px; }
.maker-link:hover .maker-name { text-decoration: underline; }
.forge-mark { width: 30px; height: 29px; flex: none; }
.forge-mark .forge-star { fill: #1b2340; }
.forge-mark .forge-heart { fill: #c9a15b; }
.maker-by { color: var(--ink-soft); font-size: 0.88rem; }
.maker-name { font-family: 'Instrument Serif', Georgia, 'Times New Roman', serif; font-size: 1.3rem; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .forge-mark .forge-star { fill: #f4efe4; }
}

/* Find device (v1.5.0): the picture a new device shows while it looks for its family. */
.link-picture { font-size: 7rem; line-height: 1.1; margin: 8px auto; width: 10rem; height: 10rem; display: grid; place-items: center; background: var(--card); box-shadow: var(--shadow); border-radius: 32px; }
.link-pick .pic-pad { max-width: 260px; }
.link-pick .pic { font-size: 2rem; border-radius: 16px; }
