:root {
  --bg: #f4f1e8;
  --card: #ffffff;
  --ink: #1f1a3d;
  --muted: #6b6785;
  --line: #e2ddcf;
  --brand: #1f1a3d;
  --accent: #ffc93c;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --green-ink: #14532d;
  --red: #dc2626;
  --pts: #c2410c;
  --primary: #4f3fd0;
  --kid: #2563eb;
  --soft: #ece8dc;
  --field: #ffffff;
  --solid: #1f1a3d;
  --warn-bg: #fff8e1;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
  min-height: 100dvh; display: flex; flex-direction: column;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: 76px;
}
body[data-view="home"] { padding-bottom: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
input, select { font: inherit; color: inherit; }

/* ---------- Header / footer ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--brand); color: #fff;
  padding-top: calc(12px + max(env(safe-area-inset-top), var(--sat, 0px)));
}
/* In the Android app the page runs under the phone's clock and battery: the app sends the exact sizes (--sat, --sab); these are for older app versions */
html.in-app { --sat: 28px; --sab: 16px; }
.brand { color: #fff; text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: .2px; white-space: nowrap; }
.brand span { color: var(--accent); }
.badge { font-weight: 800; font-size: 15px; padding: 6px 14px; border-radius: 999px; background: #fff; }
.status { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 14px; font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #c9a227; }
.dot.ok { background: var(--green); }
.dot.bad { background: var(--red); }

#main { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; }
.center { display: grid; place-items: center; min-height: 50vh; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--primary); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Home ---------- */
.home { padding: 24px 16px; max-width: 440px; margin: 0 auto; }
.lead { font-size: 22px; font-weight: 800; text-align: center; margin: 12px 0 24px; }
.pick {
  display: block; text-align: center; text-decoration: none; color: #fff;
  background: var(--c, var(--primary)); font-size: 28px; font-weight: 800;
  padding: 26px; border-radius: 20px; margin-bottom: 14px;
}
.pick.parent { background: var(--brand); }
.sim-link { display: block; text-align: center; margin-top: 22px; color: var(--muted); font-weight: 600; }

/* ---------- Kid header ---------- */
.kid-head { padding: 18px 16px 8px; text-align: center; }
.pts { display: inline-flex; align-items: baseline; gap: 8px; }
.pts-num { font-size: 64px; font-weight: 900; line-height: 1; color: var(--kid); font-variant-numeric: tabular-nums; }
.pts-label { font-size: 20px; font-weight: 800; color: var(--muted); }
.pts.bump .pts-num { animation: bump .6s ease-out; }
@keyframes bump { 0% { transform: scale(1.35); color: var(--green); } 100% { transform: scale(1); } }
.held { font-size: 14px; color: var(--muted); font-weight: 700; margin-top: 4px; }
.goal {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 14px;
  background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 10px 14px; text-align: left;
}
.goal img { width: 40px; height: 40px; flex: none; }
.goal-text { flex: 1; display: flex; flex-direction: column; gap: 8px; font-size: 16px; }
.goal-label { color: #a16207; font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: -4px; }
.bar { display: block; height: 12px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--green); border-radius: 999px; transition: width .4s; }

/* ---------- Chore cards (like the cork board) ---------- */
.kid-body, .parent-body { padding: 8px 16px 16px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--card); border: 3px solid var(--line); border-radius: 16px;
  padding: 14px 8px 12px; min-height: 168px; text-align: center;
  box-shadow: 0 2px 0 rgba(0,0,0,.06); transition: background .2s, border-color .2s, transform .1s;
  user-select: none;
}
.card:active { transform: scale(.96); }
.card img { width: 84px; height: 84px; object-fit: contain; pointer-events: none; }
.card-name { font-weight: 800; font-size: 15px; line-height: 1.2; }
.card-pts { font-weight: 800; font-size: 14px; color: var(--pts); }
.dots { font-size: 16px; color: var(--green); display: inline-flex; gap: 4px; align-items: center; }
/* One round dot per time a chore can be done: filled = done, ring = not yet (all the same size) */
.cdot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--green); box-sizing: border-box; vertical-align: -1px; }
.cdot.on { background: var(--green); }
.dots.count { font-size: 14px; font-weight: 800; letter-spacing: 0; }
.card.partial { border-color: var(--green); }
.card.done { background: var(--green-soft); border-color: var(--green); }
.card.done .card-pts { color: var(--green-ink); }
.check {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--green); color: #fff; font-weight: 900; display: grid; place-items: center; font-size: 16px;
}
.card.nudge { animation: nudge .35s; }
@keyframes nudge { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.fine { text-align: center; color: var(--muted); font-size: 13px; margin: 18px 0 0; }

/* ---------- Rewards ---------- */
.rlist { display: flex; flex-direction: column; gap: 12px; }
.reward {
  display: flex; align-items: center; gap: 12px; background: var(--card);
  border: 2px solid var(--line); border-radius: 16px; padding: 12px;
}
.reward.is-goal { border-color: var(--accent); }
.reward img { width: 56px; height: 56px; flex: none; }
.reward-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.reward-info b { font-size: 17px; }
.reward-info span { color: var(--muted); font-size: 14px; font-weight: 600; }
.goal-btn { align-self: flex-start; background: none; border: 0; padding: 4px 0; color: #a16207; font-weight: 700; font-size: 14px; }
.ask { flex: none; min-width: 92px; min-height: 52px; border-radius: 14px; border: 0; background: var(--soft); color: var(--muted); font-weight: 800; font-size: 14px; padding: 0 12px; }
.ask.go { background: var(--green); color: #fff; font-size: 18px; }

/* ---------- Shared rows / sections ---------- */
.sec { font-size: 14px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 22px 0 8px; }
.title { font-size: 22px; margin: 10px 0 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: 15px; }
.row small { color: var(--muted); white-space: nowrap; }
.pending-row { background: var(--warn-bg); border: 2px solid #f5d77a; border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.pending-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 16px; }
.pending-top small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.resend { width: 100%; margin-top: 10px; min-height: 50px; border-radius: 12px; border: 2px dashed #e7c75a; background: transparent; color: #92400e; font-weight: 800; font-size: 15px; }
.resend.go { border: 0; background: #f59e0b; color: #fff; font-size: 17px; }
.req.resent { border-color: #f59e0b; box-shadow: 0 0 0 2px #fde68a; }
.req-flag { font-weight: 800; color: #b45309; font-size: 14px; margin-bottom: 6px; }
.empty { color: var(--muted); padding: 8px 2px; }

/* ---------- Buttons ---------- */
.primary, .ghost, .danger { border-radius: 12px; padding: 12px 16px; font-weight: 700; min-height: 48px; }
.primary { background: var(--primary); color: #fff; border: 0; }
.ghost { background: var(--card); border: 2px solid var(--line); }
.danger { background: var(--card); border: 2px solid #f3b4b4; color: var(--red); }
.wide { display: block; width: 100%; margin-top: 12px; text-align: center; }
.add-row { display: flex; gap: 8px; margin-top: 12px; }
.add-row button { flex: 1 1 0; min-width: 0; white-space: nowrap; padding-left: 8px; padding-right: 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 2px solid var(--line); background: var(--card); font-weight: 800; flex: none; }
.icon-btn:disabled { opacity: .35; }

/* ---------- Bottom tabs ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; background: var(--card); border-top: 2px solid var(--line);
  padding-bottom: max(env(safe-area-inset-bottom), var(--sab, 0px));
}
.tabs.two { grid-template-columns: 1fr 1fr; }
.tabs.five { grid-template-columns: repeat(5, 1fr); }
.tabs button { background: none; border: 0; min-height: 64px; font-weight: 800; font-size: 17px; color: var(--muted); border-top: 4px solid transparent; }
.tabs.five button { font-size: 13px; padding: 0 2px; }
.tabs button.on { color: var(--ink); border-top-color: var(--kid); }
body[data-view="parent"] .tabs button.on { border-top-color: var(--primary); }
.pip { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-style: normal; font-size: 13px; margin-left: 2px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 86px; transform: translate(-50%, 20px);
  width: min(92vw, 440px); z-index: 20; opacity: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--solid); color: #fff; border-radius: 14px; padding: 14px 16px;
  font-weight: 700; font-size: 16px; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; touch-action: none; cursor: grab; }
.toast.good { background: var(--green-ink); }
.toast.info { background: var(--primary); }
.toast button { background: #fff; color: #1f1a3d; border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 800; flex: none; }

/* ---------- Parent: PIN ---------- */
.pin { padding: 24px 16px; max-width: 340px; margin: 0 auto; text-align: center; }
.pin-dots { display: flex; justify-content: center; gap: 16px; margin-bottom: 24px; }
.pin-dots i { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--ink); }
.pin-dots i.on { background: var(--ink); }
.pin-dots.wrong { animation: nudge .35s; }
.pin-dots.wrong i { border-color: var(--red); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.keypad button { height: 68px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); font-size: 26px; font-weight: 800; }

/* ---------- Parent: segmented ---------- */
.seg { display: inline-flex; background: var(--soft); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; border-radius: 9px; padding: 8px 14px; font-weight: 800; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.seg.small { background: rgba(255,255,255,.15); }
.seg.small button { color: rgba(255,255,255,.8); padding: 6px 12px; }
.seg.small button.on { background: var(--card); color: var(--ink); }
.seg.big { display: flex; margin-bottom: 8px; }
.seg.big button { flex: 1; padding: 12px; font-size: 16px; }

/* ---------- Parent: requests ---------- */
.req { background: var(--card); border: 2px solid #f5d77a; border-radius: 16px; padding: 14px; margin-bottom: 12px; }

.req-meta { color: var(--muted); font-size: 14px; margin: 6px 0 12px; }
/* Like Android and iPhone: the main (yes) button on the right, the other one on the left */
.req-btns { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.req-btns button { min-height: 54px; border-radius: 12px; font-weight: 800; font-size: 17px; }
.req-btns .yes { background: var(--green); color: #fff; border: 0; }
.req-btns .no { background: var(--card); border: 2px solid var(--line); }

/* ---------- Parent: kids, items ---------- */
.kid-card { background: var(--card); border: 2px solid var(--line); border-left: 8px solid var(--c); border-radius: 16px; padding: 14px; margin-bottom: 14px; }
.kid-card-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.kid-card-head > b { font-size: 20px; }
.kid-card-head span { color: var(--muted); font-size: 14px; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.item img { width: 44px; height: 44px; flex: none; }
.item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item-info b { font-size: 15px; }
.item-info span { color: var(--muted); font-size: 13px; }
.item-btns { display: flex; gap: 6px; align-items: center; }
.drag-handle { flex: none; width: 28px; height: 44px; margin-right: -6px; border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1;
  cursor: grab; touch-action: none; padding: 0; border-radius: 8px; }
.drag-handle:hover { background: var(--soft); color: var(--ink); }
.item.dragging { background: var(--card); box-shadow: 0 8px 24px rgba(0,0,0,.25); border-radius: 12px; position: relative; z-index: 3; }
.item.dragging .drag-handle { cursor: grabbing; color: var(--primary); }
.item.drop-before { box-shadow: inset 0 3px 0 var(--primary); }
.item-list.drop-end > .item:last-child:not(.dragging), .item-list.drop-end > .item:nth-last-child(2):has(+ .dragging) { box-shadow: inset 0 -3px 0 var(--primary); }
body.drag-on { user-select: none; -webkit-user-select: none; cursor: grabbing; }
.sort-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 6px; }
.sort-row > span { font-weight: 700; color: var(--muted); }
.sort-row .hint { margin: 0; flex-basis: 100%; }
.item-btns .ghost { min-height: 40px; padding: 6px 12px; }

/* ---------- Parent: settings ---------- */
.panel { background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.panel h3 { margin: 0 0 6px; font-size: 18px; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.checkline { display: flex; align-items: center; gap: 10px; margin: 14px 0; font-size: 16px; }
.checkline input { width: 24px; height: 24px; accent-color: var(--primary); flex: none; }
.sched { display: flex; flex-direction: column; gap: 6px; }
.sched-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; font-weight: 700; }
.sched-row select { min-width: 0; padding: 8px 6px; }
.sched-row .to { color: var(--muted); font-weight: 600; }
input[type="time"], input:not([type]), input[type="number"], select {
  border: 2px solid var(--line); border-radius: 10px; padding: 10px; background: var(--field); min-height: 46px; width: 100%;
}
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; margin-top: 14px; }
.field small { color: var(--muted); font-weight: 600; }
.inline { display: flex; gap: 10px; }
.inline > * { flex: 1; }
.inline .primary { flex: none; }
.testing { border-style: dashed; }

/* ---------- Sheet (pop-up editor) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(12,10,28,.6); z-index: 30; }

.sheet-head { position: sticky; top: 0; background: var(--card); display: flex; align-items: center; justify-content: space-between; padding: 16px 0 8px; }
.sheet-head h2 { margin: 0; font-size: 20px; }
.icon-edit { display: flex; gap: 14px; align-items: flex-start; }
.icon-edit > img { width: 96px; height: 96px; border: 2px solid var(--line); border-radius: 16px; background: var(--field); padding: 6px; flex: none; }
.file-btn { display: inline-flex; align-items: center; }
.icon-edit .hint { margin: 10px 0 6px; }

.icon-pick button { width: 44px; height: 44px; padding: 4px; border-radius: 10px; border: 2px solid var(--line); background: var(--field); }
.icon-pick img { width: 100%; height: 100%; object-fit: contain; }
.icon-pick button.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.icon-pick { display: flex; flex-wrap: wrap; gap: 6px; max-height: 200px; overflow-y: auto; }
.stepper { display: grid; grid-template-columns: 56px 1fr 56px; gap: 8px; }
.stepper button { border-radius: 12px; border: 2px solid var(--line); background: var(--card); font-size: 24px; font-weight: 800; min-height: 50px; }
.stepper input { text-align: center; font-size: 20px; font-weight: 800; }

/* Keep focused fields clear of the sticky header and bottom tabs */
#main * { scroll-margin-top: 76px; scroll-margin-bottom: 90px; }

/* ---------- Kid notice (must be dismissed) ---------- */
/* News for the kid (a yes, a no, points): laid over the top of the screen wherever they've scrolled to, so the page
   doesn't move under their finger. "Got it" closes it. top is set under the header by kid.js. */
.notice {
  position: fixed; z-index: 20; left: 0; right: 0; top: 70px; margin: 0 auto; width: min(528px, calc(100% - 32px));
  max-height: calc(100dvh - 190px); overflow-y: auto; box-sizing: border-box;
  padding: 16px; border-radius: 18px; border: 3px solid; box-shadow: 0 12px 32px rgba(20, 16, 40, .35);
  display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center;
  animation: drop .35s ease-out;
}
@keyframes drop { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
.notice.plus { background: var(--green-soft); border-color: var(--green); }
.notice.minus { background: #fee2e2; border-color: #f87171; }
.notice.zero { background: #ede9fe; border-color: #a78bfa; }
.notice-pts { font-size: 34px; font-weight: 900; min-width: 64px; text-align: center; }
.notice-pts.word { font-size: 22px; line-height: 1.1; max-width: 80px; }
.notice.plus .notice-pts { color: var(--green-ink); }
.notice.minus .notice-pts { color: #991b1b; }
.notice.zero .notice-pts { color: #5b21b6; }
.notice-text { display: flex; flex-direction: column; gap: 4px; font-size: 18px; }
.notice-text span { font-size: 15px; color: var(--muted); font-weight: 600; }
.notice-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.notice-foot span { color: var(--muted); font-weight: 700; font-size: 14px; }
.got { flex: 1; min-height: 52px; border: 0; border-radius: 14px; background: var(--solid); color: #fff; font-weight: 800; font-size: 18px; }

/* ---------- Kid history ---------- */
.tabs.three { grid-template-columns: repeat(3, 1fr); }
.hist { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.hist-pts { font-weight: 900; font-size: 18px; text-align: center; border-radius: 10px; padding: 6px 0; }
.hist-pts.plus { background: var(--green-soft); color: var(--green-ink); }
.hist-pts.minus { background: #fee2e2; color: #991b1b; }
.hist-pts.zero { background: #ede9fe; color: #5b21b6; }
.hist.hold .hist-pts { background: #fff8e1; color: #92400e; }
.hist.spend .hist-pts { background: #dbeafe; color: #1e40af; }
.hist-text { display: flex; flex-direction: column; min-width: 0; font-size: 15px; }
.hist-text small { color: var(--muted); font-size: 13px; }
.hist time { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* ---------- Parent: removed entries ---------- */
.row s { text-decoration: none; }
.row.removed s { text-decoration: line-through; color: var(--muted); }

/* ---------- Pending chores ---------- */
.check.wait { background: #f59e0b; font-size: 14px; }
.pend-pts { font-size: 15px; color: #b45309; font-weight: 800; margin-top: 4px; }

.kidswitch button { flex: 1; padding: 12px; font-size: 17px; }
.kidswitch button.on { color: var(--c); }
.pend-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.primary.small, .danger.small { min-height: 40px; padding: 8px 14px; font-size: 15px; margin-top: 12px; }
.pend { display: grid; grid-template-columns: 48px 1fr auto auto; gap: 10px; align-items: center; background: var(--card); border: 2px solid #f5d77a; border-radius: 14px; padding: 10px; margin-bottom: 8px; }
.pend img { width: 48px; height: 48px; object-fit: contain; }
.pend-info { display: flex; flex-direction: column; min-width: 0; }
.pend-info b { font-size: 15px; }
.pend-info span { color: var(--muted); font-size: 13px; }
.pend button { min-height: 46px; border-radius: 12px; font-weight: 800; padding: 0 12px; }
.pend .yes { background: var(--green); color: #fff; border: 0; }
.pend .no { background: var(--card); border: 2px solid var(--line); }
.sheet .hist { padding: 8px 0; }

/* ---------- Parent header gear, setup switch, tab badges ---------- */
.gear { width: 44px; height: 44px; border-radius: 12px; border: 0; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; }
.gear.on { background: #fff; color: #1f1a3d; }
.setup-switch { display: flex; margin: 12px 16px 0; }
.setup-switch button { flex: 1; padding: 10px; font-size: 16px; }
.tab-label { position: relative; display: inline-block; }
.tab-label .pip { position: absolute; top: -10px; right: -24px; margin: 0; }
.parent-pick { width: 100%; border: 0; background: var(--brand); }
.center-text { text-align: center; margin-bottom: 22px; }

/* Pop-up open: the page behind can't scroll; the pop-up's own scrolling doesn't leak through. */
html { scrollbar-width: thin; } /* thin PC scrollbars only when needed; phones use overlay scrollbars */
html.sheet-open, html.sheet-open body { overflow: hidden; }

.sheet-backdrop { touch-action: none; }

/* ---------- Family fork ---------- */
.setup-switch button { font-size: 14px; padding: 10px 4px; }
.seg.wrap { flex-wrap: wrap; }
.who-line { color: var(--primary) !important; font-weight: 700; }
.who-box { background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-top: 16px; }
.who-box h4 { margin: 0; font-size: 16px; }
.who-box .checkline { margin: 10px 0 4px; }
.who-row { display: grid; grid-template-columns: 1fr 76px 76px; gap: 8px; align-items: center; margin-top: 8px; }
.who-row.head span { font-size: 12px; color: var(--muted); font-weight: 700; text-align: center; }
.who-row input[type="number"] { min-height: 42px; padding: 6px; text-align: center; font-weight: 800; }
.who-kid { display: flex; align-items: center; gap: 8px; font-weight: 800; min-width: 0; }
.who-kid input { width: 22px; height: 22px; accent-color: var(--primary); flex: none; }
.who-kid span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-box .hint { margin: 10px 0 0; }
.kid-dot { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 900; flex: none; }
.kid-dot.parent { background: var(--brand); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches button { width: 44px; height: 44px; border-radius: 50%; border: 3px solid transparent; }
.swatches button.on { border-color: var(--ink); box-shadow: inset 0 0 0 3px #fff; }
.kidswitch { display: flex; margin: 10px 0 14px; flex-wrap: wrap; }
.kidswitch button { min-width: 30%; }
.setup-switch button { font-size: 13px; white-space: nowrap; padding: 10px 2px; }
.who-row input::placeholder { color: #b9b4a6; font-weight: 600; }
.who-row.off input[type="number"] { opacity: .35; }
.who-row.off .who-kid span { opacity: .5; }
html { background: var(--bg); }

/* ---------- Avatars, nicknames, My look ---------- */
.avatar { display: block; flex: none; object-fit: contain; }
.badge.with-av { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 6px; max-width: 58vw; overflow: hidden; white-space: nowrap; }
.badge.with-av.big { font-size: 22px; padding: 8px 18px 8px 10px; gap: 10px; border: 2px solid var(--line); }

.pick.with-av { display: flex; align-items: center; justify-content: center; gap: 12px; }
.pick.with-av .avatar, .pick.with-av .kid-dot { background: #fff; border-radius: 50%; padding: 4px; }
.sw-in { display: inline-flex; align-items: center; gap: 6px; position: relative; }
.sw-in .pip { position: absolute; top: -10px; right: -18px; }
.req-top { font-size: 18px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.avatar-grid button { aspect-ratio: 1; border-radius: 14px; border: 3px solid var(--line); background: var(--field); padding: 6px; }
.avatar-grid button.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); background: #eef2ff; }

.swatches button.taken { opacity: .35; font-size: 14px; }
.look-preview { display: flex; justify-content: center; padding: 8px 0 4px; }
.nick-note { margin-top: 10px; background: var(--warn-bg); border: 2px solid #f5d77a; border-radius: 12px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 15px; }

.me-line { display: inline-flex; align-items: center; gap: 10px; background: none; border: 0; padding: 2px 8px; font-size: 24px; font-weight: 900; max-width: 100%; }
.me-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet .field + .field { margin-top: 18px; }
.kid-head .me-line { display: flex; margin: 0 auto 6px; justify-content: center; }
.pick.with-av .kid-dot { background: #fff !important; color: var(--c); }

/* Kid header: their animal + nickname replace the logo */
body[data-view="kid"] .brand { display: none; }
.me-chip { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; background: none; border: 0; padding: 0; text-align: left; }
.me-chip span { font-size: 20px; font-weight: 900; color: #fff !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-chip .avatar, .me-chip .kid-dot { background: #fff; border-radius: 50%; padding: 3px; box-shadow: 0 0 0 3px var(--kid); }

/* Never scroll sideways; grids shrink to fit narrow screens */
html, body { overflow-x: clip; max-width: 100%; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-height: 92dvh; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-bottom: 0; box-shadow: 0 -8px 40px rgba(0,0,0,.35); border-radius: 22px 22px 0 0; padding: 0 16px calc(20px + max(env(safe-area-inset-bottom), var(--sab, 0px))); max-width: 560px; margin: 0 auto; overscroll-behavior: contain; overflow-x: hidden; }
.avatar-grid { display: grid; gap: 8px; margin-top: 6px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.avatar-grid button { min-width: 0; }
.avatar-grid img { width: 100%; height: 100%; display: block; max-width: 100%; }
.icon-pick button { flex: none; }
[hidden] { display: none !important; }

/* Chores tab kid switch: tiles that fit any number of kids and name lengths */
.seg.kidswitch { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 4px; }
.kidswitch button { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; font-size: 14px; }
.sw-av { position: relative; display: block; }
.sw-av .pip { position: absolute; top: -6px; right: -12px; margin: 0; }
.sw-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg.big.wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 4px; }
.seg.big.wrap button { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Messages show above pop-ups (e.g. "There's already a parent named Mom") */
.toast { z-index: 40; }

/* Per day / per week */
.daily-tag { position: absolute; top: 8px; left: 8px; background: #e0e7ff; color: #3730a3; font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 999px; }
.per-switch { display: flex; margin: 2px 0 8px; }
.per-switch button { flex: 1; padding: 10px; font-size: 15px; }

/* ---------- Join your family ---------- */
.join { max-width: 360px; margin: 0 auto; padding: 32px 16px; text-align: center; }
.join input { text-align: center; font-size: 28px; font-weight: 800; letter-spacing: 3px; text-transform: uppercase; margin: 8px 0 4px; }
.join-err { color: var(--red); font-weight: 700; min-height: 22px; margin: 6px 0; }

/* ---------- Dark mode (Settings → Look) ---------- */
:root[data-theme="dark"] {
  --bg: #15132a; --card: #221f3d; --ink: #ece9ff; --muted: #a9a4c8; --line: #37335a;
  --brand: #2b2560; --soft: #2d2a4c; --field: #1b1834; --solid: #3a3470; --warn-bg: #3a2f12;
  --green-soft: #12351f; --green-ink: #86efac; --primary: #7c6ff0; --pts: #fb923c;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15132a; --card: #221f3d; --ink: #ece9ff; --muted: #a9a4c8; --line: #37335a;
    --brand: #2b2560; --soft: #2d2a4c; --field: #1b1834; --solid: #3a3470; --warn-bg: #3a2f12;
    --green-soft: #12351f; --green-ink: #86efac; --primary: #7c6ff0; --pts: #fb923c;
    color-scheme: dark;
  }
}
/* Light tinted boxes keep dark text so they stay readable in both looks */
.notice.minus, .notice.zero, .avatar-grid button.on { color: #1f1a3d; }
.notice.minus .notice-text span, .notice.zero .notice-text span, .notice.minus .notice-foot span, .notice.zero .notice-foot span { color: #4b4668; }

/* ---------- Swipe between tabs ---------- */
#main.slide-l > * { animation: slideL .18s ease-out; }
#main.slide-r > * { animation: slideR .18s ease-out; }
@keyframes slideL { from { transform: translateX(28px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes slideR { from { transform: translateX(-28px); opacity: .4; } to { transform: none; opacity: 1; } }
#main.slide-l > nav.tabs, #main.slide-r > nav.tabs { animation: none; }
.sheet .sim-link { display: block; text-align: center; margin-top: 14px; }

/* ---------- Screen Time ---------- */
.st-frame { position: fixed; left: 0; right: 0; width: 100%; border: 0; z-index: 4; background: var(--bg); }
.st-frame[hidden] { display: none; }
body.st-open { overflow: hidden; }
body.st-open > .status { visibility: hidden; }
.pc-pick { display: flex; margin: 12px 0 0; }
.pc-pick button { flex: 1; }
.pc-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.pc-name { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pc-name b { font-size: 17px; } .pc-name small { color: var(--muted); font-size: 13px; }
.pair-code { font-size: 44px; font-weight: 900; letter-spacing: 4px; text-align: center; margin: 8px 0 14px; font-variant-numeric: tabular-nums; }
.pair-steps { margin: 0 0 12px; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; font-size: 16px; line-height: 1.4; }
.pair-ok { font-size: 18px; font-weight: 800; color: var(--green); text-align: center; }

/* ---------- Kids: sort by points ---------- */
.sort-bar { display: flex; margin: 4px 0 12px; }
.sort-bar button { flex: 1; padding: 8px 4px; font-size: 14px; }

/* ---------- Reject all ---------- */
.pend-all { display: inline-flex; gap: 8px; }
.reject-list { margin: 0 0 12px; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; font-size: 16px; }
.reject-list small { color: var(--muted); font-weight: 700; }

/* ---------- Notifications question ---------- */
.push-ask { margin: 14px 16px 0; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 2px solid var(--line); display: flex; flex-direction: column; gap: 10px; font-weight: 700; }
.push-ask-btns { display: flex; gap: 8px; justify-content: flex-end; }
.small-btn { font-size: 14px; min-height: 40px; padding: 8px 14px; border-radius: 12px; font-weight: 800; }

/* ---------- Kid messages ---------- */
.send-msg { margin-top: 4px; }
.msg-left { margin: 6px 0 14px; }
.msg-row span { font-weight: 700; }
.msg-row small { color: var(--muted); font-weight: 600; }
.msg-text { font-size: 17px; margin: 8px 0 4px; line-height: 1.4; word-break: break-word; }
.req-btns.three { grid-template-columns: 1fr 1fr 1fr; }
.req-btns.three button { font-size: 15px; padding-left: 6px; padding-right: 6px; }
textarea { border: 2px solid var(--line); border-radius: 10px; padding: 10px; background: var(--field); width: 100%; font: inherit; color: inherit; resize: vertical; }

/* ---------- Counts next to list titles ---------- */
.title .count { color: var(--muted); font-weight: 700; }

/* ---------- Message history ---------- */
.hist-pts.icon { background: var(--soft); font-size: 18px; }
.msg-recent { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.msg-recent-top small, .msg-outcome { color: var(--muted); font-weight: 600; }
.msg-recent .msg-text { margin: 2px 0; font-size: 16px; }
.msg-reply { font-size: 15px; background: var(--soft); border-radius: 10px; padding: 6px 10px; }
.msg-recent .small-btn { margin-top: 4px; }

/* ---------- Change a checked chore ---------- */
.hist-flip { align-self: flex-start; padding: 4px 0; font-size: 14px; }
.linkbtn { white-space: nowrap; background: none; border: 0; color: var(--primary); font-weight: 800; font-size: 15px; padding: 8px 6px; cursor: pointer; }

/* ---------- Ask about this ---------- */
.ask-about { min-height: 52px; border-radius: 14px; border: 2px solid currentColor; background: transparent; font-weight: 800; font-size: 16px; padding: 0 14px; color: inherit; }

/* ---------- Icon picker ---------- */
.icon-btns { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.icon-btns .primary, .icon-btns .file-btn { min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 12px; font-weight: 700; padding: 8px 12px; cursor: pointer; }
.icon-browser { margin-top: 12px; padding: 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--card); }
.icon-browser input[type="search"] { width: 100%; border: 2px solid var(--line); border-radius: 10px; padding: 10px; min-height: 46px; background: var(--field); }
.icon-cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.icon-cats .chip { border: 2px solid var(--line); background: var(--field); border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 14px; }
.icon-cats .chip.on { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.icon-pick.big { max-height: 280px; margin-top: 8px; }
.icon-pick.big button { width: 52px; height: 52px; }
.icon-suggest { margin-top: 8px; }
.icon-suggest .hint { display: block; margin: 0 0 6px; }

/* ---------- Only once a day / rewards to give ---------- */
.card.resting { opacity: .75; }
.rest-tag { background: #fde68a !important; color: #92400e !important; }
.req.give { border-color: #a7f3d0; }
.req.give.old { border-color: #f59e0b; }
.req-btns.one { grid-template-columns: 1fr; }
.coming .pending-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ---------- Kid picture picker ---------- */
.avatar-picker .av-search { width: 100%; border: 2px solid var(--line); border-radius: 10px; padding: 10px; min-height: 46px; background: var(--field); margin-top: 6px; }
.avatar-picker .av-grid { max-height: 260px; overflow-y: auto; margin-top: 8px; }
.paint-row { display: flex; align-items: center; gap: 10px; }
.paint-row input[type="range"] { flex: 1; -webkit-appearance: none; appearance: none; height: 12px; border-radius: 999px; margin: 12px 0;
  background: linear-gradient(90deg, #f43f5e, #f59e0b, #84cc16, #10b981, #06b6d4, #6366f1, #d946ef, #f43f5e); }
.paint-row input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 3px solid #1f1a3d; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.paint-row input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 3px solid #1f1a3d; }

/* ---------- Must-do chores ---------- */
.must-box { border: 3px solid #f59e0b; background: var(--warn-bg); border-radius: 18px; padding: 10px 10px 12px; margin-bottom: 14px; }
.must-box.all-done { border-color: var(--green); background: var(--green-soft); }
.must-head { display: flex; justify-content: space-between; align-items: baseline; margin: 2px 4px 10px; font-size: 18px; }
.must-head span { font-size: 14px; color: var(--muted); font-weight: 700; }
.must-gate { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; border: 3px solid #f59e0b; background: var(--warn-bg); border-radius: 16px; padding: 12px 14px; margin-bottom: 14px; }
.must-gate span { color: var(--muted); font-weight: 600; }
.must-days { display: flex; margin: 0 0 10px; }
.must-days button { flex: 1; padding: 8px 0; }
.must-tag { color: #b45309; }

/* ---------- Daily points max ---------- */
.day-max { font-size: 14px; font-weight: 800; color: var(--muted); margin-top: 2px; }
.day-max.full { color: #b45309; }

/* ---------- Shared chores ---------- */
.shared-line { font-size: 12px; font-weight: 800; color: var(--muted); }
.card.taken { background: var(--soft) !important; border-color: var(--line) !important; opacity: .7; }
.card.taken img { filter: grayscale(1); }
label.file-btn.wide { display: flex; justify-content: center; align-items: center; cursor: pointer; }
.bad-text { color: var(--red); font-weight: 700; }
h4.sub { margin: 14px 0 4px; font-size: 15px; }
ul.changes { margin: 0; padding-left: 18px; color: var(--muted, #6b6585); font-size: 15px; line-height: 1.45; }
ul.changes b { color: var(--ink); margin-right: 4px; }
.set-groups { display: flex; flex-direction: column; gap: 10px; }
.set-group { display: grid; grid-template-columns: 1fr auto; text-align: left; background: var(--card); border: 1px solid var(--line, #e7e3f3); border-radius: 14px; padding: 14px 16px; color: var(--ink); cursor: pointer; }
.set-group b { font-size: 17px; }
.set-group small { grid-column: 1; color: var(--muted); font-size: 14px; margin-top: 2px; }
.set-group span { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 26px; color: var(--muted); }
.back-link { background: none; border: 0; color: var(--primary); font-weight: 700; font-size: 16px; padding: 6px 0; cursor: pointer; }
.once-tag { background: #ede9fe; color: #5b21b6; }
.once-tag.late { background: #fee2e2; color: var(--red); }
.done-box { margin-top: 14px; }
.done-box > summary { cursor: pointer; font-weight: 700; color: var(--muted); padding: 10px 2px; list-style: none; }
.done-box > summary::before { content: "▸ "; }
.done-box[open] > summary::before { content: "▾ "; }
.all-done-line { text-align: center; font-weight: 700; color: var(--muted); margin: 18px 0 4px; }

.list-search { width: 100%; margin: 12px 0 4px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 16px; }
.stats { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 14px; }
.stat-row { display: flex; gap: 8px; }
.stat { flex: 1; text-align: center; }
.stat b { display: block; font-size: 26px; color: var(--kid, var(--primary)); }
.stat span { font-size: 13px; color: var(--muted); }
.stat-line { margin: 10px 0 0; font-size: 15px; }
.idea { display: grid; grid-template-columns: auto 36px 1fr; gap: 10px; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.idea img { width: 36px; height: 36px; }
.idea b { display: block; font-size: 15px; }
.idea small { color: var(--muted); }
.idea.dup { opacity: .55; }
.idea input { width: 22px; height: 22px; }
.idea-ages { margin-top: 6px; }
.balance { margin-top: 14px; }
/* More options: a bordered row you open, well apart from Save */
.more-opts { margin-top: 18px; border: 2px solid var(--line); border-radius: 12px; padding: 0 12px; }
.more-opts > summary { cursor: pointer; font-weight: 700; color: var(--primary); padding: 12px 0; list-style: none; display: flex; align-items: center; gap: 8px; }
.more-opts > summary::-webkit-details-marker { display: none; }
.more-opts > summary::after { content: "▸"; margin-left: auto; font-size: 18px; }
.more-opts[open] > summary::after { content: "▾"; }
.more-opts[open] { padding-bottom: 12px; }
.more-opts + .primary.wide, .more-opts ~ #save { margin-top: 24px; }
.cat-chips { margin: 4px 0 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.cat-chips .chip { border: 2px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 14px; cursor: pointer; }
.cat-chips .chip.on { border-color: var(--kid, var(--primary)); box-shadow: inset 0 0 0 1px var(--kid, var(--primary)); }
.snd-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; margin-top: 10px; font-size: 15px; }
.snd-row select { max-width: 9.5em; }
.first-run { background: var(--card); border: 2px dashed var(--primary); border-radius: 16px; padding: 14px; margin: 16px 0 14px; }
.first-run h3 { margin: 0 0 6px; }
#who { align-items: center; display: flex; gap: 8px; }
.gear.help { font-size: 22px; font-weight: 800; }
.tour { position: fixed; inset: 0; z-index: 60; }
.tour-hole { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(15, 12, 35, .62); pointer-events: none; transition: all .2s; }
.tour-bubble { position: fixed; left: 14px; right: 14px; max-width: 420px; margin: 0 auto; background: var(--card); color: var(--ink); border-radius: 16px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.tour-head { display: flex; align-items: center; gap: 8px; background: var(--primary); color: #fff; padding: 8px 8px 8px 16px; }
.tour-head b { flex: 1; font-size: 17px; }
.tour-x { flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: #fff;
  font-size: 18px; line-height: 1; cursor: pointer; }
.tour-x:hover, .tour-x:focus-visible { background: rgba(255,255,255,.2); }
.tour-body { padding: 10px 16px 0; }
.tour-body p { margin: 0 0 8px; }
.tour-body p { line-height: 1.45; }
.tour-ex { display: inline-block; margin-top: 6px; font-weight: 800; }
.tour-btns { padding: 4px 16px 14px; }
.tour-btns { display: flex; gap: 8px; align-items: center; }
.tour-btns span { flex: 1; color: var(--muted); font-size: 14px; }
.tour-btns .small-btn { margin-top: 0; }
.seg.stats-span { margin-bottom: 12px; display: flex; width: 100%; }
.seg.stats-span button { flex: 1; white-space: nowrap; }
.top-chores { list-style: none; margin: 6px 0 0; padding: 0 0 0 14px; }
.by-type { list-style: none; margin: 6px 0 0; padding: 0 0 0 14px; }
.by-type li { display: grid; grid-template-columns: minmax(70px, 30%) 1fr auto; align-items: center; gap: 10px; padding: 4px 0; font-size: 15px; }
.by-type .bar { display: block; height: 10px; border-radius: 5px; background: linear-gradient(90deg, var(--primary) var(--w), var(--soft) var(--w)); }
.by-type small { color: var(--muted); white-space: nowrap; }
.top-chores li { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: 15px; }
.top-chores img { width: 28px; height: 28px; }
.top-chores small { margin-left: auto; color: var(--muted); }
.milestone { margin-top: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.milestone-top { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; }
.milestone-top span { color: #16a34a; font-weight: 800; }
.milestone .bar { display: block; margin: 8px 0 4px; }
.milestone small { color: var(--muted); }
.ms-row { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 15px; }
.ms-row input { width: 4em; padding: 8px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--field, var(--card)); color: var(--ink); font-size: 16px; }
.ms-row .icon-btn { margin-left: auto; }
.ms-row.ms-every { flex-wrap: wrap; }
.nw { white-space: nowrap; }
.word-panel { margin-top: 12px; }
.word-panel .seg.big.wrap { grid-template-columns: 1fr 1fr; }
.family-code { font-size: 30px; font-weight: 900; letter-spacing: 3px; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }

.setup .setup-kid { display: block; width: 100%; margin-top: 8px; }
.setup .field { margin-top: 14px; }
.join.setup { text-align: left; }
.join.setup .lead { text-align: center; }
.join.setup input { text-align: left; font-size: 17px; font-weight: 600; letter-spacing: 0; text-transform: none; margin: 0; }
.join.setup .setup-kid + .setup-kid { margin-top: 10px; }   /* space between the kids' names */
#setupMoreKid { margin-top: 10px; }
.join-new { margin-top: 8px; padding-top: 0; }
#setupPin { -webkit-text-security: disc; letter-spacing: 4px; }
.pin-msg { min-height: 22px; text-align: center; color: var(--red); font-weight: 700; margin: 8px 0 0; }
/* Checking the PIN: the dots light up green one after another, left to right, with "Connecting…" under them */
.pin-dots.checking i { border-color: var(--green); background: transparent; animation: pinSweep 1.1s ease-in-out infinite; }
.pin-dots.checking i:nth-child(2) { animation-delay: .15s; }
.pin-dots.checking i:nth-child(3) { animation-delay: .3s; }
.pin-dots.checking i:nth-child(4) { animation-delay: .45s; }
@keyframes pinSweep { 0%, 100% { background: transparent; transform: scale(1); } 25% { background: var(--green); transform: scale(1.2); } 55% { background: var(--green); transform: scale(1); } }
.pin-status { min-height: 20px; margin: -14px 0 12px; text-align: center; color: var(--green); font-weight: 800; font-size: 15px; }
@media (prefers-reduced-motion: reduce) { .pin-dots.checking i { animation: none; background: var(--green); } }
.recovery-code { font-size: 26px; font-weight: 900; letter-spacing: 2px; text-align: center; margin: 8px 0 12px; font-variant-numeric: tabular-nums; user-select: all; }
.invite-adult { margin-top: 12px; padding: 12px 14px; border: 2px dashed var(--line); border-radius: 14px; font-size: 15px; }
.invite-adult ol { margin: 6px 0 0; padding-left: 20px; }
.invite-adult li { margin: 3px 0; }
button.pend-pts, button.held { background: none; border: 0; padding: 4px 8px; cursor: pointer; font: inherit; }
button.pend-pts { font-size: 15px; font-weight: 800; color: #b45309; }
.hist-filters { margin: 4px 0 8px; flex-wrap: wrap; }
.msg-kinds { grid-template-columns: 1fr !important; }

/* Subscription: the free month's last week, and read-only */
.bill-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 12px; padding: 10px 12px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font-size: 15px; }
.bill-bar.over { border-color: var(--red); }
.bill-bar button { margin-left: auto; padding: 6px 14px; min-height: 0; }
.bill-status { font-weight: 800; font-size: 18px; margin: 4px 0; }
.bill-status.good { color: var(--green); }
.bill-status.bad { color: var(--red); }
#billingPanel [data-plan] small { font-weight: 600; opacity: .85; }

/* Subscription: a message across the top, a spinner in a button while Stripe's page opens, and a cancelled plan */
.top-note { position: fixed; z-index: 60; top: calc(10px + var(--sat, 0px)); left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 24px));
  display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; border-radius: 14px; background: #3b3470; color: #fff;
  font-weight: 700; box-shadow: 0 8px 28px rgba(0,0,0,.25); animation: drop .25s ease-out; }
.top-note.good { background: var(--green); color: #fff; }
.top-note span { flex: 1; }
.top-note button { background: transparent; border: 0; color: inherit; font-size: 18px; padding: 4px 8px; min-height: 0; cursor: pointer; }
.btn-spin { display: inline-block; width: 16px; height: 16px; margin: 0 8px -3px 0; border-radius: 50%; border: 3px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
button.busy { opacity: 1 !important; }
.bill-status.warn { color: var(--amber, #b45309); }
#billCancel { margin-top: 14px; }

.change-email { margin: 8px 0 10px; } .change-email summary { cursor: pointer; font-weight: 700; color: var(--primary); padding: 6px 0; }

/* Start screen: Take a tour / Try the demo */
.join-try { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.join-try + .hint { margin-top: 14px; }
.join-try a { display: block; text-align: center; text-decoration: none; padding: 12px 10px; border-radius: 12px; font-weight: 800; border: 2px solid var(--line); color: var(--ink); background: var(--card); }

/* ---------- Little celebrations (js/fx.js) ---------- */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.fx-card { position: fixed !important; margin: 0; box-sizing: border-box; pointer-events: none; }
.fx-pop { animation: fxSquish .55s cubic-bezier(.3,1.6,.5,1) both, fxFade .3s ease-in .75s forwards; background: var(--green-soft); border-color: var(--green); }
.fx-pop img { animation: fxWiggle .6s ease-in-out .05s; }
.fx-check { animation: fxCheck .45s cubic-bezier(.3,1.8,.5,1) .12s both; }
.fx-plain { animation: fxGlow 1s ease both; border-color: var(--green); }
.fx-plain .fx-check { animation: none; }
@keyframes fxSquish { 0% { transform: scale(1); } 22% { transform: scale(1.06, .86); } 50% { transform: scale(.95, 1.07); } 75% { transform: scale(1.02, .98); } 100% { transform: scale(1); } }
@keyframes fxWiggle { 0%, 100% { transform: none; } 20% { transform: rotate(-12deg) scale(1.12); } 40% { transform: rotate(10deg) scale(1.15) translateY(-6px); } 60% { transform: rotate(-6deg) scale(1.08); } 80% { transform: rotate(3deg); } }
@keyframes fxCheck { from { transform: scale(0) rotate(-40deg); } to { transform: none; } }
@keyframes fxFade { to { opacity: 0; } }
@keyframes fxGlow { 0% { box-shadow: 0 0 0 0 var(--green); background: var(--green-soft); } 70% { box-shadow: 0 0 0 6px var(--green); background: var(--green-soft); opacity: 1; } 100% { opacity: 0; } }
.fx-star { position: fixed; font-size: 22px; line-height: 1; transform: translate(-50%, -50%); animation: fxStar .75s ease-out both; }
@keyframes fxStar { 0% { transform: translate(-50%, -50%) scale(.2); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(90deg); opacity: 0; } }
.fx-plus { position: fixed; font-size: 34px; font-weight: 900; color: var(--green); text-shadow: 0 2px 0 #fff, 0 0 8px rgba(255,255,255,.8);
  transform: translate(-50%, -50%); animation: fxPlus 1.15s cubic-bezier(.4,0,.3,1) .1s both; }
@keyframes fxPlus { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; } 18% { transform: translate(-50%, -80%) scale(1.25); opacity: 1; } 75% { opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.7); opacity: 0; } }
.fx-confetti { position: fixed; top: -14px; width: 9px; height: 14px; border-radius: 2px; animation: fxFall 2s cubic-bezier(.25,.6,.5,1) both; }
@keyframes fxFall { to { transform: translate(var(--dx), 105vh) rotate(var(--rot)); } }
@media (prefers-reduced-motion: reduce) { .card.nudge { animation: none; } }

.ms-kid { display: block; margin: 4px 0; font-size: 15px; color: var(--ink); }

/* A chore the server is saving: a spinner in the corner until it's done */
.card.saving::after { content: ""; position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .card.saving::after { animation-duration: 2s; } }

.pin-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.pin-row input { width: 9em; }

/* Computers and tablets: the pop-up is a box in the middle of the screen (phones keep it sliding up from the bottom) */
@media (min-width: 700px) and (min-height: 500px) {
  .sheet { top: 50%; bottom: auto; transform: translateY(-50%); max-height: 86dvh; border-radius: 22px; border-bottom: 1px solid var(--line);
    box-shadow: 0 20px 60px rgba(0,0,0,.45); padding-bottom: 20px; }
}
.sheet { --field: var(--bg); }   /* text boxes are wells of the page color inside the lighter pop-up */
/* Pop-up title bar: the same colored bar as the ? help cards, edge to edge, with white ? and ✕ */
.sheet .sheet-head { background: var(--primary); color: #fff; margin: 0 -16px 12px; padding: 10px 10px 10px 16px; gap: 8px; z-index: 2; }
.sheet .sheet-head h2 { flex: 1; color: #fff; }
.sheet .sheet-head .icon-btn { background: transparent; border-color: rgba(255,255,255,.5); color: #fff; }
.sheet .sheet-head .icon-btn:hover, .sheet .sheet-head .icon-btn:focus-visible { background: rgba(255,255,255,.2); }
@media (max-width: 699px) {
  .sheet.tall { min-height: calc(100dvh - 64px); display: flex; flex-direction: column; }
  .sheet.tall .sheet-body { flex: 1; display: flex; flex-direction: column; }
  .sheet.tall #save, .sheet.tall #kSave { margin-top: auto; }
  .sheet.tall .more-opts, .sheet.tall .sheet-body > * { flex: none; }
  .sheet.tall .sheet-body > :has(+ #save), .sheet.tall .sheet-body > :has(+ #kSave) { margin-bottom: 24px; }
}

/* Point values and 💡 Help me pick */
.inline-num { display: flex; align-items: center; gap: 8px; }
.inline-num input { width: 110px; }
.pts-help-btn { margin: -4px 0 8px; font-size: 15px; }
.pts-help { background: var(--soft); border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; }
.pts-help .help-row { display: flex; flex-wrap: wrap; min-height: 44px; align-items: center; gap: 8px; margin: 4px 0 8px; }
.pts-help .help-row label { display: flex; align-items: center; gap: 6px; margin: 0; }
.pts-help .help-row input { width: 62px; padding: 8px 6px; }
.pts-help .help-row { font-size: 15px; }
.pts-help .hint { margin: 4px 0 0; }
.pts-help .help-use { padding: 6px 10px; margin-left: auto; }
.flash { animation: flash 0.8s; }
@keyframes flash { 0%, 100% { box-shadow: none; } 30% { box-shadow: 0 0 0 4px var(--primary); } }

/* two equal buttons side by side (Cancel, OK) */
.two-btns { display: flex; gap: 10px; margin-top: 12px; }
.two-btns button { flex: 1; margin: 0; }
