/* Family Hub. Yoto brand language: fruit-punch coral, marshmallow, wool greys,
   primary card colours, Castledown type, chunky rounded shapes. */
@font-face { font-family: 'Castledown'; font-weight: 400; font-display: swap; src: local('Castledown Regular'), local('Castledown'), url('/fonts/castledown-regular.woff2') format('woff2'); }
@font-face { font-family: 'Castledown'; font-weight: 700; font-display: swap; src: local('Castledown Bold'), url('/fonts/castledown-bold.woff2') format('woff2'); }
@font-face { font-family: 'Castledown'; font-weight: 900; font-display: swap; src: local('Castledown Heavy'), url('/fonts/castledown-heavy.woff2') format('woff2'); }

:root {
  --punch: #f45436; --punch-hover: #d7543b; --punch-deep: #e92f0c;
  --marsh: #efeee9; --marsh-2: #deddd8; --peach: #ffdac5;
  --wool: #eae6e6; --wool-60: #938e8e; --ink: #1e1c1c; --ink-2: #4a4848; --white: #fff;
  --blue: #1471d9; --forest: #003c1f; --green: #2fb36b; --yellow: #ffc62c; --pink: #ff8fc1; --orange: #ff8a1f;
  --surface: #fff; --bg: var(--marsh); --line: var(--wool);
  --r-sm: .75rem; --r: 1.25rem; --r-lg: 1.75rem;
  --display: 'Castledown', 'Fredoka', ui-rounded, system-ui, sans-serif;
  --body: 'Castledown', 'Nunito', ui-rounded, system-ui, sans-serif;
  /* spacing scale: everything below uses these, so gaps grow with the type */
  --s1: .5rem; --s2: .75rem; --s3: 1.25rem; --s4: 2rem;
  --pad: clamp(16px, 3vw, 72px); /* page edges + buddy corner */
  --gap: var(--s3);
  --card-pad: clamp(18px, 1.6rem, 44px);
  --buddy: 192px; --buddy-lift: var(--pad); /* corner buddy size + its gap to the bottom edge */
  --tap: max(48px, 2.9rem); /* minimum touch target */
  --shadow: none;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: clamp(17px, .9vw + 8px, 30px); -webkit-tap-highlight-color: transparent; }
body { min-height: 100dvh; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
h1, h2, h3 { font-family: var(--display); font-weight: 900; letter-spacing: -.01em; margin: 0; line-height: 1.05; }
h1 { font-size: clamp(1.7rem, 3vw, 3rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; font-weight: 700; }
.muted { color: var(--wool-60); }
.px { image-rendering: pixelated; display: block; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.app { min-height: 100dvh; padding: var(--pad) var(--pad) calc(var(--buddy-lift) + var(--buddy) + var(--pad)); }
.top { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.logo { width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--punch); display: grid; place-items: center; flex: none; }
.logo svg { width: 60%; height: 60%; }
.top .clock { margin-left: auto; text-align: right; font-family: var(--display); font-weight: 900; font-size: clamp(2.2rem, 4.5vw, 4.5rem); line-height: .95; letter-spacing: -.02em; }
.top .clock small { display: block; font-family: var(--body); font-weight: 700; font-size: 1rem; letter-spacing: 0; color: var(--wool-60); margin-top: var(--s1); }

.tabs { position: fixed; z-index: 20; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 4px; padding: 6px; background: var(--ink); border-radius: 999px; max-width: calc(100vw - 20px); overflow-x: auto; }
.tabs a { min-height: var(--tap); color: #fff; text-decoration: none; padding: 0 1.1em; border-radius: 999px; font-weight: 700; font-size: 0.882rem; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.tabs a svg { width: 1.3em; height: 1.3em; }
.tabs { gap: var(--s1); padding: var(--s1); bottom: var(--pad); }
.tabs a.on { background: var(--punch); }
@media (max-width: 620px) { .tabs a span { display: none; } .tabs a { padding: 0 .9em; } }

.grid { display: grid; gap: var(--gap); }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.card { background: var(--surface); border-radius: var(--r); padding: var(--card-pad); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s3); }
.card-head .spacer { flex: 1; }

.btn { min-height: var(--tap); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; padding: 0 1.2em; font-weight: 700; background: var(--punch); color: #fff; transition: transform .15s, background .15s; }
.btn:hover { background: var(--punch-hover); }
.btn:active { transform: scale(.96); }
.btn.ghost { background: var(--marsh); color: var(--ink); }
.btn.ghost:hover { background: var(--marsh-2); }
.btn.dark { background: var(--ink); }
.btn.small { padding: 8px 14px; font-size: 0.824rem; }
.btn.icon { width: var(--tap); height: var(--tap); padding: 0; flex: none; }
.btn svg { width: 1.35em; height: 1.35em; }
.btn:disabled { opacity: .45; pointer-events: none; }

.field { display: grid; gap: var(--s1); margin-bottom: var(--s3); }
.field label { font-weight: 700; font-size: 0.824rem; }
.input, select.input, textarea.input { width: 100%; border: 2px solid var(--wool); background: #fff; border-radius: var(--r-sm); padding: 0 .9em; min-height: var(--tap); outline: none; }
textarea.input { padding: .7em .9em; }
.input:focus { border-color: var(--ink); }
.row { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 140px; }
input[type=checkbox] { appearance: none; -webkit-appearance: none; margin: 0; flex: none; width: 1.7em; height: 1.7em; border: 3px solid var(--ink); border-radius: 9px; background: #fff center / 72% no-repeat; cursor: pointer; transition: background-color .2s; }
input[type=checkbox]:checked { background-color: var(--green); border-color: var(--green); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
label.row:has(input[type=checkbox]) { min-height: var(--tap); cursor: pointer; }
.pill { display: inline-flex; align-items: center; gap: .4em; padding: .35em .8em; border-radius: 999px; font-size: 0.765rem; font-weight: 700; background: var(--marsh); }
.dot { width: .6rem; height: .6rem; border-radius: 50%; flex: none; }
.empty { text-align: center; padding: 28px 10px; color: var(--wool-60); }
.empty .px { margin: 0 auto 10px; }
.notice { background: var(--peach); border-radius: var(--r-sm); padding: 12px 14px; font-size: 0.882rem; }
.err { background: #ffe1db; color: #9c1e08; }

/* ---------- today: live schedule ---------- */
.live-head { display: flex; align-items: baseline; gap: 10px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--punch); position: relative; top: -2px; }
.live-dot::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--punch); animation: ping 1.6s ease-out infinite; }
@keyframes ping { to { transform: scale(2.6); opacity: 0; } }
.sched { display: grid; gap: var(--s1); }
.sched-row { min-height: var(--tap); display: grid; grid-template-columns: 4.6rem 6px 2.8rem 1fr auto; gap: var(--s3); align-items: center; padding: var(--s2); border-radius: var(--r-sm); transition: background .2s, transform .2s; }
.sched-row:hover { background: var(--marsh); }
.sched-row > .px { width: 2.8rem; height: 2.8rem; }
@media (max-width: 620px) {
  .sched-row { grid-template-columns: 4.2rem 2.4rem 1fr auto; gap: 8px; padding: 8px 4px; }
  .sched-row .sched-bar { display: none; }
  .sched-row > .px { width: 2.4rem; height: 2.4rem; }
  .sched-time { font-size: 1.0rem; }
  .badge { font-size: 0.588rem; padding: 4px 7px; }
  .top h1 { font-size: 1.412rem; }
  .top .clock { font-size: 1.176rem; }
}
.sched-row.now { background: #fff3ee; }
.sched-row.past { opacity: .5; }
.sched-time { font-family: var(--display); font-weight: 900; font-size: 1.294rem; text-align: right; }
.sched-bar { height: 100%; min-height: 40px; border-radius: 3px; background: var(--wool); position: relative; overflow: hidden; }
.sched-bar i { position: absolute; left: 0; top: 0; width: 100%; background: var(--c, var(--punch)); }
.sched-title { font-weight: 700; }
.sched-meta { font-size: 0.824rem; color: var(--wool-60); }
.badge { font-size: 0.706rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; padding: 5px 10px; border-radius: 999px; border: 2px solid var(--wool); white-space: nowrap; }
.badge.now { background: var(--punch); border-color: var(--punch); color: #fff; display: inline-flex; gap: 6px; align-items: center; }
.badge.now::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.badge.next { border-color: var(--punch); color: var(--punch-deep); }
.badge.tonight { border-color: var(--blue); color: var(--blue); }
.badge.done { color: var(--wool-60); }

/* ---------- week calendar ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--s2); }
.day { background: #fff; border-radius: var(--r-sm); padding: .6rem; min-height: 12rem; display: flex; flex-direction: column; gap: var(--s1); }
.day.today { outline: 3px solid var(--punch); }
.day-h { display: flex; align-items: baseline; justify-content: space-between; font-weight: 700; }
.day-add { margin-top: auto; min-height: calc(var(--tap) * .8); border-radius: 10px; color: var(--wool-60); display: grid; place-items: center; }
.day-add:hover { background: var(--marsh); color: var(--ink); }
.day-add svg { width: 1.3em; height: 1.3em; }
.day-h b { font-family: var(--display); font-size: 1.6rem; font-weight: 900; }
.ev { min-height: var(--tap); text-align: left; border-radius: 10px; padding: .45em .5em; background: color-mix(in srgb, var(--c) 16%, white); border: 0; display: grid; grid-template-columns: 1.4em 1fr; gap: 6px; align-items: start; font-size: 0.824rem; line-height: 1.2; }
.ev .px { width: 1.4em; height: 1.4em; }
.ev b { display: block; font-weight: 700; }
.ev small { color: var(--ink-2); }
@media (max-width: 860px) {
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; }
}
.legend { display: flex; flex-wrap: wrap; gap: var(--s1); }
.seg { display: inline-flex; background: var(--marsh); border-radius: 999px; padding: 4px; }
.seg button { min-height: calc(var(--tap) - 8px); padding: 0 1.1em; border-radius: 999px; font-weight: 700; }
.seg button.on { background: #fff; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--s1); }
.month-dow { font-weight: 700; color: var(--wool-60); padding: 0 var(--s1); }
.mday { background: #fff; border-radius: var(--r-sm); padding: var(--s1); min-height: 6rem; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mday.out { background: transparent; }
.mday.out .mday-n { color: var(--wool-60); }
.mday.today { outline: 3px solid var(--punch); }
.mday-n { align-self: flex-start; min-width: 2.2rem; min-height: 2.2rem; border-radius: 999px; font-family: var(--display); font-weight: 900; font-size: 1.1rem; }
.mday.today .mday-n { background: var(--punch); color: #fff; }
.mday-n:hover { background: var(--marsh); }
.mchip { display: flex; align-items: center; gap: 4px; min-height: 1.9rem; padding: 0 6px; border-radius: 8px; background: color-mix(in srgb, var(--c) 16%, white); font-size: .78rem; font-weight: 700; text-align: left; min-width: 0; }
.mchip .px { width: 1.1em; height: 1.1em; flex: none; }
.mchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mmore { font-size: .75rem; font-weight: 700; color: var(--wool-60); text-align: left; padding: 2px 6px; min-height: 1.6rem; }
@media (max-width: 760px) { .mchip span { display: none; } .mchip { justify-content: center; padding: 0; } .mday { min-height: 5rem; } .month-dow { font-size: .75rem; } }

/* ---------- routines (parent) ---------- */
.routine-list { display: grid; gap: var(--s1); }
.routine-cols { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr)); }
.r-item { display: grid; grid-template-columns: auto 1fr; gap: 6px; align-items: center; padding: 0 0 0 .6rem; border-radius: var(--r-sm); background: var(--marsh); }
.r-item .px { width: 2.8rem; height: 2.8rem; }
.r-item .r-main { padding-top: var(--s1); padding-bottom: var(--s1); }
.r-main { display: grid; grid-template-columns: auto 1fr; gap: .8rem; align-items: center; text-align: left; padding: .4rem .6rem; min-height: var(--tap); border-radius: var(--r-sm); }
.r-item.done { background: #e3f6ea; }
.progress { height: 14px; background: var(--wool); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--green); border-radius: 999px; transition: width .5s cubic-bezier(.3,1.4,.5,1); }
.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tap), 1fr)); gap: 6px; }
.icon-pick button { padding: 6px; border-radius: 12px; background: var(--marsh); border: 3px solid transparent; }
.icon-pick button.on { border-color: var(--punch); background: #fff; }
.icon-pick .px { width: 40px; height: 40px; margin: 0 auto; }

/* ---------- music ---------- */
.now-card { display: grid; grid-template-columns: 120px 1fr; gap: 18px; align-items: center; }
.now-art { width: 120px; aspect-ratio: 1; border-radius: var(--r-sm); background: var(--wool) center/cover; }
.controls { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.ctl { width: 56px; height: 56px; border-radius: 50%; background: var(--marsh); display: grid; place-items: center; }
.ctl.big { width: 68px; height: 68px; background: var(--punch); color: #fff; }
.ctl svg { width: 26px; height: 26px; }
input[type=range] { accent-color: var(--punch); width: 100%; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: var(--s3); }
.tile { position: relative; text-align: left; }
/* Yoto card proportions (54 x 85.6 mm) */
.ycard { aspect-ratio: 54 / 85.6; border-radius: 18px; background: var(--c, var(--punch)); padding: 10px; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform .2s cubic-bezier(.3,1.5,.5,1); }
.ycard .art { flex: 1; border-radius: 12px; background: #fff center/cover; }
.ycard .name { color: #fff; font-family: var(--display); font-weight: 900; font-size: 0.941rem; line-height: 1.1; padding: 10px 2px 2px; min-height: 2.4em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile:active .ycard { transform: scale(.94); }
.tile .x { position: absolute; top: -10px; right: -10px; width: 40px; height: 40px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; }
.tile .x svg { width: 18px; height: 18px; }
.result { display: grid; grid-template-columns: 3rem 1fr auto; gap: 12px; align-items: center; padding: 6px; border-radius: var(--r-sm); }
.result:hover { background: var(--marsh); }
.result .thumb { width: 3rem; height: 3rem; border-radius: 8px; background: var(--wool) center/cover; }
.eq { display: inline-flex; gap: 3px; align-items: flex-end; height: 18px; }
.eq i { width: 4px; background: currentColor; border-radius: 2px; animation: eq .9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; } .eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%,100% { height: 4px; } 50% { height: 18px; } }

/* ---------- shopping ---------- */
.shop-add { display: flex; gap: var(--s1); margin-bottom: var(--s2); }
.shop-item { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; border-bottom: 2px solid var(--marsh); }
.shop-tap { display: grid; grid-template-columns: auto 1fr; gap: var(--s2); align-items: center; text-align: left; min-height: calc(var(--tap) + var(--s2)); padding: 0 .3rem; }
.check { width: 1.7em; height: 1.7em; flex: none; border-radius: 9px; border: 3px solid var(--ink); background: #fff; display: grid; place-items: center; transition: background .2s; }
.r-item > .check { width: var(--tap); height: var(--tap); border: 0; background: none; }
.r-item > .check::before { content: ''; grid-area: 1 / 1; width: 1.7em; height: 1.7em; border-radius: 9px; border: 3px solid var(--ink); background: #fff; box-sizing: border-box; transition: background .2s; }
.r-item > .check svg { grid-area: 1 / 1; position: relative; }
/* ticked = same box, just filled: only colour changes, never size */
.shop-item.done .check, .r-item.done > .check::before { background: var(--green); border-color: var(--green); }
.shop-item.done .t { text-decoration: line-through; color: var(--wool-60); }
.check svg { width: 1em; height: 1em; opacity: 0; transform: scale(.4); transition: .25s cubic-bezier(.3,1.6,.5,1); }
.done .check svg { opacity: 1; transform: scale(1); }

/* ---------- sheet ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(30,28,28,.4); z-index: 50; display: grid; place-items: end center; animation: fade .2s; }
.sheet { background: #fff; width: min(36rem, 100%); max-height: 92dvh; overflow: auto; border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 22px 18px 28px; animation: up .3s cubic-bezier(.2,1,.3,1); }
@media (min-width: 700px) { .sheet-bg { place-items: center; } .sheet { border-radius: var(--r-lg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

/* ---------- lock ---------- */
.lock { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.lock .card { width: min(380px, 100%); text-align: center; }
.pin { font-size: 1.882rem; letter-spacing: .4em; text-align: center; font-family: var(--display); font-weight: 900; }

/* =========================================================
   KID MODE: big, picture-first, almost no words
   ========================================================= */
body.kid { background: var(--marsh); }
.kid-app { min-height: 100dvh; display: flex; flex-direction: column; padding: var(--pad) var(--pad) calc(var(--pad) + 130px); }
.kid-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.kid-top h1 { font-size: clamp(30px, 5vw, 48px); }
.stars { margin-left: auto; display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 999px; padding: 6px 16px 6px 8px; font-family: var(--display); font-weight: 900; font-size: 1.529rem; }
.stars .px { width: 38px; height: 38px; }
.stars.bump { animation: bump .5s cubic-bezier(.3,1.8,.5,1); }
@keyframes bump { 40% { transform: scale(1.25); } }
.kid-lock { width: 52px; height: 52px; border-radius: 50%; background: #fff; display: grid; place-items: center; position: relative; }
.kid-lock svg { width: 22px; height: 22px; }
.kid-lock .ring { position: absolute; inset: -4px; border-radius: 50%; border: 4px solid var(--punch); clip-path: inset(0 100% 0 0); }
.kid-lock.holding .ring { animation: wipe 2s linear forwards; }
@keyframes wipe { to { clip-path: inset(0 0 0 0); } }

.kid-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; gap: 10px; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--marsh) 30%); }
.kid-tabs a { width: 92px; height: 92px; border-radius: 26px; background: #fff; display: grid; place-items: center; box-shadow: var(--shadow); transition: transform .2s cubic-bezier(.3,1.6,.5,1); }
.kid-tabs a .px { width: 60px; height: 60px; }
.kid-tabs a.on { background: var(--punch); transform: translateY(-6px); }
@media (max-width: 520px) { .kid-tabs a { width: 64px; height: 64px; border-radius: 20px; } .kid-tabs a .px { width: 42px; height: 42px; } }

/* today / tomorrow */
.kid-days { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .kid-days { grid-template-columns: 1fr; } }
.kid-day { background: #fff; border-radius: var(--r-lg); padding: 18px; }
.kid-day.is-today { box-shadow: 0 0 0 5px var(--punch); }
.kid-day h2 { font-size: clamp(30px, 4vw, 42px); margin-bottom: 14px; display: flex; align-items: center; gap: 12px; }
.kid-day h2 .px { width: 48px; height: 48px; }
.kid-ev { display: grid; grid-template-columns: 112px 1fr; gap: 16px; align-items: center; padding: 10px; border-radius: 22px; margin-bottom: 10px; background: color-mix(in srgb, var(--c) 14%, white); }
.kid-ev .pic { width: 112px; height: 112px; border-radius: 20px; background: #fff; display: grid; place-items: center; }
.kid-ev .pic .px { width: 88px; height: 88px; }
.kid-ev b { font-family: var(--display); font-weight: 900; font-size: clamp(22px, 2.6vw, 30px); line-height: 1.05; display: block; }
.kid-ev .when { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 1.118rem; color: var(--ink-2); margin-top: 6px; }
.kid-ev .when .px { width: 28px; height: 28px; }
.kid-ev.now { animation: glow 2s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 45%, transparent); } }
.kid-ev.past { opacity: .4; }

/* routine runner */
.runner { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.steps { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.step { width: 76px; height: 76px; border-radius: 20px; background: #fff; display: grid; place-items: center; position: relative; border: 4px solid transparent; transition: transform .25s; }
.step .px { width: 54px; height: 54px; }
.step.cur { border-color: var(--punch); transform: scale(1.1); }
.step.done { background: #e3f6ea; }
.step.done .px { opacity: .45; }
.step .tick { position: absolute; right: -8px; top: -8px; width: 32px; height: 32px; border-radius: 50%; background: var(--green); display: grid; place-items: center; animation: pop .45s cubic-bezier(.3,1.8,.5,1); }
.step .tick svg { width: 18px; height: 18px; }
@keyframes pop { from { transform: scale(0) rotate(-90deg); } }
.hero-step { position: relative; width: min(440px, 100%, 36dvh); aspect-ratio: 1; background: #fff; border-radius: 44px; display: grid; place-items: center; box-shadow: var(--shadow); }
.hero-step .px { width: 72%; height: 72%; }
.hero-step.yay .px { animation: yay .9s cubic-bezier(.3,1.6,.5,1); }
@keyframes yay { 0% { transform: scale(1); } 30% { transform: scale(.82) rotate(-8deg); } 60% { transform: scale(1.15) rotate(6deg); } 100% { transform: scale(1); } }
.hero-step.enter .px { animation: enter .5s cubic-bezier(.3,1.5,.5,1); }
@keyframes enter { from { transform: translateX(60px) scale(.6); opacity: 0; } }
.hero-title { font-family: var(--display); font-weight: 900; font-size: clamp(34px, 5vw, 56px); text-align: center; }
.done-btn { width: min(440px, 100%); height: clamp(80px, 12dvh, 108px); border-radius: 999px; background: var(--green); color: #fff; font-family: var(--display); font-weight: 900; font-size: 2.588rem; display: flex; align-items: center; justify-content: center; gap: 14px; box-shadow: 0 8px 0 #1e8a50; transition: transform .1s, box-shadow .1s; }
.done-btn:active { transform: translateY(6px); box-shadow: 0 2px 0 #1e8a50; }
.done-btn svg { width: 48px; height: 48px; }
.back-btn { background: #fff; border-radius: 999px; padding: 12px 22px; font-weight: 700; }

.celebrate { text-align: center; display: grid; justify-items: center; gap: 14px; padding: 30px 0; }
.celebrate .px { width: min(300px, 70vw); height: auto; aspect-ratio: 1; animation: spinpop 1.1s cubic-bezier(.3,1.5,.5,1); }
@keyframes spinpop { from { transform: scale(0) rotate(-200deg); } }
.celebrate h1 { font-size: clamp(40px, 7vw, 72px); }

/* jobs grid */
.jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.job { background: #fff; border-radius: 30px; padding: 18px; display: grid; justify-items: center; gap: 10px; position: relative; transition: transform .2s; }
.job .px { width: 130px; height: 130px; }
.job b { font-family: var(--display); font-weight: 900; font-size: 1.412rem; text-align: center; }
.job.done { background: #e3f6ea; }
.job.done .px { opacity: .5; }
.job .tick { position: absolute; top: 12px; right: 12px; width: 48px; height: 48px; border-radius: 50%; background: var(--green); display: grid; place-items: center; animation: pop .45s cubic-bezier(.3,1.8,.5,1); }
.job .tick svg { width: 28px; height: 28px; }
.job:active { transform: scale(.95); }

/* kid music */
.kid-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.kid-tiles .ycard .name { font-size: 1.176rem; }
.tile.playing .ycard { box-shadow: 0 0 0 6px var(--ink); }
.tile .eqbadge { position: absolute; left: 12px; top: 12px; background: var(--ink); color: #fff; border-radius: 12px; padding: 8px; }
.kid-player { position: fixed; z-index: 19; left: 50%; transform: translateX(-50%); bottom: 124px; display: flex; gap: 14px; background: var(--ink); padding: 10px; border-radius: 999px; }
.kid-player .ctl { width: 76px; height: 76px; background: #fff; color: var(--ink); }
.kid-player .ctl.big { background: var(--punch); color: #fff; }
.kid-player .ctl svg { width: 36px; height: 36px; }
@media (max-width: 520px) { .kid-player { bottom: 92px; } }

/* ---------- celebration particles ---------- */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden; }
.fx i { position: absolute; width: 14px; height: 14px; left: var(--x); top: var(--y); background: var(--c); animation: burst var(--d, .9s) cubic-bezier(.2,.8,.3,1) forwards; }
.fx i.s { width: 30px; height: 30px; background: none; }
@keyframes burst {
  0% { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(.4); opacity: 0; }
}
.toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 700; z-index: 120; animation: up .3s; max-width: calc(100vw - 32px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (max-height: 900px) and (min-width: 521px) {
  .kid-tabs { padding-top: 8px; padding-bottom: 8px; }
  .kid-tabs a { width: 76px; height: 76px; border-radius: 22px; }
  .kid-tabs a .px { width: 50px; height: 50px; }
  .kid-app { padding-bottom: 110px; }
  .runner { gap: 12px; }
}
@media (max-width: 460px) { .routine-cols { grid-template-columns: 1fr; } }

/* Corner buddy (public/buddy.js): same gap to the right and bottom edges */
.buddy { position: fixed; z-index: 21; right: var(--pad); bottom: var(--buddy-lift); width: var(--buddy); height: var(--buddy); image-rendering: pixelated; cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; }
@media (min-width: 1800px) { :root { --buddy: 256px; } }
/* narrow screens: the tab bar spans the bottom, so lift the buddy above it */
@media (max-width: 1100px) { :root { --buddy: 144px; --buddy-lift: calc(var(--pad) + 72px); } }
@media (max-width: 620px) { :root { --buddy: 112px; } }
body.kid { --buddy-lift: calc(var(--pad) + 120px); }

/* page header with mode toggle (Routines, Rewards) */
.page-head { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--gap); }
.page-head h2 { font-size: 1.8rem; }
.r-head { margin-bottom: var(--s2); min-height: var(--tap); }
.r-main { position: relative; }
.r-edit { position: absolute; right: var(--s2); top: 50%; transform: translateY(-50%); color: var(--wool-60); }
.r-edit svg { width: 1.2em; height: 1.2em; }
.card.editing .r-item { background: #fff; outline: 2px dashed var(--wool); }
a.pill { color: inherit; text-decoration: none; }

/* rewards */
.reward-stars { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s3); }
.reward-stars .px { width: 3.5rem; height: 3.5rem; }
.reward-stars b { font-family: var(--display); font-weight: 900; font-size: 3.2rem; line-height: 1; }
.progress.big { height: 1.4rem; }
.reward-prize { font-size: 1.15rem; margin: var(--s3) 0 0; }

/* add/edit windows: picture button + name, "More details" */
.name-row { display: flex; align-items: flex-end; gap: var(--s2); margin-bottom: var(--s2); }
.name-row .field { margin-bottom: 0; }
.name-row h2 { margin-bottom: 4px; }
.pic-btn { position: relative; flex: none; width: 4.2rem; height: 4.2rem; border-radius: var(--r-sm); background: var(--marsh); display: grid; place-items: center; }
.pic-btn .px { width: 72%; height: 72%; }
.pic-edit { position: absolute; right: -6px; bottom: -6px; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; }
.pic-edit svg { width: 60%; height: 60%; }
details.more { margin-bottom: var(--s3); border-top: 2px solid var(--marsh); }
details.more summary { min-height: var(--tap); display: flex; align-items: center; gap: var(--s1); font-weight: 700; cursor: pointer; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: ''; width: .55em; height: .55em; border: solid currentColor; border-width: 0 3px 3px 0; transform: rotate(45deg); margin: -4px 0 0 6px; transition: transform .2s; }
details.more[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.ev-notes { white-space: pre-wrap; background: var(--marsh); border-radius: var(--r-sm); padding: var(--s2); }

/* loading ghost: real markup, text hidden, shapes greyed */
.loading { pointer-events: none; animation: ghost 1.4s ease-in-out infinite; }
.loading :is(h2, h3, b, small, .px, .sched-time, .sched-title, .sched-meta, .badge, .pill, .t, .btn, .input, .check, .progress, .ev, .day-h span, .seg button, .r-main b, .mday-n) { color: transparent !important; background: var(--marsh-2) !important; border-color: transparent !important; border-radius: 8px; }
.loading .btn, .loading .pill, .loading .badge, .loading .seg button { border-radius: 999px; }
.loading .check { border-radius: 9px; }
@keyframes ghost { 50% { opacity: .55; } }

/* unify: everything that grows fills its row, grids scale with the type */
.page-head .grow, .name-row .grow { flex: 1; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.kid-prog { display: grid; grid-template-columns: 2rem 6rem 1fr 3rem; gap: var(--s2); align-items: center; margin-bottom: var(--s2); }
.kid-prog .px { width: 2rem; height: 2rem; }
.kid-prog > span { text-align: right; color: var(--wool-60); }
@media (max-width: 620px) { .tabs { gap: 0; } .tabs a { padding: 0 .7em; } }
@media (max-width: 620px) { .badge.done, .badge.later { display: none; } }
