/* Layout: one-column phone app that opens to two columns on tablets; bottom tab bar, big tap targets. */
:root {
  --bg: #F3F5FA;
  --surface: #FFFFFF;
  --surface-2: #EBEFF7;
  --ink: #1B2140;
  --ink-2: #5A6285;
  --line: #DCE1EE;
  --primary: #0F766E;
  --primary-ink: #FFFFFF;
  --primary-soft: #D3F0EB;
  --star: #E89A06;
  --star-soft: #FEF1C7;
  --ok: #15803D;
  --ok-soft: #DCF5E3;
  --warn: #B45309;
  --warn-soft: #FDEBD3;
  --danger: #C2262E;
  --p-resp: #2563EB;
  --p-kind: #DB2777;
  --p-disc: #7C3AED;
  --p-grow: #4D8B0B;
  --p-fam: #E2550B;
  --shadow: 0 1px 2px rgba(27, 33, 64, .06), 0 6px 18px rgba(27, 33, 64, .07);
  --font-display: "Baloo Da 2", "Hind Siliguri", system-ui, sans-serif;
  --font-body: "Hind Siliguri", "Baloo Da 2", system-ui, sans-serif;
  --r-lg: 22px;
  --r-md: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1324; --surface: #171D33; --surface-2: #212944; --ink: #EEF1FA; --ink-2: #A4ACC9; --line: #2B3456;
    --primary: #2DD4BF; --primary-ink: #04201D; --primary-soft: #123B38;
    --star: #FBBF24; --star-soft: #3A2F0D; --ok: #4ADE80; --ok-soft: #12321F; --warn: #FBBF24; --warn-soft: #3A2B0D; --danger: #F87171;
    --p-resp: #60A5FA; --p-kind: #F472B6; --p-disc: #A78BFA; --p-grow: #A3E635; --p-fam: #FB923C;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 22px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1324; --surface: #171D33; --surface-2: #212944; --ink: #EEF1FA; --ink-2: #A4ACC9; --line: #2B3456;
  --primary: #2DD4BF; --primary-ink: #04201D; --primary-soft: #123B38;
  --star: #FBBF24; --star-soft: #3A2F0D; --ok: #4ADE80; --ok-soft: #12321F; --warn: #FBBF24; --warn-soft: #3A2B0D; --danger: #F87171;
  --p-resp: #60A5FA; --p-kind: #F472B6; --p-disc: #A78BFA; --p-grow: #A3E635; --p-fam: #FB923C;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 22px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; text-wrap: balance; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }

#app { max-width: 1080px; margin: 0 auto; padding-inline: 16px; padding-block: 12px 104px; min-height: 100%; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 12px; padding-block: 6px 14px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 40px; height: 40px; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; letter-spacing: .2px; }
@media (max-width: 400px) { .brand-name small { display: none !important; } }
.brand-name small { display: block; font-family: var(--font-body); font-weight: 500; font-size: .8rem; color: var(--ink-2); letter-spacing: 0; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 10px 18px; font-weight: 700; min-height: 44px; background: var(--surface-2); color: var(--ink); }
.btn svg { width: 20px; height: 20px; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-ok { background: var(--ok); color: var(--surface); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-danger { background: transparent; color: var(--danger); border: 2px solid var(--danger); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: .9rem; }
.btn-block { width: 100%; }
.icon-btn { border: 0; background: var(--surface-2); width: 44px; height: 44px; border-radius: 999px; display: inline-grid; place-items: center; color: var(--ink-2); flex: none; }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.section-title { display: flex; align-items: baseline; gap: 10px; font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; margin: 6px 2px 0; }
.section-title .muted { font-family: var(--font-body); font-size: .9rem; font-weight: 500; }

.banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--star-soft); border-radius: var(--r-md); padding: 12px 14px; }
.banner p { margin: 0; flex: 1 1 240px; min-width: 0; }

/* ---------- profile picker ---------- */
.hero-q { font-size: clamp(1.6rem, 5vw, 2.2rem); font-weight: 800; margin: 8px 2px 4px; }
.profiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 14px; }
.profile { text-align: left; border: 0; background: var(--surface); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; transition: transform .15s ease; }
.profile:hover { transform: translateY(-2px); }
.profile:active { transform: scale(.98); }
.profile .who { display: flex; align-items: center; gap: 12px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 2.1rem; background: var(--primary-soft); flex: none; }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar svg { width: 26px; height: 26px; color: var(--ink-2); }
.avatar.sm { width: 44px; height: 44px; font-size: 1.45rem; }
.profile .nm { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; line-height: 1.1; }
.profile.parent .avatar { background: var(--surface-2); color: var(--ink-2); }
.profile.parent .avatar svg { width: 30px; height: 30px; }

.bar { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--star), var(--primary)); border-radius: inherit; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.bar.thin { height: 8px; }

/* ---------- kid view ---------- */
.kid-head { display: flex; align-items: center; gap: 12px; padding-block: 4px 14px; }
.kid-head h1 { font-size: 1.6rem; font-weight: 800; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kid-head .btn-sm, .topbar .btn-sm { padding-inline: 12px; flex: none; }
.topbar .brand { min-width: 0; }
.starcount { display: inline-flex; align-items: center; gap: 6px; background: var(--star-soft); color: var(--ink); border-radius: 999px; padding: 6px 14px 6px 8px; font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; }
.starcount svg { width: 26px; height: 26px; color: var(--star); }
.kid-grid { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 760px) {
  .kid-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
  .kid-grid .gift-col { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 12px); }
}

.gift { display: flex; flex-direction: column; gap: 14px; }
.gift-art { position: relative; aspect-ratio: 4 / 3; max-width: 100%; border-radius: 18px; overflow: hidden; background: var(--surface-2); }
.gift-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gift-art .g-base { filter: grayscale(1) blur(1.5px); opacity: .38; }
.gift-art .g-fill { transition: clip-path .9s cubic-bezier(.2,.8,.2,1); }
.gift-art .g-line { position: absolute; left: 0; right: 0; height: 3px; background: var(--star); box-shadow: 0 0 12px var(--star); transition: bottom .9s cubic-bezier(.2,.8,.2,1); }
.gift-art .pct { position: absolute; right: 12px; top: 12px; background: var(--surface); border-radius: 999px; padding: 4px 12px; font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; box-shadow: var(--shadow); }
.gift-label { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.gift-name { font-size: 1.5rem; font-weight: 800; }
.gift .bar { height: 16px; }
.gift-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 600; }
.gift.reached .gift-art { outline: 4px solid var(--star); }

.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.task { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: var(--r-md); padding: 12px 12px 12px 14px; box-shadow: var(--shadow); min-height: 72px; }
.task .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--star); flex: none; box-shadow: 0 0 0 4px var(--star-soft); }
.task .body { flex: 1; min-width: 0; }
.task .ttl { font-weight: 600; font-size: 1.05rem; line-height: 1.3; overflow-wrap: anywhere; }
.task .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .82rem; color: var(--ink-2); margin-top: 2px; }
.task .plbl { color: var(--pc); font-weight: 700; }
.task .pts { font-family: var(--font-display); font-weight: 800; color: var(--star); }
.task.is-approved { opacity: .72; }
.task.is-approved .ttl { text-decoration: line-through; text-decoration-color: var(--ink-2); }
.done-btn { min-width: 96px; font-size: 1.05rem; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: .85rem; white-space: nowrap; }
.pill svg { width: 16px; height: 16px; }
.pill-wait { background: var(--warn-soft); color: var(--warn); }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-count { background: var(--danger); color: var(--surface); padding: 1px 7px; font-size: .75rem; min-width: 20px; justify-content: center; }

.p-resp { --pc: var(--p-resp); } .p-kind { --pc: var(--p-kind); } .p-disc { --pc: var(--p-disc); } .p-grow { --pc: var(--p-grow); } .p-fam { --pc: var(--p-fam); }
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: .8rem; font-weight: 700; color: var(--pc); background: color-mix(in srgb, var(--pc) 14%, transparent); }

.pillars { display: flex; flex-direction: column; gap: 14px; }
.pillar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; }
.pillar-row .bar { grid-column: 1 / -1; height: 14px; }
.pillar-row .bar > i { background: var(--pc); }
.pillar-row .nm { font-weight: 700; }
.pillar-row .v { font-family: var(--font-display); font-weight: 800; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* ---------- bottom nav ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); }
.tabbar .in { max-width: 720px; margin: 0 auto; display: flex; justify-content: space-around; gap: 4px; }
.tab { flex: 1; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 14px; color: var(--ink-2); font-size: .78rem; font-weight: 700; position: relative; min-width: 0; }
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }
.tab .pill-count { position: absolute; top: 2px; left: calc(50% + 6px); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-weight: 700; font-size: .9rem; color: var(--ink-2); }
.input, select.input, textarea.input { width: 100%; border: 2px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 12px; min-height: 46px; }
.input:focus { border-color: var(--primary); outline: none; }
textarea.input { min-height: 110px; font-family: ui-monospace, monospace; font-size: .8rem; }
.grid2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); }
.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pick label { cursor: pointer; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick .opt { display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--line); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: .9rem; }
.pick input:checked + .opt { border-color: var(--pc, var(--primary)); background: color-mix(in srgb, var(--pc, var(--primary)) 14%, transparent); }
.pick input:focus-visible + .opt { outline: 3px solid var(--primary); outline-offset: 2px; }
.pick.avatars .opt { font-size: 1.6rem; width: 52px; height: 52px; justify-content: center; padding: 0; }

/* ---------- parent ---------- */
.ptabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.childchips { display: flex; gap: 8px; flex-wrap: wrap; }
.childchip { border: 2px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 14px 4px 4px; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.childchip .avatar { width: 34px; height: 34px; font-size: 1.15rem; }
.childchip[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.check-item { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.check-item .grow { flex: 1 1 200px; min-width: 0; }
.parent-grid { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 860px) { .parent-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.gift-edit { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .gift-edit { grid-template-columns: minmax(0, 220px) minmax(0, 1fr); } }
.photo-box { position: relative; aspect-ratio: 4 / 3; max-width: 100%; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.photo-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- pin pad ---------- */
.pin-wrap { max-width: 360px; margin: 6vh auto 0; text-align: center; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.pin-dots { display: flex; gap: 14px; justify-content: center; }
.pin-dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink-2); }
.pin-dots i.on { background: var(--primary); border-color: var(--primary); }
.pin-dots.shake { animation: shake .4s; }
.pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; justify-content: center; }
.pad button { width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow); font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; }
.pad button:active { background: var(--primary-soft); }
.pad .blank { visibility: hidden; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- modal, toast, fx ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 40; background: rgba(10, 14, 30, .45); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
@media (min-width: 640px) { .modal-bg { align-items: center; } }
.modal { background: var(--surface); width: 100%; max-width: 480px; border-radius: var(--r-lg); padding: 20px; max-height: 88vh; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); border-radius: 999px; padding: 10px 10px 10px 18px; display: flex; align-items: center; gap: 12px; font-weight: 600; box-shadow: var(--shadow); max-width: calc(100% - 32px); animation: rise .25s ease; }
.toast button { border: 0; background: transparent; color: var(--star); font-weight: 800; padding: 4px 8px; }
.toast:not(:has(button)) { padding-right: 18px; }
@keyframes rise { from { transform: translate(-50%, 12px); opacity: 0; } }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.pop { animation: pop .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }
.celebrate { text-align: center; align-items: center; }
.celebrate .big { font-size: 4rem; line-height: 1; }
.empty { text-align: center; color: var(--ink-2); padding: 24px 12px; }

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

@media (max-width: 400px) { .kid-head h1 { font-size: 1.25rem; } .kid-head { gap: 8px; } }

/* ---------- older child: wishlist, gift stages, family sync ---------- */
a { color: var(--primary); font-weight: 600; word-break: break-word; }
.kid-tabs { margin: 0 0 14px; }
.wishes li { align-items: flex-start; }
.wish-img { width: 72px; height: 72px; border-radius: var(--r-md); background: var(--primary-soft); display: grid; place-items: center; overflow: hidden; flex: none; color: var(--primary); }
.wish-img img { width: 100%; height: 100%; object-fit: cover; }
.wish-img svg { width: 28px; height: 28px; }
.wish-note { background: var(--warn-soft); border-radius: var(--r-md); padding: 8px 12px; font-size: .92rem; margin-top: 6px; }
.pill-bad { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.pill-info { background: var(--primary-soft); color: var(--primary); }
.pill-star { background: var(--star-soft); color: var(--warn); }
.commit-box { background: var(--star-soft); border-left: 4px solid var(--star); border-radius: var(--r-md); padding: 12px 14px; font-weight: 600; }
.code-big { font-family: var(--font-display); font-size: 2.8rem; font-weight: 800; letter-spacing: .3em; text-align: center; color: var(--primary); padding: 8px 0; }
[hidden] { display: none !important; }
