:root {
  --cream: #fff8e6;
  --cream2: #f6ead0;
  --brown: #5a4430;
  --brown2: #8a6a48;
  --green: #6cbf6a;
  --green-d: #4a9a4a;
  --gold: #f2c14e;
  --sky: #bfe6ff;
  --shadow: 0 6px 0 rgba(90, 68, 48, 0.18), 0 10px 24px rgba(0, 0, 0, 0.15);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--sky);
  font-family: 'Nunito', system-ui, sans-serif; color: var(--brown);
  user-select: none; -webkit-user-select: none;
}
#game { position: fixed; inset: 0; }
#game canvas { display: block; }
.hidden { display: none !important; }
button { font-family: 'Fredoka', sans-serif; cursor: pointer; color: var(--brown); }

.panel {
  background: var(--cream); border-radius: 26px; box-shadow: var(--shadow);
  border: 3px solid #fff;
}
.pill {
  background: var(--cream); border-radius: 999px; padding: 6px 14px; box-shadow: var(--shadow);
  font-family: 'Fredoka'; font-weight: 600;
}
.big-btn {
  background: var(--green); color: #fff; border: none; border-radius: 999px; padding: 12px 30px;
  font-size: 20px; font-weight: 600; box-shadow: 0 5px 0 var(--green-d); transition: transform .08s;
}
.big-btn:hover { transform: translateY(-2px); }
.big-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--green-d); }
.big-btn.alt { background: #f0a85a; box-shadow: 0 5px 0 #c97f36; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
#goals {
  position: absolute; top: 14px; left: 14px; padding: 12px 16px 10px; width: min(340px, 60vw);
  pointer-events: auto;
}
#goal-chapter { font-family: 'Fredoka'; font-size: 13px; color: var(--brown2); text-transform: uppercase; letter-spacing: 1px; }
#goal-title { font-family: 'Fredoka'; font-weight: 600; font-size: 19px; margin-bottom: 4px; }
#goal-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
#goal-list li { padding: 3px 0 3px 26px; position: relative; line-height: 1.25; }
#goal-list li::before {
  content: ''; position: absolute; left: 2px; top: 4px; width: 15px; height: 15px; border-radius: 50%;
  border: 2.5px solid var(--brown2);
}
#goal-list li.done { color: #9a8a76; text-decoration: line-through; }
#goal-list li.done::before { background: var(--green); border-color: var(--green-d); }
#goal-list li.locked { opacity: .45; }
#goal-list li .prog { font-weight: 800; color: #d9822b; }
#goals { cursor: pointer; }
#goals.collapsed #goal-list { display: none; }
#goal-toggle {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; border: none;
  display: grid; place-items: center; background: rgba(138, 106, 72, .14); color: var(--brown2); cursor: pointer;
}
#goal-toggle:hover { background: rgba(138, 106, 72, .26); }
#goal-toggle .ico { width: 16px; height: 16px; transition: transform .2s; transform: rotate(180deg); }
#goals.collapsed #goal-toggle .ico { transform: none; }
#goal-chapter, #goal-title { padding-right: 34px; }
#goal-summary { display: none; font-size: 13px; font-weight: 700; color: var(--brown2); }
#goals.collapsed #goal-summary { display: block; }

#topright { position: absolute; top: 14px; right: 14px; display: flex; gap: 8px; align-items: center; pointer-events: auto; }
#coins { font-size: 18px; display: flex; align-items: center; gap: 6px; }
.round-btn {
  width: 46px; height: 46px; border-radius: 50%; border: 3px solid #fff; background: var(--cream);
  font-size: 22px; box-shadow: var(--shadow); padding: 0;
}
.round-btn:active { transform: translateY(2px); }
#prompt {
  position: absolute; left: 50%; bottom: 110px; transform: translateX(-50%);
  background: rgba(255, 248, 230, .95); border-radius: 999px; padding: 8px 18px; font-family: 'Fredoka';
  font-weight: 600; font-size: 18px; box-shadow: var(--shadow); white-space: nowrap;
  pointer-events: auto; cursor: pointer; /* tap it to hear it */
}
#prompt kbd {
  display: inline-block; background: var(--brown); color: #fff; border-radius: 8px; padding: 0 8px; margin-right: 6px;
  font-family: 'Fredoka';
}
#help { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); font-size: 13px; opacity: .85; white-space: nowrap; }

/* Dialog: a storybook panel. --speaker is set per line to the speaker's colour. */
#dialog {
  --speaker: #e98d5b;
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(720px, 94vw); z-index: 20; cursor: pointer; color: var(--brown);
  padding: 14px 22px 16px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(253, 246, 228, .8), rgba(244, 229, 196, .74));
  -webkit-backdrop-filter: blur(4px) saturate(1.1); backdrop-filter: blur(4px) saturate(1.1);
  border: 2px solid rgba(138, 106, 72, .5);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .5), 0 10px 26px rgba(40, 25, 10, .22);
  font-family: 'Nunito'; font-weight: 700; font-size: 20px; line-height: 1.45;
}
#dlg-name {
  display: flex; align-items: center; gap: 10px; margin-bottom: 4px; color: var(--speaker);
  font-family: 'Fredoka'; font-weight: 600; font-size: 14px; letter-spacing: .1em; text-transform: uppercase;
}
#dlg-name::after { content: ''; flex: 1; height: 2px; border-radius: 2px; background: currentColor; opacity: .3; }
#dlg-text { min-height: 2.9em; padding-right: 18px; }
/* a live, round portrait of whoever is speaking, ringed in their colour */
#dlg-portrait {
  --ring: var(--speaker); position: absolute; left: 16px; top: 14px; width: 84px; height: 84px; border-radius: 50%;
  overflow: hidden; background: radial-gradient(circle at 50% 40%, #fbf1d8, #f0deb5); box-shadow: 0 0 0 4px var(--ring), 0 4px 10px rgba(40, 25, 10, .25);
}
#dlg-portrait canvas { display: block; width: 100%; height: 100%; }
#dlg-portrait.pop { animation: portraitIn .25s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes portraitIn { from { transform: scale(.7); } }
#dialog:has(#dlg-portrait:not(.hidden)) { padding-left: 120px; min-height: 112px; }
/* hear a choice read aloud before picking it */
#dlg-choices .hear { margin-left: auto; flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; }
#dlg-choices .hear:hover { background: rgba(122, 184, 232, .25); }
#dlg-choices .hear .ico { width: 22px; height: 22px; }
#dlg-next { position: absolute; right: 14px; bottom: 10px; color: var(--speaker); animation: nudge 1.1s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(4px); opacity: .55; } }
/* QA #8: hear the line again (speaker), and a big separate skip arrow that shows late in a voiced line */
#dialog:has(#dlg-replay:not(.hidden)) #dlg-name { margin-right: 44px; }
#dialog:has(#dlg-replay:not(.hidden)) #dlg-text { padding-right: 44px; }
#dlg-replay { position: absolute; right: 10px; top: 8px; width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(138, 106, 72, .35);
  background: rgba(255, 255, 255, .7); color: var(--brown); display: grid; place-items: center; padding: 0; cursor: pointer; }
#dlg-replay .ico { width: 26px; height: 26px; vertical-align: middle; }
#dlg-replay:active { transform: scale(.92); }
#dlg-skip { position: absolute; right: 6px; top: -80px; width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; padding: 0;
  background: var(--speaker); color: #fff; box-shadow: 0 6px 16px rgba(40, 25, 10, .3); display: grid; place-items: center; cursor: pointer;
  animation: skipIn .3s cubic-bezier(.34, 1.56, .64, 1); }
#dlg-skip .ico { width: 40px; height: 40px; vertical-align: middle; }
@keyframes skipIn { from { transform: scale(.4); opacity: 0; } }
#dlg-skip.wiggle, #dlg-replay.wiggle { animation: wiggle .4s ease-in-out; }
@keyframes wiggle { 25% { transform: rotate(-12deg) scale(1.08); } 75% { transform: rotate(12deg) scale(1.08); } }
/* the story page's Next button waits until most of the page has been read aloud */
#story-next.wait, #saint-next.wait { opacity: .45; filter: saturate(.4); pointer-events: none; }
#story-next, #saint-next { transition: opacity .4s, filter .4s; }
@keyframes bob { 50% { transform: translateY(4px); } }
/* choices: a numbered list inside the panel (number keys pick them too) */
#dlg-choices {
  display: flex; flex-direction: column; gap: 2px; margin-top: 10px; padding-top: 8px;
  border-top: 2px dashed rgba(138, 106, 72, .3); counter-reset: choice;
}
#dlg-choices button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px; border: none; border-radius: 8px;
  background: transparent; color: var(--brown); font: 700 18px 'Nunito'; text-align: left; cursor: pointer;
  counter-increment: choice;
}
#dlg-choices button::before {
  content: counter(choice); flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px;
  border-radius: 50%; background: rgba(138, 106, 72, .16); font: 600 13px 'Fredoka';
}
#dlg-choices button:hover, #dlg-choices button.sel { background: rgba(255, 255, 255, .62); box-shadow: inset 3px 0 0 var(--speaker); }
#dlg-choices button.sel::before { background: var(--speaker); color: #fff; }
/* picture choices (a fruit from your tree to show Mary): bigger pictures, two columns */
#dlg-choices:has(.pic-choice) { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
#dlg-choices button.pic-choice { padding: 3px 8px; }
#dlg-choices button.pic-choice .ico { width: 38px; height: 38px; flex: none; }

/* Toasts & floaters */
#toasts { position: fixed; top: 80px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 30; pointer-events: none; }
.toast {
  background: var(--cream); border-radius: 999px; padding: 10px 22px; box-shadow: var(--shadow); font-family: 'Fredoka';
  font-weight: 600; font-size: 19px; animation: toastIn .3s ease-out; border: 3px solid #fff;
}
.toast.big { font-size: 24px; padding: 14px 30px; background: #fff3c4; }
@keyframes toastIn { from { transform: translateY(-20px) scale(.8); opacity: 0; } }
/* an aside (UI.bubble): a fish fact or a find, over the game while you keep playing; a tap closes it */
.aside {
  --speaker: #3a8fb5;
  position: fixed; left: 50%; bottom: calc(158px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: max-content; max-width: min(480px, calc(100vw - 360px)); z-index: 19; pointer-events: auto; cursor: pointer;
  display: flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 16px; color: var(--brown);
  background: rgba(253, 246, 228, .92); border: 3px solid #fff; border-left: 8px solid var(--speaker); box-shadow: var(--shadow);
  font-family: 'Fredoka'; font-weight: 500; font-size: 19px; line-height: 1.3; animation: asideIn .3s ease-out;
}
.aside .ico { width: 34px; height: 34px; flex: none; }
.aside.out { transition: opacity .3s, transform .3s; opacity: 0; transform: translate(-50%, 12px); }
@keyframes asideIn { from { transform: translate(-50%, 16px) scale(.9); opacity: 0; } }
/* it sits just above the action prompt ("E Fish", #prompt), so the prompt is never covered (playtest, Oct 2026) */
body.touch .aside { bottom: calc(198px + env(safe-area-inset-bottom)); }
body.in-browser.touch .aside { bottom: calc(162px + env(safe-area-inset-bottom)); }
@media (max-width: 700px) { body .aside { max-width: calc(100vw - 32px); font-size: 17px; } }
body.talking .aside { display: none; }
#floaters { position: fixed; inset: 0; pointer-events: none; z-index: 15; }
/* memory bubble (src/memory.js): a thought cloud over the town, under the HUD and dialog; never takes input */
#memory { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; display: none; }
.floater { position: absolute; font-size: 28px; transform: translate(-50%, -50%); animation: floatUp 1.3s ease-out forwards; font-family: 'Fredoka'; font-weight: 700; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
@keyframes floatUp { to { transform: translate(-50%, -150%); opacity: 0; } }
.floater.stay { animation: pop .25s ease-out; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(0); } }

/* Modal */
#modal { position: fixed; inset: 0; background: rgba(60, 40, 20, .35); display: flex; align-items: center; justify-content: center; z-index: 40; }
#modal-card { position: relative; width: min(680px, 94vw); max-height: 86dvh; overflow: auto; padding: 24px 26px; }
#modal-close { position: absolute; top: 12px; right: 14px; border: none; background: #f0a85a; color: #fff; width: 36px; height: 36px; border-radius: 50%; font-size: 18px; }
#modal h2 { font-family: 'Fredoka'; margin: 0 0 12px; font-weight: 600; }
#modal h3 { font-family: 'Fredoka'; margin: 16px 0 8px; font-weight: 600; color: var(--brown2); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.slot {
  background: var(--cream2); border-radius: 18px; padding: 10px 6px; text-align: center; position: relative; border: 3px solid transparent;
}
.slot .ic { font-size: 34px; line-height: 1.1; }
.slot .nm { font-size: 13px; line-height: 1.2; margin-top: 4px; }
.slot .ct { position: absolute; top: 4px; right: 8px; font-weight: 800; color: #d9822b; }
.slot.off { opacity: .35; filter: grayscale(1); }
.slot button { margin-top: 6px; border: none; background: var(--green); color: #fff; border-radius: 999px; padding: 4px 10px; font-size: 14px; }
.slot button:disabled { background: #c9bba3; }
.slot.owned { border-color: var(--green); }
.empty { opacity: .6; font-style: italic; }
/* Journal: your fruit tree (the Fruits of the Holy Spirit as real fruit; src/fruits.js) */
.tree-wrap { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-start; }
.tree-pic { flex: 0 0 auto; width: min(300px, 100%); margin: 0 auto; }
.tree-pic svg { width: 100%; height: auto; display: block; }
.tree-pic .tf { cursor: pointer; }
.tree-pic .tf:hover, .tree-pic .tf:focus { filter: drop-shadow(0 0 4px #ffe58a); }
.fruit-list { flex: 1 1 260px; display: grid; gap: 8px; align-content: start; }
.fruit-row { display: flex; gap: 10px; align-items: center; background: var(--cream2); border-radius: 16px; padding: 6px 12px 6px 6px; cursor: pointer; text-align: left; }
.fruit-row .ico { width: 46px; height: 46px; flex: 0 0 auto; }
.fruit-row b { font-family: 'Fredoka'; font-size: 17px; }
.fruit-row small { display: block; font-size: 13px; opacity: .78; line-height: 1.3; }
.tree-about { font-size: 14px; opacity: .8; margin: -4px 0 10px; }
#mapcanvas { width: 100%; border-radius: 18px; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: 14px; margin-top: 8px; }

/* Story */
#story { position: fixed; inset: 0; background: rgba(60, 40, 20, .55); display: flex; align-items: center; justify-content: center; z-index: 50; }
#story-card {
  width: min(620px, 92vw); background: #fdf3da; border-radius: 30px; padding: 30px 34px 26px; text-align: center;
  box-shadow: var(--shadow); border: 6px solid #fff; background-image: radial-gradient(circle at 30% 0%, #fffaf0, #f7e7c2);
}
#story-ref { font-family: 'Fredoka'; color: var(--brown2); letter-spacing: 1px; text-transform: uppercase; font-size: 14px; }
#story-title { font-family: 'Fredoka'; font-size: 30px; font-weight: 600; margin: 4px 0 6px; }
#story-art { font-size: 64px; margin: 6px 0; }
#story-text { font-size: 20px; line-height: 1.5; min-height: 90px; margin-bottom: 18px; }
#story-note { font-size: 17px; font-style: italic; color: var(--brown2); line-height: 1.4; margin: -6px 0 18px; }
#story-note .ico { width: 1.5em; height: 1.5em; vertical-align: -0.4em; margin-right: 6px; }
/* a Fruit of the Holy Spirit: it grows in gently, in a soft glow */
.fruit-page #story-art { background: radial-gradient(circle, rgba(255, 236, 150, .85), rgba(255, 236, 150, 0) 62%); }
.fruit-page #story-art .ico { width: 124px; height: 124px; animation: fruit-grow 1.2s cubic-bezier(.34, 1.56, .64, 1) both; }
.fruit-page #story-text { min-height: 0; }
@keyframes fruit-grow { from { transform: scale(0) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .fruit-page #story-art .ico { animation: none; } }
#story-card { position: relative; }
/* "Talk about it": a small box for the grown-up under a page's text (the calm stop before the next chapter) */
#story-note.talk { font-style: normal; color: inherit; text-align: left; background: #e7f4e2; border: 3px dashed #6cbf6a; border-radius: 16px; padding: 8px 14px; margin: -6px 0 16px; font-size: 16px; line-height: 1.4; }
#story-note.talk b { display: block; font: 600 13px 'Fredoka'; letter-spacing: .08em; text-transform: uppercase; color: #3f8a3d; }
#story-note.hidden, #story-close.hidden { display: none; }
#story-close { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; background: var(--cream2, #f3e3c0); padding: 6px; cursor: pointer; }
#story-close .ico { width: 100%; height: 100%; }
/* Story Time in the Journal: one picture book per finished chapter, read with a grown-up */
.storytime { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.st-book { font: inherit; color: inherit; cursor: pointer; text-align: center; border-radius: 18px; border: 3px solid #fff; background: var(--cream2, #f3e3c0); padding: 8px 8px 10px; }
.st-book:hover { border-color: #f2c14e; }
.st-book .st-pic svg, .st-book .st-pic img { display: block; width: 100%; height: auto; border-radius: 12px; border: 2px solid #5a4430; background: #fff8e8; }
.st-book .st-pic .ico { width: 64px; height: 64px; }
.st-book .st-nm { font-size: 13px; line-height: 1.25; margin-top: 6px; }
.st-book .st-nm b { font-family: 'Fredoka'; font-weight: 600; font-size: 15px; }
.st-book.off { opacity: .4; filter: grayscale(1); cursor: default; }


/* Creator */
#creator { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 55; background: rgba(60, 40, 20, .55); }
#creator-card { width: min(860px, 96vw); max-height: 96dvh; overflow: auto; padding: 18px 24px 22px; text-align: center; }
#creator-card h2 { font-family: 'Fredoka'; font-weight: 600; margin: 0 0 8px; font-size: 28px; }
#creator-grid { display: grid; grid-template-columns: 300px 1fr; gap: 18px; text-align: left; margin-bottom: 16px; }
@media (max-width: 720px) { #creator-grid { grid-template-columns: 1fr; } #preview-wrap { height: 230px; } }
#preview-wrap { position: relative; background: radial-gradient(circle at 50% 40%, #fffdf5, #f1e2bf); border-radius: 24px; height: 380px; overflow: hidden; }
#preview { width: 100%; height: 100%; display: block; }
.preview-rot { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 14px; }
.preview-rot button { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; background: var(--cream); font-size: 20px; box-shadow: var(--shadow); }
.opt-row { margin-bottom: 10px; }
.opt-row label { display: block; font-family: 'Fredoka'; font-weight: 600; font-size: 15px; margin-bottom: 4px; color: var(--brown2); }
.opt-row input[type=text] {
  font-family: 'Fredoka'; font-size: 18px; padding: 7px 14px; border-radius: 999px; border: 3px solid var(--cream2); background: #fff; color: var(--brown); width: 220px; outline: none;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 3px solid var(--cream2); background: #fff; border-radius: 999px; padding: 4px 13px; font-size: 15px; font-weight: 500; }
.chip.sel { border-color: #e98d5b; background: #ffe9d6; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--cream2); padding: 0; }
.swatch.sel { box-shadow: 0 0 0 3px #e98d5b; }

/* Touch */
#touch { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#stick { position: absolute; left: 26px; bottom: 26px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,248,230,.45); border: 3px solid rgba(255,255,255,.7); pointer-events: auto; touch-action: none; }
#knob { position: absolute; left: 40px; top: 40px; width: 50px; height: 50px; border-radius: 50%; background: var(--cream); box-shadow: var(--shadow); }
#act-btn { position: absolute; right: 30px; bottom: 40px; width: 86px; height: 86px; border-radius: 50%; border: 4px solid #fff; background: var(--gold); font-size: 38px; pointer-events: auto; box-shadow: var(--shadow); touch-action: none; }
body.touch #help { display: none; }
body.touch #prompt { bottom: 150px; }
body.touch #prompt kbd { display: none; }
@media (max-width: 900px) {
  #goals { width: min(290px, 55vw); padding: 9px 12px 8px; }
  #goal-title { font-size: 16px; }
  #goal-list { font-size: 12.5px; }
  .round-btn { width: 40px; height: 40px; font-size: 19px; }
  #dialog { font-size: 18px; }
}
#game::after {
  content: ''; position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 55%, transparent 65%, rgba(70, 45, 20, 0.12) 100%);
}
/* Notches and home indicators (iPhone app and phone browsers) */
html, body { -webkit-touch-callout: none; overscroll-behavior: none; }
#goals { top: calc(14px + env(safe-area-inset-top)); left: calc(14px + env(safe-area-inset-left)); }
#topright { top: calc(14px + env(safe-area-inset-top)); right: calc(14px + env(safe-area-inset-right)); }
#stick { left: calc(26px + env(safe-area-inset-left)); bottom: calc(26px + env(safe-area-inset-bottom)); }
#act-btn { right: calc(30px + env(safe-area-inset-right)); bottom: calc(40px + env(safe-area-inset-bottom)); }
body.touch #prompt { bottom: calc(150px + env(safe-area-inset-bottom)); }
#creator, #modal, #story, #title, #chapters { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#creator-card { max-height: calc(96dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
#modal-card { max-height: calc(86dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
/* Drawn icons */
.ico { width: 1.25em; height: 1.25em; vertical-align: -0.3em; flex: none; }
.round-btn .ico { width: 26px; height: 26px; vertical-align: middle; }
#coins .ico { width: 22px; height: 22px; }
#act-btn .ico { width: 50px; height: 50px; vertical-align: middle; }
#dlg-next .ico { width: 14px; height: 14px; }
#modal-close .ico { width: 16px; height: 16px; vertical-align: middle; }
.slot .ic .ico { width: 42px; height: 42px; }
#story-art .ico { width: 88px; height: 88px; }
.floater .ico { width: 40px; height: 40px; vertical-align: middle; }
.toast .ico, #prompt .ico { margin-right: 6px; }
.toast.big .ico { width: 34px; height: 34px; }
#story-next .ico.after { width: .8em; height: .8em; vertical-align: -0.05em; }
#modal h2 .ico { width: 34px; height: 34px; vertical-align: -0.35em; margin-right: 4px; }
.row-ic { margin: 3px 0; }
.row-ic .retell-btn { margin-left: 8px; padding: 2px 10px; font-size: 14px; cursor: pointer; vertical-align: middle; }
.row-ic .retell-btn .ico { width: 18px; height: 18px; vertical-align: -3px; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.you-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: #2f7de1; border: 3px solid #fff; box-shadow: 0 0 0 1px #5a4430; vertical-align: -2px; }
/* Narrow phones: goals go below the top-right buttons instead of underneath them */
@media (max-width: 520px) {
  #goals { top: calc(66px + env(safe-area-inset-top)); width: min(290px, 70vw); }
  /* story pages: a little less padding, so the picture fits the card (QA kid-7yo B8) */
  #story-card { padding: 22px 18px 20px; }
}
/* Goals and key help step aside during a conversation */
#goals, #help { transition: opacity .3s; }
body.talking #goals, body.talking #help { opacity: 0; pointer-events: none; }
/* Short screens (phones in landscape): a slimmer dialog */
@media (max-height: 500px) {
  #dialog { width: min(640px, 82vw); padding: 10px 18px 12px; font-size: 16px; bottom: calc(10px + env(safe-area-inset-bottom)); }
  #dlg-text { min-height: 0; }
  #dlg-portrait { width: 60px; height: 60px; left: 12px; top: 10px; box-shadow: 0 0 0 3px var(--ring); }
  #dialog:has(#dlg-portrait:not(.hidden)) { padding-left: 86px; min-height: 80px; }
  #dlg-choices button { padding: 3px 8px; font-size: 15px; }
  /* with choices up, they sit in a column beside the text so the panel stays short */
  #dialog:has(#dlg-choices:not(.hidden)) { display: grid; grid-template-columns: 1fr minmax(180px, 42%); column-gap: 14px; width: min(760px, 92vw); }
  #dialog:has(#dlg-choices:not(.hidden)) #dlg-name { grid-column: 1 / -1; }
  #dlg-choices { margin: 0; padding: 0 0 0 12px; border-top: none; border-left: 2px dashed rgba(138, 106, 72, .3); align-self: center; }
}
/* Clues in dialog: who to find, where to go, what to bring */
#dlg-text .clue { color: #b4501f; font-weight: 800; background: rgba(242, 193, 78, .45); border-radius: 6px; padding: 0 3px; }

/* ---------- App additions: profiles, unlocking chapters, graphics settings ---------- */
/* With post-processing on, the vignette is drawn in the final pass instead */
body.polish #game::after { display: none; }
#modal { z-index: 65; }
.big-btn.small { font-size: 15px; padding: 8px 18px; }
.big-btn.ghost { background: transparent; color: var(--brown2); box-shadow: none; border: 3px solid rgba(138, 106, 72, .35); }
.link-btn { border: none; background: none; color: var(--brown2); font: 600 15px 'Fredoka'; text-decoration: underline; text-underline-offset: 3px; padding: 8px; margin-top: 6px; }
.link-btn .ico { text-decoration: none; }
.tag { font: 600 12px 'Fredoka'; background: rgba(138, 106, 72, .14); color: var(--brown2); border-radius: 999px; padding: 1px 8px; margin-left: 4px; }
#fps { position: fixed; left: 50%; top: calc(4px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 99; font: 600 12px 'Fredoka'; background: rgba(0, 0, 0, .55); color: #fff; border-radius: 999px; padding: 2px 10px; pointer-events: none; }


/* Grown-ups panel */
.grown-about { font-size: 15px; line-height: 1.45; }
.grown-msg { font-weight: 800; color: var(--green-d); }
.grown-list { display: flex; flex-direction: column; gap: 8px; }
.grown-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--cream2); border-radius: 16px; padding: 8px 8px 8px 16px; font: 600 17px 'Fredoka'; }

/* Unlock a chapter: a page from the same storybook */
#unlock { position: fixed; inset: 0; background: rgba(60, 40, 20, .55); display: flex; align-items: center; justify-content: center; z-index: 62; /* over Chapter Select (60), under the grown-ups gate (#modal, 65) */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#unlock-card {
  width: min(620px, 92vw); max-height: calc(94dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto;
  border-radius: 30px; padding: 26px 30px 18px; text-align: center;
  box-shadow: var(--shadow); border: 6px solid #fff; background: #fdf3da; background-image: radial-gradient(circle at 30% 0%, #fffaf0, #f7e7c2);
  animation: page-in .35s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes page-in { from { transform: scale(.9) rotate(-1deg); opacity: 0; } }
#unlock-ref { font-family: 'Fredoka'; color: var(--brown2); letter-spacing: 1px; text-transform: uppercase; font-size: 13px; }
.unlock-title { font-family: 'Fredoka'; font-size: 30px; font-weight: 600; margin: 4px 0 2px; }
.unlock-art { position: relative; display: inline-block; margin: 4px 0; }
.unlock-art > .ico { width: 92px; height: 92px; }
.unlock-art.yay > .ico { animation: bob 1.6s infinite; }
.unlock-lock { position: absolute; right: -14px; bottom: -4px; }
.unlock-lock .ico { width: 40px; height: 40px; filter: drop-shadow(0 2px 0 #fff); }
.unlock-text { font-size: 18px; line-height: 1.5; margin: 4px 0 8px; }
.unlock-ask { font: 600 18px 'Fredoka'; color: var(--brown2); margin-bottom: 12px; }
.ul-hear { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; }
#unlock-card { position: relative; }
.row-btn { display: block; width: 100%; text-align: left; border: none; background: rgba(138, 106, 72, .08); border-radius: 12px; padding: 4px 8px; font: inherit; color: inherit; cursor: pointer; }
.store-state { font: 600 15px 'Fredoka'; color: var(--brown2); white-space: nowrap; padding-right: 8px; }
.store-state .ico { width: 18px; height: 18px; vertical-align: -3px; }
.store-buy { min-width: 150px; }
.store-onetime { font: 600 15px 'Fredoka'; color: var(--brown2); text-align: center; margin: 8px 0 4px; }
.store-restore { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.store-restore small { flex: 1; min-width: 200px; opacity: .75; font-size: 13px; }
.unlock-note { background: #fff3c4; border-radius: 14px; padding: 8px 12px; margin-bottom: 10px; font-size: 15px; }
.unlock-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px; }
.unlock-btns .big-btn { font-size: 19px; }
#unlock-card .big-btn:disabled { opacity: .55; }
#unlock-card .link-btn { font-size: 14px; }
/* the locked-chapter pill (QA #5): small and neutral, no gold, no wiggle; a lock (or an hourglass while
   Ask to Buy is pending) and the chapter number. It opens the unlock page. */
#unlock-btn {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); pointer-events: auto;
  border: 2px solid rgba(255, 255, 255, .7); background: rgba(255, 248, 230, .82); color: var(--brown2);
  font-size: 13px; padding: 4px 12px 4px 9px; display: flex; align-items: center; gap: 5px; box-shadow: none; opacity: .9;
}
#unlock-btn .ico { width: 16px; height: 16px; opacity: .8; }
@media (max-width: 720px) { #unlock-btn { top: auto; bottom: calc(190px + env(safe-area-inset-bottom)); } }
/* Short screens (phones in landscape): a compact unlock page that fits without scrolling */
@media (max-height: 500px) {
  #unlock-card { padding: 12px 22px 8px; width: min(720px, 92vw); }
  .unlock-title { font-size: 22px; margin: 0; }
  .unlock-art > .ico { width: 46px; height: 46px; }
  .unlock-lock .ico { width: 24px; height: 24px; }
  .unlock-text { font-size: 14px; line-height: 1.35; margin: 2px 0 4px; }
  .unlock-ask { font-size: 15px; margin-bottom: 4px; }
  .unlock-btns { margin-top: 4px; gap: 8px; }
  .unlock-btns .big-btn { font-size: 15px; padding: 8px 18px; }
  .unlock-btns + .unlock-btns { display: inline-flex; }
  #unlock-card .link-btn { font-size: 13px; margin: 0; padding: 4px; }
}

/* "Play full screen" hint on phones in a browser tab (src/install.js) */
#install-hint {
  margin: 18px auto 0; width: min(520px, calc(100vw - 24px)); box-sizing: border-box; display: flex; align-items: center; gap: 10px;
  background: var(--cream); border-radius: 18px; padding: 10px 10px 10px 16px; box-shadow: var(--shadow);
  font-size: 15px; line-height: 1.35; text-align: left;
}
#install-hint .install-text { flex: 1; }
#install-hint .share-ico { width: 18px; height: 18px; vertical-align: -3px; color: #2f7de1; }
#install-hint .install-go { border: none; background: var(--green); color: #fff; border-radius: 999px; padding: 6px 14px; font-size: 15px; font-weight: 600; }
#install-hint .install-x { border: none; background: rgba(138, 106, 72, .14); border-radius: 50%; width: 30px; height: 30px; flex: none; font-size: 14px; padding: 0; }
@media (max-height: 500px) {
  #install-hint { margin-top: 12px; padding: 6px 8px 6px 14px; font-size: 14px; }
}

/* Phones playing in a browser tab: the browser's bars take room, so the HUD and
   touch controls slim down and keep clear of the bottom toolbar (src/install.js) */
body.in-browser #stick { width: 104px; height: 104px; bottom: calc(18px + env(safe-area-inset-bottom)); left: calc(18px + env(safe-area-inset-left)); }
body.in-browser #knob { left: 32px; top: 32px; width: 40px; height: 40px; }
body.in-browser #act-btn { width: 68px; height: 68px; bottom: calc(26px + env(safe-area-inset-bottom)); right: calc(20px + env(safe-area-inset-right)); border-width: 3px; }
body.in-browser #act-btn .ico { width: 38px; height: 38px; }
body.in-browser .round-btn { width: 36px; height: 36px; border-width: 2px; }
body.in-browser .round-btn .ico { width: 21px; height: 21px; }
body.in-browser #topright { gap: 6px; top: calc(8px + env(safe-area-inset-top)); right: calc(8px + env(safe-area-inset-right)); }
body.in-browser #coins { padding: 4px 11px; font-size: 15px; }
body.in-browser #goals { top: calc(8px + env(safe-area-inset-top)); left: calc(8px + env(safe-area-inset-left)); width: min(240px, 46vw); padding: 7px 10px 6px; }
body.in-browser #goal-title { font-size: 14px; }
body.in-browser #goal-list { font-size: 11.5px; }
body.in-browser.touch #prompt { bottom: calc(118px + env(safe-area-inset-bottom)); font-size: 15px; }
@media (max-width: 520px) { body.in-browser #goals { top: calc(52px + env(safe-area-inset-top)); width: min(240px, 66vw); } }
/* Short screens (phones in landscape, especially with browser bars): a story page that fits */
@media (max-height: 420px) {
  #story-card { width: min(680px, 92vw); max-height: calc(100% - 12px); overflow: auto; padding: 12px 22px 12px; border-width: 4px; }
  #story-ref { font-size: 12px; }
  #story-title { font-size: 22px; margin: 0 0 2px; }
  #story-art { margin: 0; }
  #story-art .ico { width: 48px; height: 48px; }
  .fruit-page #story-art .ico { width: 72px; height: 72px; }
  #story-note { font-size: 14px; margin: -4px 0 8px; }
  #story-text { font-size: 16px; line-height: 1.4; min-height: 0; margin-bottom: 10px; }
  #story-next { font-size: 17px; padding: 8px 24px; }
}
/* Character creator: options scroll, "Let's Go!" stays pinned and reachable */
#creator-card { display: flex; flex-direction: column; overflow: hidden; }
#creator-grid { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
#creator-card h2, #creator-done { flex: none; }
#creator-done { align-self: center; }
@media (max-height: 500px) {
  #creator-card { padding: 10px 18px 12px; }
  #creator-card h2 { font-size: 22px; margin-bottom: 4px; }
  #creator-grid { grid-template-columns: 220px 1fr; margin-bottom: 8px; }
  #preview-wrap { height: calc(100dvh - 120px); min-height: 150px; position: sticky; top: 0; }
}

/* Guidance for non-readers (src/guide.js): the narrator's banner, the ear button on the goals panel,
   and the arrow at the screen edge pointing to the nearest goal */
#goal-hear {
  position: absolute; top: 8px; right: 44px; width: 30px; height: 30px; border-radius: 50%; border: none; padding: 0;
  display: grid; place-items: center; background: #ffe58a; cursor: pointer; box-shadow: 0 2px 0 #d9b43a;
}
#goal-hear:hover { background: #ffdb5c; }
#goal-hear:active { transform: translateY(2px); box-shadow: none; }
#goal-hear .ico { width: 22px; height: 22px; }
#goal-chapter, #goal-title { padding-right: 106px; }
#narration {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translate(-50%, -140%);
  width: max-content; max-width: min(460px, calc(100vw - 32px)); display: flex; align-items: center; gap: 10px;
  background: var(--cream); border: 3px solid #ffd23f; border-radius: 22px; padding: 9px 16px 9px 10px;
  font-family: 'Fredoka'; font-weight: 600; font-size: 17px; line-height: 1.25; box-shadow: var(--shadow);
  opacity: 0; transition: transform .35s cubic-bezier(.2, 1.4, .4, 1), opacity .3s; pointer-events: none; z-index: 12;
}
#narration.show { transform: translate(-50%, 0); opacity: 1; }
#narration .ico-slot .ico { width: 30px; height: 30px; display: block; animation: narr-pulse 1s ease-in-out infinite; }
#narration .clue { color: #d9822b; }
@keyframes narr-pulse { 50% { transform: scale(1.12); } }
body.talking #narration { opacity: 0; }
/* the help arrow: a round badge with the goal's face and a gold point nudging toward it (interview 01, C3) */
#goal-arrow {
  position: fixed; left: 0; top: 0; width: 72px; height: 72px; pointer-events: none; z-index: 11;
  opacity: 0; transition: opacity .3s; filter: drop-shadow(0 3px 4px rgba(60, 40, 20, .4));
}
#goal-arrow.show { opacity: 1; }
#goal-arrow .ga-pic {
  position: absolute; inset: 0; border-radius: 50%; overflow: hidden; box-sizing: border-box;
  background: #fff8e6; border: 4px solid #ffd23f; display: grid; place-items: center;
  animation: arrow-breathe 1.8s ease-in-out infinite;
}
#goal-arrow .ga-pic img { width: 118%; height: 118%; object-fit: cover; object-position: 50% 30%; }
#goal-arrow .ga-pic .ico { width: 70%; height: 70%; }
#goal-arrow .ga-point { position: absolute; inset: 0; }
#goal-arrow .ga-point svg {
  position: absolute; left: calc(100% - 12px); top: 50%; width: 40px; height: 40px; margin-top: -20px;
  animation: arrow-nudge 1.1s ease-in-out infinite;
}
@keyframes arrow-nudge { 50% { transform: translateX(7px); } }
@keyframes arrow-breathe { 50% { transform: scale(1.07); } }
/* on screen: a small gold arrow bobbing over the goal */
#goal-pin {
  position: fixed; left: 0; top: 0; width: 46px; height: 46px; pointer-events: none; z-index: 11;
  opacity: 0; transition: opacity .3s; filter: drop-shadow(0 2px 3px rgba(60, 40, 20, .4));
}
#goal-pin.show { opacity: 1; }
#goal-pin svg { width: 100%; height: 100%; animation: pin-bob 1.2s ease-in-out infinite; }
@keyframes pin-bob { 50% { transform: translateY(-9px); } }
@media (prefers-reduced-motion: reduce) {
  #goal-arrow .ga-pic, #goal-arrow .ga-point svg, #goal-pin svg { animation: none; }
}
body.in-browser #goal-hear { width: 26px; height: 26px; top: 6px; right: 38px; }
body.in-browser #goal-hear .ico { width: 19px; height: 19px; }
body.in-browser #goal-chapter, body.in-browser #goal-title { padding-right: 92px; }
body.in-browser #narration { font-size: 15px; padding: 7px 12px 7px 8px; }

/* ---------- Touch navigation for small hands (QA #9) ---------- */
/* The goals panel: a bigger ear button and fold button, further apart (Lily kept hitting the wrong one) */
#goal-toggle { width: 44px; height: 44px; top: 6px; right: 6px; }
#goal-toggle .ico { width: 20px; height: 20px; }
#goal-hear { width: 48px; height: 48px; top: 4px; right: 64px; }
#goal-hear .ico { width: 30px; height: 30px; }
#goal-chapter, #goal-title { padding-right: 118px; }
#goals { min-height: 56px; box-sizing: border-box; }
body.in-browser #goal-toggle { width: 44px; height: 44px; top: 4px; right: 4px; }
body.in-browser #goal-hear { width: 48px; height: 48px; top: 2px; right: 60px; }
body.in-browser #goal-hear .ico { width: 28px; height: 28px; }
body.in-browser #goal-chapter, body.in-browser #goal-title { padding-right: 112px; }
/* faces (or a picture) on each goal */
.goal-pics { display: inline-flex; vertical-align: middle; margin-right: 5px; }
.goal-pics img, .goal-pics .ico { width: 24px; height: 24px; border-radius: 50%; background: #fff8e6; box-shadow: 0 0 0 2px #fff, 0 1px 2px rgba(60, 40, 20, .35); }
.goal-pics img + img { margin-left: -6px; }
#goal-list li.done .goal-pics { opacity: .5; }
#goal-list li.current { font-weight: 800; }
/* folded: just the current goal */
#goal-summary { line-height: 1.3; }
#goal-summary .goal-pics img, #goal-summary .goal-pics .ico { width: 30px; height: 30px; }
#goals.collapsed #goal-summary { display: block; padding-right: 104px; }
/* Phones: the goals panel folds to one line, the current goal with its face and the ear button */
@media (max-width: 520px), (max-height: 500px) {
  #goals.collapsed, body.in-browser #goals.collapsed { padding: 4px 8px; min-height: 0; width: min(400px, calc(100vw - 28px)); }
  #goals.collapsed #goal-chapter, #goals.collapsed #goal-title { display: none; }
  #goals.collapsed #goal-summary { display: flex; align-items: center; min-height: 48px; padding-right: 112px;
    white-space: nowrap; font-size: 14px; color: var(--brown); }
  #goals.collapsed #goal-summary .goal-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  #goals.collapsed #goal-summary .goal-pics { flex: none; }
  #goals.collapsed #goal-summary .prog { margin-left: 4px; }
}
@media (max-height: 500px) {
  #goals.collapsed, body.in-browser #goals.collapsed { width: min(400px, calc(100vw - 300px)); }
}

/* The hand button shows who it will talk to (their face), or what it will do, with a little hand */
#act-btn { display: grid; place-items: center; overflow: visible; padding: 0; }
#act-btn .act-face { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #fff8e6; }
#act-btn .ico.act-badge { position: absolute; right: -6px; bottom: -6px; width: 34px; height: 34px; padding: 3px;
  border-radius: 50%; background: var(--gold); border: 3px solid #fff; box-sizing: content-box; }
body.in-browser #act-btn .ico.act-badge { width: 26px; height: 26px; }
#prompt .prompt-face { width: 30px; height: 30px; border-radius: 50%; vertical-align: middle; margin: -6px 6px -4px 0; background: #fff8e6; }

/* The big pray-for-help button by the hand button (Clide F15, "that button is your brand"): folded hands in a warm,
   soft light that breathes slowly. After ~30 s without progress it glows gold and hops; a press makes the hands glow
   and a few motes of light rise (guide.js). Slow and calm on purpose: nothing flashes. */
#pray-btn {
  position: absolute; right: calc(24px + env(safe-area-inset-right)); bottom: calc(24px + env(safe-area-inset-bottom));
  width: 64px; height: 64px; border-radius: 50%; border: 4px solid #fff; padding: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 38%, #fffbef 0%, #fdf0d2 42%, #e8dbfd 100%);
  box-shadow: var(--shadow), inset 0 -3px 6px rgba(138, 106, 208, .18); pointer-events: auto; touch-action: none;
  cursor: pointer; z-index: 11; isolation: isolate; overflow: visible;
  transition: opacity .3s, transform .15s ease-out;
}
/* the soft light around the button, breathing in and out */
#pray-btn::before {
  content: ''; position: absolute; inset: -12px; border-radius: 50%; z-index: -1; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 226, 140, .75) 0%, rgba(255, 220, 120, .35) 50%, rgba(255, 214, 90, 0) 72%);
  animation: pray-breathe 5s ease-in-out infinite;
}
#pray-btn .ico { width: 56px; height: 56px; position: relative; }
#pray-btn .pm-halo { transform-origin: 24px 19px; animation: pray-halo 5s ease-in-out infinite; }
#pray-btn:active { transform: translateY(2px) scale(.95); }
body.touch #pray-btn { right: calc(30px + 86px + 18px + env(safe-area-inset-right)); bottom: calc(51px + env(safe-area-inset-bottom)); }
body.in-browser #pray-btn { right: calc(20px + 68px + 14px + env(safe-area-inset-right)); bottom: calc(28px + env(safe-area-inset-bottom)); width: 60px; height: 60px; }
body.in-browser #pray-btn .ico { width: 52px; height: 52px; }
@keyframes pray-breathe { 0%, 100% { opacity: .45; transform: scale(.9); } 50% { opacity: .95; transform: scale(1.06); } }
@keyframes pray-halo { 0%, 100% { opacity: .55; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.05); } }
/* stuck for ~30 s: the light grows warmer and brighter, and the button hops now and then */
#pray-btn.glow { animation: pray-glow 2.4s ease-in-out infinite, pray-hop 2.4s ease-in-out infinite; }
#pray-btn.glow::before { animation-duration: 2.4s; inset: -18px; }
@keyframes pray-glow { 50% { box-shadow: 0 0 0 6px rgba(255, 214, 90, .5), 0 0 24px 10px rgba(255, 214, 90, .55); } }
@keyframes pray-hop { 0%, 60%, 100% { transform: none; } 70% { transform: translateY(-8px); } 80% { transform: none; } 88% { transform: translateY(-3px); } }
/* a press: the hands glow, the halo swells, and motes of light drift up and fade */
#pray-btn.prayed .pm-hands { animation: pray-hands 1.6s ease-out; }
#pray-btn.prayed .pm-halo { animation: pray-swell 1.6s ease-out; }
#pray-btn.prayed::before { animation: pray-swell-light 1.6s ease-out; }
@keyframes pray-hands { 0% { filter: none; } 30% { filter: brightness(1.12) drop-shadow(0 0 3px #ffe28a); } 100% { filter: none; } }
@keyframes pray-swell { 0% { opacity: .7; transform: scale(.95); } 35% { opacity: 1; transform: scale(1.25); } 100% { opacity: .7; transform: scale(1); } }
@keyframes pray-swell-light { 0% { opacity: .5; transform: scale(.95); } 35% { opacity: 1; transform: scale(1.3); } 100% { opacity: .5; transform: scale(1); } }
#pray-btn .pray-mote {
  position: absolute; left: 50%; top: 26%; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%;
  pointer-events: none; background: #fffbe6; box-shadow: 0 0 8px 4px rgba(255, 210, 80, .85); opacity: 0;
  animation: pray-mote 1.7s ease-out forwards;
}
@keyframes pray-mote {
  0% { opacity: 0; transform: translate(0, 0) scale(.6); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx, 0px), -72px) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  #pray-btn::before, #pray-btn .pm-halo { animation: none; opacity: .6; transform: none; }
  #pray-btn.glow { animation: pray-glow 2.4s ease-in-out infinite; }
  #pray-btn.glow::before { animation: none; opacity: 1; }
  #pray-btn.prayed .pm-halo, #pray-btn.prayed::before { animation: none; }
  #pray-btn .pray-mote { display: none; }
}
body.talking #pray-btn { opacity: 0; pointer-events: none; }
/* Giving (QA #10): a grid of big item pictures. The ones the other person needs wiggle gently. */
#dlg-choices.items { display: block; counter-reset: none; }
#dialog.picking { cursor: default; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
#dlg-choices .item-tile {
  position: relative; flex-direction: column; justify-content: center; gap: 2px; min-height: 120px; padding: 10px 6px 8px;
  background: rgba(255, 255, 255, .7); border: 3px solid rgba(138, 106, 72, .25); border-radius: 18px; text-align: center;
  font: 600 14px/1.15 'Fredoka'; counter-increment: none;
}
#dlg-choices .item-tile::before { content: none; }
#dlg-choices .item-tile:hover, #dlg-choices .item-tile.sel { background: #fff; border-color: var(--speaker); box-shadow: 0 0 0 3px rgba(233, 141, 91, .3); }
.item-tile .pic .ico { width: 72px; height: 72px; }
.item-tile.want .pic { display: inline-block; animation: wiggle 1.6s ease-in-out infinite; animation-delay: var(--wig, 0s); }
@keyframes wiggle { 0%, 55%, 100% { transform: rotate(0); } 62% { transform: rotate(-9deg) scale(1.06); } 70% { transform: rotate(8deg) scale(1.06); } 78% { transform: rotate(-5deg); } 86% { transform: rotate(3deg); } }
@media (prefers-reduced-motion: reduce) { .item-tile.want .pic { animation: none; } }
.item-tile .ct { position: absolute; top: 6px; left: 8px; background: var(--brown2); color: #fff; border-radius: 999px; padding: 0 7px; font: 600 13px 'Fredoka'; }
#dlg-choices .item-tile .hear { position: absolute; top: 4px; right: 4px; margin: 0; }
#dlg-choices .not-now {
  margin: 10px auto 0; width: auto; justify-content: center; padding: 6px 18px; border-radius: 999px; font-size: 16px; opacity: .85;
  border: 2px dashed rgba(138, 106, 72, .35); counter-increment: none;
}
#dlg-choices .not-now::before { content: none; }
#dlg-choices .not-now .hear { margin-left: 6px; }
.hear-prompt { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-left: 8px; vertical-align: middle; border: none; border-radius: 50%; background: #ffe58a; padding: 0; }
.hear-prompt .ico { width: 20px; height: 20px; }
.pick-dots { display: inline-flex; gap: 5px; margin-left: 10px; vertical-align: middle; }
.pick-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid var(--brown2); }
.pick-dots i.on { background: #6cc070; border-color: #4a9a4e; }
@media (max-height: 500px) {
  #dialog.picking { display: block; }
  .item-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
  #dlg-choices .item-tile { min-height: 90px; padding: 6px 4px; }
  .item-tile .pic .ico { width: 50px; height: 50px; }
  #dlg-choices.items { padding: 6px 0 0; border-left: none; }
}

/* ---------- The narrated creator (QA #10): steps, picture chips, name ideas ---------- */
#creator-card { position: relative; }
#creator-head { display: grid; grid-template-columns: 96px 1fr 96px; align-items: center; flex: none; }
#creator-head h2 { margin: 0; }
.creator-nav {
  justify-self: start; display: inline-flex; align-items: center; gap: 4px; height: 40px; padding: 0 14px 0 8px; border: none;
  border-radius: 999px; background: var(--cream2); font: 600 16px 'Fredoka'; color: var(--brown2);
}
.creator-nav .ico { width: 18px; height: 18px; }
.creator-nav:hover { background: #efdcb8; }
#creator-steps { justify-self: end; display: flex; gap: 6px; }
#creator-steps i { width: 11px; height: 11px; border-radius: 50%; background: var(--cream2); box-shadow: inset 0 0 0 2px #e2cfa8; }
#creator-steps i.done { background: #6cc070; box-shadow: none; }
#creator-steps i.on { background: #e98d5b; box-shadow: none; transform: scale(1.25); }
#creator-prompt { flex: none; margin: 4px 0 12px; font: 700 19px/1.3 'Nunito'; color: var(--brown); min-height: 1.3em; }
#creator-card.wardrobe #creator-prompt { display: none; }
#creator-foot { flex: none; display: flex; justify-content: center; align-items: center; gap: 14px; }
#creator-done .ico.after { width: .75em; height: .75em; vertical-align: -0.05em; }
#creator-done.waiting { filter: saturate(.35); opacity: .75; }
.quick-btn {
  height: 50px; padding: 0 20px; border: 3px solid #e9c46a; border-radius: 999px; background: #fff6d6;
  font: 600 18px 'Fredoka'; color: var(--brown); box-shadow: 0 4px 0 #d9b43a;
}
.quick-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #d9b43a; }
/* step 1: boy or girl, two big pictures (no preview yet) */
#creator-card.step-gender #preview-wrap { display: none; }
#creator-card.step-gender #creator-grid { grid-template-columns: 1fr; }
.gender-pick { display: flex; justify-content: center; gap: 22px; padding: 8px 0 14px; }
.gender-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(220px, 40vw); padding: 12px 10px 14px;
  border: 4px solid var(--cream2); border-radius: 26px; background: radial-gradient(circle at 50% 40%, #fffdf5, #f1e2bf);
  font: 600 26px 'Fredoka'; color: var(--brown); box-shadow: 0 5px 0 #e2cfa8;
}
.gender-btn img { width: 100%; aspect-ratio: 1; border-radius: 18px; }
.gender-btn:hover, .gender-btn.sel { border-color: #e98d5b; }
.gender-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #e2cfa8; }
/* picture chips: a little render of you with each choice on */
.pchip {
  flex: none; width: 74px; height: 74px; padding: 0; border: 3px solid var(--cream2); border-radius: 18px; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #fffdf5, #f1e2bf); display: grid; place-items: center;
}
.pchip img { width: 100%; height: 100%; display: block; }
.pchip.sel { border-color: #e98d5b; box-shadow: 0 0 0 3px rgba(233, 141, 91, .35); }
.pchip.tunic .ico { width: 54px; height: 54px; }
.opt-row .swatch { width: 40px; height: 40px; flex: none; }
/* the 12 skin tones: two rows of six, no labels and no tone first in a long strip (Character Design Standard §3) */
.chips.skin-grid { display: grid; grid-template-columns: repeat(6, 40px); gap: 6px; padding: 3px 2px; }
.opt-row .eye-colors .swatch { width: 34px; height: 34px; }
/* step 3: a name */
.name-ideas { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.name-ideas.nudge { animation: nudgeShake .5s; }
@keyframes nudgeShake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.name-idea {
  min-width: 120px; height: 58px; padding: 0 18px; border: 3px solid var(--cream2); border-radius: 18px; background: #fff;
  font: 600 22px 'Fredoka'; color: var(--brown); box-shadow: 0 4px 0 #e2cfa8;
}
.name-idea.sel { border-color: #e98d5b; background: #ffe9d6; }
.name-idea:active { transform: translateY(3px); box-shadow: 0 1px 0 #e2cfa8; }
.name-more { width: 48px; height: 48px; border-radius: 50%; border: none; background: var(--cream2); display: grid; place-items: center; padding: 0; }
.name-more .ico { width: 28px; height: 28px; }
.grownup-btn { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px; border-radius: 999px; border: 2px dashed var(--brown2); background: transparent; font: 600 17px 'Fredoka'; color: var(--brown2); }
.name-type { display: flex; gap: 8px; align-items: center; }
.name-type input { flex: 1; min-width: 0; max-width: 260px; font: 700 20px 'Nunito'; padding: 10px 14px; border-radius: 14px; border: 3px solid var(--cream2); color: var(--brown); }
.big-btn.small { font-size: 18px; padding: 8px 20px; }
.name-chosen { margin-top: 14px; font: 600 20px 'Fredoka'; color: var(--brown2); min-height: 1.4em; }
.name-chosen b { color: #c4622d; }
/* phones in portrait: a short preview on top, then each row is one strip you can swipe sideways,
   so hair, skin and eyes all show above the fold (QA kid-7yo B12) */
@media (max-width: 600px) and (min-height: 501px) {
  #creator-card { padding: 12px 12px 14px; width: 100vw; border-radius: 22px; }
  #creator-head { grid-template-columns: 84px 1fr 60px; }
  #creator-card h2 { font-size: 20px; }
  #creator-prompt { font-size: 16px; margin: 4px 0 8px; }
  #creator-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; margin-bottom: 8px; }
  #creator-opts, .opt-row { min-width: 0; }
  #preview-wrap { height: 170px; }
  .preview-rot { bottom: 6px; }
  .preview-rot button { width: 34px; height: 34px; font-size: 16px; }
  #creator-card.step-name #preview-wrap { height: 210px; }
  .chips.strip { flex-wrap: nowrap; overflow-x: auto; padding: 3px 2px 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .chips.strip::-webkit-scrollbar { display: none; }
  .opt-row { margin-bottom: 6px; }
  .opt-row label { font-size: 14px; margin-bottom: 2px; }
  .pchip { width: 64px; height: 64px; }
  .gender-pick { gap: 12px; }
  .gender-btn { font-size: 22px; }
  .name-idea { min-width: 0; flex: 1; font-size: 20px; padding: 0 8px; }
  .quick-btn { height: 46px; font-size: 16px; padding: 0 14px; }
  #creator-foot .big-btn { font-size: 20px; padding: 10px 26px; }
}
/* the preview stays in view while you scroll the choices (on phones too, so you see the headscarf go on) */
#creator-card:not(.step-gender) #preview-wrap { position: sticky; top: 0; z-index: 2; }
#dialog.picking #dlg-text { min-height: 0; margin-bottom: 4px; }
/* phones: a small face, and the pictures use the panel's full width (three across) */
@media (max-width: 600px) {
  #dialog.picking:has(#dlg-portrait:not(.hidden)) { padding-left: 84px; min-height: 0; }
  #dialog.picking #dlg-portrait { width: 56px; height: 56px; left: 14px; top: 12px; box-shadow: 0 0 0 3px var(--ring); }
  #dialog.picking:has(#dlg-portrait:not(.hidden)) #dlg-choices { margin-left: -66px; }
  #dialog.picking .item-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  #dlg-choices .item-tile { min-height: 104px; }
  .item-tile .pic .ico { width: 56px; height: 56px; }
}
/* fishing: the hand button pulses while a fish is on the line (src/settings.js) */
#act-btn.bite-pulse { animation: bite-pulse .5s ease-in-out infinite; background: #ffe27a; }
@keyframes bite-pulse { 50% { transform: scale(1.18); box-shadow: 0 0 0 8px rgba(255, 214, 90, .55), 0 0 22px 8px rgba(255, 214, 90, .65); } }

/* ---------- Title screen and "Who's playing?" (ported from the Godot build's title_screen.gd) ----------
   The town drifts by behind it in full colour, lightly softened (Post.backdrop in src/post.js), with morning
   light from the top and a faint edge so the logo reads (Clide F11: no sepia, no sunburst). The logo fades in,
   a dove crosses now and then, and the cards pop up one after another. */
#title {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background:
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(255, 246, 220, .42), rgba(255, 246, 220, 0) 75%),
    radial-gradient(ellipse 34% 30% at 50% 48%, rgba(255, 252, 240, .3), rgba(255, 252, 240, 0)),
    radial-gradient(ellipse 80% 80% at 50% 50%, rgba(30, 44, 60, 0) 62%, rgba(30, 44, 60, .14) 100%);
  --logo-w: min(520px, 80vw, 90vh);
  --card-w: 170px; --card-h: 216px; --pic: 140px; --card-gap: 18px; --name: 22px; --meta: 14px;
}
/* the blur isn't running (no WebGL backdrop): let the browser soften the town instead */
body:not(.title-blur) #title, body:not(.title-blur) #chapters { -webkit-backdrop-filter: blur(6px) saturate(1.05); backdrop-filter: blur(6px) saturate(1.05); }
#title-rays, .title-rays {
  position: absolute; left: 50%; top: 30%; width: 125vmax; height: 125vmax; pointer-events: none;
  transform: translate(-50%, -50%); animation: title-rays 78.5s linear infinite; will-change: transform;
}
@keyframes title-rays { to { transform: translate(-50%, -50%) rotate(360deg); } }
#title-card {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
  max-height: 100%; min-height: 0; box-sizing: border-box; padding: 12px 0;
}
#title h1 { margin: 0 0 14px; line-height: 0; flex: none; transition: opacity .25s; }
.wordmark { display: block; width: var(--logo-w); height: auto; aspect-ratio: 520 / 110; overflow: visible; }
#title.enter h1 { animation: title-logo .6s ease-out backwards; }
@keyframes title-logo { from { opacity: 0; } }
#title-btns { display: flex; flex-direction: column; gap: 10px; align-items: center; margin-top: 18px; }
/* one big Play (Clide F11), with a play arrow for kids who don't read yet */
#btn-play {
  display: inline-flex; align-items: center; justify-content: center; gap: 16px; min-width: 300px;
  padding: 20px 60px 22px 50px; font: 700 48px/1 'Fredoka'; letter-spacing: .5px;
  box-shadow: 0 8px 0 var(--green-d), 0 14px 28px rgba(30, 50, 30, .3); border: 4px solid #fff;
  animation: play-breathe 3.2s ease-in-out infinite;
}
#btn-play::before { content: ''; border-style: solid; border-width: .34em 0 .34em .54em; border-color: transparent transparent transparent #fff; }
#btn-play:active { transform: translateY(5px); box-shadow: 0 3px 0 var(--green-d), 0 6px 14px rgba(30, 50, 30, .3); animation: none; }
@keyframes play-breathe { 50% { transform: scale(1.04); } }
#loader:not(.done) ~ #title #btn-play { animation-play-state: paused; }
/* New game: a small link under Play, which asks on the page */
.title-link {
  border: none; background: none; padding: 10px 16px; font: 600 18px 'Fredoka'; color: #fff;
  text-decoration: underline; text-underline-offset: 3px; text-shadow: 0 1px 0 rgba(61, 38, 15, .6), 0 1px 5px rgba(61, 38, 15, .45);
}
#new-ask { background: var(--cream); color: var(--brown); border: 4px solid #fff; border-radius: 26px; padding: 14px 20px 16px; box-shadow: var(--shadow); max-width: min(440px, 88vw); }
#new-ask p { margin: 0 0 12px; font: 600 20px/1.25 'Fredoka'; }
.new-ask-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
#title-btns .hidden { display: none; }
/* the dove: across the sky twice in each 40 s, at different heights, wings beating (none for reduced motion) */
#title-dove { position: absolute; left: 0; top: 0; width: 84px; pointer-events: none; transform: translate(-200px, 0); animation: dove-cross 40s linear 3s infinite; }
#title-dove svg { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 3px 4px rgba(40, 60, 80, .22)); animation: dove-bob 1.1s ease-in-out infinite; }
#title-dove .wing { transform-box: view-box; transform-origin: 62px 45px; animation: dove-flap .42s ease-in-out infinite alternate; }
#title-dove .wing.far { animation-delay: -.05s; }
@keyframes dove-cross {
  0% { transform: translate(-120px, 26vh) scale(1); }
  24% { transform: translate(calc(100vw + 40px), 9vh) scale(1); }
  24.01%, 50% { transform: translate(-200px, 0) scale(.8); }
  74% { transform: translate(calc(100vw + 40px), 58vh) scale(.8); }
  74.01%, 100% { transform: translate(-200px, 0) scale(.8); }
}
@keyframes dove-bob { 50% { transform: translateY(-6px) rotate(-3deg); } }
@keyframes dove-flap { from { transform: scaleY(1); } to { transform: scaleY(-.55); } }
#loader:not(.done) ~ #title #title-dove, #loader:not(.done) ~ #title #title-dove * { animation-play-state: paused; }
.title-foot { flex: none; margin-top: 10px; font: 600 17px 'Nunito'; color: #fff; text-shadow: 0 1px 0 rgba(61, 38, 15, .55), 0 1px 6px rgba(40, 25, 10, .5); }

/* Who's playing? */
#picker { display: flex; flex-direction: column; align-items: center; min-height: 0; width: 100vw; max-width: 100%; }
#picker.hidden { display: none; }
.picker-title {
  flex: none; margin: 6px 0 0; font: 600 26px 'Fredoka'; color: #fff; text-shadow: 0 2px 0 rgba(61, 38, 15, .5);
}
.picker-loading { color: var(--cream); font-family: 'Fredoka'; font-size: 18px; padding: 30px; }
/* landscape: one row that scrolls sideways when there are lots of players (like Godot); portrait: rows */
.picker-grid {
  min-height: 0; max-width: 100%; box-sizing: border-box; overflow: auto hidden; padding: 16px 22px 18px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.picker-grid::-webkit-scrollbar { display: none; }
.picker-row { display: flex; gap: var(--card-gap); width: max-content; margin: 0 auto; }
@media (orientation: portrait) {
  .picker-grid { overflow: hidden auto; width: 100%; }
  .picker-row { flex-wrap: wrap; justify-content: center; width: auto; max-width: calc(4 * var(--card-w) + 3 * var(--card-gap)); }
}
.pcard {
  position: relative; flex: none; width: var(--card-w); height: var(--card-h); box-sizing: border-box; padding: 8px 8px 8px;
  border-radius: 26px; border: 4px solid #fff; background: var(--cream); color: var(--brown);
  box-shadow: 0 6px 12px rgba(46, 28, 10, .22); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px;
  transition: transform .12s ease-out; -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) { .pcard:hover { transform: scale(1.05); } }
.pcard:active { transform: scale(.96); }
.pcard.last { border-color: #ffe7a6; }
.pthumb { flex: none; width: var(--pic); height: var(--pic); border-radius: 50%; background: #f6e3b8; display: grid; place-items: center; overflow: hidden; }
.pthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pthumb .ico { width: 46%; height: 46%; }
.pname { font: 600 var(--name) 'Fredoka'; margin-top: 3px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
.pmeta { font: 700 var(--meta) 'Nunito'; color: var(--brown2); white-space: nowrap; }
.pcard.broken { opacity: .7; }
/* New player: the same card, a big green plus */
.pcard.new { justify-content: center; gap: 0; }
.pcard.new .pplus { font: 700 calc(var(--pic) * .6) / .9 'Fredoka'; color: var(--green); }
.pcard.new .pname { margin-top: 0; }
/* hear a name (QA #8): a round button poking out of the card's corner, where Godot has its remove button */
.phear {
  position: absolute; top: -12px; right: -12px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: #f3e3c0; border: 3px solid #fff; box-sizing: border-box; box-shadow: 0 3px 6px rgba(46, 28, 10, .25); cursor: pointer; color: var(--brown2);
}
.phear .ico { width: 22px; height: 22px; vertical-align: middle; }
.phear:active { transform: scale(.9); }
.picker-note { flex: none; color: var(--cream); font-size: 14px; }
/* the cards pop up one after another once the title shows (and wait while the loading screen is up) */
.picker-row.pop .pcard { animation: card-fade .25s ease-out backwards, card-pop .35s cubic-bezier(.34, 1.56, .64, 1) backwards; animation-delay: calc(.35s + var(--i) * .07s); }
@keyframes card-fade { from { opacity: 0; } }
@keyframes card-pop { from { transform: scale(.8); } }
#loader:not(.done) ~ #title .picker-row.pop .pcard { animation-play-state: paused; }
/* Grown-ups: a lock in the corner (behind the parental gate) */
#title-corner { position: absolute; right: calc(16px + env(safe-area-inset-right)); bottom: calc(12px + env(safe-area-inset-bottom)); }
#btn-grownups {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px; border: none; background: none;
  font: 600 15px 'Fredoka'; color: #fff; text-shadow: 0 1px 0 rgba(61, 38, 15, .6), 0 1px 4px rgba(61, 38, 15, .4);
  -webkit-tap-highlight-color: transparent;
}
#btn-grownups .round {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--cream);
  border: 3px solid #fff; box-sizing: border-box; box-shadow: 0 4px 6px rgba(46, 28, 10, .22);
}
#btn-grownups .round .ico { width: 30px; height: 30px; }
#btn-grownups:active .round { transform: translateY(2px); box-shadow: 0 1px 3px rgba(46, 28, 10, .22); background: #f5ecd8; }

/* phones held upright: two cards across */
@media (max-width: 520px) and (orientation: portrait) {
  #title { --card-w: 150px; --card-h: 194px; --pic: 116px; --card-gap: 14px; --name: 20px; --meta: 13px; }
  .picker-grid { padding: 16px 14px 18px; }
  .title-foot { font-size: 14px; margin-bottom: 64px; }
  #title-dove { width: 60px; }
  #btn-play { min-width: 220px; font-size: 36px; padding: 16px 44px 18px 38px; }
}
/* short screens (phones on their side): smaller cards, no footnote */
@media (max-height: 560px) {
  #title { --logo-w: min(420px, 70vh, 84vw); --card-w: 124px; --card-h: 160px; --pic: 92px; --card-gap: 14px; --name: 18px; --meta: 12px; }
  .picker-title { font-size: 21px; margin-top: 2px; }
  .picker-grid { padding: 14px 18px 12px; }
  .title-foot { display: none; }
  #btn-grownups .round { width: 46px; height: 46px; }
  #btn-grownups { font-size: 13px; }
  /* the cards fill the width here: Grown-ups goes up beside the logo */
  #title-corner { top: calc(8px + env(safe-area-inset-top)); bottom: auto; }
}
@media (max-height: 560px) {
  #title-btns { margin-top: 10px; gap: 4px; }
  #btn-play { min-width: 200px; font-size: 32px; padding: 12px 40px 14px 34px; }
  #title-dove { width: 60px; }
}
@media (max-height: 400px) { #title { --logo-w: min(340px, 64vh, 84vw); } #title h1 { margin-bottom: 0; } }

/* Loading screen: the wordmark on a warm glow (the Godot build's launch screen) with a soft sliding bar.
   When the game has drawn its first frame the logo glides onto the title's and the glow fades away. */
#loader {
  position: fixed; inset: 0; z-index: 200;
  background: radial-gradient(ellipse 50% 50% at 50% 50%, rgba(255, 231, 176, .8), rgba(255, 231, 176, 0)), #f3c27a;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 30px;
  transition: opacity .45s ease-out;
}
#loader.done { opacity: 0; pointer-events: none; }
#loader h1 { margin: 0; line-height: 0; transition: transform .3s ease-in-out; }
#loader .wordmark { width: min(700px, 80vw, 130vh); }
.load-bar { width: min(220px, 50vw); height: 8px; border-radius: 4px; background: rgba(90, 58, 34, .16); overflow: hidden; }
.load-bar i { display: block; width: 40%; height: 100%; border-radius: 4px; background: #a85a2e; animation: loadslide 1.3s ease-in-out infinite; }
@keyframes loadslide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
/* The title's logo stays hidden until the loading screen's logo has slid exactly onto it, so the two
   are never seen apart over "Who's playing?" (QA catechist B7); then it's simply there as the glow fades */
#loader:not(.done) ~ #title h1 { opacity: 0; transition: none; }

@media (prefers-reduced-motion: reduce) {
  #title-rays, .title-rays, .load-bar i { animation: none; }
  #btn-play { animation: none; }
  #title-dove { display: none; }
  .chapters-row.pop .ccard { animation: card-fade .25s ease-out backwards; animation-delay: .2s; }
  .ccard, .ccard:hover { transition: none; transform: none; }
  .picker-row.pop .pcard { animation: card-fade .25s ease-out backwards; animation-delay: .2s; }
  .pcard, .pcard:hover { transition: none; transform: none; }
}

/* ---------- Chapter Select (src/chapterselect.js): the title screen's look, a journey through Acts (Clide F10):
   a card per chapter as a stop on a winding road, the next one glowing, the later ones soft silhouettes ---------- */
#chapters {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: radial-gradient(ellipse 72% 72% at 50% 50%, rgba(40, 24, 10, 0) 45%, rgba(40, 24, 10, .34) 100%), rgba(60, 40, 20, .3);
  --cw: 196px; --cgap: 16px;
}
#chapters.hidden { display: none; }
#chapters-card { position: relative; display: flex; flex-direction: column; align-items: center; max-height: 100%; min-height: 0; width: 100%; box-sizing: border-box; padding: 10px 0; }
#chapters-head { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: min(100%, 1100px); padding: 0 16px; box-sizing: border-box; }
#chapters-back { justify-self: start; background: var(--cream); box-shadow: 0 3px 6px rgba(46, 28, 10, .22); color: var(--brown); }
#chapters-back .ico { width: 20px; height: 20px; }
.ch-book { text-align: center; }
.ch-based { margin-top: 4px; font: 700 14px 'Nunito'; color: var(--cream); opacity: .92; text-shadow: 0 1px 3px rgba(40, 25, 10, .55); }
.ch-book h2 {
  margin: 0; font: 700 40px/1.1 'Fredoka'; color: var(--cream); letter-spacing: .5px;
  -webkit-text-stroke: 7px #5a3a22; paint-order: stroke fill; text-shadow: 0 4px 0 #5a3a22;
}
.ch-who { flex: none; display: flex; align-items: center; gap: 8px; margin-top: 8px; font: 600 20px 'Fredoka'; color: #fff; text-shadow: 0 2px 0 rgba(61, 38, 15, .5); }
.ch-who img { width: 44px; height: 44px; border-radius: 50%; background: #f6e3b8; border: 3px solid #fff; box-shadow: 0 3px 6px rgba(46, 28, 10, .25); object-fit: cover; }
#chapters-hear { position: static; flex: none; }
#chapters.enter #chapters-head { animation: title-logo .5s ease-out backwards; }
.chapters-grid { min-height: 0; max-width: 100%; box-sizing: border-box; overflow: hidden auto; padding: 18px 22px 22px; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.chapters-grid::-webkit-scrollbar { display: none; }
.chapters-row { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--cgap); max-width: calc(4 * var(--cw) + 3 * var(--cgap)); margin: 0 auto; }
/* The road winds through the stops: wide screens four along, then back the other way (Explore Jerusalem
   waits off the road in the space it leaves); tablets upright three and three; phones upright zig-zag down */
@media (min-width: 521px), (orientation: landscape) {
  #chapters { --cw: 180px; --cgap: 46px; }
  .chapters-row { display: grid; grid-template-columns: repeat(4, var(--cw)); gap: 40px var(--cgap); justify-content: center; align-items: start; max-width: none; padding-top: 12px; }
  .ccard[data-n="0"] { grid-area: 1 / 1; } .ccard[data-n="1"] { grid-area: 1 / 2; } .ccard[data-n="2"] { grid-area: 1 / 3; }
  .ccard[data-n="3"] { grid-area: 1 / 4; } .ccard[data-n="4"] { grid-area: 2 / 4; } .ccard[data-n="5"] { grid-area: 2 / 3; }
  .ccard.explore { grid-area: 2 / 1 / 3 / 3; justify-self: center; align-self: center; }
}
@media (min-width: 521px) and (orientation: portrait) {
  #chapters { --cw: min(210px, calc((100vw - 160px) / 3)); --cgap: 44px; }
  .chapters-row { grid-template-columns: repeat(3, var(--cw)); row-gap: 36px; }
  .ccard[data-n="3"] { grid-area: 2 / 3; } .ccard[data-n="4"] { grid-area: 2 / 2; } .ccard[data-n="5"] { grid-area: 2 / 1; }
  .ccard.explore { grid-area: 3 / 1 / 4 / 4; }
}
.ch-road { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.chapters-row.pop .ch-road { animation: card-fade .5s ease-out .45s backwards; }
.ch-road path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ch-road .ahead-bed { stroke: rgba(255, 244, 220, .35); stroke-width: 30px; }
.ch-road .ahead { stroke: rgba(255, 255, 255, .85); stroke-width: 9px; stroke-dasharray: .1 17; }
.ch-road .walked-bed { stroke: rgba(255, 220, 120, .75); stroke-width: 32px; }
.ch-road .walked { stroke: #fffbe9; stroke-width: 10px; stroke-dasharray: .1 16; }
.ccard {
  position: relative; flex: none; width: var(--cw); box-sizing: border-box; padding: 8px 8px 10px; border-radius: 24px; border: 4px solid #fff;
  background: var(--cream); color: var(--brown); box-shadow: 0 6px 12px rgba(46, 28, 10, .22); display: flex; flex-direction: column; align-items: center;
  gap: 1px; transition: transform .12s ease-out; -webkit-tap-highlight-color: transparent; text-align: center;
}
@media (hover: hover) { .ccard:hover { transform: scale(1.04); } }
.ccard:active { transform: scale(.96); }
.cpic { width: 100%; aspect-ratio: 2 / 1; border-radius: 16px; overflow: hidden; background: #f6e3b8; display: grid; place-items: center; margin-bottom: 4px; }
.cpic svg.story-pic, .cpic svg, .cpic img.story-pic { display: block; object-fit: cover; width: 100%; height: 100%; border: none; border-radius: 0; margin: 0; }
.cpic .ico { width: 56%; height: 56%; }
.cnum { font: 700 12px 'Nunito'; letter-spacing: 1px; text-transform: uppercase; color: var(--brown2); }
.ctitle { font: 600 18px/1.15 'Fredoka'; min-height: 2.3em; display: grid; place-items: center; }
.cref { font: 700 13px 'Nunito'; color: var(--brown2); margin-bottom: 6px; }
.cpill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 4px 14px; font: 600 15px 'Fredoka'; white-space: nowrap; }
.cpill .ico { width: 18px; height: 18px; vertical-align: middle; }
.cpill.go { background: var(--green); color: #fff; box-shadow: 0 3px 0 var(--green-d); }
.cpill.done { background: #e4f3dc; color: #3f7d3c; }
.cpill.lock { background: #eee6d6; color: var(--brown2); font-size: 13px; }
.cpill.soon { background: #fbe3a6; color: #8a5a12; }
.ccard.done { border-color: #d6efc9; }
.ccard.done .cnum { color: #3f7d3c; }
.cpic { position: relative; }
.cdone { position: absolute; left: 6px; top: 6px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #5aa84f; border: 3px solid #fff; box-sizing: border-box; box-shadow: 0 2px 4px rgba(46, 28, 10, .3); }
.cpic .cdone .ico { width: 18px; height: 18px; color: #fff; }
/* the next stop: a warm glow that breathes, and a "Next!" flag over it */
.ccard.ready, .ccard.buy { border-color: #ffe08a; box-shadow: 0 0 0 5px rgba(255, 224, 138, .55), 0 0 28px 8px rgba(255, 214, 110, .55), 0 6px 12px rgba(46, 28, 10, .22); }
.ccard.ready { animation: next-glow 2.6s ease-in-out infinite; }
@keyframes next-glow { 50% { box-shadow: 0 0 0 7px rgba(255, 224, 138, .7), 0 0 40px 14px rgba(255, 214, 110, .7), 0 6px 12px rgba(46, 28, 10, .22); } }
.chapters-row.pop .ccard.ready { animation: card-fade .25s ease-out backwards, card-pop .35s cubic-bezier(.34, 1.56, .64, 1) backwards, next-glow 2.6s ease-in-out .8s infinite; animation-delay: calc(.2s + var(--i) * .06s), calc(.2s + var(--i) * .06s), .8s; }
.cnext {
  position: absolute; top: -20px; left: 50%; z-index: 1; transform: translateX(-50%); padding: 3px 16px 4px; border-radius: 999px; white-space: nowrap;
  background: #ffd45e; border: 3px solid #fff; color: #6b3f12; font: 700 18px 'Fredoka'; box-shadow: 0 3px 0 #d9a531, 0 4px 8px rgba(46, 28, 10, .25);
  animation: next-bob 1.8s ease-in-out infinite;
}
@keyframes next-bob { 50% { transform: translate(-50%, -4px); } }
/* further along the road: soft silhouettes, named, waiting */
.ccard.later { background: rgba(250, 240, 220, .9); border-color: rgba(255, 255, 255, .7); box-shadow: 0 4px 10px rgba(46, 28, 10, .12); }
.ccard.later .cpic { background: #efe3c9; }
.ccard.later .cpic > * { filter: grayscale(1) sepia(.35) brightness(1.3) contrast(.55) blur(1.5px); opacity: .6; }
.ccard.later .cnum, .ccard.later .cref { color: rgba(90, 58, 34, .7); }
.ccard.later .ctitle { color: rgba(74, 46, 22, .85); }
.ccard.later .phear { opacity: .75; }
.cafter { font: 600 14px 'Fredoka'; color: rgba(90, 58, 34, .75); padding: 3px 0; }
.ccard.peek .cpic > * { animation: peek-shimmer .9s ease-out; }
@keyframes peek-shimmer { 30% { filter: grayscale(.3) sepia(.2) brightness(1.15) blur(0); opacity: .95; } }
.ccard.nudge .cnext { animation: next-hop .5s cubic-bezier(.34, 1.56, .64, 1) 2, next-bob 1.8s ease-in-out 1s infinite; }
@keyframes next-hop { 50% { transform: translate(-50%, -14px) scale(1.12); } }
@media (prefers-reduced-motion: reduce) {
  .ccard.ready, .chapters-row.pop .ccard.ready, .ccard .cnext, .ccard.nudge .cnext, .ccard.peek .cpic > * { animation: none; }
  .chapters-row.pop .ccard.ready { animation: card-fade .25s ease-out .2s backwards; }
}
.ccard.explore .cpic { background: #dcefd0; }
.chapters-row.pop .ccard { animation: card-fade .25s ease-out backwards, card-pop .35s cubic-bezier(.34, 1.56, .64, 1) backwards; animation-delay: calc(.2s + var(--i) * .06s); }
#chapters-corner { position: absolute; right: calc(16px + env(safe-area-inset-right)); bottom: calc(12px + env(safe-area-inset-bottom)); }
#chapters-corner #btn-ch-grownups { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px; border: none; background: none;
  font: 600 15px 'Fredoka'; color: #fff; text-shadow: 0 1px 0 rgba(61, 38, 15, .6), 0 1px 4px rgba(61, 38, 15, .4); }
#chapters-corner .round { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--cream); border: 3px solid #fff; box-sizing: border-box; box-shadow: 0 4px 6px rgba(46, 28, 10, .22); }
#chapters-corner .round .ico { width: 30px; height: 30px; }
/* phones upright: two across */
@media (max-width: 520px) and (orientation: portrait) {
  #chapters { --cw: 160px; --cgap: 12px; }
  .ch-book h2 { font-size: 28px; -webkit-text-stroke-width: 5px; }
  .ch-who { font-size: 17px; }
  #chapters-head { grid-template-columns: auto 1fr; gap: 8px; }
  #chapters-back span { display: none; }
  #chapters-back { padding: 0 10px; }
  .ctitle { font-size: 16px; }
  .chapters-grid { padding: 16px 12px 24px; }
  /* the road zig-zags down: each stop half a step below the one before, on the other side */
  .chapters-row { display: grid; grid-template-columns: repeat(2, var(--cw)); grid-auto-rows: auto; gap: 0 var(--cgap); justify-content: center; padding-top: 14px; }
  .ccard[data-n] { margin-bottom: 26px; }
  .ccard[data-n="0"] { grid-area: 1 / 1 / 3; } .ccard[data-n="1"] { grid-area: 2 / 2 / 4; } .ccard[data-n="2"] { grid-area: 3 / 1 / 5; }
  .ccard[data-n="3"] { grid-area: 4 / 2 / 6; } .ccard[data-n="4"] { grid-area: 5 / 1 / 7; } .ccard[data-n="5"] { grid-area: 6 / 2 / 8; }
  .ccard.explore { grid-area: 8 / 1 / 9 / 3; justify-self: center; margin-top: 8px; }
  /* Grown-ups up in the corner, so it never sits over a card */
  #chapters-corner { top: calc(6px + env(safe-area-inset-top)); bottom: auto; right: calc(8px + env(safe-area-inset-right)); }
  #chapters-corner .round { width: 42px; height: 42px; }
  #chapters-corner .round .ico { width: 24px; height: 24px; }
  #chapters-corner #btn-ch-grownups { font-size: 0; gap: 0; }
  #chapters-head { padding-right: 56px; }
}
/* short screens (phones on their side): one row that scrolls sideways */
@media (max-height: 560px) {
  #chapters { --cw: 168px; }
  .chapters-grid { overflow: auto hidden; padding: 14px 18px 12px; }
  .chapters-row { display: flex; flex-wrap: nowrap; width: max-content; max-width: none; padding-top: 18px; }
  .ccard.explore { margin-left: 22px; }
  .ch-book h2 { font-size: 26px; -webkit-text-stroke-width: 5px; }
  .ch-based { display: none; }
  .ch-who { margin-top: 2px; font-size: 16px; }
  .ch-who img { width: 34px; height: 34px; }
  .ctitle { font-size: 16px; }
  #chapters-corner { top: calc(6px + env(safe-area-inset-top)); bottom: auto; }
  #chapters-corner .round { width: 44px; height: 44px; }
  #chapters-corner #btn-ch-grownups { font-size: 13px; }
}

/* the first choices a 6-11 player sees: the narrator says how to hear them, and each speaker icon nudges (QA, Oct 2026) */
.choice-hint #dlg-choices .hear { animation: hear-nudge 1s ease-in-out 3; }
@keyframes hear-nudge { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.3); box-shadow: 0 0 0 4px rgba(242, 193, 78, .7); border-radius: 50%; } }
@media (prefers-reduced-motion: reduce) { .choice-hint #dlg-choices .hear { animation: none; box-shadow: 0 0 0 4px rgba(242, 193, 78, .7); border-radius: 50%; } }
/* the Journal's secrets not found yet: a "?" with a gentle picture hint of where to look (QA, Oct 2026) */
.slot.secret-hint { opacity: .85; border-style: dashed; }
.slot.secret-hint .ic { position: relative; }
.slot.secret-hint .hint-pic { position: absolute; right: -6px; bottom: -4px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); display: grid; place-items: center; }
.slot.secret-hint .hint-pic .ico { width: 20px; height: 20px; }
.slot.secret-hint .nm small { display: block; font-size: 11px; opacity: .8; }
.legend .map-x b { color: #d0342c; font: 700 16px 'Fredoka'; margin-right: 2px; }
/* "Congratulations! Chapter N Complete!" (src/chaptercomplete.js): one end screen over the dimmed town */
#chapter-done { position: fixed; inset: 0; background: rgba(40, 28, 14, .5); display: flex; align-items: center; justify-content: center; z-index: 50;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#chapter-done.hidden { display: none; }
#chapter-done .cd-card { position: relative; width: min(600px, calc(100vw - 32px)); max-height: calc(100% - 24px); overflow: auto; text-align: center;
  background: #fdf3da; background-image: radial-gradient(circle at 30% 0%, #fffaf0, #f7e7c2); border: 6px solid #fff; border-radius: 30px;
  box-shadow: var(--shadow); padding: 22px 26px 22px; animation: cd-in .5s cubic-bezier(.34, 1.56, .64, 1) both; }
@keyframes cd-in { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
#chapter-done .cd-title { font: 600 34px 'Fredoka'; margin: 2px 0 0; color: #b5651d; }
#chapter-done .cd-sub { font: 600 22px 'Fredoka'; margin-bottom: 12px; }
#chapter-done .cd-fruit { display: flex; align-items: center; gap: 14px; text-align: left; background: rgba(255, 255, 255, .6); border-radius: 20px; padding: 10px 14px; }
#chapter-done .cd-art { flex: none; width: 92px; height: 92px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 236, 150, .9), rgba(255, 236, 150, 0) 68%); }
#chapter-done .cd-art .ico { width: 92px; height: 92px; }
#chapter-done .cd-fruit-text b { font: 600 20px 'Fredoka'; }
#chapter-done .cd-line { margin: 4px 0 0; font-size: 17px; line-height: 1.4; }
#chapter-done .cd-meaning { margin: 4px 0 0; font-size: 14px; font-style: italic; opacity: .8; line-height: 1.35; }
#chapter-done .cd-helped { margin: 12px 0 2px; }
#chapter-done .cd-helped b { display: block; font: 600 13px 'Fredoka'; letter-spacing: .08em; text-transform: uppercase; color: #b5651d; margin-bottom: 6px; }
#chapter-done .cd-helped ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; }
#chapter-done .cd-helped li { width: 84px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  animation: cd-face .45s cubic-bezier(.34, 1.56, .64, 1) both; animation-delay: calc(.6s + var(--i) * .18s); }
#chapter-done .cd-helped img { width: 72px; height: 72px; border-radius: 50%; background: radial-gradient(circle, #fff7e2, #f3dfb4); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(80, 50, 20, .25); }
#chapter-done .cd-helped span { font: 600 13px/1.15 'Fredoka'; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@keyframes cd-face { from { transform: scale(.4) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
#chapter-done .cd-coins { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 12px 0 4px; font-size: 17px; }
#chapter-done .cd-coins .ico { width: 30px; height: 30px; }
#chapter-done .cd-talk { text-align: left; background: #e7f4e2; border: 3px dashed #6cbf6a; border-radius: 16px; padding: 6px 12px; margin: 10px 0 14px; font-size: 14px; line-height: 1.35; }
#chapter-done .cd-talk b { display: block; font: 600 12px 'Fredoka'; letter-spacing: .08em; text-transform: uppercase; color: #3f8a3d; }
#chapter-done .cd-go .ico.after { width: .8em; height: .8em; vertical-align: -0.05em; margin-left: 4px; }
#chapter-done .cd-go.wait { opacity: .45; filter: saturate(.4); pointer-events: none; }
#chapter-done .cd-go { transition: opacity .4s, filter .4s; }
@media (prefers-reduced-motion: reduce) { #chapter-done .cd-card, #chapter-done .cd-helped li { animation: none; } }
@media (max-width: 480px) { #chapter-done .cd-helped ul { gap: 6px 4px; } #chapter-done .cd-helped li { width: 54px; } #chapter-done .cd-helped img { width: 46px; height: 46px; border-width: 2px; } #chapter-done .cd-helped span { font-size: 11px; } }
@media (max-height: 560px) { #chapter-done .cd-card { padding: 12px 18px; } #chapter-done .cd-title { font-size: 26px; } #chapter-done .cd-art, #chapter-done .cd-art .ico { width: 64px; height: 64px; } #chapter-done .cd-helped { margin-top: 8px; } #chapter-done .cd-helped b { margin-bottom: 3px; } #chapter-done .cd-helped img { width: 44px; height: 44px; } #chapter-done .cd-helped li { width: 72px; } #chapter-done .cd-helped span { font-size: 12px; } }

/* ---------- Your fruit tree up close (main.js openTreeView; interview 01, C1) ---------- */
/* everything else on screen steps aside while you look */
body.tree-view #hud > *:not(#narration), body.tree-view #touch { opacity: 0; pointer-events: none !important; transition: opacity .3s; }
body.tree-view #narration { opacity: 0; }
#tree-view { position: fixed; inset: 0; z-index: 14; pointer-events: none; }
#tree-view .tv-btn {
  position: absolute; pointer-events: auto; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
  border: 4px solid #fff; background: var(--cream); box-shadow: var(--shadow); padding: 0; touch-action: manipulation;
  animation: tv-in .4s .5s both;
}
#tree-view .tv-btn .ico { width: 34px; height: 34px; }
#tv-back { left: calc(18px + env(safe-area-inset-left)); top: calc(18px + env(safe-area-inset-top)); }
#tv-water { right: calc(18px + env(safe-area-inset-right)); top: calc(18px + env(safe-area-inset-top)); background: #d8eefc; }
#tv-labels { position: absolute; inset: 0; }
/* a grown fruit: tap it (or its name) to hear about it */
.tv-fruit {
  position: absolute; left: 0; top: 0; pointer-events: auto; border: none; background: none; padding: 0; border-radius: 50%;
  touch-action: manipulation; transition: opacity .35s;
}
.tv-fruit span {
  position: absolute; left: 50%; top: 100%; transform: translate(-50%, -6px); white-space: nowrap;
  font: 600 16px 'Fredoka'; color: var(--brown); background: rgba(255, 248, 230, .94); border: 2px solid #fff;
  border-radius: 999px; padding: 1px 10px; box-shadow: 0 2px 0 rgba(90, 68, 48, .2);
}
.tv-fruit.on span { background: var(--gold); }
.tv-fruit:focus-visible { outline: 3px solid var(--gold); }
#tv-card {
  position: absolute; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(560px, calc(100vw - 32px)); display: flex; align-items: center; gap: 14px; padding: 12px 18px;
  pointer-events: auto; animation: tv-in .35s both;
}
#tv-card .tv-art { flex: none; width: 76px; height: 76px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 236, 150, .9), rgba(255, 236, 150, 0) 68%); }
#tv-card .tv-art .ico { width: 76px; height: 76px; }
#tv-card b { display: block; font: 600 22px 'Fredoka'; }
#tv-card p { margin: 2px 0 0; font-size: 17px; line-height: 1.35; }
#tv-card small { display: block; margin-top: 4px; font-size: 14px; font-style: italic; opacity: .8; line-height: 1.3; }
@keyframes tv-in { from { opacity: 0; transform: translateY(8px) scale(.96); } }
#tv-card { animation-name: tv-card-in; }
@keyframes tv-card-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { #tree-view .tv-btn, #tv-card { animation: none; } }
