:root {
  --night: #12172E;
  --panel: #1C2344;
  --panel-2: #242C53;
  --line: rgba(255,255,255,0.09);
  --gold: #FFC24B;
  --mint: #63E6A8;
  --coral: #FF8A8A;
  --text: #EEF1FB;
  --muted: #97A0C6;
  --accent: #FFC24B;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* Quick taps on -/+ and Y/N/N/A were read as a double-tap zoom. This turns
   double-tap zoom off for the controls; pinch-to-zoom still works. */
button, input, select, textarea, a, .chip, [data-open], [data-toggle], [data-setpage] {
  touch-action: manipulation;
}

body {
  margin: 0;
  background: var(--night);
  color: var(--text);
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  padding: env(safe-area-inset-top) 18px 64px;
}

.wrap { max-width: 560px; margin: 0 auto; }

h1, h2, .numeral {
  font-family: 'Bricolage Grotesque', Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 0 18px;
}
.coin {
  width: 26px; height: 26px; border-radius: 50%;
  background: url(/logo.svg) center / contain no-repeat;   /* the star coin */
  flex: none;
}
.topbar h1 { font-size: 20px; white-space: nowrap; }
#parentView .topbar { gap: 6px; }
#parentView .topbar h1 { font-size: 17px; margin-left: 2px; margin-right: auto; }
#parentView .topbar .small { padding: 6px 10px; font-size: 13.5px; }
.small.icon { padding: 6px 8px !important; line-height: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; flex: none; }
.topbar .who { margin-left: auto; color: var(--muted); font-size: 14px; }

/* ---------- hero ---------- */
.hero {
  background: linear-gradient(160deg, var(--panel) 0%, #191F3C 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px 22px 22px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; right: -70px; top: -70px;
  width: 190px; height: 190px; border-radius: 50%;
  background: var(--accent); opacity: 0.10;
}
.hero .label { color: var(--muted); font-size: 15px; }
.hero .numeral {
  font-size: 76px; line-height: 0.92; font-weight: 800;
  color: var(--accent); margin: 6px 0 2px;
}
.hero .unit { color: var(--muted); font-size: 16px; }

.meter { margin-top: 20px; }
.meter .caption { font-size: 14px; color: var(--muted); margin-bottom: 7px; }
.meter .track {
  height: 9px; border-radius: 99px; background: rgba(255,255,255,0.10); overflow: hidden;
}
.meter .fill { height: 100%; border-radius: 99px; background: var(--accent); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 12px 11px;
}
.stat b { font-family: 'Bricolage Grotesque', serif; font-size: 22px; font-weight: 700; display: block; }
.stat span { font-size: 12.5px; color: var(--muted); line-height: 1.25; display: block; }

/* ---------- sections ---------- */
section { margin-top: 30px; }
section > h2 { font-size: 17px; margin-bottom: 12px; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 15px;
  margin-bottom: 9px;
}
.row { display: flex; align-items: center; gap: 12px; }
.row .grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); font-size: 13.5px; }
.strike { opacity: 0.45; }

.price {
  font-family: 'Bricolage Grotesque', serif; font-weight: 700;
  font-size: 18px; color: var(--gold); white-space: nowrap;
}
.price.locked { color: var(--muted); }

/* ---------- buttons ---------- */
button {
  font-family: 'Outfit', sans-serif; font-size: 15px; font-weight: 500;
  border-radius: 11px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text);
  padding: 10px 15px; cursor: pointer;
  transition: transform .08s ease, background .15s ease;
}
button:active { transform: scale(0.97); }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button[disabled] { opacity: 0.4; cursor: default; }
.primary { background: var(--gold); color: #241A00; border-color: transparent; font-weight: 600; }
.go { background: var(--mint); color: #05291A; border-color: transparent; font-weight: 600; }
.no { background: transparent; color: var(--coral); border-color: rgba(255,138,138,0.4); }
.small { padding: 7px 12px; font-size: 14px; }
.full { width: 100%; padding: 14px; font-size: 16px; }

/* ---------- inputs ---------- */
input, select, textarea {
  font-family: 'Outfit', sans-serif; font-size: 16px;
  width: 100%; padding: 12px 13px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 11px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
label { display: block; font-size: 13.5px; color: var(--muted); margin: 14px 0 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--panel);
  border-radius: 99px; padding: 9px 14px; font-size: 14.5px; cursor: pointer;
}
.chip.on { background: var(--gold); color: #241A00; border-color: transparent; font-weight: 600; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 7px; }

.segmented { display: flex; gap: 6px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 5px; margin: 20px 0 22px; }
.segmented button { flex: 1; border: none; background: transparent; padding: 9px 4px; font-size: 14.5px; color: var(--muted); }
.segmented button.on { background: var(--panel-2); color: var(--text); font-weight: 600; }

.badge { font-size: 12px; background: var(--coral); color: #2B0808; border-radius: 99px;
  padding: 1px 7px; margin-left: 5px; font-weight: 600; }

.delta { font-family: 'Bricolage Grotesque', serif; font-weight: 700; font-size: 17px; white-space: nowrap; }
.plus { color: var(--mint); }
.minus { color: var(--coral); }
.wait { color: var(--gold); }

.daycard { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px; margin-bottom: 11px; }
.daycard.compact { padding: 11px 14px; margin-bottom: 7px; }
.dayrow { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.dayrow b { font-family: 'Bricolage Grotesque', serif; font-weight: 700; font-size: 15px; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.submenu { margin: 16px 0 14px; }
.steprow { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.steprow .kid { flex: 1; min-width: 0; }
.steprow .kid .muted { margin-top: 1px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 38px; padding: 8px 0; font-size: 18px; line-height: 1;
  border-radius: 9px; }
.stepper input.val { font-family: 'Bricolage Grotesque', serif; font-weight: 700;
  font-size: 19px; width: 56px; text-align: center; padding: 7px 4px; }
.stepper input.val.changed { color: var(--gold); }

.pill.total { color: var(--gold); font-weight: 600; font-size: 13px; }
.checklist { padding: 2px 0 4px; }
.goalrow { display: flex; align-items: center; gap: 8px; padding: 7px 0; }
.goalrow .goalname { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); }
.goalrow.met .goalname { color: var(--text); font-weight: 600; }
.goalrow.na .goalname { text-decoration: line-through; opacity: .6; }
.goalrow.no .goalname { opacity: .8; }
.goalrow.needs-answer .goalname { color: var(--coral); }
.goalrow.na .pill.pts { color: var(--muted); }
.triogroup { display: flex; gap: 4px; flex-shrink: 0; }
.trio { font-size: 11px; padding: 4px 10px; border-radius: 7px;
  background: transparent; color: var(--muted); border: 1px solid var(--line); }
.trio.y.on { background: var(--mint); color: #05291A; border-color: transparent; font-weight: 600; }
.trio.n.on { background: var(--coral); color: #3A0A0A; border-color: transparent; font-weight: 600; }
.trio.na.on { background: var(--panel-2); color: var(--text); border-color: var(--muted); font-weight: 600; }

/* the per-kid comment line under each stepper on the Daily tab */
.dnote { display: flex; align-items: center; gap: 8px; padding: 0 0 9px 0;
  margin-top: -3px; }
/* 16px: smaller text makes iPhone zoom in on tap */
.dnote input { flex: 1; min-width: 0; font-size: 16px; padding: 7px 10px; }
.state { font-size: 11.5px; color: var(--muted); white-space: nowrap;
  opacity: 0; transition: opacity .2s; }
.state.show { opacity: 1; }
.state.bad { color: var(--coral); }
.dnote .state { min-width: 46px; text-align: right; }
/* shared save-status line for the whole kid block, below the comment box */
.savebar { text-align: right; padding-top: 2px; }

button.tiny { font-size: 11.5px; padding: 2px 8px; border-radius: 7px;
  background: transparent; color: var(--muted); }
.pill { font-size: 11.5px; color: var(--muted); background: var(--panel-2);
  border-radius: 99px; padding: 2px 8px; white-space: nowrap; }
.entry { padding: 8px 0; border-top: 1px solid var(--line); }
.entry:first-child { border-top: none; }
.comment { font-size: 13.5px; color: var(--muted); padding: 4px 0 4px 14px;
  border-left: 2px solid var(--line); margin: 4px 0 4px 2px; }
.histgoals { padding: 2px 0 2px 14px; border-left: 2px solid var(--line); margin: 4px 0 4px 2px; }
.histgoal { display: flex; align-items: center; gap: 8px; padding: 3px 0;
  font-size: 13.5px; color: var(--muted); }
.histgoal .pill { margin-left: auto; }
.histgoal.met { color: var(--text); }
.histgoal.met .pill { color: var(--mint); }
.histgoal.na { text-decoration: line-through; opacity: .7; }
.histgoal.extra .pill { color: var(--gold); }
.revise { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.qty { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
/* The box holds the unit: [ $ 50 ] or [ 30 min ]. The input inside is bare. */
.qbox { display: flex; align-items: center; gap: 4px; width: 112px; padding: 0 10px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; cursor: text; }
.qbox:focus-within { outline: 2px solid var(--gold); outline-offset: 1px; }
.qbox input { flex: 1; min-width: 0; width: auto; padding: 8px 0; border: 0; background: transparent;
  text-align: right; font-size: 16px; }
.qbox input:focus { outline: none; }
.qbox input::placeholder { color: var(--muted); opacity: .6; }
.qbox .qunit { color: var(--muted); font-size: 15px; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty input[type=number] { -moz-appearance: textfield; }
.qty .out { font-family: 'Bricolage Grotesque', serif; font-weight: 700;
  color: var(--gold); font-size: 16px; }
.linkbar { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px; margin-bottom: 18px; }

.empty { color: var(--muted); font-size: 14.5px; padding: 18px 2px; }
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 12px 18px; border-radius: 12px; font-size: 14.5px; max-width: 90vw;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45); z-index: 50;
}
.toast.bad { border-color: rgba(255,138,138,0.55); }
.hidden { display: none; }
.center { text-align: center; }
.linkline { font-size: 12.5px; color: var(--muted); word-break: break-all; margin-top: 6px; }

/* ---------- settings ---------- */
.set h3 { font-family: 'Bricolage Grotesque', serif; font-size: 16px; margin: 22px 0 10px; }
.set h3:first-child { margin-top: 4px; }
.set .card label { margin: 8px 0 4px; }
.set .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.set .grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.set input, .set select { padding: 9px 10px; font-size: 16px; }
.set input[type=color] { padding: 2px; height: 40px; }
.set .check { display: flex; align-items: center; gap: 8px; margin: 10px 0 2px;
  font-size: 14px; color: var(--muted); }
.set .check input { width: auto; }
.set .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.set .inactive { opacity: .55; }
.set .kidhead { font-weight: 600; margin: 14px 0 6px; }
.set .srow { cursor: pointer; display: flex; align-items: center; gap: 12px; }
.set .srow .grow { flex: 1; min-width: 0; }
.set .card.srow { padding: 13px 15px; }
.set .chev { color: var(--muted); font-size: 20px; line-height: 1; width: 14px; text-align: center; }
.set .sitem { padding: 11px 15px; }
.set .sitem.open { border-color: rgba(255,194,75,0.35); }
.set .sedit { border-top: 1px solid var(--line); margin-top: 11px; padding-top: 2px; }
.set .sethead { margin: 2px 0 12px; }
.set .sethead h3 { margin: 0; }
.set .subhead { font-size: 13.5px; color: var(--muted); margin: 16px 0 6px; font-weight: 500; }
.set .chips { margin-bottom: 2px; }
.set .segmented.pricing { margin: 12px 0 0; }
.qty .qbtn { width: 36px; padding: 6px 0; font-size: 18px; line-height: 1; border-radius: 9px; }
#gsiButton { display: flex; justify-content: center; margin: 14px 0 4px; }

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

/* ---------- Add to Home Screen tip, setup steps ---------- */
.install { border-color: rgba(255,194,75,0.4); }
.steps { margin: 8px 0 2px; padding-left: 20px; color: var(--muted); font-size: 14.5px; }
.steps li { margin: 3px 0; }
.steps b { color: var(--text); font-weight: 600; }

/* ---------- signed-out landing ---------- */
.land .hero { padding: 24px 20px 20px; }
.land-title { font-size: 26px; line-height: 1.15; font-weight: 800; position: relative; }
.land .gsi { display: flex; justify-content: center; margin: 18px 0 8px; min-height: 44px; }
.land .card { position: relative; padding-left: 52px; }
.land .card p { margin: 4px 0 8px; }
.stepnum { position: absolute; left: 15px; top: 14px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--gold); color: #241A00; font: 700 14px/26px 'Bricolage Grotesque', serif; text-align: center; }
.example { background: var(--panel-2); border-radius: 11px; padding: 8px 12px; font-size: 14.5px; }
.example .goalrow { padding: 5px 0; }
.example .trio { pointer-events: none; }

/* ---------- setup walkthrough ---------- */
.sdots { display: flex; gap: 6px; }
.sdot { width: 22px; height: 5px; border-radius: 3px; background: var(--panel-2); }
.sdot.done { background: rgba(255,194,75,0.5); }
.sdot.on { background: var(--gold); }
.set .chip span.muted { font-size: 12.5px; margin-left: 4px; }
.land .hero::after { display: none; }
.money { font: 800 34px/1.1 'Bricolage Grotesque', serif; color: var(--mint); margin: 2px 0; }

/* ---------- "About point charts" reading links ---------- */
.learn { margin-top: 34px; }
.learnlink { display: block; text-decoration: none; color: var(--text); }
.learnlink b { display: block; margin-bottom: 2px; }
.learnlink b::after { content: ' \2197'; color: var(--muted); font-weight: 400; }
.learnlink .muted { display: block; }
#mainTabs button { padding: 9px 2px; font-size: 14px; }
#mainTabs .badge { margin-left: 3px; padding: 1px 6px; }

/* ---------- full-screen views (Goals, Links, Settings) ---------- */
.screen { padding-bottom: 20px; }
.screenhead { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; }
.screenhead h2 { font-size: 20px; margin: 0; }
#parentView .topbar .small.on { background: var(--gold); color: #241A00; border-color: transparent; }

/* ---------- pending points in the top totals ---------- */
.pendingline { color: var(--gold); font-size: 13px; }
.price .pend { display: block; font-size: 11px; font-weight: 600; color: var(--gold); text-align: right; letter-spacing: 0; }
.qbox.wide { width: 100%; padding: 2px 13px; }
.qbox.wide input { text-align: left; font-size: 18px; }
.segmented.alkind { margin: 14px 0 0; }

/* Redeem: the picked kid's points, and rewards they can't afford yet */
.money.points { color: var(--gold); }
.card.short > .row .grow, .card.short > .row .price, .card.short .out { opacity: .45; }
.example .extotal { border-top: 1px solid var(--line); margin-top: 6px; padding: 7px 0 2px; font-weight: 600; }

/* Kid page: the days a goal applies, S M T W T F S */
.week { display: flex; gap: 4px; margin-top: 6px; }
.week .wd { width: 20px; height: 20px; border-radius: 50%; font-size: 11px; font-weight: 600; line-height: 20px;
  text-align: center; background: var(--panel-2); color: var(--muted); opacity: .55; }
.week .wd.on { background: var(--accent); color: #12172E; opacity: 1; }
#kidTabs { margin: 0 0 16px; }
.price.balnum { text-align: right; }
.price.balnum .pend { white-space: nowrap; }

/* Settings: tappable day circles for a goal */
.daypick { display: flex; gap: 6px; }
.daypick .wd { width: 38px; height: 38px; padding: 0; border-radius: 50%; font-size: 14px; font-weight: 700;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.daypick .wd.on { background: var(--gold); color: #241A00; border-color: transparent; }

/* Kid page: compact goals card, privacy note, celebration */
.goallist { padding: 6px 15px 12px; }
.goalline { padding: 9px 0; border-top: 1px solid var(--line); }
.goalline:first-child { border-top: none; }
.goallist .week { margin-top: 4px; }
.goaltotal { margin-top: 6px; font-size: 13px; }
.privacynote { font-size: 12.5px; margin: 26px 8px 0; }
.cheer { border-color: rgba(99,230,168,0.5); margin-bottom: 14px; }
.cheer b { color: var(--mint); }
.confetti { position: fixed; top: -12px; width: 9px; height: 14px; border-radius: 2px; z-index: 60;
  pointer-events: none; animation: fall 2.6s ease-in forwards; }
@keyframes fall { to { top: 105vh; transform: rotate(540deg); opacity: .9; } }

/* Kid page: a tighter top so the good stuff is higher up */
#kidPointsTab .hero { padding: 18px 20px 16px; }
#kidPointsTab .hero .numeral { font-size: 60px; }
#kidPointsTab .stats { margin-top: 10px; gap: 8px; }
#kidPointsTab .stat { padding: 9px 11px 8px; }
#kidPointsTab .stat b { font-size: 19px; }
#kidPointsTab section { margin-top: 22px; }
