*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--font-size)/1.55 var(--font-body); min-height: 100vh; }
body.shell-child { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .4em; text-wrap: balance; }
h1 { font-size: 1.75em; } h2 { font-size: 1.35em; } h3 { font-size: 1.1em; }
p { margin: 0 0 .8em; text-wrap: pretty; }
a { color: var(--accent-ink); }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 8px; }
[hidden] { display: none !important; }

/* ---- Layout ---- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-left)) 32px max(16px, env(safe-area-inset-right)); }
.stack > * + * { margin-top: var(--gap); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.muted { color: var(--ink-soft); }
.small { font-size: .86em; }
.center { text-align: center; }

/* ---- Top bar ---- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .inner { max-width: 1080px; margin: 0 auto; padding: 10px 16px; display: flex; gap: 12px; align-items: center; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 800; }
.brand small { display: block; font-weight: 600; font-size: .62em; color: var(--ink-soft); letter-spacing: .02em; }
.brand .logo { width: 40px; height: 40px; flex: none; }
.topbar .spacer { flex: 1; }
.adult-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.adult-nav a { padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .95em; }
.adult-nav a[aria-current="page"] { background: var(--surface-2); color: var(--accent-ink); }

/* ---- Bottom child nav ---- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 24px rgba(0,0,0,.06); }
.tabbar ul { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); max-width: 720px; gap: 2px; }
.tabbar a { white-space: nowrap; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; min-height: 60px; text-decoration: none; color: var(--ink-soft); border-radius: 16px; font-weight: 700; font-size: .72em; }
.tabbar a svg { width: 30px; height: 30px; }
.tabbar a[aria-current="page"] { color: var(--accent-ink); background: var(--surface-2); }
[data-band="seeds"] .tabbar a { font-size: .62em; } [data-band="seeds"] .tabbar a svg { width: 38px; height: 38px; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 22px; border-radius: 999px; border: 0; background: var(--accent); color: var(--on-accent); font-weight: 800; cursor: pointer; text-decoration: none; font-family: var(--font-display); transition: transform calc(.12s * var(--speed)), filter .12s; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn.secondary { background: var(--surface-2); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.gold { background: var(--gold); color: var(--navy); }
.btn.danger { background: #B42318; color: #fff; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: .9em; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; display: inline-grid; place-items: center; background: var(--surface-2); color: var(--accent-ink); cursor: pointer; flex: none; }
.icon-btn svg { width: 55%; height: 55%; }

/* ---- Cards ---- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; border: 1px solid var(--line); }
.card.tint { background: var(--surface-2); }
a.card, button.card { display: block; text-decoration: none; color: inherit; text-align: left; width: 100%; cursor: pointer; transition: transform calc(.15s * var(--speed)); }
a.card:hover, button.card:hover { transform: translateY(-2px); }
.tile { position: relative; overflow: hidden; padding: 0; }
.tile .art { aspect-ratio: 16/10; display: block; width: 100%; background: var(--surface-2); }
.tile .art svg { width: 100%; height: 100%; display: block; }
.tile .body { padding: 14px 16px 16px; }
.tile h3 { margin: 0 0 4px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .74em; font-weight: 800; background: var(--surface-2); color: var(--accent-ink); }
.badge.gold { background: var(--gold); color: var(--navy); }
.badge.green { background: #DDF2E2; color: #1F5F33; }
.badge.coral { background: #FDE3E0; color: #8A2A20; }
.badge.lock::before { content: "🔒"; font-size: .9em; }
.tile .badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }

/* ---- Hero / sections ---- */
.hero { border-radius: calc(var(--radius) + 6px); padding: 22px; background: linear-gradient(135deg, #8A6CD6 0%, var(--purple) 55%, #5D40AE 100%); color: #fff; position: relative; overflow: hidden; }
.hero h1, .hero h2 { color: #fff; }
.hero .mascot { position: absolute; right: 8px; bottom: -6px; width: 120px; height: 120px; }
.hero .sparkle { position: absolute; color: var(--gold); opacity: .8; }
[data-band="giants"] .hero { background: linear-gradient(135deg, #2B2251 0%, #3A2C74 60%, #1F2A40 100%); }
.mode-bedtime .hero { background: linear-gradient(135deg, #2B3463, #1E2547); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-head h2 { margin: 0; }
.scripture { background: var(--surface); border-left: 6px solid var(--gold); border-radius: var(--radius-sm); padding: 14px 18px; }
.scripture blockquote { margin: 0; font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif; font-size: 1.08em; }
.scripture cite { display: block; margin-top: 6px; font-style: normal; font-weight: 800; color: var(--accent-ink); font-size: .9em; }
.label-kind { font-size: .72em; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); display: inline-flex; gap: 6px; align-items: center; }
.kind-scripture { color: #8A6200; } [data-band="giants"] .kind-scripture, .mode-bedtime .kind-scripture { color: var(--gold); }
.kind-retelling { color: var(--accent-ink); }
.kind-history { color: var(--green-ink); } [data-band="giants"] .kind-history { color: #8FD6A3; }
.kind-interpretation { color: var(--coral-ink); } [data-band="giants"] .kind-interpretation { color: #F6B0A9; }
.kind-imagined { color: #8B5A00; }

/* ---- Forms ---- */
label { font-weight: 700; display: block; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.input, select, textarea { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--surface); }
textarea { min-height: 120px; resize: vertical; }
.input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { width: 22px; height: 22px; margin-top: 3px; flex: none; accent-color: var(--accent); }
.hint { font-size: .86em; color: var(--ink-soft); margin-top: 4px; }
.error-text { color: #B42318; font-weight: 700; }
[data-band="giants"] .error-text, .mode-bedtime .error-text { color: #FFA39A; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 14px; }
legend { font-weight: 800; padding: 0 6px; }
.switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.switch:last-child { border-bottom: 0; }
.switch input { width: 46px; height: 26px; accent-color: var(--accent); }

/* ---- States ---- */
.state { text-align: center; padding: 40px 16px; color: var(--ink-soft); }
.state svg { width: 120px; height: 120px; display: block; margin: 0 auto 12px; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 5px solid var(--surface-2); border-top-color: var(--accent); animation: spin calc(.9s * max(var(--speed), .3)) linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner { padding: 10px 16px; text-align: center; font-weight: 700; }
.banner.offline { background: var(--gold); color: var(--navy); }
.toast-region { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 60; display: grid; gap: 8px; width: min(92vw, 440px); }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow); font-weight: 700; animation: pop calc(.25s * var(--speed)) ease-out; }
.toast.good { background: #1F5F33; } .toast.bad { background: #8A1C12; }
@keyframes pop { from { transform: translateY(10px) scale(.96); opacity: 0; } }

/* ---- Dialog ---- */
dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(94vw, 520px); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(20, 24, 40, .55); }
dialog .dlg { padding: 22px; }
dialog .dlg-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }

/* ---- Profile picker ---- */
.profiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px; }
.profile { background: var(--surface); border: 3px solid transparent; border-radius: 28px; padding: 18px 12px; text-align: center; cursor: pointer; box-shadow: var(--shadow); font-weight: 800; font-family: var(--font-display); font-size: 1.1em; }
.profile:hover, .profile:focus-visible { border-color: var(--accent); }
.profile svg { width: 110px; height: 110px; display: block; margin: 0 auto 8px; }

/* ---- Kingdom map ---- */
.kingdom { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #BFE6F7; }
.kingdom svg { display: block; width: 100%; height: auto; }
.kingdom a.place { cursor: pointer; }
.kingdom a.place:focus-visible { outline: none; }
.kingdom a.place:focus-visible .pin, .kingdom a.place:hover .pin { stroke: var(--focus); stroke-width: 6; }
.kingdom .place-label { font: 800 22px var(--font-display); fill: var(--navy); paint-order: stroke; stroke: #fff; stroke-width: 6px; stroke-linejoin: round; }
.kingdom .soon .place-label { fill: #6B7280; font-weight: 600; font-style: italic; }
.view-toggle { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; }
.view-toggle button { border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; font-weight: 800; cursor: pointer; min-height: 40px; color: var(--ink); }
.view-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--accent-ink); box-shadow: var(--shadow); }

/* ---- Story player ---- */
.steps { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin; }
.steps button { flex: none; border: 2px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-weight: 800; cursor: pointer; min-height: 40px; color: var(--ink); font-size: .85em; }
.steps button[aria-current="step"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.steps button.done::after { content: " ✓"; }
.scene { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); max-width: 860px; margin-inline: auto; }
.scene svg { display: block; width: 100%; height: auto; }
.hotspot { cursor: pointer; }
.hotspot:focus-visible { outline: none; }
.hotspot:focus-visible .ring, .hotspot:hover .ring { stroke: var(--gold); stroke-width: 6; }
.hotspot .ring { fill: rgba(255,255,255,.0); stroke: rgba(255,255,255,.85); stroke-width: 4; stroke-dasharray: 6 6; }
.read-text p { font-size: 1.08em; line-height: 1.75; }
.read-text .word.on { background: var(--gold); color: var(--navy); border-radius: 4px; }
.player { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px; background: var(--surface-2); border-radius: var(--radius); }
.player input[type=range] { width: 120px; accent-color: var(--accent); }

/* ---- Games ---- */
.choices { display: grid; gap: 12px; }
.choice { text-align: left; border: 3px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); padding: 14px 16px; min-height: var(--tap); font-weight: 700; cursor: pointer; color: var(--ink); }
.choice:hover { border-color: var(--accent); }
.choice.right { border-color: #2E8B57; background: #E6F6EC; color: #10331E; }
.choice.wrong { border-color: #C2410C; background: #FFF1E8; color: #4A1A06; }
.choice[disabled] { cursor: default; }
.feedback { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--surface-2); margin-top: 12px; }
.meter { height: 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--blue)); border-radius: 99px; transition: width calc(.4s * var(--speed)); }
.seq-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.seq-list li { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; }
.seq-list li .n { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 800; flex: none; }
.seq-list li .t { flex: 1; font-weight: 700; }
.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 560px; margin: 0 auto; }
.mcard { aspect-ratio: 1; border-radius: var(--radius-sm); border: 0; cursor: pointer; background: var(--accent); color: var(--on-accent); font-weight: 800; display: grid; place-items: center; padding: 6px; font-size: .85em; }
.mcard svg { width: 70%; height: 70%; }
.mcard.up { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 3px var(--accent); }
.mcard.done { background: #E6F6EC; color: #10331E; box-shadow: inset 0 0 0 3px #2E8B57; }
.ws-grid { display: grid; gap: 4px; max-width: 520px; margin: 0 auto; user-select: none; }
.ws-cell { aspect-ratio: 1; border: 0; border-radius: 8px; background: var(--surface); font-weight: 800; font-size: 1.05em; cursor: pointer; box-shadow: inset 0 0 0 2px var(--line); color: var(--ink); text-transform: uppercase; padding: 0; }
.ws-cell.sel { background: var(--gold); color: var(--navy); }
.ws-cell.found { background: #CDEBD6; color: #10331E; }
.word-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 2px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-weight: 700; cursor: pointer; min-height: 44px; color: var(--ink); }
.chip.used { opacity: .35; }
.chip.found { text-decoration: line-through; background: #E6F6EC; color: #10331E; }
.answer-line { min-height: 64px; border: 2px dashed var(--line); border-radius: var(--radius-sm); padding: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---- Garden ---- */
.garden { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); touch-action: none; aspect-ratio: 16/10; max-width: 900px; margin-inline: auto; width: 100%; background: linear-gradient(#BFE6F7 0 30%, #A6DA9E 30% 100%); }
.garden .gitem { position: absolute; width: 11%; aspect-ratio: 1; transform: translate(-50%, -80%); border: 0; background: transparent; padding: 0; cursor: grab; }
.garden .gitem svg { width: 100%; height: 100%; }
.garden .gitem:focus-visible { outline: 3px solid var(--focus); }
.avatar-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.avatar-pick button { border: 3px solid var(--line); background: var(--surface); border-radius: 20px; padding: 8px; cursor: pointer; }
.avatar-pick button[aria-pressed="true"] { border-color: var(--accent); background: var(--surface-2); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); cursor: pointer; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 4px var(--accent); }

/* ---- Colouring ---- */
.colouring svg [data-region] { cursor: pointer; stroke: #24324A; stroke-width: 3; }
.palette { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* ---- Tables (adult areas) ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95em; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8em; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.kpi { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.kpi .card { padding: 14px; }
.kpi b { display: block; font-size: 1.8em; font-family: var(--font-display); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 90px; }
.bars div { flex: 1; background: var(--blue); border-radius: 6px 6px 0 0; min-height: 3px; position: relative; }
.bars span { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: .7em; color: var(--ink-soft); }
.review-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.review-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.status-approved { color: #1F5F33; font-weight: 800; } .status-pending { color: var(--ink-soft); } .status-changes_requested { color: #8A2A20; font-weight: 800; }
pre.json { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); padding: 12px; border-radius: 10px; font-size: .82em; max-height: 420px; overflow: auto; }
code { font-size: .9em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }

/* ---- Atlas ---- */
.atlas svg { display: block; width: 100%; height: auto; border-radius: var(--radius); background: #EADFC7; }
.atlas .city { cursor: pointer; }
.atlas .city text { font: 700 15px var(--font-body); fill: #24324A; paint-order: stroke; stroke: #FFF7E8; stroke-width: 4px; }
.atlas .city:focus-visible circle, .atlas .city:hover circle { stroke: #1B6FD8; stroke-width: 4; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; border-left: 4px solid var(--line); }
.timeline li { position: relative; padding: 0 0 18px 14px; }
.timeline li::before { content: ""; position: absolute; left: -33px; top: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--gold); border: 3px solid var(--surface); }
.letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.letter { border: 2px solid var(--line); background: var(--surface); border-radius: 14px; padding: 8px; text-align: center; cursor: pointer; color: var(--ink); }
.letter b { display: block; font-size: 2em; font-family: "SBL Hebrew", "Times New Roman", serif; line-height: 1.2; }
.bells { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.bell { border: 0; border-radius: 18px 18px 30px 30px; min-height: 120px; cursor: pointer; font-weight: 800; color: #24324A; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 10px; }
.bell:active, .bell.ring { transform: translateY(4px); filter: brightness(1.1); }

@media (max-width: 640px) {
  h1 { font-size: 1.45em; }
  .hero .mascot { width: 90px; height: 90px; opacity: .9; }
  .adult-nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .topbar .inner { flex-wrap: wrap; }
  .memory-grid { grid-template-columns: repeat(3, 1fr); }
  .bells { grid-template-columns: repeat(4, 1fr); }
  .hide-sm { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  [data-shell="child"] .topbar .inner { flex-wrap: nowrap; }
  .step-nav, .steps { flex-wrap: nowrap; overflow-x: auto; }
}
@media print { .topbar, .tabbar, .toast-region, .no-print { display: none !important; } body { background: #fff; color: #000; padding: 0; } .card { box-shadow: none; } }

/* ---- Kingdom of Discovery in 3D ---- */
.k3d { position: relative; height: min(68vh, 640px); min-height: 380px; border-radius: var(--radius); overflow: hidden; box-shadow: 0 18px 40px rgba(36, 50, 74, .22), inset 0 0 0 1px rgba(255,255,255,.4); background: linear-gradient(#6fb9ea, #fff1d6); touch-action: none; user-select: none; }
.k3d-canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.k3d-canvas:active { cursor: grabbing; }
.k3d-labels { position: absolute; inset: 0; pointer-events: none; }
.k3d-label { position: absolute; left: 0; top: 0; pointer-events: auto; border: 0; cursor: pointer; white-space: nowrap; font: 800 14px var(--font-display); color: var(--navy); background: rgba(255, 255, 255, .92); padding: 5px 11px; border-radius: 999px; box-shadow: 0 3px 10px rgba(36, 50, 74, .22); transition: background .2s, color .2s, opacity .2s; will-change: transform; }
.k3d-label::after { content: ''; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: inherit; transform: translateX(-50%) rotate(45deg); border-radius: 2px; z-index: -1; }
.k3d-label.main { background: var(--purple); color: #fff; font-size: 16px; padding: 7px 14px; }
.k3d-label.soon { background: rgba(230, 226, 218, .9); color: #6b7280; font-style: italic; font-weight: 600; }
.k3d-label.on { background: var(--gold); color: var(--navy); transform-origin: bottom center; }
.k3d-label.hide { visibility: hidden; opacity: 0; }
.k3d-label:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.k3d-card { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(92%, 420px); background: rgba(255, 255, 255, .96); color: var(--navy); border-radius: 22px; padding: 14px 18px; box-shadow: 0 12px 30px rgba(36, 50, 74, .3); animation: k3d-up .35s ease-out; }
.k3d-card h3 { margin: 0 0 4px; font-family: var(--font-display); color: var(--purple-ink); }
.k3d-card p { margin: 0 0 10px; }
.k3d-card-row { display: flex; gap: 8px; flex-wrap: wrap; }
@keyframes k3d-up { from { transform: translate(-50%, 30px); opacity: 0; } }
.k3d-hint { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: rgba(36, 50, 74, .72); color: #fff; font-weight: 700; font-size: 13px; padding: 6px 14px; border-radius: 999px; pointer-events: none; transition: opacity .6s; }
.k3d-hint.gone { opacity: 0; }
@media (max-width: 600px) { .k3d { height: 62vh; min-height: 340px; } .k3d-label { font-size: 12px; padding: 4px 9px; } .k3d-label.main { font-size: 14px; } }

/* ---- Richer look: welcome banner, cards and the home 3D preview ---- */
.hero { padding: 28px 26px 30px; background:
  radial-gradient(circle at 85% 10%, rgba(255, 233, 160, .55), transparent 40%),
  radial-gradient(circle at 10% 110%, rgba(120, 200, 239, .55), transparent 45%),
  linear-gradient(135deg, #8F6FE0 0%, var(--purple) 50%, #4F35A0 100%);
  box-shadow: 0 16px 36px rgba(90, 59, 166, .35); }
.hero::before { content: ''; position: absolute; inset: auto -10% -40px -10%; height: 90px; background:
  radial-gradient(ellipse at 20% 100%, rgba(101, 184, 121, .9) 0 45%, transparent 46%),
  radial-gradient(ellipse at 65% 100%, rgba(79, 164, 99, .9) 0 40%, transparent 41%),
  radial-gradient(ellipse at 100% 100%, rgba(101, 184, 121, .85) 0 38%, transparent 39%); pointer-events: none; }
.hero::after { content: '✦  ✧   ✦    ✧  ✦'; position: absolute; top: 14px; right: 170px; color: rgba(255, 241, 196, .85); letter-spacing: 8px; font-size: 18px; animation: twinkle calc(3s * var(--speed)) ease-in-out infinite; pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.hero .mascot { filter: drop-shadow(0 10px 14px rgba(36, 20, 80, .35)); animation: float calc(4s * var(--speed)) ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .35; } }
@keyframes float { 50% { transform: translateY(-8px); } }
a.card.tile:hover, a.card.tile:focus-visible { transform: translateY(-4px); box-shadow: 0 4px 0 rgba(36, 50, 74, .06), 0 18px 34px rgba(36, 50, 74, .16); }
.tile .art { background: linear-gradient(180deg, #fffaf0, var(--surface-2)); }
.kingdom-preview .kp-stage { position: relative; }
.kingdom-preview .k3d.preview { height: 300px; min-height: 0; border-radius: 0; box-shadow: none; cursor: pointer; }
.kingdom-preview .k3d.preview canvas { cursor: pointer; }
.kingdom-preview .body h3 { margin: 0 0 2px; }
@media (max-width: 600px) { .kingdom-preview .k3d.preview { height: 220px; } .hero::after { right: 24px; } }

.logo { border-radius: 22%; display: block; flex: none; }

/* ---- Daily declaration (shown when the app opens) ---- */
.declare { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; padding: 84px 16px 16px; overflow-y: auto;
  background: radial-gradient(120% 80% at 50% 110%, #F4C64E 0%, #F28C82 28%, #7654C4 62%, #24324A 100%); animation: declare-in .45s ease both; }
.declare.leaving { animation: declare-out .35s ease both; }
.declare-glow { position: absolute; inset: 0; pointer-events: none; background:
  radial-gradient(2px 2px at 12% 20%, #fff 50%, transparent 51%), radial-gradient(2px 2px at 80% 14%, #fff 50%, transparent 51%),
  radial-gradient(3px 3px at 66% 32%, #fff6c9 50%, transparent 51%), radial-gradient(2px 2px at 30% 40%, #fff 50%, transparent 51%),
  radial-gradient(2px 2px at 90% 46%, #fff 50%, transparent 51%), radial-gradient(3px 3px at 20% 70%, #fff6c9 50%, transparent 51%);
  animation: twinkle 3s ease-in-out infinite; }
.declare-card { position: relative; margin: auto 0; flex: none; width: min(560px, 100%); background: rgba(255, 255, 255, .96); color: #24324A; border-radius: 28px;
  padding: 22px 22px 18px; text-align: center; box-shadow: 0 24px 60px rgba(20, 16, 60, .45); }
.declare-mascot { margin: -78px auto 0; width: max-content; animation: float 3s ease-in-out infinite; filter: drop-shadow(0 8px 14px rgba(0,0,0,.2)); }
.declare-label { margin: 4px 0 6px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: .8em; color: #7654C4; }
.declare-words { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.45em, 5vw, 2.1em); line-height: 1.25; margin: 0 0 10px; color: #24324A; }
.declare-words .word { border-radius: 6px; transition: background .15s, box-shadow .15s; }
.declare-words .word.on { background: #F4C64E; box-shadow: 0 0 0 3px #F4C64E; color: #24324A; }
.declare-verse { font-size: .92em; color: #5B6478; margin: 0 auto 10px; max-width: 46ch; font-style: italic; }
.declare-verse cite { font-style: normal; font-weight: 700; color: #7654C4; }
.declare-stars { display: flex; justify-content: center; gap: 12px; font-size: 2.2em; line-height: 1; margin: 8px 0 4px; }
.declare-stars span { color: #E4DDF3; transition: color .3s, transform .3s; }
.declare-stars span.on { color: #F4C64E; transform: scale(1.25) rotate(-8deg); text-shadow: 0 0 16px rgba(244, 198, 78, .8); }
.declare-prompt { font-weight: 800; font-size: 1.15em; margin: 6px 0 12px; color: #24324A; min-height: 1.4em; }
.declare-actions { display: flex; justify-content: center; }
.declare .btn.big { font-size: 1.2em; padding: 14px 30px; min-width: 220px; box-shadow: 0 6px 0 #C99A24; }
.declare .btn.big:active { transform: translateY(3px); box-shadow: 0 3px 0 #C99A24; }
.declare-skip { margin-top: 10px; color: #5B6478; }
.declare-streak, .declare-badge { margin: 10px 0 0; font-weight: 800; color: #7654C4; }
.declare.pop .declare-card { animation: pop .35s ease; }
.declare.done .declare-card { box-shadow: 0 0 0 6px #F4C64E, 0 24px 60px rgba(20, 16, 60, .45); }
body.declare-open { overflow: hidden; }
@keyframes declare-in { from { opacity: 0; } }
@keyframes declare-out { to { opacity: 0; transform: scale(1.03); } }
@media (max-width: 480px) { .declare-card { padding: 18px 14px 14px; border-radius: 22px; } .declare .btn.big { min-width: 0; width: 100%; } }
.reduce-motion .declare, .reduce-motion .declare-mascot, .reduce-motion .declare-glow { animation: none; }

/* ---- Badges & streak ---- */
.streak-hero { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 18px 20px; border-radius: 24px; color: #fff;
  background: linear-gradient(135deg, #7654C4, #F28C82 70%, #F4C64E); box-shadow: 0 12px 30px rgba(118, 84, 196, .3); }
.streak-flame { font-size: 3em; line-height: 1; animation: float 2.6s ease-in-out infinite; }
.streak-num { font-family: var(--font-display); font-weight: 800; font-size: 1.5em; margin: 0; }
.streak-week { display: flex; gap: 6px; margin-left: auto; }
.streak-day { display: grid; place-items: center; width: 38px; height: 50px; border-radius: 12px; background: rgba(255,255,255,.2); font-size: .8em; }
.streak-day i { font-style: normal; font-size: 1.3em; line-height: 1; }
.streak-day.on { background: #fff; color: #7654C4; }
.badge-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); }
.badge-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 16px 12px; border-radius: 20px; background: var(--surface); border: 2px solid var(--line); }
.badge-card .badge-medal { display: grid; place-items: center; width: 92px; height: 92px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #FFF4C8, #F4C64E 70%); box-shadow: 0 0 0 5px #fff, 0 0 0 8px #F4C64E, 0 8px 18px rgba(201, 154, 36, .35); }
.badge-card.earned { border-color: #F4C64E; }
.badge-card.locked .badge-medal { background: var(--surface-2); box-shadow: 0 0 0 5px var(--surface), 0 0 0 8px var(--line); filter: grayscale(1); opacity: .55; }
@media (max-width: 560px) { .streak-week { margin-left: 0; } .streak-day { width: 34px; } }

/* ---- Bedtime routine ---- */
.bed-dots { display: flex; justify-content: center; gap: 8px; }
.bed-dots span { width: 12px; height: 12px; border-radius: 50%; background: var(--line); transition: background .3s, transform .3s; }
.bed-dots span.done { background: #9C8BD9; }
.bed-dots span.on { background: #F4C64E; transform: scale(1.3); }
.bed-stage { max-width: 680px; margin-inline: auto; }
.breath { width: 200px; height: 200px; margin: 20px auto; border-radius: 50%; display: grid; place-items: center; color: #24324A; font-weight: 800;
  background: radial-gradient(circle at 40% 35%, #E9F6FF, #9FD4F2 60%, #7654C4); box-shadow: 0 0 60px rgba(120, 200, 239, .5); animation: breathe 8s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(.7); } 50% { transform: scale(1.1); } }
.bed-chips { justify-content: center; }
.bed-chips .chip { border: 2px solid var(--line); background: var(--surface); padding: 10px 16px; border-radius: 999px; cursor: pointer; font-weight: 700; }
.bed-chips .chip[aria-pressed="true"] { background: #F4C64E; border-color: #F4C64E; color: #24324A; }
.bed-thanks-said { font-weight: 700; min-height: 1.5em; }
.bed-night { padding: 26px 18px; border-radius: 28px; color: #EDEAFB; background: radial-gradient(120% 90% at 50% 0%, #3A3F7A, #1C2550 60%, #121833); }
.bed-night h2 { color: #fff; }
.bed-moon { width: max-content; margin: 0 auto; animation: float 4s ease-in-out infinite; }
.sleep-screen { position: fixed; inset: 0; z-index: 95; background: #05060E; color: #4A4F72; display: grid; place-content: center; text-align: center; cursor: pointer; }
.sleep-screen p { margin: 4px; }
.sleep-stars { position: absolute; inset: 0; opacity: .5; background:
  radial-gradient(1.5px 1.5px at 20% 30%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 70% 20%, #fff 50%, transparent 51%),
  radial-gradient(2px 2px at 50% 60%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 85% 75%, #fff 50%, transparent 51%),
  radial-gradient(1.5px 1.5px at 10% 80%, #fff 50%, transparent 51%); animation: twinkle 6s ease-in-out infinite; }
.reduce-motion .breath { animation-duration: 16s; }

/* ---- Bible Museum ---- */
.museum-stage .k3d { height: min(62vh, 600px); background: #2b2350; }
.museum3d .k3d-label { background: rgba(255, 255, 255, .95); }
.museum3d .k3d-label.seen { border-color: #F4C64E; }
.museum3d .k3d-label.on { background: #F4C64E; color: #24324A; }
.museum-progress { font-weight: 800; color: var(--accent-ink); margin: 0; }
.museum-start { justify-content: center; }
.museum-info h2 { font-size: 1.4em; }
.museum-nav { margin-top: 6px; }
