/* BE-AI Stationery — "highlighter on a school booklist".
   One signature: choices get highlighted like a marked-up paper list. */
:root {
  --paper: #f4f5f8;
  --sheet: #ffffff;
  --ink: #1b1f3b;
  --ink-2: #5d627c;
  --line: #dde0ea;
  --dot: rgba(27, 31, 59, 0.07);
  --hl: #ffe45c;
  --hl-ink: #1b1f3b;
  --mark: #ffe45c; --mark-h: 62%;
  --btn: #1b1f3b;
  --btn-ink: #ffffff;
  --focus: #3a5ba0;
  --danger: #c2362b;
  --shelf: #c9cede;
  --shadow: 0 1px 0 rgba(27, 31, 59, 0.04), 0 12px 32px -18px rgba(27, 31, 59, 0.28);
  /* book-cloth spines, P1–P6 */
  --s1: #2e6f57; --s2: #3a5ba0; --s3: #c8553d; --s4: #d9a23a; --s5: #6b4e9b; --s6: #1f7a8c;
  --display: "Shantell Sans", ui-rounded, system-ui, sans-serif;
  --body: "Lexend", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --out: cubic-bezier(0.22, 1, 0.36, 1);
  --cur-book: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M6 3h15a2 2 0 0 1 2 2v17a2 2 0 0 1-2 2H7.5A2.5 2.5 0 0 1 5 21.5V4a1 1 0 0 1 1-1z' fill='%231b1f3b' stroke='%23fff' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M5 21.5A2.5 2.5 0 0 1 7.5 19H23' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3Cpath d='M9.5 8h8' stroke='%23ffe45c' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") 5 3;
  --cur-open: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cpath d='M15 8C12 5.5 7.5 5 3 5.5v17c4.5-.5 9 0 12 2.5 3-2.5 7.5-3 12-2.5v-17C22.5 5 18 5.5 15 8z' fill='%23ffe45c' stroke='%231b1f3b' stroke-width='1.8' stroke-linejoin='round'/%3E%3Cpath d='M15 8v16.5M6.5 10c2.2-.1 4.4.3 6 1.2M17.5 11.2c1.6-.9 3.8-1.3 6-1.2' fill='none' stroke='%231b1f3b' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E") 15 8;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121429; --sheet: #1b1e3a; --ink: #ecedf6; --ink-2: #a3a7c4; --line: #2c3058;
    --dot: rgba(236, 237, 246, 0.06); --btn: #ffe45c; --btn-ink: #1b1f3b; --focus: #9db4ff;
    --danger: #ff8f85; --shelf: #2c3058; --mark: rgba(255, 228, 92, 0.2); --mark-h: 100%;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.25), 0 14px 36px -16px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121429; --sheet: #1b1e3a; --ink: #ecedf6; --ink-2: #a3a7c4; --line: #2c3058;
  --dot: rgba(236, 237, 246, 0.06); --btn: #ffe45c; --btn-ink: #1b1f3b; --focus: #9db4ff;
  --danger: #ff8f85; --shelf: #2c3058; --mark: rgba(255, 228, 92, 0.2); --mark-h: 100%;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.25), 0 14px 36px -16px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font: 16px/1.6 var(--body);
  color: var(--ink);
  background: var(--paper) radial-gradient(var(--dot) 1.2px, transparent 1.6px) 0 0 / 22px 22px fixed;
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
  transition: background-color 0.3s, color 0.3s;
  -webkit-tap-highlight-color: transparent;
}
body[data-step="done"] { padding-bottom: 0; }
.wrap { width: 100%; max-width: 620px; margin: 0 auto; padding: 0 18px; }
h2, h3, .name, .bar-sum strong, .total-row strong, .r-head { font-family: var(--display); }
h2 { font-size: clamp(2rem, 7.5vw, 2.75rem); line-height: 1.05; letter-spacing: -0.015em; font-weight: 700; font-variation-settings: "INFM" 60; margin: 8px 0 10px; outline: none; text-wrap: balance; }
h3 { font-size: 1.1875rem; font-weight: 700; margin: 0 0 10px; }
p { margin: 0; }
.lede { color: var(--ink-2); max-width: 48ch; margin-bottom: 28px; text-wrap: pretty; }
.lede strong { color: var(--ink); }
.hint { color: var(--ink-2); font-size: 0.875rem; margin-bottom: 12px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding-top: env(safe-area-inset-top); border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.top-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 20px; padding-top: 16px; padding-bottom: 14px; }
#theme { margin-left: auto; }
.brand { display: flex; align-items: center; gap: 10px; flex: 1 1 0; min-width: 0; }
.brand > div { min-width: 0; }
.logo { width: 34px; height: 34px; flex: none; transform: rotate(-8deg); }
.logo path { fill: var(--ink); }
.logo .pg { fill: none; stroke: var(--hl); stroke-width: 2.4; stroke-linecap: round; }
.name { margin: 0; font-size: 1.1875rem; font-weight: 800; line-height: 1.1; font-variation-settings: "INFM" 40; }
.sub { font-size: 0.8125rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 44px; height: 44px; flex: none; border: 1.5px solid var(--line); border-radius: 50%; background: var(--sheet); color: var(--ink); display: grid; place-items: center; cursor: pointer; transition: transform 0.2s var(--spring); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn svg { width: 22px; height: 22px; overflow: visible; }
.orb { fill: currentColor; transition: r 0.45s var(--spring); }
.cut { transition: cx 0.45s var(--out), cy 0.45s var(--out); }
.rays { stroke: currentColor; stroke-width: 2; stroke-linecap: round; transform-origin: 12px 12px; transition: transform 0.45s var(--spring), opacity 0.3s; }
[data-theme="dark"] .orb { r: 8.5px; }
[data-theme="dark"] .cut { cx: 16.5px; cy: 7.5px; }
[data-theme="dark"] .rays { transform: rotate(-60deg) scale(0.4); opacity: 0; }

/* progress: a real sequence, so numbered; current step gets the highlighter */
.progress { order: 3; flex: 1 0 100%; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; counter-reset: st; }
.progress li { counter-increment: st; font-size: 0.875rem; font-weight: 700; color: var(--ink-2); padding: 0 0 8px; position: relative; display: flex; align-items: center; gap: 8px; transition: color 0.3s; }
.progress li::before { content: counter(st); width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; font: 700 0.75rem var(--display); border: 1.5px solid var(--line); background: var(--sheet); transition: background-color 0.3s, border-color 0.3s, color 0.3s; }
.progress li::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; border-radius: 4px; background: var(--line); background-image: linear-gradient(var(--hl), var(--hl)); background-repeat: no-repeat; background-size: 0% 100%; transition: background-size 0.55s var(--out); }
.progress li.on { color: var(--ink); }
.progress li.on::before { background: var(--hl); border-color: var(--hl); color: var(--hl-ink); }
.progress li.on::after { background-size: 100% 100%; }

/* ---------- steps ---------- */
main { padding-top: 20px; view-transition-name: step; }
.back { appearance: none; background: none; border: 0; color: var(--ink-2); font: 700 0.9375rem var(--body); min-height: 44px; padding: 0 12px 0 0; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.back:hover { color: var(--ink); }
.back::before { content: ""; width: 8px; height: 8px; border-left: 2px solid; border-bottom: 2px solid; transform: rotate(45deg); margin-right: 4px; }

/* ---------- fields ---------- */
form { margin: 0; }
.field { border: 0; margin: 0 0 22px; padding: 0; min-width: 0; }
.field > label, .field > legend { display: block; font-weight: 700; font-size: 0.9375rem; margin-bottom: 8px; padding: 0; }
input:not([type="radio"]):not([type="checkbox"]), select {
  width: 100%; min-height: 52px; padding: 12px 14px; font: inherit; font-size: 17px; color: var(--ink);
  background: var(--sheet); border: 1.5px solid var(--line); border-radius: 12px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 20px) 23px, calc(100% - 15px) 23px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 40px; }
select:disabled { opacity: 0.55; }
input:focus, select:focus { border-color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--hl) 55%, transparent); }
input:user-invalid { border-color: var(--danger); }
.err { color: var(--danger); font-size: 0.875rem; font-weight: 700; }
.err:not(:empty) { margin-top: 6px; }
.invalid input, .invalid select { border-color: var(--danger); }
.invalid .chip span { border-color: var(--danger); }
.invalid { animation: nudge 0.35s var(--out); }
@keyframes nudge { 30% { transform: translateX(-5px); } 60% { transform: translateX(4px); } }

/* chips & segments: chosen = highlighted */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
#mt-chips { display: grid; grid-template-columns: repeat(4, 1fr); }
.chip { position: relative; }
.chip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: inherit; z-index: 1; }
.chip span {
  display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 10px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--sheet); font-weight: 700;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.3s var(--spring);
  user-select: none;
}
.chip input:checked + span { background: var(--hl); border-color: var(--hl); color: var(--hl-ink); transform: rotate(-1.5deg); }
.chip input:active + span { transform: scale(0.94); }
.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.seg { display: flex; width: 100%; max-width: 440px; padding: 3px; gap: 2px; border-radius: 14px; background: color-mix(in srgb, var(--line) 75%, transparent); }
.seg .chip { flex: 1 1 0; min-width: max-content; }
.seg .chip span { border: 0; background: transparent; min-height: 44px; padding: 0 12px; font-size: 0.9375rem; border-radius: 11px; white-space: nowrap; }
.seg .chip input:checked + span { background: var(--hl); color: var(--hl-ink); box-shadow: var(--shadow); transform: none; }
/* subject tracks: label above a full-width toggle on phones, inline row on wider screens */
.field.row { margin-bottom: 14px; }
.field.row legend { margin-bottom: 6px; }
@media (min-width: 480px) {
  .field.row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
  .field.row legend { float: left; width: 96px; flex: none; margin: 0; }
  .field.row .seg { max-width: 340px; }
}
#subject-tracks { padding: 14px 16px 6px; border: 1.5px dashed var(--line); border-radius: 16px; margin-bottom: 22px; }

/* level picker: a shelf of book spines */
#level-chips { display: flex; align-items: flex-end; gap: 6px; padding: 18px 8px 0; min-height: 112px; border-bottom: 7px solid var(--shelf); border-radius: 0 0 4px 4px; }
#level-chips .chip { flex: 1; display: flex; align-items: flex-end; animation: shelf-in 0.6s var(--out) both; }
#level-chips .chip span {
  width: 100%; height: var(--h, 84px); min-height: 0; padding: 0 0 10px; align-items: flex-end;
  border: 0; border-radius: 5px 5px 2px 2px; background-color: var(--c); color: #fff;
  font: 700 1.125rem var(--display); font-variation-settings: "INFM" 70;
  background-image: linear-gradient(transparent 12px, rgba(255, 255, 255, 0.32) 12px 15px, transparent 15px 20px, rgba(255, 255, 255, 0.32) 20px 22px, transparent 22px);
  box-shadow: inset -6px 0 0 rgba(0, 0, 0, 0.12), inset 2px 0 0 rgba(255, 255, 255, 0.15);
  transform-origin: bottom center;
  transition: transform 0.4s var(--spring), filter 0.3s, opacity 0.3s;
}
#level-chips .chip:nth-child(1) { --c: var(--s1); --h: 78px; animation-delay: 0.05s; }
#level-chips .chip:nth-child(2) { --c: var(--s2); --h: 88px; animation-delay: 0.1s; }
#level-chips .chip:nth-child(3) { --c: var(--s3); --h: 72px; animation-delay: 0.15s; }
#level-chips .chip:nth-child(4) { --c: var(--s4); --h: 92px; animation-delay: 0.2s; }
#level-chips .chip:nth-child(4) span { color: #2a2205; }
#level-chips .chip:nth-child(5) { --c: var(--s5); --h: 80px; animation-delay: 0.25s; }
#level-chips .chip:nth-child(6) { --c: var(--s6); --h: 86px; animation-delay: 0.3s; }
#level-chips:has(input:checked) .chip span { opacity: 0.5; filter: saturate(0.5); }
#level-chips .chip input:checked + span { opacity: 1; filter: none; transform: translateY(-14px) rotate(-4deg); background-color: var(--c); color: #fff; }
#level-chips .chip:nth-child(4) input:checked + span { color: #2a2205; }
#level-chips .chip input:focus-visible + span { outline-offset: 3px; }
@keyframes shelf-in { from { opacity: 0; transform: translateY(24px); } }

/* ---------- full set switch ---------- */
.fullset { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; margin-bottom: 26px; background: var(--sheet); border: 1.5px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); cursor: pointer; }
.fullset small { display: block; color: var(--ink-2); font-size: 0.875rem; }
.fullset strong { font-family: var(--display); font-size: 1.125rem; }
input[role="switch"] { appearance: none; flex: none; width: 54px; height: 32px; border-radius: 99px; background: var(--line); position: relative; cursor: inherit; margin: 0; transition: background-color 0.25s; }
input[role="switch"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.35s var(--spring), background-color 0.25s; }
input[role="switch"]:checked { background: var(--btn); }
input[role="switch"]:checked::after { transform: translateX(22px); background: var(--hl); }

/* ---------- item list: ticking = highlighting ---------- */
.group { margin-bottom: 28px; break-inside: avoid; }
.group h3 { display: flex; align-items: center; gap: 10px; }
.tag { font: 700 0.75rem var(--body); color: var(--hl-ink); background: var(--hl); padding: 3px 9px; border-radius: 6px; transform: rotate(-3deg); }
.group ul { list-style: none; margin: 0; padding: 0; background: var(--sheet); border: 1.5px solid var(--line); border-radius: 18px; overflow: hidden; }
.group li { border-top: 1px solid var(--line); animation: rise 0.45s var(--out) both; animation-delay: calc(var(--i) * 26ms); }
.group li:first-child { border-top: 0; }
.optional ul { border-style: dashed; background: color-mix(in srgb, var(--sheet) 60%, transparent); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.item { display: grid; grid-template-columns: 26px 1fr auto; gap: 12px; align-items: start; padding: 14px 16px; min-height: 58px; cursor: pointer; position: relative; }
.item input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.item:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: -3px; }
.box { width: 24px; height: 24px; margin-top: 1px; border: 2px solid var(--ink-2); border-radius: 7px; display: grid; place-items: center; transition: background-color 0.2s, border-color 0.2s, transform 0.35s var(--spring); }
.box svg { width: 16px; height: 16px; fill: none; stroke: var(--btn-ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 16; stroke-dashoffset: 16; transition: stroke-dashoffset 0.25s var(--out) 0.05s; }
.item input:checked ~ .box { background: var(--btn); border-color: var(--btn); transform: rotate(-4deg); }
.item input:checked ~ .box svg { stroke-dashoffset: 0; }
.item:active .box { transform: scale(0.86); }
.txt { min-width: 0; }
.nm {
  display: inline; font-size: 0.9688rem; line-height: 1.6; overflow-wrap: anywhere;
  padding: 1px 4px; margin: 0 -4px; border-radius: 0.35em 0.15em 0.4em 0.2em;
  background-image: linear-gradient(var(--mark), var(--mark));
  background-repeat: no-repeat; background-position: 0 100%; background-size: 0% var(--mark-h);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  transition: background-size 0.45s var(--out), color 0.2s 0.1s;
}
.item input:checked ~ .txt .nm { background-size: 100% var(--mark-h); }
.qty, .note { display: block; font-size: 0.8125rem; color: var(--ink-2); margin-top: 3px; }
.note { font-style: italic; }
.pr { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.9688rem; white-space: nowrap; padding-top: 1px; }
.pr.tbc { color: var(--ink-2); font-weight: 400; font-size: 0.8125rem; }

/* ---------- review: the bookshop slip ---------- */
.receipt-wrap { filter: drop-shadow(0 1px 0 var(--line)) drop-shadow(0 14px 22px rgba(27, 31, 59, 0.12)); margin-bottom: 28px; }
.receipt {
  background: var(--sheet); padding: 22px 20px 34px; border-radius: 16px 16px 0 0;
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - 10px) no-repeat, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 20px 10px repeat-x;
  mask: linear-gradient(#000 0 0) top / 100% calc(100% - 10px) no-repeat, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 20px 10px repeat-x;
}
.r-head { text-align: center; font-weight: 800; font-size: 1.25rem; padding-bottom: 14px; border-bottom: 2px dashed var(--line); }
.r-head span { display: block; font: 400 0.8125rem var(--body); color: var(--ink-2); }
.summary h3 { font: 700 0.875rem var(--body); color: var(--ink-2); margin: 18px 0 4px; }
.summary ul { list-style: none; margin: 0; padding: 0; }
.summary li { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px dotted var(--line); font-size: 0.9375rem; }
.summary .qty { display: inline; }
.total-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-top: 16px; margin-top: 8px; border-top: 2px dashed var(--line); font-weight: 700; }
.total-row strong { font-size: 2rem; font-variant-numeric: tabular-nums; background: linear-gradient(transparent 55%, var(--hl) 55%); color: inherit; padding: 0 4px; }
:root[data-theme="dark"] .total-row strong { background: none; color: var(--hl); }
.total-row small { color: var(--ink-2); font-weight: 400; }
#parent-form { padding: 22px 18px 6px; background: var(--sheet); border: 1.5px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); align-self: start; }
#parent-form h3 { margin-bottom: 2px; }
/* collection date picker: only bookshop days are tappable; the chosen day gets the highlighter */
.cal { background: var(--paper); border: 1.5px solid var(--line); border-radius: 16px; padding: 10px 10px 12px; }
.invalid .cal { border-color: var(--danger); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-head strong { font: 700 1.0625rem var(--display); }
.cal-nav { width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); font: 700 1.5rem/1 var(--body); cursor: pointer; }
.cal-nav:hover:not(:disabled) { background: var(--line); }
.cal-nav:disabled { opacity: 0.25; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.dow { font-size: 0.75rem; font-weight: 700; color: var(--ink-2); padding-bottom: 2px; }
.day { display: grid; place-items: center; min-height: 42px; border-radius: 11px; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.day.off { color: color-mix(in srgb, var(--ink-2) 40%, transparent); }
button.day { font: 700 0.9375rem var(--body); color: var(--ink); background: var(--sheet); border: 1.5px solid var(--line); cursor: pointer; transition: transform 0.3s var(--spring), background-color 0.2s, border-color 0.2s; }
button.day:hover { border-color: var(--ink-2); }
button.day:active { transform: scale(0.9); }
button.day.on { background: var(--hl); border-color: var(--hl); color: var(--hl-ink); transform: rotate(-5deg) scale(1.08); box-shadow: 0 6px 14px -8px rgba(27, 31, 59, 0.5); }
.cal-times-h { font-weight: 700; font-size: 0.9375rem; margin: 16px 0 8px; }
.times { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 6px; }
.slot { min-height: 44px; padding: 0 6px; white-space: nowrap; letter-spacing: -0.01em; border-radius: 11px; border: 1.5px solid var(--line); background: var(--sheet); color: var(--ink); font: 700 0.875rem var(--body); font-variant-numeric: tabular-nums; cursor: pointer; animation: rise 0.35s var(--out) both; transition: transform 0.3s var(--spring), background-color 0.2s, border-color 0.2s; }
.slot:nth-child(n+5) { animation-delay: 40ms; }
.slot:nth-child(n+9) { animation-delay: 80ms; }
.slot:hover { border-color: var(--ink-2); }
.slot:active { transform: scale(0.94); }
.slot.on { background: var(--hl); border-color: var(--hl); color: var(--hl-ink); transform: rotate(-3deg); }
.invalid .times .slot:not(.on) { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.cal-pick { margin-top: 10px; font-size: 0.875rem; color: var(--ink-2); }
.cal-pick strong { display: block; color: var(--ink); font: 700 1.0625rem var(--display); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- order bar (bottom bar on phones, sticky panel on desktop) ---------- */
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: color-mix(in srgb, var(--sheet) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); view-transition-name: bar; }
.bar-row { display: flex; align-items: center; gap: 16px; max-width: 584px; margin: 0 auto; }
.bar-info, .bar-pay { display: none; }
.bar-sum { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.bar-sum span { font-size: 0.8125rem; color: var(--ink-2); }
.bar-sum strong { font-size: 1.625rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; padding: 0 26px; margin-left: auto;
  font: 700 1.0625rem var(--body); color: var(--btn-ink); background: var(--btn); border: 0; border-radius: 14px;
  text-decoration: none; cursor: pointer; box-shadow: 0 8px 18px -10px var(--btn);
  transition: transform 0.25s var(--spring), opacity 0.2s, background-color 0.3s, box-shadow 0.25s;
}
body[data-step="child"] #next { flex: 1; }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }

/* ---------- done ---------- */
.done { text-align: center; padding-top: 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.done .btn { margin: 4px 0 0; width: 100%; max-width: 380px; }
.tick { width: 92px; height: 92px; fill: none; stroke: var(--hl-ink); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.tick circle { fill: var(--hl); stroke: none; transform-origin: center; animation: pop 0.55s var(--spring) 0.1s both; }
.tick path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw 0.4s var(--out) 0.5s forwards; }
@keyframes pop { from { transform: scale(0) rotate(-20deg); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.ref { color: var(--ink-2); }
.ref strong { color: var(--ink); font-family: var(--display); font-size: 1.375rem; letter-spacing: 0.03em; display: block; }
.amount { font-size: 1.125rem; font-weight: 700; max-width: 36ch; text-wrap: balance; padding: 16px 18px; background: var(--hl); color: var(--hl-ink); border-radius: 14px; transform: rotate(-0.6deg); }
.dates { width: 100%; max-width: 460px; text-align: left; background: var(--sheet); border: 1.5px solid var(--line); border-radius: 18px; padding: 18px; margin-top: 8px; }
.dates ul { margin: 0; padding-left: 18px; }
.dates li { margin: 5px 0; font-size: 0.9375rem; }
.dates li.note { list-style: none; margin-left: -18px; color: var(--ink-2); font-size: 0.8125rem; }

/* ---------- footer ---------- */
/* pinned to the very bottom: body is a min-100dvh column, main grows, footer takes margin-top:auto */
body { display: flex; flex-direction: column; }
main.wrap { flex: 1 0 auto; padding-bottom: 48px; }
.site-footer { flex: none; height: 56px; margin-top: auto; display: flex; align-items: center; border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.site-footer p { font-size: 0.8125rem; color: var(--ink-2); text-align: center; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 10; width: max-content; max-width: calc(100% - 32px); padding: 13px 18px; border-radius: 14px; background: var(--ink); color: var(--paper); font-weight: 700; font-size: 0.9375rem; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: transform 0.4s var(--spring), opacity 0.25s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- step transitions ---------- */
::view-transition-old(step) { animation: 0.22s var(--out) both slide-out; }
::view-transition-new(step) { animation: 0.4s var(--out) both slide-in; }
[data-dir="back"]::view-transition-old(step) { animation-name: slide-out-back; }
[data-dir="back"]::view-transition-new(step) { animation-name: slide-in-back; }
@keyframes slide-out { to { opacity: 0; transform: translateX(-32px); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(40px); } }
@keyframes slide-out-back { to { opacity: 0; transform: translateX(32px); } }
@keyframes slide-in-back { from { opacity: 0; transform: translateX(-40px); } }
.step.enter { animation: slide-in 0.4s var(--out) both; }
[data-dir="back"] .step.enter { animation-name: slide-in-back; }

/* ---------- mini-book cursor + hover (desktop pointers only) ---------- */
@media (hover: hover) and (pointer: fine) {
  html { cursor: var(--cur-book), auto; }
  html :is(a, button, label, select, .chip input, .item, .btn, input[type="checkbox"]) { cursor: var(--cur-open), pointer; }
  html input:not([type="radio"]):not([type="checkbox"]) { cursor: text; }
  html :is(button, select):disabled { cursor: var(--cur-book), not-allowed; }
  .btn:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 12px 22px -10px var(--btn); }
  .item:hover input:not(:checked) ~ .txt .nm { background-size: 100% var(--mark-h); background-image: linear-gradient(color-mix(in srgb, var(--hl) 35%, transparent), color-mix(in srgb, var(--hl) 35%, transparent)); }
  #level-chips .chip:hover input:not(:checked) + span { transform: translateY(-5px); opacity: 1; filter: none; }
  .chip:hover input:not(:checked) + span { border-color: var(--ink-2); }
}

/* ---------- desktop: use the width ---------- */
@media (min-width: 1000px) {
  body { padding-bottom: 0; }
  .wrap { max-width: 1180px; padding: 0 40px; }
  .top-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 480px) minmax(0, 1fr); align-items: center; gap: 40px; padding-top: 18px; padding-bottom: 16px; }
  .progress { order: 0; padding-top: 8px; }
  #theme { justify-self: end; margin: 0; width: 48px; height: 48px; }
  main.wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 56px; align-items: start; padding-top: 36px; }
  main > .step { grid-column: 1; grid-row: 1; min-width: 0; }
  h2 { font-size: 3.25rem; margin-top: 4px; }

  /* sticky order panel */
  .bar { grid-column: 2; grid-row: 1; position: sticky; top: 108px; left: auto; right: auto; bottom: auto; padding: 24px; border: 1.5px solid var(--line); border-radius: 22px; background: var(--sheet); box-shadow: var(--shadow); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .bar-row { flex-direction: column; align-items: stretch; gap: 16px; max-width: none; }
  .bar-info { display: block; padding-bottom: 16px; border-bottom: 2px dashed var(--line); }
  .bar-info h3 { margin-bottom: 4px; }
  .bar-info p { color: var(--ink-2); font-size: 0.9375rem; }
  .bar-sum strong { font-size: 2.5rem; }
  .bar-sum span { font-size: 0.875rem; }
  .bar .btn { margin: 0; width: 100%; }
  .bar-pay { display: block; font-size: 0.8125rem; color: var(--ink-2); text-align: center; }
  .toast { bottom: 40px; }

  /* step 1: two-column form, wide shelf */
  #child-form { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
  #child-form [data-field="name"], #child-form [data-field="level"], #mt-track, #subject-tracks { grid-column: 1 / -1; }
  #level-chips { gap: 14px; padding: 22px 18px 0; min-height: 140px; }
  #level-chips .chip span { height: calc(var(--h) * 1.25); font-size: 1.375rem; }
  #mt-chips { grid-template-columns: repeat(2, 1fr); }

  /* step 2: book list in two columns */
  #groups { columns: 2; column-gap: 24px; }
  .fullset { max-width: 520px; }

  /* step 3: slip beside the parent form */
  #step-review { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); column-gap: 28px; align-items: start; }
  #step-review > .back, #step-review > h2, #step-review > .lede { grid-column: 1 / -1; }
  /* details column scrolls with the page (no nested scroll area); the order panel on the right stays pinned */

  /* done: centred, full width of main */
  body[data-step="done"] main.wrap { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .tick path { stroke-dashoffset: 0; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
