/* UI tokens: UI-UX-QOL v0.1.1 §9 only (barn-red, spruce, straw, cream, teal, night). */
:root {
  --barn-red: #A5311F; --spruce: #2F5D3A; --straw: #D9A441; --cream: #F6EFE1; --teal: #3F8C8A; --night: #1E2A3A;
  --shadow: rgba(30, 42, 58, 0.28);
  --edge: 24px;
  --app-height: 100vh;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-width: calc(100% - var(--safe-left) - var(--safe-right));
}
@supports (height: 100dvh) { :root { --app-height: 100dvh; } }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: var(--app-height); overflow: hidden; overscroll-behavior: none; background: var(--cream); color: var(--spruce);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
html { -webkit-text-size-adjust: 100%; }
#gl, #ui { position: fixed; inset: 0 auto auto 0; width: 100%; height: var(--app-height); }
#gl { display: block; touch-action: none; }
#gl.graphics-lost { visibility: hidden; }
#ui { pointer-events: none; }
#ui > * { pointer-events: auto; }
#ui > .caption, #ui > .banner, #ui > .hearts { pointer-events: none; }
#hud, #activity-ui { pointer-events: none !important; position: absolute; inset: 0; }
#hud > *, #activity-ui .tray, #activity-ui .tray * { pointer-events: auto; }
[hidden] { display: none !important; }
.screen { position: absolute; inset: 0; }
.center { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg { width: 100%; height: 100%; display: block; }

.btn { border: 0; border-radius: 22px; background: var(--cream); color: var(--spruce); font: inherit; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 0 var(--shadow); display: inline-flex; align-items: center; justify-content: center; gap: 12px; }
.btn:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--shadow); }
.btn:focus { outline: none; }
.btn:focus-visible, .tool:focus-visible, .cue:focus-visible { outline: 4px solid var(--spruce); outline-offset: 4px; }
.btn .ico { width: 44px; height: 44px; display: inline-block; }

/* boot */
#boot { background: var(--cream); }
.boot-art { width: 140px; height: 140px; }
.boot-text { font-size: 28px; font-weight: 700; }

/* welcome (booklet p.9): one big Play, Stories, small Grown-ups, Speaker */
#welcome { pointer-events: none; }
#welcome > * { pointer-events: auto; }
.title { position: absolute; top: 40px; left: 50%; transform: translateX(-50%); margin: 0; padding: 14px 32px; border-radius: 22px;
  background: var(--cream); color: var(--barn-red); font-size: clamp(26px, 4vw, 44px); white-space: nowrap; box-shadow: 0 6px 0 var(--shadow); }
.welcome-actions { position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 24px; }
.btn-play { min-width: 320px; min-height: 112px; font-size: 44px; background: var(--spruce); color: var(--cream); border-radius: 30px; padding: 0 40px; }
.btn-play .ico { width: 64px; height: 64px; }
.btn-stories { min-width: 240px; min-height: 88px; font-size: 32px; padding: 0 28px; }
.btn-grownups { position: absolute; left: var(--edge); bottom: var(--edge); min-width: 160px; min-height: 56px; font-size: 20px; padding: 0 16px; }
.btn-grownups .ico { width: 32px; height: 32px; }
.note { position: absolute; left: 50%; bottom: 100px; transform: translateX(-50%); max-width: 70vw; background: var(--cream); color: var(--spruce);
  padding: 12px 20px; border-radius: 14px; font-size: 18px; box-shadow: 0 4px 0 var(--shadow); text-align: center; }

/* corner buttons 72×72, 24 px from edges */
.corner { position: fixed; top: var(--edge); width: 72px; height: 72px; border-radius: 20px; padding: 0; z-index: 20; }
.corner .ico { width: 44px; height: 44px; }
.corner-left { left: var(--edge); }
.corner-right { right: var(--edge); }
.halo { overflow: visible; }
.halo .halo-text { display: none; }
.halo.halo-on { box-shadow: 0 0 0 8px var(--straw), 0 6px 0 var(--shadow); animation: halo 1.6s ease-in-out infinite; }
.halo.halo-on .halo-text { display: block; position: absolute; top: 84px; right: 0; white-space: nowrap; font-size: 18px; background: var(--cream);
  padding: 6px 12px; border-radius: 12px; box-shadow: 0 3px 0 var(--shadow); }
@keyframes halo { 50% { box-shadow: 0 0 0 14px var(--straw), 0 6px 0 var(--shadow); } }

/* portrait cue pill (240×88 min; pony face 72 px) */
.cue { position: fixed; left: 0; top: 0; min-width: 240px; min-height: 88px; border: 0; border-radius: 44px; background: var(--cream); color: var(--spruce);
  box-shadow: 0 0 0 6px var(--straw), 0 8px 0 var(--shadow); display: flex; align-items: center; gap: 10px; padding: 8px 22px 8px 8px; font: inherit;
  font-weight: 700; font-size: 24px; cursor: pointer; transform: translate(-50%, -100%); z-index: 15; }
.cue-face { width: 72px; height: 72px; border-radius: 50%; background: var(--teal); padding: 6px; }
.cue-act { width: 48px; height: 48px; }
.cue-tick { position: absolute; right: -14px; top: -14px; width: 44px; height: 44px; }
.cue.little .cue-label { display: none; }
.cue.continue { box-shadow: 0 0 0 6px var(--teal), 0 0 0 14px var(--straw), 0 8px 0 var(--shadow); }
.cue.bounce { animation: bounce 0.9s ease-in-out infinite; }
.cue.glow { box-shadow: 0 0 0 12px var(--straw), 0 8px 0 var(--shadow); }
@keyframes bounce { 50% { transform: translate(-50%, calc(-100% - 18px)); } }

/* activity: title banner, tool tray (cream, tools 96×96, 16 px gaps), target rings */
.act-banner { position: fixed; top: var(--edge); left: 50%; transform: translateX(-50%); background: var(--cream); color: var(--barn-red); font-size: 30px;
  font-weight: 800; padding: 10px 26px; border-radius: 22px; box-shadow: 0 6px 0 var(--shadow); display: flex; align-items: center; gap: 12px; transition: opacity .4s; }
.act-banner .ico { width: 40px; height: 40px; }
.act-banner.gone { opacity: 0; }
.tray { position: fixed; bottom: var(--edge); left: 50%; transform: translateX(-50%); display: flex; gap: 16px; padding: 16px 20px; background: var(--cream);
  border-radius: 28px; box-shadow: 0 6px 0 var(--shadow); }
.tray.left { left: calc(var(--edge) + 220px); }
.tool { width: 96px; height: 96px; border: 0; border-radius: 20px; background: var(--cream); padding: 10px; cursor: pointer; box-shadow: inset 0 0 0 3px var(--straw);
  transition: transform .2s; touch-action: none; }
.tool.required { animation: pulse 1.2s ease-in-out infinite; }
.tool.held { transform: translateY(-18px); box-shadow: inset 0 0 0 5px var(--teal), 0 8px 0 var(--shadow); }
.tool.lift { animation: lift .5s ease-out; }
.tool.strong { animation: pulse .5s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: inset 0 0 0 5px var(--straw), 0 0 0 10px var(--straw); } }
@keyframes lift { 40% { transform: translateY(-22px) rotate(-6deg); } 100% { transform: none; } }
.ring { position: fixed; border-radius: 50%; border: 6px solid var(--straw); box-shadow: 0 0 0 4px var(--cream);
  pointer-events: none; animation: ring 1.6s ease-in-out infinite; }
.ring.strong { animation-duration: .6s; border-width: 9px; }
@keyframes ring { 50% { transform: scale(1.08); opacity: .75; } }
.ghost { position: fixed; width: 96px; height: 96px; transform: translate(-50%, -50%); pointer-events: none; z-index: 30; opacity: .9; }

/* caption (stands in for grown-up narration that has not been recorded) */
.caption { position: fixed; left: 50%; bottom: 168px; transform: translateX(-50%); max-width: 70vw; background: var(--cream); color: var(--spruce);
  font-size: 26px; font-weight: 700; padding: 12px 22px; border-radius: 20px; box-shadow: 0 5px 0 var(--shadow); display: flex; align-items: center; gap: 12px; z-index: 18; pointer-events: none; }
.caption-missing { width: 30px; height: 30px; color: var(--spruce); opacity: .7; flex: none; }
body.on-farm .caption, body.on-welcome .caption { bottom: 40px; }

.banner { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); background: var(--night); color: var(--cream); padding: 8px 18px; border-radius: 14px;
  font-size: 18px; z-index: 40; pointer-events: none; }

.hearts { position: fixed; inset: 0; pointer-events: none; z-index: 12; }
.heart { position: absolute; width: 56px; height: 56px; animation: rise 2.4s ease-out forwards; }
@keyframes rise { from { transform: translateY(0) scale(.6); opacity: 0; } 20% { opacity: 1; } to { transform: translateY(-90px) scale(.9); opacity: 0; } }

.fade { position: fixed; inset: 0; background: var(--cream); opacity: 0; pointer-events: none; transition: opacity .35s; z-index: 50; }
.fade.on { opacity: 1; }

/* chores board and barn book - kept out of the middle of the screen so ground taps and the cue stay clear */
.board { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 16; display: flex; gap: 8px;
  align-items: center; min-height: 72px; padding: 8px 12px; border: 0; border-radius: 18px; background: var(--cream);
  box-shadow: 0 4px 0 var(--shadow); cursor: pointer; }
.board-tile { width: 64px; height: 64px; border-radius: 14px; background: #fff; position: relative; padding: 8px; }
.board-tile.done { outline: 3px solid var(--spruce); }
.board-tile .tick { position: absolute; right: -4px; top: -4px; width: 22px; height: 22px; }
.book-btn { position: fixed; left: var(--edge); bottom: var(--edge); width: 72px; height: 72px; z-index: 20; padding: 0; }
.book-btn .ico { width: 44px; height: 44px; }
#book { background: rgba(246, 239, 225, 0.96); z-index: 30; }
.book-title { margin: 0; color: var(--barn-red); font-size: 36px; }
.book-stickers { display: flex; flex-wrap: wrap; gap: 12px; max-width: 760px; justify-content: center; }
.book-empty { font-size: 22px; font-weight: 700; }
.sticker { width: 96px; height: 96px; background: #fff; border-radius: 16px; box-shadow: 0 4px 0 var(--shadow); padding: 12px; }
.g-code { width: 100%; min-height: 88px; font: 16px/1.4 ui-monospace, monospace; padding: 8px; border-radius: 12px; border: 2px solid var(--straw); }
.g-select { min-height: 48px; max-width: 100%; font-size: 18px; padding: 0 12px; border-radius: 12px; border: 2px solid var(--straw); background: #fff; color: var(--spruce); }

/* shelf (booklet p.8) */
#shelf { background: rgba(246, 239, 225, 0.75); }
.card { width: 400px; background: var(--cream); border-radius: 26px; box-shadow: 0 8px 0 var(--shadow); padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.card-art { border: 0; padding: 0; width: 364px; height: 273px; border-radius: 16px; overflow: hidden; cursor: pointer; background: var(--cream); }
.card-art img { width: 100%; height: 100%; display: block; }
.card-title { margin: 0; font-size: 30px; font-weight: 800; color: var(--barn-red); }
.btn-card-play { min-width: 240px; min-height: 88px; font-size: 34px; background: var(--spruce); color: var(--cream); }
.dots .dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--spruce); }

/* failure / rotate */
#fail { background: var(--cream); padding: 40px; text-align: center; }
.fail-art { width: 180px; height: 180px; color: var(--spruce); }
.fail-text { font-size: 34px; font-weight: 800; margin: 0; }
.fail-details { font-size: 16px; max-width: 80vw; }
.fail-details summary { min-height: 44px; line-height: 44px; cursor: pointer; }
.fail-details pre { white-space: pre-wrap; text-align: left; }

/* grown-up area: text allowed, 44 px targets */
.grown { background: var(--cream); color: var(--spruce); z-index: 45; overflow: auto; padding: 24px 32px; touch-action: pan-y; user-select: text; -webkit-user-select: text; }
.gbtn { min-height: 44px; min-width: 88px; padding: 0 18px; font-size: 18px; border-radius: 12px; box-shadow: 0 3px 0 var(--shadow); }
.gbtn.on { background: var(--spruce); color: var(--cream); }
.gate-text { font-size: 22px; font-weight: 700; }
.gate-area { position: relative; height: 60vh; border-radius: 20px; box-shadow: inset 0 0 0 3px var(--straw); }
.gate-target { position: absolute; width: 96px; height: 96px; border-radius: 50%; border: 0; background: var(--teal); box-shadow: 0 0 0 6px var(--straw); overflow: hidden; padding: 0; touch-action: none; }
.gate-fill { position: absolute; left: 0; bottom: 0; width: 100%; height: 0; background: var(--spruce); }
.g-head { display: flex; align-items: center; justify-content: space-between; }
.g-head h2 { margin: 0; font-size: 28px; }
.g-body section { border-top: 2px solid var(--straw); padding: 12px 0; }
.g-body h3 { margin: 4px 0 8px; font-size: 20px; }
.g-body p, .g-body li, .g-body td { font-size: 16px; line-height: 1.45; }
.g-body table { border-collapse: collapse; }
.g-body td { padding: 2px 12px 2px 0; vertical-align: top; }
.g-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.noscript { padding: 40px; font-size: 24px; }

@media (max-width: 1023px) { .tool { width: 80px; height: 80px; } }
@media (prefers-reduced-motion: reduce) {
  .cue.bounce { animation: none; box-shadow: 0 0 0 12px var(--straw), 0 8px 0 var(--shadow); }
  .halo.halo-on, .ring, .tool.required, .tool.strong, .heart { animation-duration: 0s; animation-iteration-count: 1; }
  .fade { transition: none; }
}
body.reduced .cue.bounce { animation: none; box-shadow: 0 0 0 12px var(--straw), 0 8px 0 var(--shadow); }
body.reduced .ring, body.reduced .tool.required, body.reduced .halo.halo-on { animation: none; }
body.reduced .fade { transition: none; }

.pony-portrait { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.act-banner .ico:has(.pony-portrait) { width: 58px; height: 58px; }

.cue-face, .act-banner .ico { position: relative; flex: none; }
.pony-portrait { position: absolute; inset: 0; }

/* Illustrated story shelf and parchment book */
#shelf {
  overflow-y: auto;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  padding: 24px 108px 32px;
  justify-content: flex-start;
  gap: 12px;
}
.shelf-title { flex: none; margin: auto 0 0; color: #783b29; font-size: 30px; text-align: center; }
.shelf-cards {
  flex: none;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px 14px;
  width: min(930px, 100%);
  margin-block-end: auto;
  padding: 8px;
}
.shelf-cards .card { grid-column: span 2; width: 100%; min-width: 0; padding: 8px; gap: 5px; text-align: center; }
.shelf-cards .card-art { width: 100%; height: auto; aspect-ratio: 16 / 9; background: #f9ead1; }
.shelf-cards .card-art img { object-fit: contain; }
.shelf-cards .card-title { font-size: 20px; line-height: 1.15; min-height: 46px; display: flex; align-items: center; justify-content: center; }
.shelf-cards .btn-card-play { min-width: min(150px, 100%); min-height: 44px; font-size: 22px; }
.shelf-cards .btn-card-play svg { width: 22px; height: 22px; flex: none; }
.shelf-cards .movie-pill { margin: 0; }
@media (min-width: 980px) {
  .shelf-cards .card:nth-child(4):nth-last-child(2) { grid-column: 2 / span 2; }
}
@media (max-width: 979px) {
  .shelf-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 620px; }
  .shelf-cards .card:last-child:nth-child(odd) { grid-column: 2 / span 2; }
}
@media (max-width: 740px) {
  #shelf { padding: 100px 20px 80px; }
}
@media (max-width: 520px) {
  .shelf-cards { grid-template-columns: minmax(0, 1fr); max-width: 340px; }
  .shelf-cards .card, .shelf-cards .card:last-child:nth-child(odd) { grid-column: 1; }
}
.card-art img { object-fit:cover; }
#book { padding: 12px; gap: 10px; overflow-y:auto; touch-action:pan-y; }
.storybook { position:relative; width:min(900px, 88vw); min-height: min(440px, 66vh); padding: 20px 38px; border: 9px solid #9b583a; border-radius: 28px; background: linear-gradient(90deg,#fff1cf 0%,#f8e5bb 48%,#dfc59b 50%,#fff2d0 52%,#fae9c4 100%); box-shadow: 0 10px 0 #633c2c, inset 0 0 35px #bd956055; text-align:center; }
.book-portraits { display:flex; justify-content:center; gap:10px; }
.book-portraits img { width:62px; height:62px; object-fit:cover; border-radius:50%; border:4px solid #e3bd69; box-shadow:0 2px 5px #84613d88; }
.book-title { font-family: Georgia,serif; font-size:32px; }
.book-subtitle { color:#8a6247; font-family:Georgia,serif; margin:3px 0 12px; }
.book-stickers { min-height:150px; align-content:center; margin:auto; }
.book-empty { color:#806044; max-width:450px; margin:auto; line-height:1.45; }
.sticker { width:120px; height:130px; border:0; background:transparent; box-shadow:none; padding:3px; color:#69452f; cursor:pointer; font:700 15px/1.1 system-ui,sans-serif; display:flex; flex-direction:column; align-items:center; gap:5px; }
.sticker-picture { width:84px; height:84px; border:5px solid #d5a94a; border-radius:50%; padding:12px; background:#fff9df; box-shadow:0 4px 0 #ac7b35, inset 0 0 0 3px #f9df95; }
.sticker-picture svg { width:100%; height:100%; }
.sticker.bounce { animation:sticker-bounce .5s ease; }
@keyframes sticker-bounce { 50% { transform:translateY(-12px) rotate(-5deg) scale(1.08); } }
.book-nav { display:flex; align-items:center; justify-content:center; gap:24px; color:#805439; font-weight:700; }
.book-nav button { width:48px; height:48px; border:0; border-radius:50%; background:#a85d3d; color:#fff7e4; font-size:24px; cursor:pointer; }
.book-nav button:disabled { opacity:.35; }
@media (prefers-reduced-motion:reduce) { .sticker.bounce { animation:none; } }
body.reduced .sticker.bounce { animation:none; }

/* Warm paper, cedar edges and gold tooling echo the illustrated barn book. */
:root { --cream: #fffaf0; --shadow: rgba(94, 57, 35, .25); }
.btn, .title, .act-banner, .tray, .board, .card, .note, .caption {
  border: 3px double #b77b46;
  box-shadow: 0 5px 0 #a46b43, 0 10px 18px #51372233, inset 0 0 0 2px #f3dba8;
}
.btn, .tool, .card-art, .book-nav button, .sticker { transition: transform .22s ease-out, box-shadow .22s; }
.btn, .book-nav button { min-width: 44px; min-height: 44px; }
@media (hover:hover) {
  .btn:hover, .tool:hover, .card-art:hover, .book-nav button:not(:disabled):hover, .sticker:hover { filter: brightness(1.045); }
}
.btn:active, .tool:active, .card-art:active, .book-nav button:active, .sticker:active { transform: scale(.95); }
.title, .act-banner { background: linear-gradient(#fffdf5, #f9e9c8); font-family: Georgia, serif; }
.board-tile { background: #fffaf0; box-shadow: inset 0 0 0 2px #e8cd96; }
.card { background: linear-gradient(145deg, #fffdf5, #f7e8c8); }
.card-art { border: 3px solid #dfbd7b; }
.storybook { border: 9px double #9b583a; background: linear-gradient(90deg,#fffaf0 0%,#f9edcf 48%,#dfc59b 50%,#fffaf0 52%,#faedce 100%); }
.tool.required { background: #fff7d9; box-shadow: inset 0 0 0 4px #d69d38, 0 0 0 5px #f6d57a, 0 0 22px 8px #f4c554aa; animation: tool-glow 1.5s ease-in-out infinite; }
.tool.required.held { box-shadow: inset 0 0 0 5px var(--teal), 0 0 18px 6px #f4c554aa; }
@keyframes tool-glow { 50% { box-shadow: inset 0 0 0 4px #d69d38, 0 0 0 9px #f6d57a99, 0 0 30px 12px #f4c554bb; } }
#ui > .sticker-toast {
  position: fixed; z-index: 35; top: calc(var(--safe-top) + var(--edge));
  transform: translateX(-50%); display: flex; align-items: center; gap: 8px; width: max-content;
  max-width: min(370px, calc(var(--safe-width) - 136px)); padding: 5px 9px 5px 5px;
  background: #fff7de; border: 1px solid #ae8551; border-radius: 36px 14px 14px 36px;
  box-shadow: 0 3px #aa8659, 0 5px 14px #51372233; color: #603e2d;
  text-align: left; pointer-events: none; font: bold clamp(14px, 2.5vw, 19px)/1.12 Georgia, serif;
}
.sticker-toast .sticker-picture { flex: none; width: 34px; height: 34px; padding: 5px; border-width: 2px; animation: sticker-pop .32s ease-out both; }
.sticker-toast small { display: block; margin-bottom: 2px; color: #4e614c; font: 700 11px/1.15 Arial, sans-serif; }
@media (prefers-reduced-motion: reduce) { .tool.required { animation: none; } .btn, .tool, .card-art, .book-nav button, .sticker { transition: none; } }
body.reduced .tool.required { animation: none; }
.mute-btn { position: fixed; right: var(--edge); bottom: var(--edge); z-index: 21; min-height: 44px; padding: 0 14px; font-size: 15px; }

/* Story theater and parent dashboard */
.story-card { display: flex; flex-direction: column; }
.story-card .card-title { text-align: center; }
.story-card .btn-card-play { margin-top: auto; }
.cutscene-overlay { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; background: radial-gradient(ellipse at center, #67402b, #28180f); color: #fff2cf; text-align: center; overflow: auto; }
.cutscene-overlay[hidden], .story-beat[hidden] { display: none; }
.cutscene-overlay h2 { margin: 0; padding: 8px 24px; border-radius: 14px; color: #633a20; background: #f4deb0; font: bold clamp(20px, 3vw, 34px) Georgia, serif; }
.cutscene-frame { position: relative; width: min(72vw, 760px, 55vh * 16 / 9); aspect-ratio: 16 / 9; border: 9px ridge #d3a453; border-radius: 20px; background: #6c492e center / cover; overflow: hidden; }
.cutscene-frame video { width: 100%; height: 100%; object-fit: contain; }
.storybook-kenburns { position: absolute; inset: 0; background: center / cover no-repeat; pointer-events: none; animation: storybook-pan 24s ease-in-out infinite alternate; }
@keyframes storybook-pan {
  from { transform: scale(1.02); }
  to { transform: translate(1.2%, -0.8%) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) { .storybook-kenburns { animation: none; } }
body.reduced .storybook-kenburns { animation: none; }
#cutscene-watch { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); }
.cutscene-overlay p { max-width: 800px; margin: 0; padding: 10px 18px; border-radius: 14px; color: #523622; background: #fff0ce; font: 600 clamp(16px, 2vw, 22px)/1.35 Georgia, serif; }
.cutscene-actions { display: flex; gap: 16px; }
.story-beat { position: fixed; z-index: 95; bottom: 12%; left: 50%; transform: translateX(-50%); width: min(620px, 85vw); padding: 18px; background: #fff0ce; color: #543723; border: 6px double #aa773f; border-radius: 20px; text-align: center; box-shadow: 0 8px 25px #25170e99; }
.story-beat p { font: bold 22px/1.3 Georgia, serif; margin: 0 0 12px; }
.movie-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.movie-button { display: flex; align-items: center; gap: 6px; padding: 8px; border: 2px solid #dab977; border-radius: 12px; background: #fff8e5; color: #60412b; cursor: pointer; font-weight: bold; }
.movie-button span:first-child { display: block; width: 30px; height: 30px; flex: none; }
.movie-button svg { width: 100%; height: 100%; }
#book { overflow: auto; justify-content: flex-start; padding: 20px; }
#book .storybook { flex: none; }
#book-movies .movie-button { max-width: 160px; font-size: 12px; }
#grownup { background: #eee0c4; }
#grownup .g-head, #grownup .g-body { max-width: 960px; margin: 0 auto; }
#grownup .g-head { position: sticky; top: -24px; z-index: 2; padding: 14px 0; background: #eee0c4; }
#grownup .g-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 18px; }
#grownup .g-body section { border: 2px solid #d9bd8f; border-radius: 20px; padding: 20px; background: #fff8e8; box-shadow: 0 5px 0 #d1b78d; }
.privacy-safety { border-color: #688d6b !important; background: #f1f8ee !important; }
.privacy-safety h3 { color: #315a3a; }
.privacy-safety p { max-width: 68ch; }
.privacy-erase { border: 2px solid #8b3d32; background: #fff0eb; color: #6d261e; font-weight: 700; }
.privacy-erase:disabled { opacity: .7; cursor: default; }
.privacy-safety [data-erase-msg]:empty { display: none; }
.privacy-safety [data-erase-msg]:not(:empty) { padding: 10px 12px; border-radius: 10px; background: #e3eddc; color: #24442b; }
.g-toggles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
#grownup .gbtn { border-radius: 999px; font-size: 15px; min-height: 42px; padding: 8px 14px; }
#grownup .gbtn.on { background: #466b4c; color: white; }
.season-spring { border-color: #92b882; } .season-summer { border-color: #e7bc55; } .season-autumn { border-color: #c97e4d; } .season-winter { border-color: #9bbfd4; }
.g-badge, .g-stats span { display: inline-block; padding: 7px 12px; border-radius: 999px; background: #e3eddc; }
.g-stats { display: flex; flex-wrap: wrap; gap: 8px; }
#grownup details { margin-top: 14px; } #grownup summary { cursor: pointer; font-weight: bold; }

.character-picker { display: flex; gap: 8px; padding: 5px; border-radius: 999px; background: #fff6dfed; box-shadow: 0 3px 12px #54372355; }
.character-pill { display: flex; align-items: center; gap: 7px; border: 3px solid transparent; border-radius: 999px; background: transparent; color: #543723; padding: 3px 12px 3px 3px; font: bold 18px Georgia, serif; cursor: pointer; }
.character-pill[aria-pressed="true"] { border-color: #d7a631; background: #fff; }
.character-pill img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.character-options { margin-top: 10px; }
.fundraiser-pill { position: absolute; bottom: var(--edge); left: 50%; transform: translateX(-50%); padding: 10px 18px; background: #ffe7d7; color: #79452f; }
.fundraiser-overlay { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; background: #281b17aa; }
.fundraiser-overlay[hidden], .fundraiser-pill[hidden] { display: none; }
.fundraiser-dialog { max-width: 440px; padding: 28px; border: 5px double #c79a63; border-radius: 24px; background: #fff7e7; color: #543723; text-align: center; box-shadow: 0 8px 25px #25170e99; }
.fundraiser-dialog .btn { display: inline-block; margin: 6px; padding: 10px 16px; text-decoration: none; }
@media (max-width: 600px) { .fundraiser-pill { left: auto; right: var(--edge); transform: none; font-size: 14px; } .character-pill img { width: 34px; height: 34px; } .welcome-actions { gap: 12px; } }

/* Picture book theater */
.cutscene-overlay { opacity: 0; transition: opacity .16s ease-out; }
.cutscene-overlay.visible { opacity: 1; transition: none; }
/* The theater fades over its own dark backdrop, never a stale gameplay frame. */
#ui:has(> #cutscene-overlay:not([hidden])) { background: #192e36; }
#ui:has(> #cutscene-overlay:not([hidden])) > :not(#cutscene-overlay) { visibility: hidden; }

#cutscene-title { padding: 8px 24px; font-size: clamp(20px, 2.8vw, 32px); }
#cutscene-caption { padding: 10px 22px; font-size: clamp(16px, 1.8vw, 22px); }
.movie-progress { position: absolute; bottom: 0; left: 0; width: 100%; height: 5px; background: #51321c88; pointer-events: none; }
#cutscene-progress { width: 0; height: 100%; background: #f2c86e; box-shadow: 0 0 8px #f6d98f; }
.chapter-actions:has(.movie-finished) :is(#cutscene-next:not([hidden]), #cutscene-play-next-story:not([hidden])),
.chapter-actions:has(#cutscene-next[hidden]):has(#cutscene-play-next-story[hidden]) #cutscene-continue.movie-finished {
  box-shadow: 0 0 0 2px #edc477;
}
.movie-pill { align-self: center; margin: 8px 0; padding: 8px 18px; min-height: 44px; border: 2px solid #c59a4d; border-radius: 999px; background: #fff2ce; color: #694124; font-weight: bold; cursor: pointer; }

/* Storybook keepsakes and movie night */
.movie-night-button { display: block; margin: 10px auto 14px; padding: 13px 24px; background: linear-gradient(#ffe5a0, #e9b64f); color: #583716; border: 3px solid #b77c28; box-shadow: 0 4px 0 #996221, 0 0 18px #ffd57488; font-size: clamp(17px, 2vw, 22px); }
.collectible-section { margin: 24px auto; padding: 14px; border: 2px solid #d5ae75; border-radius: 20px; background: #fff9e9c9; }
.collectible-section h3, .collectible-section p { margin: 4px; }
.collectible-shelf { display: grid; grid-template-columns: repeat(4, minmax(75px, 1fr)); gap: 12px; margin-top: 14px; }
.collectible { display: flex; flex-direction: column; align-items: center; gap: 5px; color: #68472e; font: bold 14px Georgia, serif; }
.collectible svg { width: min(100%, 82px); overflow: visible; }
.collectible.earned svg { filter: drop-shadow(0 0 7px #f4c965aa); animation: sticker-pop .55s ease both; }
@keyframes sticker-pop { 0% { transform: scale(.75); } 65% { transform: scale(1.1); } 100% { transform: scale(1); } }
.cutscene-overlay { background: linear-gradient(#160e0b 0 7%, #422719 7% 93%, #160e0b 93%); }
.chapter-pill { padding: 6px 18px; border: 2px solid #e4bd6d; border-radius: 999px; background: #573720; color: #fff3d5; font: bold 16px Georgia, serif; }
.movie-title-card { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 15px; padding: 25px; background: #62462f center / cover; color: #fff3d4; text-shadow: 0 2px 5px #21150f; font: italic clamp(16px, 2vw, 24px) Georgia, serif; }
.movie-title-card[hidden] { display: none; }
.movie-title-card strong { font: bold clamp(25px, 4vw, 45px) Georgia, serif; }
.cutscene-actions { flex-wrap: wrap; justify-content: center; }
.cutscene-actions .btn { min-height: 52px; padding: 8px 18px; }
.theo-card { display: flex; gap: 18px; align-items: flex-start; border: 2px solid #ddb38b; border-radius: 20px; padding: 20px; background: linear-gradient(135deg, #fff7eb, #f9e5d8); color: #5d3b30; }
.theo-card-heart { color: #c66e70; font-size: 38px; line-height: 1; }
.theo-card h3 { margin: 3px 0 8px; }
.theo-card-kicker { margin: 0; color: #9a6856; font-size: 14px; }
.theo-preview { display: inline-block; border-radius: 999px; padding: 5px 12px; background: #efd2bd; font-weight: bold; }
@media (max-width: 600px) { .collectible-shelf { grid-template-columns: repeat(2, minmax(75px, 1fr)); } .cutscene-actions { gap: 7px; } .cutscene-actions .btn { min-height: 44px; padding: 6px 10px; } }
@media (prefers-reduced-motion: reduce) { .collectible.earned svg { animation: none; } }
body.reduced .collectible.earned svg { animation: none; }

/* Keep overlays aligned with the dynamic canvas while the browser bars move. */
.corner, .board, .book-btn, .mute-btn, .cue, .act-banner, .tray, .ring, .ghost,
.caption, .banner, .hearts, .sticker-toast, .cutscene-overlay, .story-beat, .fundraiser-overlay {
  position: absolute;
}
.title { top: calc(var(--safe-top) + 40px); }
.corner { top: calc(var(--safe-top) + var(--edge)); }
.corner-left, .book-btn, .btn-grownups { left: calc(var(--safe-left) + var(--edge)); }
.corner-right, .mute-btn { right: calc(var(--safe-right) + var(--edge)); }
.book-btn, .mute-btn, .btn-grownups, .tray, .fundraiser-pill { bottom: calc(var(--safe-bottom) + var(--edge)); }
.board { top: calc(var(--safe-top) + 16px); }
.board, .act-banner, .tray, .caption, .banner, .sticker-toast, .story-beat {
  left: calc(50% + (var(--safe-left) - var(--safe-right)) / 2);
}
.act-banner { top: calc(var(--safe-top) + var(--edge)); width: max-content; max-width: min(650px, calc(var(--safe-width) - 204px)); }
.tray {
  width: max-content;
  max-width: calc(var(--safe-width) - 2 * var(--edge));
  flex-wrap: wrap;
  justify-content: center;
}
.tray.left { left: calc(var(--safe-left) + var(--edge)); transform: none; }
.tool { flex: none; }
.caption {
  bottom: calc(var(--safe-bottom) + 168px);
  width: max-content;
  max-width: min(70vw, calc(var(--safe-width) - 2 * var(--edge)));
  max-height: 38%;
  overflow: hidden;
}
body.on-farm .caption, body.on-welcome .caption { bottom: calc(var(--safe-bottom) + 40px); }
.banner { top: calc(var(--safe-top) + 8px); }
#graphics-status { z-index: 41; width: max-content; max-width: calc(var(--safe-width) - 24px); text-align: center; }
#graphics-retry { margin: 4px; padding: 4px 12px; pointer-events: auto; }
.story-beat { bottom: max(12%, calc(var(--safe-bottom) + 12px)); max-width: calc(var(--safe-width) - 24px); }
.story-beat .btn { padding: 6px 14px; }

#boot, #fail, .grown, #shelf, #book, .cutscene-overlay, .fundraiser-overlay {
  padding: calc(var(--safe-top) + var(--pad-top, 16px)) calc(var(--safe-right) + var(--pad-side, 16px))
    calc(var(--safe-bottom) + var(--pad-bottom, 20px)) calc(var(--safe-left) + var(--pad-side, 16px));
}
#fail, .grown, #shelf, #book, .cutscene-overlay, .fundraiser-overlay {
  overflow: hidden auto;
  overscroll-behavior: none;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}
#shelf { --pad-top: 24px; --pad-side: 108px; --pad-bottom: 36px; }
#book { --pad-top: 20px; --pad-side: 20px; --pad-bottom: 28px; scroll-padding-block-end: calc(var(--safe-bottom) + 28px); }
#book .storybook { width: min(900px, 100%); overflow-wrap: anywhere; }
#book-close { flex: none; }
.grown { --pad-top: 12px; --pad-side: 24px; --pad-bottom: 24px; user-select: none; -webkit-user-select: none; }
.grown textarea, .grown input { user-select: text; -webkit-user-select: text; -webkit-touch-callout: default; }
.gate-area { height: clamp(122px, 50vh, 520px); height: clamp(122px, 50dvh, 520px); margin-bottom: 12px; }
#grownup .g-head { top: var(--safe-top); gap: 10px; }
#grownup .gbtn { min-height: 44px; }
#grownup .g-body section { min-width: 0; overflow-wrap: anywhere; }
.cutscene-overlay { justify-content: flex-start; }
.cutscene-overlay > * { flex: none; max-width: 100%; }
.chapter-pill { margin-block-start: auto; }
.cutscene-actions { margin-block-end: auto; }
.cutscene-frame { width: min(100%, 760px, calc(var(--app-height) * .98)); }
.cutscene-frame video { display: block; }
#cutscene-watch { width: max-content; max-width: calc(100% - 16px); min-height: 52px; padding: 8px 18px; font-size: clamp(17px, 3vw, 24px); }
.fundraiser-dialog { margin: auto; }

@media (max-width: 740px) {
  #shelf { --pad-top: 74px; --pad-side: 12px; --pad-bottom: 78px; }
}
@media (max-width: 900px) {
  :root { --edge: 12px; }
  .corner, .book-btn { width: 50px; height: 50px; border-radius: 15px; }
  .corner .ico, .book-btn .ico { width: 30px; height: 30px; }
  .corner.halo .halo-text { top: 58px; font-size: 14px; }
  .board { gap: 4px; min-height: 44px; border-radius: 14px; padding: 4px 6px; }
  .board-tile { width: clamp(30px, 8vw, 48px); height: clamp(32px, 8vw, 48px); border-radius: 9px; padding: 4px; }
  .act-banner { max-width: calc(var(--safe-width) - 132px); padding: 5px 10px; gap: 6px; font-size: 20px; line-height: 1.1; text-align: center; }
  .act-banner .ico, .act-banner .ico:has(.pony-portrait) { width: 34px; height: 34px; }
  .tray { gap: 12px; padding: 9px 12px; border-radius: 18px; }
  .tool { width: 56px; height: 56px; padding: 6px; border-radius: 14px; }
  .ghost { width: 62px; height: 62px; }
  .cue { min-width: 0; max-width: min(245px, calc(var(--safe-width) - 28px)); min-height: 52px; padding: 4px 12px 4px 4px; gap: 5px; font-size: 16px; }
  .cue-face { flex: none; width: 42px; height: 42px; padding: 4px; }
  .cue-act { flex: none; width: 28px; height: 28px; }
  .cue-tick { width: 29px; height: 29px; right: -8px; top: -8px; }
  .caption { bottom: calc(var(--safe-bottom) + 94px); max-width: min(75vw, calc(var(--safe-width) - 24px)); padding: 6px 12px; font-size: 17px; }
  #activity-ui:not([hidden]) ~ .caption { top: calc(var(--safe-top) + 70px); bottom: auto; max-height: 26%; }
  body.on-farm .caption, body.on-welcome .caption { bottom: calc(var(--safe-bottom) + 72px); }
}
@media (max-width: 600px), (max-height: 510px) {
  #welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden auto;
    overscroll-behavior: none;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    pointer-events: auto;
    gap: 12px;
    padding: calc(var(--safe-top) + 68px) calc(var(--safe-right) + 12px)
      calc(var(--safe-bottom) + 68px) calc(var(--safe-left) + 12px);
  }
  #welcome > * { position: static; flex: none; transform: none; max-width: 100%; }
  #welcome .title { margin-block-start: auto; padding: 8px 16px; font-size: clamp(24px, 5vw, 34px); text-align: center; white-space: normal; }
  .welcome-actions { gap: 10px; }
  .welcome-actions .btn { min-width: 164px; min-height: 54px; padding: 5px 16px; font-size: 25px; }
  .welcome-actions .btn .ico { width: 32px; height: 32px; }
  #welcome .btn-grownups { min-height: 44px; font-size: 16px; margin-block-end: auto; }
  #welcome .note { margin: 0; font-size: 15px; }
  #fail { justify-content: flex-start; }
  #fail > * { flex-shrink: 0; }
  .fail-art { width: 90px; height: 90px; }
  .fail-text { font-size: 24px; }
}
@media (max-width: 600px) {
  .storybook { padding: 14px 10px; }
  .collectible-shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .book-nav { gap: 12px; }
  .cutscene-overlay { gap: 8px; }
  #cutscene-title, #cutscene-caption { max-width: 100%; padding: 6px 10px; }
}
@media (orientation: landscape) and (max-height: 510px) {
  #welcome { padding-top: calc(var(--safe-top) + 12px); padding-bottom: calc(var(--safe-bottom) + 12px); }
  #welcome .title { max-width: calc(100% - 126px); }
  .welcome-actions { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .cutscene-overlay {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    align-content: start;
    justify-items: center;
    gap: 8px 12px;
  }
  .cutscene-overlay .chapter-pill, .cutscene-actions { margin: 0; }
  #cutscene-title { grid-column: 2; grid-row: 1; }
  .chapter-pill { grid-column: 1; grid-row: 1; }
  .cutscene-frame { grid-column: 1; grid-row: 2 / span 2; width: min(100%, calc(var(--app-height) * .98)); }
  #cutscene-caption { grid-column: 2; grid-row: 2; }
  .cutscene-actions { grid-column: 2; grid-row: 3; gap: 6px; }
  #cutscene-title, #cutscene-caption { padding: 6px 10px; line-height: 1.25; }
  .cutscene-actions .btn { min-height: 44px; padding: 4px 10px; }
}
@media (max-height: 450px) {
  .movie-title-card { gap: 6px; padding: 10px; }
  .story-beat { max-height: calc(var(--app-height) - var(--safe-top) - var(--safe-bottom) - 28px); overflow: auto; -webkit-overflow-scrolling: touch; }
}

/* Story shelf, theater and touch layout */
#shelf { --pad-top: 30px; --pad-side: 100px; --pad-bottom: 110px; gap: 18px; background: linear-gradient(150deg, #fff8e9, #e8d5b2); scroll-padding-bottom: 110px; }
.shelf-title { margin: 0; font: 700 clamp(26px, 3vw, 38px)/1.1 Georgia, serif; }
.shelf-cards { width: min(1050px, 100%); max-width: none; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; padding: 5px 5px 14px; margin: 0 auto; }
.shelf-cards .card, .shelf-cards .card:last-child:nth-child(odd), .shelf-cards .card:nth-child(4):nth-last-child(2) { grid-column: auto; padding: 10px; gap: 8px; border: 4px solid #fff5dc; border-radius: 22px; box-shadow: 0 4px 0 #b88b5b, 0 9px 20px #62442933; }
.shelf-cards .card-art { flex: none; border: 3px solid #ead3a6; border-radius: 14px; overflow: hidden; }
.shelf-cards .card-title { min-height: 46px; margin: 0; font: 700 20px/1.15 Georgia, serif; }
.shelf-cards .card-art { order: -3; }
.shelf-cards .card-title { order: -2; }
.shelf-cards .btn-card-play, .shelf-cards .movie-pill { order: 1; width: min(100%, 210px); min-height: 44px; margin: 0; padding: 7px 12px; white-space: nowrap; line-height: 1.1; }
.shelf-cards .btn-card-play { margin-top: auto; font-size: 19px; }
.shelf-cards .movie-pill { font-size: 15px; }
.board { max-width: calc(var(--safe-width) - 204px); }
.board-tile { flex: none; transition: transform .15s, box-shadow .15s; }
.board-tile.done { background: #e5f0dc; outline: 2px solid #47764c; }
.board-tile .tick { background: #fff9e9; border-radius: 50%; }
@media (hover: hover) { .board:hover .board-tile { box-shadow: inset 0 0 0 2px #c2913e; } .board-tile:hover { transform: translateY(-3px); } }
.board-tile:active { transform: scale(.95); }
.ring { min-width: 64px; min-height: 64px; border: 5px solid #f5c54d; box-shadow: 0 0 0 3px #80520b, 0 0 0 6px #fff2ba, 0 0 18px #ffde6b; }
.tray { flex-wrap: nowrap; max-width: calc(var(--safe-width) - 210px); }
.caption { max-height: none; overflow: visible; text-align: center; line-height: 1.25; }
#activity-ui:not([hidden]) ~ .caption { top: auto; bottom: calc(var(--safe-bottom) + 174px); }
#book { scroll-padding-bottom: calc(var(--safe-bottom) + 30px); }
#book .storybook { margin: 0 auto; }
.movie-night-button { max-width: 100%; min-height: 48px; white-space: normal; line-height: 1.2; }
#book-movies { margin-top: 12px; }
#book-movies .movie-button { min-height: 44px; max-width: 200px; text-align: left; line-height: 1.2; }
.collectible-shelf { grid-template-columns: repeat(auto-fit, minmax(95px, 1fr)); }
.collectible { min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }
#grownup .g-head { margin-bottom: 12px; }
#grownup .g-body { padding-bottom: 12px; }
#grownup .g-body section { line-height: 1.5; }
#grownup .character-options { margin-top: 16px; }
#grownup .character-options .gbtn { min-width: 100px; }
.theo-card > div { min-width: 0; }
.theo-card a { text-decoration: none; max-width: 100%; }
.cutscene-overlay { gap: 8px; }
.cutscene-frame { width: min(760px, 100%, calc((var(--app-height) - 290px) * 16 / 9)); flex-shrink: 0; border-width: 6px; background-color: #18100b; }
.cutscene-actions { gap: 8px; }
.cutscene-actions .btn { min-height: 44px; font-size: 16px; white-space: nowrap; }
#cutscene-title, #cutscene-caption { line-height: 1.25; }
@media (max-width: 900px) {
  #shelf { --pad-side: 72px; --pad-bottom: 90px; }
  .shelf-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board { max-width: calc(var(--safe-width) - 132px); }
  .tray { max-width: calc(var(--safe-width) - 150px); }
  #activity-ui:not([hidden]) ~ .caption { top: auto; bottom: calc(var(--safe-bottom) + 94px); }
}
@media (max-width: 520px) {
  #shelf { --pad-top: 72px; --pad-side: 18px; --pad-bottom: 100px; }
  .shelf-cards { grid-template-columns: minmax(0, 1fr); max-width: 350px; }
  .shelf-cards .card-title { min-height: 0; }
  .tray { gap: 6px; padding: 7px; }
  .tool { width: 52px; height: 52px; }
  #activity-ui:not([hidden]) ~ .caption { bottom: calc(var(--safe-bottom) + 86px); max-width: calc(var(--safe-width) - 28px); font-size: 15px; }
  #book { --pad-side: 12px; }
  .storybook { border-width: 6px; }
  .collectible-shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (orientation: landscape) and (max-height: 510px) {
  #shelf { --pad-top: 12px; --pad-side: 72px; --pad-bottom: 90px; }
  .cutscene-overlay { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); grid-template-rows: auto auto auto; align-content: center; }
  .cutscene-frame { width: min(100%, calc((var(--app-height) - 80px) * 16 / 9)); }
  #cutscene-title { font-size: 18px; }
  #cutscene-caption { font-size: 15px; }
  .chapter-pill { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { .ring, .board-tile { animation: none; transition: none; } }
body.reduced .ring { animation: none; }
@media (max-width: 520px) {
  .tray:not(.left) { left: calc(50% + (var(--safe-left) - var(--safe-right)) / 2 - 20px); }
}

/* A little field guide tucked inside the storybook. */
.book-tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 14px auto 20px; }
.book-tabs button { flex: 1 1 200px; max-width: 280px; min-height: 48px; padding: 9px 14px; border: 2px solid #b88b58; border-radius: 16px; background: #fff7e5; color: #67452e; font: 700 16px system-ui, sans-serif; cursor: pointer; }
.book-tabs button[aria-selected="true"] { background: #5c7954; border-color: #496643; color: #fffdf1; }
.book-tabs button:focus-visible, .guide-card:focus-visible { outline: 3px solid #825028; outline-offset: 3px; }
.guide-intro { color: #79563d; font-family: Georgia, serif; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 14px; }
.guide-card { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; min-height: 210px; padding: 16px; border: 2px solid #d6b587; border-radius: 20px; background: #fffaf0; color: #68482f; font: 16px/1.4 system-ui, sans-serif; cursor: pointer; overflow-wrap: anywhere; }
.guide-card[aria-expanded="true"] { border-color: #688657; background: #f0f6df; box-shadow: 0 0 0 3px #b5cc92; }
.guide-card svg { width: 76px; height: 76px; flex: none; color: #a85d3d; }
.guide-card strong { font: bold 20px/1.2 Georgia, serif; }
.guide-prompt { padding-top: 8px; border-top: 1px solid #c9d7b0; color: #53694b; font-size: 0.94em; }
.guide-prompt[hidden], [role="tabpanel"][hidden] { display: none; }
.comfort-toggle { margin: 4px 8px 4px 0; }
.large-text #book { font-size: 1.25rem; }
.large-text #book .book-title { font-size: clamp(34px, 5vw, 42px); }
.large-text #book .guide-card, .large-text #book .book-tabs button, .large-text #book .sticker, .large-text #book .collectible { font-size: 1.15rem; }
.large-text #book .sticker { height: auto; min-height: 145px; }
.large-text .caption, .large-text #cutscene-caption { font-size: clamp(20px, 2.3vw, 28px); }

/* Phone controls and scrollable story surfaces. */
.farm-stories { position: absolute; left: calc(var(--safe-left) + var(--edge) + 84px); bottom: calc(var(--safe-bottom) + var(--edge)); z-index: 20; min-height: 56px; padding: 0 14px; }
.farm-stories .ico { width: 28px; height: 28px; }
@media (max-width: 600px), (max-height: 460px) {
  :root { --edge: 8px; }
  .corner, .book-btn { width: 56px; height: 56px; }
  .board { top: calc(var(--safe-top) + 8px); min-height: 56px; padding: 4px; gap: 3px; max-width: calc(var(--safe-width) - 136px); }
  .board-tile { width: 48px; height: 48px; }
  .mute-btn { min-height: 56px; padding: 0 10px; }
  .farm-stories { left: calc(var(--safe-left) + 72px); min-height: 56px; gap: 5px; padding: 0 10px; font-size: 14px; }
  .farm-stories .ico { width: 24px; height: 24px; }
  .tray, .tray:not(.left) { left: calc(50% + (var(--safe-left) - var(--safe-right)) / 2); max-width: calc(var(--safe-width) - 150px); gap: 4px; padding: 5px; }
  .tray.left { left: calc(var(--safe-left) + 70px); transform: none; }
  .tool { width: 56px; height: 56px; }
  .tool.held { transform: translateY(-5px); }
  .tool:active, .tool.held:active { transform: scale(.92); }
  .act-banner { top: calc(var(--safe-top) + 8px); max-width: calc(var(--safe-width) - 136px); font-size: 17px; }
  #activity-ui:not([hidden]) ~ .caption { bottom: calc(var(--safe-bottom) + 82px); max-width: calc(var(--safe-width) - 24px); font-size: 15px; padding: 5px 10px; }
  #shelf, #book { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  #shelf { --pad-bottom: 100px; }
  .shelf-cards .btn-card-play, .shelf-cards .movie-pill { min-height: 56px; }
  #book { --pad-bottom: 80px; }
  .book-tabs button, .movie-night-button, #book-movies .movie-button, #book-watch-movie, .book-nav button { min-height: 56px; }
  .book-nav button { min-width: 56px; }
  .cutscene-actions .btn { min-height: 56px; }
}
@media (max-width: 600px) and (orientation: portrait) {
  #act-title { display: block; text-wrap: balance; }
  #tray.left, #tray:has(> .tool:nth-child(2)) {
    left: calc(var(--safe-left) + var(--edge));
    transform: none;
  }
  #shelf { --pad-side: 12px; }
  .shelf-cards { grid-template-columns: minmax(0, 1fr); max-width: none; }
  .cutscene-overlay { display: flex; justify-content: flex-start; gap: 8px; }
  .cutscene-overlay .chapter-pill, .cutscene-actions { margin: 0; }
  .cutscene-frame { width: min(100%, 760px); }
  .cutscene-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .cutscene-actions .btn { white-space: normal; }
}
@media (orientation: landscape) and (max-height: 460px) {
  #shelf { --pad-side: 72px; }
  .shelf-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: none; }
  .cutscene-overlay { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); grid-template-rows: auto auto auto; gap: 5px 10px; align-content: center; }
  .cutscene-frame { width: 100%; grid-column: 1; grid-row: 1 / span 3; }
  #cutscene-title { grid-column: 2; grid-row: 1; }
  .chapter-pill { display: none; }
  #cutscene-caption { grid-column: 2; grid-row: 2; font-size: 15px; }
  .cutscene-actions { grid-column: 2; grid-row: 3; display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cutscene-actions .btn { min-height: 48px; white-space: normal; }
}
@media (max-width: 600px), (max-height: 460px) {
  .board-tile { width: 44px; height: 48px; }
}

/* Comfortable targets and feedback for mouse, touch, keyboard and switches. */
button, summary { min-width: 48px; min-height: 48px; }
#grownup .gbtn, .shelf-cards .btn-card-play, .shelf-cards .movie-pill,
.cutscene-actions .btn, .movie-pill { min-height: 48px; }
.character-pill, .book-tabs button, .movie-pill, .movie-button, .guide-card,
.gate-target, summary { transition: transform .18s ease-out, box-shadow .18s; }
.character-pill:active, .book-tabs button:active, .movie-pill:active,
.movie-button:active, .guide-card:active, .gate-target:active, summary:active {
  transform: scale(.96);
}
button:focus-visible, summary:focus-visible, a:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid #174e75;
  outline-offset: 3px;
  box-shadow: 0 0 0 2px #fff;
}
/* Paint the menu surface on the first frame, including on slow WebGL devices. */
#gate:not([hidden]) .gate-card { animation: gate-arrive .15s ease-out; }
@keyframes gate-arrive { from { transform: translateY(4px); } to { transform: none; } }
@keyframes screen-arrive { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .character-pill, .book-tabs button, .movie-pill, .movie-button, .guide-card, .gate-target, summary { transition: none; }
}
body.reduced .character-pill, body.reduced .book-tabs button, body.reduced .movie-pill,
body.reduced .movie-button, body.reduced .guide-card, body.reduced .gate-target, body.reduced summary { transition: none; }
.btn, #welcome .btn-grownups, #book-close { min-height: 48px; }
.board-tile { min-width: 48px !important; min-height: 48px !important; }
@media (max-width: 600px) {
  .board { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
}
/* The shelf scrolls beneath fixed farm controls, so keep its cards unobstructed. */
#ui:has(#shelf:not([hidden])) > #btn-mute { visibility: hidden; }

/* Respect both the device preference and the in-game calmer motion setting. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
body.reduced *, body.reduced *::before, body.reduced *::after {
  animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important;
}
@media (forced-colors: active) {
  button, summary, a, textarea, select { border: 2px solid ButtonText; }
  .board-tile { border: 2px solid ButtonText !important; }
  button:focus-visible, summary:focus-visible, a:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid Highlight; }
  button[aria-pressed="true"], button[aria-expanded="true"], [role="tab"][aria-selected="true"] { border: 4px solid Highlight; }
  .board-tile.done { outline: 3px solid Highlight; }
  .cutscene-overlay, .story-beat { background: Canvas; color: CanvasText; }
  .tool.held { border: 4px solid Highlight; }
  .tool.required { outline: 2px dashed Highlight; outline-offset: 2px; }
  .tool.required:focus-visible { outline: 3px solid Highlight; }
  .gate-fill { background: Highlight; forced-color-adjust: none; }
  .storybook, .card, #grownup .g-body section { border-color: CanvasText; }
}

/* Keep the grown-up header in the document flow so it never covers form controls. */
#grownup .g-head { position: static; }

/* Give keyboard focus room inside the app's scrollable panels. */
#shelf :focus-visible, #book :focus-visible, #grownup :focus-visible { scroll-margin: 12px; }

/* The welcome screen and story moments share the same gentle arrival as menus. */
#welcome:not([hidden]), #story-beat:not([hidden]) { animation: screen-arrive .18s ease-out; }
/* The storybook scrolls under farm controls, just like the shelf. */
#ui:has(#book:not([hidden])) > #btn-mute { visibility: hidden; }
#ui:has(#gate:not([hidden])) > #btn-mute,
#ui:has(#grownup:not([hidden])) > #btn-mute { visibility: hidden; }

.cutscene-loading { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 90%; padding: 8px 14px; border-radius: 12px; background: #fff7e5; color: #49301e; font-weight: 700; text-align: center; }
.cutscene-loading[hidden] { display: none; }

/* Fit all five 48px chore targets between the corner controls on small phones. */
@media (max-width: 600px) {
  .board { width: min(246px, calc(var(--safe-width) - 128px)); max-width: calc(var(--safe-width) - 128px); justify-content: center; gap: 0; padding: 0; }
}

/* Preserve the centered position while the optional fundraiser button responds. */
@media (min-width: 601px) {
  @media (hover: hover) { .fundraiser-pill:hover { transform: translateX(-50%); filter: brightness(1.045); } }
  .fundraiser-pill:active { transform: translateX(-50%) scale(.95); }
}
/* Parent-facing information can be selected and copied, including privacy details. */
#grownup { user-select: text; -webkit-user-select: text; -webkit-touch-callout: default; }
#grownup button, #grownup summary { user-select: none; -webkit-user-select: none; }
.theo-card-kicker { color: #754a39; }

/* Artwork and earned stickers are buttons too, so make their response visible. */
.card-art, .sticker {
  transition: transform .18s ease-out, box-shadow .18s;
}
.card-art:active, .sticker:active { transform: scale(.97); }
@media (prefers-reduced-motion: reduce) {
  .card-art, .sticker { transition: none; }
}
body.reduced .card-art, body.reduced .sticker { transition: none; }

/* Leave an uninterrupted view from the barn door to the paddock gate. */
#welcome {
  display: flex; flex-direction: column; align-items: center; justify-content: start; gap: 0;
  padding: calc(var(--safe-top) + clamp(14px, 3.6vh, 38px)) calc(var(--safe-right) + 14px)
    calc(var(--safe-bottom) + 12px) calc(var(--safe-left) + 14px);
  overflow: auto; pointer-events: auto; touch-action: pan-y;
}
#welcome .title {
  position: static; transform: none; flex: none; margin: 0; max-width: calc(100% - 156px);
  padding: 10px clamp(20px, 4vw, 52px) 14px; text-align: center; white-space: normal;
  color: #63352c; font: bold clamp(32px, 5.5vw, 72px)/.98 Georgia, serif; letter-spacing: -.045em;
  border: 1px solid #976844; border-bottom: 4px solid #936445; border-radius: 7px 7px 34px 34px;
  background: linear-gradient(175deg, #fffaf0, #f7e7bd);
  box-shadow: inset 0 0 0 4px #fff5d9, inset 0 0 0 5px #cbaa77, 0 5px 12px #49312c35;
}
.title-place {
  display: flex; align-items: center; justify-content: center; gap: .75em;
  margin: 2px 0 7px; color: #446457; font: 700 clamp(12px, 1.45vw, 18px)/1.2 Georgia, serif;
  text-transform: uppercase; letter-spacing: .18em;
}
.title-place::before, .title-place::after { content: ''; width: 1.8em; border-top: 1px solid #aa8252; }
#welcome .welcome-actions {
  position: static; transform: none; margin: auto 0 0; display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; justify-items: stretch;
  width: min(415px, 100%); gap: 9px; padding: 12px; flex: none;
  background: #fff7e7; border: 1px solid #be9c71; border-bottom: 4px solid #98724c;
  border-radius: 22px; box-shadow: 0 7px 20px #3b383b40;
}
#welcome .welcome-actions .btn {
  min-width: 0; min-height: 58px; padding: 6px 10px; border-radius: 14px;
  font: bold clamp(21px, 2.3vw, 30px)/1.12 Georgia, serif; gap: 7px;
  border: 1px solid #bca781; box-shadow: 0 2px 0 #bda883;
}
#welcome .welcome-actions .btn-play { background: #2e5b46; color: #fffbe9; border-color: #2e5b46; box-shadow: 0 2px 0 #1f4134; }
#welcome .welcome-actions .ico { width: 28px; height: 28px; }
#welcome .character-picker { grid-column: 1 / -1; justify-content: center; padding: 0; background: transparent; box-shadow: none; }
#welcome .character-pill { min-height: 48px; padding: 2px 12px 2px 4px; font-size: 17px; }
#welcome .character-pill img { width: 36px; height: 36px; }
#welcome .character-pill[aria-pressed="true"] { border: 2px solid #64856b; background: #edf2e5; }
#welcome .character-pill[aria-pressed="true"]::after {
  content: ''; width: 9px; height: 5px; border: solid #2f5d3a; border-width: 0 0 2px 2px; transform: rotate(-45deg);
}
#welcome .welcome-footer {
  align-self: stretch; display: flex; flex-wrap: wrap; align-items: end;
  gap: 6px; margin: 8px 103px 0 0; min-height: 48px; pointer-events: none;
}
#welcome .welcome-footer .btn { position: static; transform: none; pointer-events: auto; margin: 0; min-width: 0; min-height: 48px; font: bold 16px Georgia, serif; padding: 4px 12px; }
#welcome .welcome-footer .btn-grownups { order: -1; }
#welcome .note { position: static; transform: none; order: -1; margin: 0 0 4px; font-size: 15px; }
@media (max-width: 600px) and (orientation: portrait) {
  #welcome .title { margin-top: 72px; max-width: 100%; font-size: clamp(36px, 11vw, 56px); }
  #welcome .welcome-actions { width: min(335px, 100%); }
}
@media (orientation: landscape) and (max-height: 510px) {
  #welcome { padding-top: calc(var(--safe-top) + 8px); }
  #welcome .title { padding: 6px 25px 9px; font-size: clamp(28px, 4vw, 40px); }
  .title-place { font-size: 11px; margin-bottom: 3px; }
  #welcome .welcome-actions { width: auto; max-width: 100%; grid-template-columns: auto auto auto; padding: 7px; gap: 7px; }
  #welcome .character-picker { grid-column: auto; }
  #welcome .welcome-actions .btn { min-height: 48px; }
  #welcome .welcome-footer { min-height: 0; margin: 0 96px 0 0; }
}
@media (max-width: 660px) and (orientation: landscape) and (max-height: 510px) {
  #welcome .welcome-actions { grid-template-columns: repeat(2, auto); }
  #welcome .character-picker { grid-column: span 2; }
}

/* The book opens to one activity at a time. Its cover also plays the whole movie. */
#book { background: #e4dac4; }
#book .storybook {
  width: min(850px, 100%); padding: clamp(12px, 2.8vw, 30px); min-height: 0;
  background: #fff8e9; border: 1px solid #bb9873; border-left: 8px solid #884e40;
  border-radius: 6px 20px 18px 6px;
  box-shadow: 0 3px #eadabe, 0 4px #ba9e76, 0 7px #eddebf, 0 9px #966b4e, 0 14px 30px #62442a30;
}
.book-head { position: sticky; top: var(--safe-top); z-index: 2; background: #fff8e9; display: flex; justify-content: space-between; gap: 10px; align-items: center; text-align: left; }
.book-head .book-title { color: #713f32; font: bold clamp(24px, 3.6vw, 40px)/1.06 Georgia, serif; letter-spacing: -.035em; }
#book-close, .movie-picker button {
  min-width: 48px; min-height: 48px; border: 1px solid #bca07a; border-radius: 12px;
  color: #54422e; background: #fffdf5; font: bold 17px Georgia, serif; cursor: pointer;
}
#book-close { padding: 0 12px; }
.book-tabs { display: grid; grid-template-columns: 1fr 1fr 1.35fr; gap: 4px; margin: 14px 0 18px; padding: 4px; background: #eee1c7; border-radius: 13px; }
.book-tabs button { min-width: 0; max-width: none; border: 0; border-radius: 9px; min-height: 48px; padding: 5px; font: 700 16px/1.15 Arial, sans-serif; color: #655440; background: transparent; }
.book-tabs button[aria-selected="true"] { background: #355e4d; color: #fffdf2; box-shadow: 0 2px 3px #3a382b30; }
#book-movies, #grownup [data-movies] { display: block; container-type: inline-size; }
.movie-picker { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; margin-bottom: 12px; }
.movie-picker button { display: grid; place-items: center; }
.movie-picker button svg { width: 23px; height: 23px; }
.movie-picker button:last-child svg { transform: rotate(180deg); }
.movie-picker select { width: 100%; min-width: 0; padding: 4px 8px; border: 1px solid #bba07f; border-radius: 10px; background: #fffdf6; color: #523d2e; text-align: center; font: bold 18px/1.2 Georgia, serif; }
.movie-programme { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; gap: 16px; }
.movie-cover { position: relative; display: grid; width: 100%; padding: 0; overflow: hidden; border: 2px solid #896b4a; border-radius: 14px; background: #f2e3c4; cursor: pointer; }
.movie-cover img { width: 100%; height: auto; aspect-ratio: 16/9; object-fit: contain; display: block; }
.movie-cover span { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; color: #fffaf0; background: #315c4d; font: 700 18px/1.2 Georgia, serif; }
.movie-cover span svg { width: 22px; height: 22px; }
.chapter-list { display: grid; gap: 6px; }
#book .chapter-list .movie-button, #grownup .chapter-list .movie-button {
  width: 100%; max-width: none; min-height: 48px; padding: 6px 9px; gap: 10px;
  background: #fffdf7; border: 1px solid #d7c2a0; border-radius: 10px;
  color: #584434; text-align: left; font: 600 16px/1.28 Georgia, serif;
}
.chapter-list b { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #eee4cb; color: #5e4c33; }
/* Each chapter ticket carries the same opening picture as the film. */
#book .chapter-list .movie-button, #grownup .chapter-list .movie-button {
  display: grid; grid-template-columns: clamp(70px, 8vw, 100px) 1fr; gap: 10px;
  align-items: center; min-width: 0; padding: 3px 9px 3px 3px;
  background: #fffcf2; box-shadow: 0 2px 0 #dcc9a6;
}
.chapter-list .chapter-still:first-child {
  display: block; position: relative; overflow: hidden; width: 100%; height: auto;
  aspect-ratio: 16/10; border-radius: 7px; background: #e7dec9 center / cover no-repeat;
}
.chapter-still img { display: block; width: 100%; height: 100%; object-fit: cover; }
.chapter-still b {
  position: absolute; left: 0; bottom: 0; width: 1.55em; height: 1.45em;
  border-radius: 0 6px 0 0; background: #274b46; color: #fff7dc; font: 700 13px/1 system-ui, sans-serif;
}
.chapter-name { text-wrap: pretty; }
@container (max-width: 480px) {
  .chapter-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  #book .chapter-list .movie-button, #grownup .chapter-list .movie-button {
    display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 3px;
  }
  .chapter-list .chapter-still:first-child { aspect-ratio: 2.35; border-radius: 7px 7px 3px 3px; }
  .chapter-name { padding: 5px 6px; }
}
.movie-night-button { display: flex; gap: 9px; flex-wrap: wrap; margin: 18px 0 0; width: 100%; background: #344557; border: 1px solid #263a48; border-radius: 13px; box-shadow: 0 3px #202f3a; color: #fff4cf; font: bold 21px/1.2 Georgia, serif; }
.movie-night-button > span { width: 20px; height: 20px; background: #ffd070; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 58%, 80% 95%, 50% 72%, 20% 95%, 32% 58%, 2% 35%, 39% 35%); }
.movie-night-button small { padding-left: 10px; border-left: 1px solid #92a2ac; font: 15px Arial, sans-serif; color: #fffaf2; }
@container (max-width: 480px) { .movie-programme { grid-template-columns: 1fr; gap: 10px; } }
@media (orientation: landscape) and (max-height: 510px) {
  #book { --pad-top: 6px; --pad-bottom: 18px; }
  #book .storybook { padding: 10px 16px 14px; }
  .book-tabs { margin: 5px 0 9px; }
}
.collectible-section { margin: 0 0 16px; }
#book .collectible svg { aspect-ratio: 1; height: auto; }
.guide-heading { color: #4c624c; font: bold 22px Georgia, serif; margin: 0 0 12px; text-align: left; }
.guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 9px; }
.guide-entry { overflow: hidden; border: 1px solid #d5bd98; background: #fffdf6; border-radius: 12px; }
.guide-card {
  width: 100%; min-height: 68px; display: grid; grid-template-columns: 86px 1fr auto;
  align-items: center; gap: 10px; padding: 5px 12px 5px 5px;
  border: 0; border-radius: 11px; background: transparent; text-align: left;
}
.guide-card svg, .guide-card img { display: block; width: 86px; height: 61px; border-radius: 7px; overflow: hidden; }
/* Isolate each cropped vector when Chromium tiles the scrolling book on phones. */
.guide-card > :is(svg, img) { transform: translateZ(0); }
.guide-card strong { font-size: 17px; }
.guide-card::after { content: ''; width: 8px; height: 8px; border: solid #577563; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.guide-card[aria-expanded="true"] { background: #e6eddc; border-radius: 0; box-shadow: none; }
.guide-card[aria-expanded="true"]::after { transform: rotate(225deg); }
.guide-reading { padding: 12px 16px; text-align: left; color: #493b32; font: 17px/1.48 Georgia, serif; }
.guide-reading p { margin: 0; }
.guide-reading .guide-prompt { margin-top: 10px; padding-top: 8px; font: 15px/1.45 Arial, sans-serif; }
.guide-entry:has(:focus-visible) { outline: 3px solid #825028; outline-offset: 2px; }
.large-text .guide-reading, .large-text .guide-prompt, .large-text .guide-card strong { font-size: 1.23rem; }
@media (max-width: 670px) { .guide-grid { grid-template-columns: 1fr; } }
@media (forced-colors: active) {
  .book-tabs button[aria-selected="true"], .character-pill[aria-pressed="true"] { outline: 2px solid Highlight; }
}
@media (min-width: 700px) and (orientation: landscape) and (max-height: 510px) {
  #book .storybook { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; }
  .book-head { position: static; gap: 12px; }
  .book-head .book-title { font-size: 25px; }
  .book-tabs { margin: 0; grid-template-columns: repeat(3, auto); overflow-wrap: normal; }
  .book-tabs button { padding-inline: 10px; }
  .large-text #book .book-title { font-size: 34px; }
  .large-text .book-tabs button:last-child { max-width: 7ch; }
  #book [role="tabpanel"] { grid-column: 1 / -1; }
  #book-stories-panel { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: max-content; gap: 8px 14px; align-content: start; }
  #book-movies, #book-movies .movie-programme { display: contents; }
  #book-movies .movie-picker { grid-column: span 2; margin: 0; }
  #book-movies .movie-cover { grid-row: 2 / span 2; align-self: start; justify-self: center; max-width: min(100%, calc((var(--app-height) - 200px) * 16 / 9)); }
  #book-movies .chapter-list { grid-column: 2; grid-row: 2; align-self: start; }
  #book-movies .chapter-list:has(:nth-child(3)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #book-movies .chapter-list .movie-button { grid-template-columns: 68px 1fr; gap: 7px; font-size: 15px; }
  #book-movies .chapter-list:has(:nth-child(3)) .movie-button { grid-template-columns: minmax(38px, .43fr) 1fr; gap: 5px; padding: 3px; }
  #book-movies .chapter-list:has(:nth-child(3)) .chapter-still { aspect-ratio: 1; }
  #book-movies .chapter-list:has(:nth-child(3)) .chapter-name { padding: 2px 1px; }
  #book-watch-all { grid-column: 2; grid-row: 3; align-self: start; margin: 0; }
}

/* Let the covers scroll on their own, clear of Home and the speaker. */
#shelf { padding: 0; gap: 0; overflow: clip; scroll-padding: 0; }
.shelf-head {
  flex: none; width: 100%; padding: calc(var(--safe-top) + var(--edge)) calc(var(--safe-right) + 12px) 10px calc(var(--safe-left) + 12px);
  background: #fff8e9; border-bottom: 1px solid #c9ae85;
}
.shelf-head .shelf-title { display: grid; place-items: center; min-height: 72px; padding-inline: 74px; }
#shelf-season { display: flex; justify-content: center; gap: 3px; margin: 4px auto 0; max-width: 430px; padding: 3px; border-radius: 13px; background: #ede1ca; }
#shelf-season button {
  flex: 1; min-width: 0; min-height: 48px; padding: 4px 2px; border: 0; border-radius: 10px;
  background: transparent; color: #5b4733; font: bold clamp(15px, 2vw, 17px)/1.1 Georgia, serif; cursor: pointer;
}
#shelf-season [aria-pressed="true"] { background: #355e4d; color: #fffaf0; box-shadow: 0 2px 3px #48332333; }
.shelf-scroll { flex: 1; min-height: 0; width: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 12px calc(var(--safe-right) + 14px) calc(var(--safe-bottom) + 18px) calc(var(--safe-left) + 14px); }
.shelf-cards .story-card {
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto 1fr auto;
  align-items: start; gap: 7px; padding: 9px; border: 1px solid #c5aa83; border-radius: 15px;
  background: #fff8ea; box-shadow: 0 3px 0 #c3a880, 0 6px 12px #68432518;
}
.shelf-cards .story-card > * { order: initial; }
.shelf-cards .card-art { position: relative; grid-column: span 2; border: 0; border-radius: 9px; }
.card-listen { position: absolute; bottom: 5px; right: 5px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #fff8e9; color: #355e4d; box-shadow: 0 1px 5px #32271766; }
.card-listen svg { width: 18px; height: 18px; }
.card-season { grid-column: span 2; justify-self: start; margin: 3px 5px 0; color: #52644d; font: bold 12px/1.1 Arial, sans-serif; text-transform: uppercase; letter-spacing: .07em; }
.shelf-cards .card-title { grid-column: span 2; align-self: start; justify-content: start; min-height: 0; padding: 0 5px 4px; color: #6a3a2f; text-align: left; }
.shelf-cards .story-card :is(.btn-card-play,.movie-pill) {
  width: 100%; min-width: 0; min-height: 50px; margin: 0; padding: 5px; align-self: stretch;
  border: 1px solid #bca581; border-radius: 10px; box-shadow: 0 2px 0 #bfab88; font: bold 17px/1.1 Georgia, serif; white-space: normal;
}
.shelf-cards .story-card .btn-card-play { background: #355e4d; border-color: #355e4d; color: #fff9eb; }
.shelf-cards .story-card .movie-pill { color: #624530; background: #fffaf0; }
@media (max-width: 600px) { .shelf-head .shelf-title { min-height: 56px; font-size: 26px; } }
@media (min-width: 960px), (min-width: 700px) and (orientation: landscape) and (max-height: 510px) {
  .shelf-head { display: flex; justify-content: center; align-items: center; gap: 20px; padding-inline: calc(var(--safe-left) + 76px) calc(var(--safe-right) + 76px); }
  .shelf-head .shelf-title { min-height: clamp(56px, 9vh, 72px); padding: 0; font-size: clamp(25px, 2.7vw, 34px); }
  #shelf-season { flex: 1; max-width: 380px; margin: 0; }
}

.farm-library {
  position: absolute; bottom: calc(var(--safe-bottom) + var(--edge)); left: calc(var(--safe-left) + var(--edge));
  display: flex; align-items: stretch; gap: 8px; z-index: 20;
}
.farm-library .btn { position: static; width: auto; height: auto; min-height: 52px; padding: 5px 12px; gap: 5px; border-radius: 14px; font: bold 17px/1.15 Georgia, serif; }
.farm-library .ico { width: 24px; height: 24px; }
@media (max-width: 600px) {
  .farm-library .btn { padding: 5px 9px; }
  body.on-farm #hud .corner, body.on-farm #btn-speaker { width: 48px; }
  .board { width: max-content; max-width: calc(var(--safe-width) - 120px); justify-content: safe center; gap: 2px; }
}

#gate { display: flex; background: #e9dfca; }
.gate-card { width: min(500px, 100%); margin: auto; padding: clamp(12px, 3vw, 24px); background: #fff8e9; border: 1px solid #bfa27c; border-radius: 18px; box-shadow: 0 4px #c3a886; }
.gate-card h2 { margin: 0; color: #673b30; font: bold 28px/1.1 Georgia, serif; }
.gate-text { margin: 8px 0 12px; font: 17px/1.35 Arial, sans-serif; color: #504332; }
.gate-area { height: clamp(122px, 25dvh, 210px); background: #edf0de; box-shadow: inset 0 0 0 1px #c1c7a8; }
.gate-target { width: 72px; height: 72px; color: white; background: #387568; box-shadow: inset 0 0 0 2px #f6ebc6, 0 0 0 2px #517564; }
.gate-hold-label { position: relative; font: bold 20px Georgia, serif; }
.gate-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.gate-actions .gbtn, #grownup #g-back { border: 1px solid #bda582; border-radius: 11px; box-shadow: 0 2px #c4ac89; font: bold 16px Georgia, serif; min-height: 48px; padding: 5px 10px; }
#gate-accessible-status { min-height: 2.5em; margin: 10px 0 0; color: #355e4d; font: 16px/1.25 Arial, sans-serif; }
#grownup .setting-label { margin: 10px 0 4px; font-weight: 700; }
#grownup .setting-label + .g-row { margin-top: 0; }

#book .book-empty { width: 100%; margin: 0; color: #634b37; font: 17px/1.35 Georgia, serif; }
#book .collectible-section { margin-top: 16px; }
#book { scroll-padding-top: calc(var(--safe-top) + 68px); }
.boot-art { width: 96px; height: 96px; border-radius: 22%; box-shadow: 0 3px 10px #5346312b; }
#boot .boot-text { margin: 0; font: bold 24px Georgia, serif; color: #355e4d; }
#ui:has(#boot:not([hidden]),#fail:not([hidden])) > :is(#btn-mute,#btn-speaker) { visibility: hidden; }
.cutscene-actions #cutscene-next { background: #e6c884; color: #4c341f; }
.cutscene-actions:has(#cutscene-next[hidden]) #cutscene-continue { grid-column: 1 / -1; background: #ead7ae; color: #4c341f; }
#shelf-season button:active, .movie-cover:active, .movie-picker button:active, #book-close:active { background-color: #e1d1b5; color: #362b1f; }
button:active { transition-duration: .055s; }
@media (display-mode: standalone) {
  #ui::after { content: ''; position: absolute; inset: 0 0 auto; height: var(--safe-top); background: #2f5d3a; z-index: 150; pointer-events: none; }
}

.ring-count { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); padding: 2px 7px; border-radius: 9px; background: #553f26; color: #fff8dc; font: bold 13px/1.2 Arial, sans-serif; white-space: nowrap; }
#book-stickers:has(.book-empty) { min-height: 0; text-align: left; }

/* Leave the exit in its own row when a parent reads the longer sections. */
#grownup { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; }
#grownup .g-head { flex: none; width: 100%; margin-bottom: 0; }
#grownup .g-body { width: 100%; min-height: 0; overflow-y: auto; align-content: start; overscroll-behavior: contain; padding: 5px 4px calc(var(--safe-bottom) + 18px); }
#grownup .setting-label + .g-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
#grownup .setting-label + .g-row button { min-width: 0; padding: 5px; border: 1px solid #b9a684; border-radius: 11px; box-shadow: 0 2px #cbb893; font: bold 16px Georgia, serif; }
#banner.offline { top: calc(var(--safe-top) + var(--edge)); left: calc(var(--safe-left) + var(--edge)); transform: none; font: 600 14px/1.2 Arial, sans-serif; padding: 7px 10px; border-radius: 9px; }
body:not(.on-welcome) #banner.offline { visibility: hidden; }

.farm-library:has(#btn-book[hidden]) { display: none; }
#farm-wide { order: 1; color: #355e4d; background: #fff9e9; border: 1px solid #ab9172; }
#farm-wide svg { width: 27px; height: 27px; }
#farm-wide[aria-pressed="true"] { color: #fff9e9; background: #355e4d; }
@media (max-width: 620px) {
  #farm-wide { position: fixed; top: calc(var(--safe-top) + var(--edge) + 84px); left: calc(var(--safe-left) + var(--edge)); width: 60px; padding: 6px 2px; flex-direction: column; gap: 3px; font: 700 12px/1.1 system-ui, sans-serif; }
}

#island-guide .guide-card { border: 1px solid #d6bf99; border-radius: 12px; }
#island-guide .guide-card::after { transform: rotate(-45deg); }
#book-guide-panel:has(#guide-page:not([hidden])) > h3 { display: none; }
.guide-tools { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.guide-tools button, #guide-scale, #guide-listen {
  min-width: 48px; min-height: 48px; padding: 6px 12px; cursor: pointer;
  border-radius: 10px; border: 1px solid #b6a282; background: #fffdf5; color: #344f42;
  font: 700 15px/1.2 system-ui, sans-serif;
}
.guide-tools [data-icon] { display: block; width: 18px; height: 18px; margin: auto; }
#guide-next [data-icon] svg { transform: rotate(180deg); }
#guide-next .guide-next-preview { display: grid; place-items: center; width: 32px; height: 28px; overflow: hidden; border-radius: 5px; background: #fff7e5; }
#guide-next .guide-next-preview :is(svg, img) { display: block; width: 100%; height: 100%; object-fit: contain; }
.guide-tools button:disabled, #guide-listen:disabled { opacity: .4; cursor: default; }
#guide-listen { margin-top: 14px; }
#guide-folio { margin-left: auto; margin-right: 5px; color: #5b5442; font: 600 14px system-ui, sans-serif; }
.guide-spread { display: grid; grid-template-columns: 1.15fr 1fr; align-items: start; gap: clamp(14px, 2.8vw, 28px); }
.guide-plate { position: relative; background: #ebe1cd; border-radius: 12px; overflow: hidden; border: 1px solid #cabea5; }
#guide-picture { aspect-ratio: 16/9; }
#guide-picture > * { width: 100%; height: 100%; display: block; object-fit: contain; }
#guide-scale { width: 100%; border: 0; border-radius: 0; background: #305b4d; color: #fff9e9; }
#guide-scale::after { content: ''; position: absolute; inset: 0; }
.guide-plate:has(#guide-scale:focus-visible) { outline: 3px solid #825028; outline-offset: 2px; }
#guide-scale::before { content: ''; display: inline-block; vertical-align: -2px; margin-right: 9px; width: 15px; height: 11px; border: 2px solid currentColor; border-radius: 3px; }
#guide-page .guide-reading { padding: 0; font: 19px/1.45 Georgia, serif; }
#guide-page-title { margin: 0 0 9px; color: #633e31; font: bold clamp(24px, 2.6vw, 32px)/1.08 Georgia, serif; }
#guide-page-title:focus { outline: none; }
#guide-together { margin-top: 14px; border-top: 1px solid #cbbca0; }
#guide-together summary { min-height: 48px; padding: 13px 4px; color: #375749; cursor: pointer; font: 700 16px/1.35 system-ui, sans-serif; }
#guide-together .guide-prompt { padding: 0 4px 8px; margin: 0; border: 0; color: #4e5445; }
.large-text #guide-page :is(.guide-reading,.guide-prompt) { font-size: 1.35rem; }
@media (max-width: 670px) { .guide-spread { grid-template-columns: 1fr; } }

/* A dark surround for the film and one continuous reading surface below it. */
#cutscene-overlay {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  background: radial-gradient(ellipse at 50% 40%, #36535a 0, #1d343e 58%, #14252f);
  --pad-side: clamp(10px, 3vw, 32px);
}
.theater-program {
  width: min(100%, 840px, calc((var(--app-height) - 255px) * 16 / 9)); margin: auto;
  background: #fff6df; color: #383a33; border: 1px solid #bca783;
  border-radius: 16px; box-shadow: 0 5px 0 #a98b68, 0 20px 52px #091c2666;
  overflow: hidden; text-align: left;
}
.theater-heading { padding: 15px 22px 12px; background: #f4e6c8; }
.theater-program .chapter-pill {
  display: flex; align-items: center; gap: .7em; margin: 0 0 5px; padding: 0; border: 0; background: none;
  color: #4a645b; font: 700 13px/1.25 system-ui, sans-serif; letter-spacing: .055em;
}
.theater-program .chapter-pill::after { content: ''; width: 3em; height: 1px; background: #ab9673; }
.theater-program .chapter-pill[data-act]::after {
  flex: none; width: 44px; height: 6px; border-radius: 1px;
  background: linear-gradient(to right, #526f60 var(--act-fill), #cab995 var(--act-fill));
  mask-image: repeating-linear-gradient(to right, #000 0 8px, transparent 8px 12px);
}
.chapter-pill[data-act="1"] { --act-fill: 25%; }
.chapter-pill[data-act="2"] { --act-fill: 50%; }
.chapter-pill[data-act="3"] { --act-fill: 75%; }
.chapter-pill[data-act="4"] { --act-fill: 100%; }
#cutscene-title { padding: 0; border-radius: 0; background: none; color: #50382f; font: bold clamp(24px, 3.2vw, 36px)/1.12 Georgia, serif; letter-spacing: -.018em; }
.theater-program:has(#cutscene-card:not([hidden])) #cutscene-title {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
}
#cutscene-frame { width: 100%; border: 0; border-radius: 0; background: #12252a center / contain no-repeat; container-type: inline-size; }
#cutscene-video { position: absolute; inset: 0; opacity: 0; }
#cutscene-video.frame-ready { opacity: 1; }
#cutscene-video[hidden] { display: none; }
.theater-program .movie-progress { z-index: 2; }
.theater-program .film-paused, .theater-program .film-end { z-index: 2; }
.theater-program .movie-title-card strong { text-shadow: none; }
.theater-program .movie-title-card strong {
  font-kerning: normal; hyphens: none;
}
.theater-program .movie-title-card strong::before {
  display: block; margin-bottom: .35em; color: #edc477;
  font: 700 clamp(10px, 2cqi, 13px)/1.2 system-ui, sans-serif;
  letter-spacing: .1em; text-transform: uppercase; content: attr(data-chapter);
}
.theater-program .movie-title-card strong::before { content: 'Up next'; }
@media (max-height: 440px) {
  #cutscene-frame .movie-title-card { padding: 10px; }
}
/* Chapter names stay in the program header, outside all film pictures. */
#cutscene-loading, #cutscene-watch { z-index: 2; }
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced) #cutscene-video.frame-ready { transition: opacity .18s ease-out; }
  /* Fade the outgoing shot to the dark auditorium, not its opening poster. */
  body:not(.reduced) #cutscene-frame.chapter-handoff { background-image: none !important; }
  body:not(.reduced) #cutscene-frame.chapter-handoff :is(#cutscene-video, .storybook-kenburns) {
    opacity: 0; transition: opacity .16s ease-in;
  }
}
#cutscene-caption { background: none; max-width: none; color: #3d382f; padding: 16px 22px; font: 500 clamp(17px, 1.7vw, 21px)/1.42 Georgia, serif; }
.theater-program .cutscene-actions {
  display: flex; justify-content: flex-start; gap: 6px; width: auto; margin: 0 16px; padding: 9px 0 12px; border-top: 1px solid #d9c9a9;
}
.theater-program .cutscene-actions .btn {
  min-height: 48px; gap: 6px; padding: 6px 12px; margin: 0; border: 1px solid #b8aa8c;
  color: #344e43; background: #fffbef; border-radius: 10px; box-shadow: none;
  font: 700 15px/1.2 system-ui, sans-serif; letter-spacing: 0; white-space: normal;
}
.theater-program .cutscene-actions #cutscene-next, .theater-program .cutscene-actions:has(#cutscene-next[hidden]) #cutscene-continue {
  background: #325c4d; color: #fff8e6; border-color: #325c4d;
}
.theater-program #cutscene-continue { margin-left: auto; }
.theater-program .cutscene-actions .btn::before { content: ''; width: 15px; height: 15px; flex: none; background: currentColor; }
#cutscene-pause::before { clip-path: polygon(12% 8%,40% 8%,40% 92%,12% 92%,12% 8%,60% 8%,88% 8%,88% 92%,60% 92%,60% 8%); }
#cutscene-pause[aria-pressed="true"]::before { clip-path: polygon(18% 3%,95% 50%,18% 97%); }
.theater-program #cutscene-replay::before { content: none; }
#cutscene-replay svg { width: 17px; height: 17px; flex: none; }
#cutscene-next::before { clip-path: polygon(13% 8%,73% 49%,73% 10%,90% 10%,90% 90%,73% 90%,73% 51%,13% 92%); }
#cutscene-continue::before { clip-path: polygon(0 50%,47% 8%,47% 36%,100% 36%,100% 64%,47% 64%,47% 92%); }
.theater-program .movie-title-card {
  justify-content: flex-end; isolation: isolate; container-type: inline-size;
  padding: clamp(12px, 3vw, 28px); background: #12252a center / contain no-repeat;
  text-align: start;
}
.theater-program .movie-title-card::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(0deg, #10252cf5 4%, #10252ccf 26%, #10252c12 76%);
}
.theater-program .movie-title-card strong {
  max-width: min(100%, 23ch); padding: .35em .55em; border-inline-start: 3px solid #edc477;
  align-self: flex-start; background: #142b32; border-radius: 0 7px 7px 0;
  color: #fff6de; font: 700 clamp(20px, 3.8vw, 42px)/1.12 Georgia, serif;
  font-size: clamp(17px, min(6cqi, 7dvh), 42px); text-wrap: balance; overflow-wrap: anywhere;
  border-block: 1px solid #e8c78366; border-inline-end: 1px solid #e8c78366;
}
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced) .theater-program .movie-title-card:not([hidden]) { animation: theater-card-in .22s ease-out; }
  @keyframes theater-card-in { from { opacity: 0; } }
}
.reduced #cutscene-overlay { transition: none; }
@media (prefers-reduced-motion: reduce) { #cutscene-overlay { transition: none; } }
@media (max-width: 640px) {
  .theater-program { width: 100%; }
  .theater-heading, #cutscene-caption { padding: 14px 15px; }
  .theater-program .cutscene-actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); margin: 0 10px; }
  .theater-program #cutscene-continue { margin: 0; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .theater-program {
    width: min(100%, 1100px); display: grid; grid-template-columns: 1.3fr 1fr;
    grid-template-areas: "film heading" "film caption" "film controls"; background: #fff6df;
    align-items: start;
  }
  #cutscene-frame { grid-area: film; align-self: stretch; aspect-ratio: auto; min-height: 0; background-size: contain; background-repeat: no-repeat; }
  #cutscene-frame .storybook-kenburns { background-size: contain; animation: none; }
  .theater-heading { grid-area: heading; padding: 10px 14px 8px; }
  #cutscene-title { font-size: 23px; }
  #cutscene-caption { grid-area: caption; padding: 8px 14px; font-size: 16px; }
  .theater-program .cutscene-actions { grid-area: controls; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 9px; }
  .theater-program .cutscene-actions .btn { padding: 5px; font-size: 14px; }
  .theater-program #cutscene-continue { margin: 0; }
}
@media (forced-colors: active) {
  .theater-program .cutscene-actions .btn::before { background: ButtonText; }
  #farm-wide[aria-pressed="true"] { outline: 2px solid Highlight; }
}

/* A bookmark links the unfinished chore on the title to its tile in the yard. */
#resume-chore {
  grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; justify-content: center;
  margin: 0; padding: 0 4px 6px; border-bottom: 1px solid #d9c7a7;
  color: #624633; font: bold 16px/1.25 Georgia, serif;
}
#resume-chore::before, .board-tile.in-progress::after {
  content: ''; width: 11px; height: 15px; flex: none; background: #99503b;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 73%, 0 100%);
}
.board-tile.in-progress::after { position: absolute; top: -1px; right: 3px; }
#story-progress {
  display: grid; grid-template-rows: auto auto; align-items: center; gap: 3px 4px;
}
.chore-heading {
  grid-row: 1; padding: 1px 3px; color: #5d4c39;
  font: 700 12px/1.1 Arial, sans-serif; text-align: left;
}
.chore-heading + .chore-heading { border-left: 1px solid #bca887; padding-left: 6px; }
#story-progress .board-tile { grid-row: 2; }
#btn-board {
  padding: 4px; gap: 4px; border: 1px solid #ad9068; border-radius: 14px;
  box-shadow: 0 3px #977550, 0 5px 12px #4b38212b; cursor: default;
}
#btn-board .board-tile {
  display: grid; justify-items: center; align-content: center; gap: 2px;
  width: auto; height: 58px; padding: 2px 7px; border: 1px solid #c8b692;
  border-radius: 10px; background: #fffdf4; color: #4d4335; cursor: pointer;
  font: 700 14px/1.12 Arial, sans-serif;
}
#btn-board .board-tile > svg { width: 28px; height: 28px; }
#btn-board .board-tile.in-progress { background: #fff0cd; border-color: #ad7047; }
#btn-board .board-tile.done { background: #e8efdc; }
#btn-board .board-tile .tick { right: -2px; top: -2px; width: 16px; height: 16px; }
#btn-board .board-tile:active { background: #e6dcbe; transform: scale(.96); transition-duration: 45ms; }
@media (max-width: 600px) {
  #btn-board { gap: 0; padding: 2px; }
  #story-progress { column-gap: 2px; }
  #btn-board .board-tile { padding: 2px 3px; font-size: 12px; height: 52px; }
  #btn-board .board-tile > svg { width: 25px; height: 25px; }
}
@media (max-width: 380px) and (orientation: portrait) {
  #btn-board:has(.chore-heading + .chore-heading) {
    top: calc(var(--safe-top) + 66px);
    max-width: calc(var(--safe-width) - 2 * var(--edge));
  }
}

.fade { transition: opacity .18s ease-out; }
#activity-ui:not([hidden]) ~ .caption {
  background: #fff9e8; border: 1px solid #b19873; border-radius: 13px;
  box-shadow: 0 3px #917450, 0 4px 9px #382a2538;
  color: #403b31; font-family: Arial, sans-serif; line-height: 1.25;
}

/* Keep both choices beside each other within the short landscape viewport. */
@media (orientation: landscape) and (max-height: 510px) and (min-width: 700px) {
  .shelf-cards .story-card {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto 1fr auto;
    gap: 6px 9px; align-content: start;
  }
  .shelf-cards .story-card .card-art { grid-column: 1; grid-row: 1 / 3; align-self: center; }
  .shelf-cards .story-card .card-season { grid-column: 2; margin: 3px 0 0; }
  .shelf-cards .story-card .card-title { grid-column: 2; padding: 0; font-size: 19px; }
  .shelf-cards .story-card .btn-card-play, .shelf-cards .story-card .movie-pill { grid-row: 3; }
}

.film-paused { display: none; }
.theater-program:has(#cutscene-pause[aria-pressed="true"]) .film-paused {
  display: flex; align-items: center; gap: 7px; position: absolute; left: 9px; top: 9px;
  padding: 5px 9px; border-radius: 7px; background: #203632ee; color: #fff8e7;
  font: 700 14px/1.2 Arial, sans-serif; pointer-events: none;
}
.film-paused::before { content: ''; width: 9px; height: 10px; border-inline: 3px solid currentColor; box-sizing: border-box; }
.theater-program #cutscene-pause[aria-pressed="true"] { background: #e2ebd9; border-color: #80977c; }

/* Only the open pages scroll. The book's binding and navigation stay in hand. */
#book { overflow: hidden; --pad-bottom: 18px; }
#book-movies { margin-top: 0; }
.book-tabs { margin-bottom: 8px; }
@media (min-width: 700px) and (orientation: landscape) and (max-height: 510px) {
  .book-tabs { margin-bottom: 0; }
}
#book .storybook {
  max-height: 100%; display: flex; flex-direction: column;
}
.book-head, .book-tabs { flex: none; position: static; }
#book [role="tabpanel"] {
  min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 4px 5px 7px; scroll-padding: 5px; scrollbar-width: thin; scrollbar-color: #b9a27d transparent;
}
@media (min-width: 700px) and (orientation: landscape) and (max-height: 510px) {
  #book .storybook { display: grid; grid-template-rows: auto minmax(0, 1fr); }
  #book [role="tabpanel"] { padding: 3px 5px 5px; }
  #book-movies .movie-cover { max-width: min(100%, calc((var(--app-height) - var(--safe-top) - var(--safe-bottom) - 224px) * 16 / 9)); }
}

#grownup .g-head { flex-wrap: wrap; gap: 8px; padding: 5px 0 10px; }
#grownup h2, #grownup h3 { font-family: Georgia, serif; }
#g-jump {
  width: 158px; min-width: 0; min-height: 48px; margin-left: auto; padding: 5px 8px;
  border: 1px solid #b8a385; border-radius: 10px; color: #3e594b; background: #fffcf2;
  font: 600 16px Arial, sans-serif;
}
#grownup .g-head h2 { font-size: 26px; }
#grownup .g-body section { align-self: start; }
#grownup .g-body h3 { scroll-margin-top: 8px; }
#grownup .setting-label + .g-row [data-tier] { flex-direction: column; gap: 3px; padding: 7px 4px; }
#grownup [data-tier] small { font: 14px/1.2 Arial, sans-serif; }
#grownup .g-toggles { display: grid; gap: 0; border-block: 1px solid #d7c5a7; }
#grownup .g-toggles .gbtn {
  justify-content: space-between; width: 100%; padding: 6px 3px;
  border: none; border-radius: 0; background: none; color: #443d31; box-shadow: none;
  font: 600 16px/1.2 Arial, sans-serif;
}
#grownup .g-toggles button + button { border-top: 1px solid #e0d2b7; }
#grownup .setting-state {
  min-width: 50px; padding: 5px 8px; border-radius: 12px; color: #605442;
  background: #eee4cf; text-align: center; font-size: 14px;
}
#grownup .on .setting-state { background: #355e4d; color: #fffdf3; }
#grownup .g-toggles button:active { background: #eee6d4; transform: none; }
#g-offline-status { color: #625240; font-weight: 700; }
#g-offline-status.ready { color: #335e48; }
@media (display-mode: standalone) { .install-help { display: none; } }
@media (max-width: 535px) {
  #grownup .g-head { display: grid; grid-template-columns: 1fr auto; }
  #g-back { grid-row: 1; grid-column: 2; }
  #g-jump { grid-column: 1 / -1; width: 100%; }
}

#boot { gap: 15px; background: radial-gradient(ellipse at center, #fffaf0 32%, #f2e6cc); }
#boot-progress {
  appearance: none; width: min(205px, 65%); height: 7px; border: 0;
  border-radius: 6px; overflow: hidden; color: #54755d; background: #e5d7b9;
}
#boot-progress::-webkit-progress-bar { background: #e5d7b9; }
#boot-progress::-webkit-progress-value { background: #54755d; border-radius: 6px; transition: width .12s ease-out; }
#boot-progress::-moz-progress-bar { background: #54755d; border-radius: 6px; }
@media (max-width: 600px) and (orientation: portrait) {
  #welcome .welcome-actions:has(#resume-chore:not([hidden])) .btn-play { font-size: 20px; gap: 4px; }
  #welcome .welcome-actions:has(#resume-chore:not([hidden])) .btn-play .ico { width: 21px; height: 21px; }
}
@media (min-width: 700px) and (orientation: landscape) and (max-height: 510px) {
  .guide-spread { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
  .guide-plate {
    width: min(100%, calc((var(--app-height) - var(--safe-top) - var(--safe-bottom) - 232px) * 16 / 9));
    justify-self: center;
  }
}

#ui:has(#story-beat:not([hidden])) > :is(#hud, #cue, #btn-mute, #btn-speaker) { visibility: hidden; }
#story-beat {
  width: min(420px, 92vw); padding: 16px; border: 1px solid #b0956c; border-radius: 16px;
  background: #fff8e8; box-shadow: 0 4px #967652, 0 8px 20px #44362e45;
}
#story-beat-continue { min-width: 140px; border: 0; border-radius: 11px; box-shadow: 0 2px #284a3f; background: #355e4d; color: #fffaf0; font: 700 18px Georgia, serif; }

/* The cover and its voiced opening sit together like an illustrated book jacket. */
.shelf-cards .story-card {
  --binding: #48685a;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto 1fr auto;
  column-gap: 7px;
  row-gap: 8px;
  border-left: 5px solid var(--binding);
  border-radius: 6px 15px 15px 6px;
  box-shadow: 0 2px #fbefda, 0 3px #b29b76, 0 5px #efdfc2, 0 6px #ac9066, 0 10px 16px #68432518;
}
.story-card[data-season="spring"] { --binding: #646f48; }
.story-card[data-season="summer"] { --binding: #467579; }
.story-card[data-season="autumn"] { --binding: #8d5639; }
.story-card[data-season="winter"] { --binding: #545b79; }
.shelf-cards .story-card .card-art { grid-column: 1 / -1; grid-row: auto; border-radius: 3px 9px 9px 3px; }
.shelf-cards .card-title.sr-only { padding: 0; min-height: 0; }
.story-card .movie-pill { display: flex; justify-content: center; align-items: center; gap: 6px; }
.story-card .movie-pill svg { width: 24px; height: 24px; flex: none; }
.story-sample {
  grid-column: 1 / -1; width: 100%; min-height: 64px; align-self: start;
  display: grid; grid-template-columns: clamp(44px, 4.5vw, 60px) 1fr; align-items: center; gap: 9px;
  padding: 5px 3px 8px; border: 0; border-radius: 8px; background: transparent; color: #4f382d;
  text-align: left; cursor: pointer;
}
.sample-seal { align-self: start; display: grid; filter: drop-shadow(0 2px 1px #57432940); }
.sample-seal svg { width: 100%; height: auto; }
.sample-copy { min-width: 0; }
.sample-label { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 9px; margin-bottom: 4px; }
.story-sample .card-season { margin: 0; color: var(--binding); font: 700 11px/1.2 Arial, sans-serif; letter-spacing: .065em; }
.sample-label > :last-child { display: inline-flex; align-items: center; gap: 3px; color: #365c4d; font: 700 12px/1.2 Arial, sans-serif; }
.sample-label svg { width: 15px; height: 15px; }
.sample-line { display: block; font: 17px/1.29 Georgia, serif; }
.shelf-cards .story-card :is(.btn-card-play,.movie-pill) { grid-row: auto; align-self: end; }
@media (orientation: landscape) and (max-height: 510px) and (min-width: 700px) {
  .shelf-cards { grid-template-columns: 1fr; max-width: 790px; }
  .shelf-cards .story-card {
    grid-template-columns: minmax(0, 1.75fr) repeat(2, minmax(0, 1fr)); grid-template-rows: 1fr auto;
    padding: 9px; column-gap: 12px;
  }
  .shelf-cards .story-card .card-art { grid-column: 1; grid-row: 1 / 3; }
  .story-sample { grid-column: 2 / -1; align-self: center; }
}

/* A paper mount for the first care sticker and enamel badges set in individual pockets. */
#book-stickers:has(.first-sticker) { min-height: 0; margin: 0; display: block; }
.first-sticker {
  width: 100%; display: flex; gap: 15px; align-items: center;
  padding: 12px 16px; border: 1px solid #9aaa8e; border-radius: 4px 15px 15px 4px;
  border-left: 5px solid #4c6c58; text-align: left; color: #284b3c;
  background: linear-gradient(105deg, #dfe9d8, #f1f4e7); cursor: pointer;
}
.first-sticker .sticker-picture { flex: none; width: 55px; height: 55px; display: grid; padding: 8px; transform: rotate(-7deg); }
.first-sticker small, #badge-status, #badge-count { font: 700 13px/1.25 Arial, sans-serif; }
.first-sticker strong { display: block; margin-top: 3px; font: 700 21px/1.1 Georgia, serif; }
.first-sticker::after { content: ''; margin-left: auto; flex: none; width: 9px; height: 9px; border: solid #3a624b; border-width: 2px 2px 0 0; transform: rotate(45deg); }
#book .collectible-section { padding: 0; background: transparent; border: none; text-align: left; }
.album-heading { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.album-heading h3 { color: #4c624c; font: bold 22px Georgia, serif; }
#badge-count { color: #5e5547; }
.collectible-section :is(h3,p) { margin: 0; }
.collectible-section > p { margin-top: 4px; color: #624d3b; font: 16px/1.3 Georgia, serif; }
.collectible-shelf { grid-template-columns: repeat(auto-fit, minmax(min(117px, 100%), 1fr)); gap: 8px; margin-top: 10px; }
.collectible {
  position: relative; justify-content: flex-start; padding: 7px 5px 9px; border: 1px solid #cfbea1;
  border-radius: 7px 7px 13px 13px; background: linear-gradient(#f1e6d1, #fff9e9 83%);
  box-shadow: inset 0 -2px #e9d8b6; text-align: center; cursor: pointer;
}
.collectible svg { width: min(68px, 82%); }
.collectible.locked svg { filter: saturate(.65); }
.collectible.earned { background: #faf0cd; border-color: #b98d49; }
.collectible.earned::after {
  content: '✓'; position: absolute; top: 5px; right: 5px; width: 20px; line-height: 20px;
  border-radius: 50%; color: #fff; background: #375e4c; font: bold 16px/20px Arial, sans-serif;
}
#badge-index, #badge-play {
  min-height: 48px; padding: 6px 13px; border: 1px solid #bca381; border-radius: 10px;
  color: #4e4130; background: #fffaf0; font: bold 16px/1.2 Georgia, serif; cursor: pointer;
}
#badge-page { text-align: left; }
#badge-index::before { content: '‹'; margin-right: 6px; font-size: 22px; vertical-align: -1px; }
.badge-spread {
  display: grid; grid-template-columns: minmax(110px, .75fr) minmax(0, 1fr); align-items: stretch;
  margin-top: 10px; border: 1px solid #c3ac87; border-radius: 12px; background: #fffbef; overflow: hidden;
}
#badge-plate {
  position: relative; display: grid; place-items: end center; overflow: hidden; min-height: 170px;
  background: repeating-linear-gradient(98deg, #365b4e 0 2px, #3c6254 3px 4px);
  border: 5px double #adc0aa;
}
.badge-scene {
  position: absolute; inset: 0 0 auto; width: 100%; height: 69%; border-bottom: 3px double #ecd89e;
}
#badge-seal { z-index: 1; width: min(60%, 155px); padding-block: 6%; filter: drop-shadow(0 3px 2px #263a2c99); }
#badge-seal svg { display: block; width: 100%; height: auto; }
.badge-reading { padding: clamp(12px, 2.2vw, 24px); }
#badge-status { margin: 0 0 3px; color: #526448; }
#badge-title { margin: 0; color: #6a3c2e; font: bold clamp(23px, 3.1vw, 34px)/1.08 Georgia, serif; }
#badge-instruction { margin: 8px 0; color: #544b3a; font: 17px/1.25 Georgia, serif; }
#badge-goals { padding: 0; margin: 0 0 10px; list-style: none; }
#badge-goals li {
  display: flex; align-items: baseline; gap: 8px; border-top: 1px solid #e3d6be;
  padding: 6px 0; color: #544738; font: 16px/1.3 Georgia, serif;
}
#badge-goals li::before { content: ''; flex: none; width: .72em; height: .72em; border: 1.5px solid #95876c; border-radius: 50%; }
#badge-goals li.done::before {
  content: ''; width: 1em; height: 1em; border: none;
  background: #3b6955 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8l3 3 6-6' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 85% no-repeat;
}
#badge-play { border-color: #315841; background: #365e4c; color: #fff9ea; }
@media (max-width: 560px) {
  .badge-spread { grid-template-columns: 1fr; }
  #badge-plate { min-height: 136px; place-items: end start; }
  .badge-scene { height: 80%; }
  #badge-seal { width: 78px; margin-left: 10px; padding: 0; }
}
@media (hover: hover) {
  .story-sample:hover, .collectible:hover { background: #f2e7cf; }
}
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced) :is(.story-sample, .collectible) svg { transition: transform .18s ease; }
  body:not(.reduced) :is(.story-sample, .collectible):active svg { transform: rotate(-5deg) scale(.95); }
}
.large-text .sample-line, .large-text #badge-goals li { font-size: 1.23rem; }

@media (min-width: 700px) and (orientation: landscape) and (max-height: 510px) {
  #badge-page { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); grid-template-rows: auto 1fr; gap: 6px 14px; align-content: start; }
  #badge-index { grid-area: 1 / 1; place-self: start; }
  .badge-spread { display: contents; }
  #badge-plate { grid-area: 2 / 1; min-height: 116px; border-radius: 6px; }
  #badge-seal { width: 82px; padding: 2px; }
  .badge-reading { grid-area: 1 / 2 / 3; padding: 2px 5px; }
  #badge-goals li { padding: 4px 0; }
}
@media (forced-colors: active) {
  .collectible.earned::after, #badge-goals li.done::before { color: HighlightText; background: Highlight; forced-color-adjust: none; }
}

/* Frame each face at the same scale and keep both choices still when picked. */
#welcome .character-picker { display: grid; grid-template-columns: auto repeat(2, minmax(0, 1fr)); align-items: center; gap: 5px; }
.character-legend { padding-inline: 4px; color: #65553e; font: 700 14px/1.1 Arial, sans-serif; }
#welcome .character-pill {
  display: grid; grid-template-columns: 37px 1fr 10px; align-items: center; gap: 4px;
  border: 1px solid #d6c6a9; border-radius: 24px; padding: 3px 8px 3px 3px; background: #fffdf4; color: #564132;
}
#welcome .character-pill[aria-pressed="true"] { border: 1px solid #53745e; background: #e6eedd; box-shadow: inset 0 0 0 1px #53745e; }
.character-face { display: block; width: 37px; height: 37px; overflow: hidden; border-radius: 50%; background: #eee1c9; }
#welcome .character-face img { display: block; width: 100%; height: 100%; border-radius: 0; }
#welcome [data-character="miley"] img { transform: scale(2.95); transform-origin: 50% 23%; }
@media (min-width: 700px) and (max-height: 510px) and (orientation: landscape) {
  #welcome .character-picker { padding-left: 6px; border-left: 1px solid #d6c6a9; border-radius: 0; }
}

.farm-library {
  padding: 3px; gap: 3px; border: 1px solid #b49973; border-radius: 15px;
  background: #fff6e4; box-shadow: 0 3px #977653, 0 5px 12px #32251935;
}
.farm-library .btn, .farm-library #farm-wide {
  position: static; border: 0; border-radius: 11px; box-shadow: none; color: #365d4b;
  background: transparent; font: bold 16px/1.15 Georgia, serif;
}
.farm-library #farm-wide[aria-pressed="true"] { background: #355e4d; color: #fff9e9; }
.farm-library .btn:active { background: #e1e8d6; }
@media (max-width: 620px) {
  .farm-library { max-width: calc(var(--safe-width) - 128px); }
  .farm-library .btn, .farm-library #farm-wide {
    display: flex; flex: 1 1 auto; flex-direction: column; gap: 2px;
    width: auto; min-width: 48px; min-height: 49px; padding: 3px 6px; font: 700 12px/1.1 Arial, sans-serif;
  }
  .farm-library .btn .ico, .farm-library #farm-wide svg { width: 23px; height: 23px; }
}
.shelf-bookmark {
  position: absolute; bottom: 6px; left: 0; padding: 5px 12px 5px 8px;
  background: #344e41; color: #fff9e7; border-radius: 0 7px 7px 0;
  font: 700 13px/1.2 Arial, sans-serif; box-shadow: 0 2px 3px #2f241b55;
}
#act-banner { padding: 6px 12px 7px 7px; gap: 8px; border: 1px solid #ad9171; border-radius: 12px; box-shadow: 0 3px #9c7b59, 0 5px 10px #44342738; }
.act-heading { min-width: 0; text-align: left; font: 700 clamp(17px, 2.4vw, 27px)/1.08 Georgia, serif; }
#care-progress { display: flex; gap: 3px; margin-top: 5px; }
#care-progress i { flex: 1; height: 6px; border-radius: 3px; background: #eadcc1; box-shadow: inset 0 0 0 1px #c6b397; }
#care-progress .filled { background: #50765e; box-shadow: none; }
.tray .tool { display: grid; grid-template-rows: minmax(0,1fr) auto; justify-items: center; align-items: center; padding: 5px; }
.tool-name { color: #453c30; font: 700 clamp(12px, 1.6vw, 16px)/1.1 Arial, sans-serif; }
.tray .tool:only-child { min-width: max-content; padding-inline: 9px; }
.tray .tool svg { min-height: 0; }
.tray .tool.held { background: #e0eee3; }
#sticker-memory { margin: 5px 0 0; color: #3a5241; font: 18px/1.35 Georgia, serif; }
.large-text #sticker-memory { font-size: 1.28rem; }

.film-end { display: none; }
.theater-program:has(.movie-finished) .film-end {
  display: block; position: absolute; left: 8px; bottom: 10px;
  background: #203632ed; color: #fff8dd; padding: 5px 9px; border-radius: 6px; font: 700 14px/1.2 Arial, sans-serif;
}
.theater-program:has(.chapter-pill[data-act="4"]):has(.movie-finished) .film-end {
  border-inline-start: 3px solid #edc477;
  background: #142b32; color: #fff6de;
  box-shadow: 0 3px 12px #091c2699;
}
/* One readable status at a time when Movie Night is paused between chapters. */
.theater-program:has(.movie-finished) .film-paused { display: none; }
.theater-program:has(#cutscene-pause[hidden]) .cutscene-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.theater-program:has(#cutscene-pause[hidden]) #cutscene-continue { grid-column: auto; }
@media (orientation: landscape) and (max-height: 520px) {
  #cutscene-overlay { --pad-top: 10px; --pad-bottom: 12px; }
  #cutscene-overlay .theater-program {
    flex: none; max-height: 100%; min-height: 0; grid-template-rows: auto minmax(0, 1fr) auto;
  }
  #cutscene-caption { min-height: 0; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; }
}
.home-preview { display: flex; align-items: center; gap: 12px; padding-block: 5px; }
.home-preview img { flex: none; border-radius: 22%; box-shadow: 0 2px 3px #3c31282e; }
.home-preview strong { color: #443d31; font: bold 21px/1.1 Georgia, serif; }
.home-preview #g-offline-status { margin: 4px 0 0; font: 16px/1.25 Arial, sans-serif; }
.install-help ol { margin: 0; padding: 0 0 4px 24px; color: #4a4639; }
.install-help li + li { margin-top: 5px; }
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced) #care-progress i { transition: background-color .14s ease-out; }
  body:not(.reduced) .tray .tool:active { transition-duration: .045s; }
}
@media (forced-colors: active) {
  #care-progress i { border: 1px solid CanvasText; }
  #care-progress .filled { background: Highlight; forced-color-adjust: none; }
}
#act-banner .ico:has(.pony-portrait), .cue-face:has(.pony-portrait) { border-radius: 50%; overflow: hidden; }
:is(#act-banner, #cue) .pony-portrait { transform: scale(2.7); transform-origin: 80% 29%; }
#cutscene-caption:focus-visible { outline: 2px solid #527565; outline-offset: -3px; }
@media (orientation: landscape) and (max-height: 520px) {
  .large-text .theater-program { grid-template-columns: minmax(0, 1fr) minmax(0, 1.18fr); }
}
@media (display-mode: standalone) {
  #ui:has(#cutscene-overlay:not([hidden]))::after { background: #192e36; }
}

/* Keep sound within reach on the shelf and inside the theater dialog. */
.sound-switch {
  display: grid; justify-items: center; align-content: center; gap: 1px;
  min-width: 56px; min-height: 48px; padding: 3px 6px;
  border: 1px solid #a79879; border-radius: 11px; background: #fffaf0;
  color: #365948; font: 700 12px/1.1 Arial, sans-serif; cursor: pointer;
}
.sound-switch [data-sound-icon] { width: 24px; height: 24px; }
[data-sound][aria-pressed="true"] { color: #5d493e; background: #f1e1cb; }
.sound-switch:active { box-shadow: inset 0 0 0 2px #81917a; }
.shelf-sound { position: absolute; right: calc(var(--safe-right) + var(--edge)); top: calc(var(--safe-top) + var(--edge)); }
#ui:has(#shelf:not([hidden])) > #btn-speaker {
  visibility: hidden; top: auto; bottom: calc(var(--safe-bottom) + var(--edge));
  width: 48px; height: 48px;
}
/* A spoken title or sample gets its own row below the scrolling covers. */
#ui:has(#shelf:not([hidden])):has(> #caption:not([hidden])) {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr) auto;
  background: #f4e9d4;
}
#ui:has(> #caption:not([hidden])) > #shelf:not([hidden]) { position: relative; grid-area: 1 / 1 / 2 / -1; min-height: 0; }
#ui:has(> #caption:not([hidden])) .shelf-scroll { padding-bottom: 12px; }
#ui:has(#shelf:not([hidden])):has(> #caption:not([hidden])) > #btn-speaker {
  grid-area: 2 / 2; position: static; align-self: center; visibility: visible;
  margin: 6px calc(var(--safe-right) + var(--edge)) calc(6px + var(--safe-bottom)) 6px;
}
#ui:has(#shelf:not([hidden])) > #caption {
  grid-area: 2 / 1; position: static; align-self: center; justify-self: center; transform: none; max-height: none;
  width: fit-content; max-width: min(580px, calc(100% - var(--safe-left) - 12px));
  margin: 6px 0 calc(6px + var(--safe-bottom)) var(--safe-left); padding: 6px 10px;
  background: transparent; box-shadow: none; border: 0; font-size: 17px; text-align: left;
}
.theater-heading { display: grid; grid-template-columns: minmax(0,1fr) auto; column-gap: 10px; align-items: center; }
.theater-heading .chapter-pill { grid-area: 1 / 1; }
#cutscene-title { grid-area: 2 / 1; text-wrap: balance; }
.theater-heading .sound-switch { grid-column: 2; grid-row: 1 / 3; }
#shelf-season button { display: grid; justify-items: center; align-content: center; gap: 2px; line-height: 1; }
#shelf-season svg { width: 23px; height: 23px; }
#shelf-season [aria-pressed="true"] svg { background: #fff6e6; border-radius: 50%; padding: 1px; color: #395e49; }
.story-sample :is(.sample-stop,.sample-read), .story-sample[aria-pressed="true"] .sample-hear,
.story-sample:disabled :is(.sample-hear, .sample-label svg), .card-art:disabled .card-listen { display: none; }
.story-sample[aria-pressed="true"] .sample-stop, .story-sample:disabled .sample-read { display: inline; }
.story-sample[aria-pressed="true"] { background: #e6eedd; box-shadow: inset 3px 0 #54735b; }
.story-sample[aria-pressed="true"] .sample-label svg, .card-art[aria-pressed="true"] .card-listen svg { display: none; }
.story-sample[aria-pressed="true"] .sample-label > :last-child::before, .card-art[aria-pressed="true"] .card-listen::before {
  content: ''; display: block; width: 10px; height: 10px; background: #355948; border-radius: 2px;
}
.story-sample:disabled, .card-art:disabled { opacity: 1; cursor: default; }
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced) :is(.sound-switch, .story-sample, #shelf-season button) { transition: background-color .12s ease-out; }
  body:not(.reduced) :is(.sound-switch, .story-sample, #shelf-season button):active { transition-duration: 35ms; }
}

/* A ticket keeps the whole cover on the narrow page and leaves room for chapters. */
.movie-cover .movie-admit { flex-wrap: wrap; }
.movie-admit small { font: 600 13px/1.2 Arial, sans-serif; color: #e4efdf; }
@container (max-width: 480px) {
  .movie-programme .movie-cover {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: stretch;
    border: 1px solid #52705a; border-radius: 7px 13px 13px 7px; background: #355e4d;
    box-shadow: 0 2px #c4b89b;
  }
  .movie-programme .movie-admit {
    position: relative; display: grid; grid-template-columns: 1fr; justify-items: center; align-content: center;
    gap: 3px; padding: 6px 4px; border-left: 2px dashed #d9caa5; font-size: 17px;
  }
  .movie-programme .movie-admit svg { width: 26px; height: 26px; padding: 3px; border: 1px solid #e2cf9b; border-radius: 50%; }
}
.ring-count {
  display: flex; gap: 3px; align-items: center; padding: 2px 6px 2px 3px;
  border: 1px solid #e8ca84; background: #453a2c; font-variant-numeric: tabular-nums;
}
.ring-count svg { flex: none; width: 17px; height: 17px; }
.chore-heading:first-child { color: #365b46; }
#story-progress:has(.chore-heading + .chore-heading) .board-tile:not(.done,.in-progress) { border-top-color: #67856b; border-top-width: 3px; }
#story-progress:has(.chore-heading + .chore-heading) .board-tile.extra:not(.done,.in-progress) { border: 1px solid #c8b692; background: #f3eada; }
.gate-actions { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1fr); }
.gate-actions .gbtn { min-width: 0; white-space: normal; }
#g-offline-progress { width: 100%; height: 8px; margin: 6px 0; accent-color: #53755b; }
.home-preview:has(.ready) img { outline: 2px solid #657f63; outline-offset: 2px; }
@media (max-width: 600px) {
  #book-watch-all {
    display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto;
    justify-content: center; align-content: center; gap: 2px 10px; padding: 8px;
  }
  #book-watch-all > span { grid-row: span 2; align-self: center; }
  #book-watch-all small { grid-column: 2; padding: 0; border: 0; }
}

/* Picture index for children choosing a film before they can read its title. */
.movie-picker .movie-browse {
  display: flex; gap: 10px; align-items: center; justify-content: center; min-width: 0;
  color: #344f43; background: #f7f0de; text-align: left;
}
.movie-browse > svg { flex: none; }
.movie-browse span { display: grid; gap: 2px; }
.movie-browse small { font: 700 13px/1.15 system-ui, sans-serif; }
.movie-browse strong { color: #593c2f; font: bold 18px/1.08 Georgia, serif; text-wrap: balance; }
.movie-picker:has([aria-expanded="true"]) .movie-step { display: none; }
.movie-browse[aria-expanded="true"] { grid-column: 1 / -1; justify-content: flex-start; }
#movie-covers {
  grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(142px, 46%), 1fr));
  gap: 10px; padding: 3px 2px 6px;
}
#movie-covers button {
  position: relative; display: grid; grid-template-rows: auto 1fr; align-items: stretch; padding: 0;
  overflow: hidden; border: 1px solid #b49c78; border-radius: 8px 8px 12px 12px;
  background: #fffaf0; color: #563e30; box-shadow: 0 2px 0 #c9b796; cursor: pointer;
}
#movie-covers svg { display: block; width: 100%; height: auto; aspect-ratio: 2.1; }
#movie-covers span { display: grid; place-items: center; padding: 7px; font: bold 16px/1.16 Georgia, serif; text-wrap: balance; }
#movie-covers [aria-pressed="true"] { border-color: #345f4c; background: #345f4c; color: #fff9ea; }
#movie-covers [aria-pressed="true"]::before { content: ''; position: absolute; right: 5px; top: 5px; width: 20px; height: 20px; border-radius: 50%; background: #345f4c; }
#movie-covers [aria-pressed="true"]::after { content: ''; position: absolute; right: 10px; top: 11px; width: 10px; height: 5px; border: solid #fff9ea; border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.large-text :is(#movie-covers span, .movie-browse strong) { font-size: 1.25rem; }

/* Each portrait on the friendship page leads straight to that pony in the yard. */
.pony-friends #badge-plate { display: none; }
.pony-friends .badge-spread { display: block; }
.pony-friends .badge-reading { padding: clamp(10px, 2vw, 22px); }
.pony-friends #badge-goals {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin: 10px 0 0;
}
.pony-friends #badge-goals li { display: block; border: 0; padding: 0; }
.pony-friends #badge-goals li::before { display: none; }
.pony-friends #badge-goals button {
  position: relative; display: grid; width: 100%; overflow: hidden; padding: 0;
  border: 1px solid #ae9571; border-radius: 10px; background: #fff7e6;
  box-shadow: 0 2px 0 #b8a17f; color: #3d5647; cursor: pointer;
}
.friend-portrait { display: block; height: clamp(85px, 16vh, 138px); overflow: hidden; border-bottom: 1px solid #cfbaa0; }
.friend-portrait img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 31%; transform: scale(1.48); transform-origin: 60% 35%; }
[data-pony="charlie"] .friend-portrait { transform: scaleX(-1); }
#badge-status:has(svg), #caption-text:has(svg) { display: inline-flex; align-items: center; gap: 8px; }
#badge-status svg, #caption-text svg { width: 38px; height: 38px; flex: none; }
.pony-friends #badge-goals strong { padding: 8px; font: bold 19px/1.2 Georgia, serif; }
.pony-friends #badge-goals small {
  position: absolute; top: 5px; left: 5px; padding: 3px 7px;
  background: #fff8e9; color: #5b4635; border-radius: 8px; font: 650 12px/1.2 system-ui, sans-serif;
}
.pony-friends #badge-goals .done small { background: #355e4d; color: white; }
.pony-friends #badge-goals .done small::before { content: ''; display: inline-block; width: 8px; height: 4px; margin: 0 4px 2px 0; border: solid currentColor; border-width: 0 0 2px 2px; transform: rotate(-45deg); }
@media (min-width: 700px) and (orientation: landscape) and (max-height: 510px) {
  #badge-page.pony-friends { display: block; }
  .pony-friends .badge-reading { display: grid; grid-template-columns: minmax(0,.85fr) minmax(0,1.25fr); gap: 3px 12px; align-content: center; }
  .pony-friends #badge-goals { grid-area: 1 / 2 / 5; margin: 0; }
  .pony-friends .friend-portrait { height: 80px; }
}

/* Keep the voice prompt inside its target, clear of the title and chore board. */
#btn-speaker { flex-direction: column; gap: 1px; }
#btn-speaker .ico { width: clamp(24px, 3vw, 33px); height: clamp(24px, 3vw, 33px); }
.voice-label { font: 700 12px/1.05 system-ui, sans-serif; }
#btn-speaker.halo-on { animation: none; box-shadow: inset 0 0 0 2px #be903e, 0 2px 0 #967447; }

.shelf-vignette { display: none; }
@media (max-width: 620px) {
  .shelf-cards .story-card {
    grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr);
    grid-template-rows: auto 1fr auto; gap: 5px 10px;
  }
  .shelf-cards .story-card .card-art {
    grid-area: 1 / 1 / 3; align-self: stretch; min-height: 104px; aspect-ratio: auto;
  }
  .card-art > img { display: none; }
  .card-art > .shelf-vignette { display: block; position: absolute; inset: 0; }
  .card-art .card-listen { top: 4px; bottom: auto; }
  .shelf-cards .story-card .card-title {
    grid-area: 1 / 2; position: static; width: auto; height: auto; clip: auto; margin: 0;
    padding: 1px 0; font: bold 21px/1.08 Georgia, serif; text-wrap: pretty;
  }
  .shelf-cards .story-sample {
    grid-area: 2 / 2; display: block; align-self: stretch; padding: 4px 6px;
  }
  .story-sample .sample-seal { display: none; }
  .sample-line { font-size: 16px; line-height: 1.25; }
  .sample-label { gap: 3px 7px; }
  .shelf-cards .story-card :is(.btn-card-play, .movie-pill) { grid-row: 3; margin-top: 3px; }
}
.farm-library #btn-book[data-sticker]:not([data-sticker=""]) { color: #603f27; background: #f4dfad; }
#memory-index {
  display: inline-flex; align-items: center; gap: 7px; min-height: 48px; padding: 6px 12px; margin-bottom: 8px;
  border: 1px solid #b3a180; border-radius: 10px; color: #365746; background: #fffaf0; font: 700 16px/1.15 system-ui, sans-serif; cursor: pointer;
}
#memory-index::before { content: ''; width: 8px; height: 8px; border: solid currentColor; border-width: 0 0 2px 2px; transform: rotate(45deg); }
.memory-card { overflow: hidden; border: 1px solid #b59c75; border-radius: 7px 15px 15px 7px; background: #fff9e8; text-align: left; }
.memory-art { position: relative; background: #e2dfc2; }
#memory-scene svg { height: auto; aspect-ratio: 2.7; }
#memory-seal {
  position: absolute; bottom: 6px; right: 9px; width: clamp(48px, 8vw, 70px); height: auto; aspect-ratio: 1;
  padding: 7px; transform: rotate(7deg); background: #fff7e1; border: 3px double #ab813b; box-shadow: 0 2px 4px #3c311e55;
}
.memory-writing { padding: 14px 18px; border-top: 1px dashed #ab976f; }
.memory-writing small { color: #47624c; font: 700 14px/1.2 system-ui, sans-serif; }
#memory-title { margin: 4px 0; color: #593d30; font: bold clamp(24px, 4vw, 33px)/1.12 Georgia, serif; }
@media (min-width: 700px) {
  .memory-card { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
  .memory-writing { border: 0; border-left: 1px dashed #ab976f; align-self: center; }
  #memory-scene, #memory-scene svg { height: 100%; min-height: 110px; }
}
#grownup #g-install { min-height: 48px; margin-top: 8px; padding-inline: 16px; background: #355e4d; color: #fff9ec; }
#g-installed { font-weight: 700; color: #365a47; }

/* Playback belongs to the picture. The reading page holds the way forward and back. */
#cutscene-overlay .theater-program { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "heading heading" "film film" "caption caption" "transport controls"; }
.theater-program .theater-heading { grid-area: heading; }
.theater-program #cutscene-frame { grid-area: film; }
.theater-program #cutscene-caption { grid-area: caption; margin: 0; }
#cutscene-overlay .film-transport { grid-area: transport; display: flex; margin: 0 0 0 14px; }
#cutscene-overlay .chapter-actions { grid-area: controls; display: flex; justify-content: flex-end; margin: 0 14px 0 0; }
#cutscene-overlay .chapter-actions #cutscene-continue { margin-left: 0; }
@media (max-width: 640px), (orientation: landscape) and (max-height: 520px) {
  #cutscene-overlay .theater-program { grid-template-columns: 1fr; grid-template-areas: "heading" "film" "transport" "caption" "controls"; }
  #cutscene-overlay .film-transport {
    justify-content: center; gap: 6px; padding: 4px 8px; margin: 0; border: 0; background: #233c40;
  }
  #cutscene-overlay .film-transport .btn {
    flex: 1; padding: 4px 8px; max-width: 160px; border: 1px solid #607a79; border-radius: 8px; background: #304c4e; color: #fff9e8;
  }
  #cutscene-overlay .film-transport [aria-pressed="true"] { background: #f7e8c9; color: #264448; }
  #cutscene-overlay .chapter-actions { margin: 0 10px; justify-content: stretch; }
  #cutscene-overlay .chapter-actions .btn { flex: 1; margin: 0; }
}
@media (orientation: landscape) and (max-height: 520px) {
  #cutscene-overlay .theater-program {
    height: 100%; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "film heading" "film caption" "transport controls";
    overflow-y: auto; overscroll-behavior: contain;
  }
  #cutscene-overlay .film-transport { align-self: stretch; align-items: center; }
  #cutscene-overlay .chapter-actions .btn { min-width: 0; }
}
@media (orientation: portrait) and (max-width: 640px) and (min-height: 390px) {
  #cutscene-overlay .theater-program {
    max-height: 100%; grid-template-rows: auto minmax(100px, auto) auto minmax(54px, auto) auto;
    overflow-y: auto; overscroll-behavior: contain;
  }
  #cutscene-frame { min-height: 0; align-self: stretch; }
  #cutscene-frame .storybook-kenburns { background-size: contain; }
  #cutscene-caption { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
}
@media (orientation: portrait) and (max-width: 640px) and (max-height: 520px) {
  #cutscene-overlay { --pad-top: 8px; --pad-bottom: 12px; }
  #cutscene-overlay .theater-program { grid-template-rows: auto minmax(88px, auto) auto minmax(50px, auto) auto; }
  .theater-program .theater-heading { padding: 8px 12px; }
  #cutscene-title { font-size: 21px; }
  #cutscene-caption { padding: 8px 12px; }
  #cutscene-overlay .chapter-actions { padding-block: 6px 8px; }
  .theater-program:has(#cutscene-pause[aria-pressed="true"]) #cutscene-frame .film-paused { display: none; }
}
@media (orientation: landscape) and (max-height: 520px) and (max-width: 700px) {
  .theater-program .chapter-pill { font-size: 12px; letter-spacing: .035em; }
  .theater-heading .chapter-pill::after { display: none; }
  .theater-heading .sound-switch { grid-row: 1; min-width: 48px; width: 48px; padding: 4px; }
  .theater-heading .sound-switch [data-sound-label] { display: none; }
  #cutscene-title { grid-column: 1 / -1; }
}
@media (orientation: landscape) and (max-height: 360px) {
  .theater-program .theater-heading { padding: 6px 12px; column-gap: 6px; }
  #cutscene-title { font-size: 21px; }
  #cutscene-caption { padding: 6px 12px; line-height: 1.25; }
  body:not(.large-text) #cutscene-caption { font-size: 15px; }
}
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced) .memory-card { animation: memory-open .16s ease-out; }
  @keyframes memory-open { from { opacity: .75; transform: translateY(4px); } }
  body:not(.reduced) :is(.film-transport, .chapter-actions, .shelf-cards, .farm-library) button:active { transition-duration: 35ms; }
}

/* Confirm the same landing zone that will accept this tool on release. */
#activity-ui:has(.ghost.drop-ready) .ring {
  animation: none; border-color: #e0f1c4; box-shadow: 0 0 0 4px #37624b; background: #7ba88040;
}

@media (max-width: 500px), (orientation: landscape) and (max-height: 460px) {
  #rings .ring { border-width: 4px; box-shadow: 0 0 0 2px #80520b, 0 0 0 4px #fff2ba, 0 0 13px #ffde6b; }
  #rings .ring.strong { border-width: 6px; }
  #rings .ring-count { bottom: -13px; }
}

@media (max-width: 500px) and (orientation: portrait),
       (orientation: landscape) and (min-width: 760px) and (max-height: 460px) {
  #ui:has(#activity-ui:not([hidden])) #btn-mute { width: 56px; padding: 0; }
  #ui:has(#activity-ui:not([hidden])) #btn-mute [data-sound-label] { display: none; }
}

/* The farm has one large action. The book, camera, stories and sound share a corner. */
.on-farm .farm-library {
  inset: auto calc(var(--safe-right) + 10px) calc(var(--safe-bottom) + 8px) auto;
  flex-direction: row; max-width: calc(var(--safe-width) - 24px);
  padding: 2px; gap: 1px; border-radius: 13px; background: #fff6e4ed; box-shadow: 0 2px 6px #32251940;
}
.on-farm .farm-library .btn, .on-farm .farm-library #farm-wide {
  order: 0; display: flex; flex-direction: column; gap: 2px; padding: 3px 5px; white-space: nowrap;
  min-width: 44px; min-height: 44px; border-radius: 9px;
  font: 700 11px/1.1 Arial, sans-serif;
}
.on-farm .farm-library .btn :is(.ico, svg), .mute-btn > .ico { width: 22px; height: 22px; }
.on-farm #btn-board {
  min-height: 0; padding: 2px; background: #fff8e8de; box-shadow: 0 1px #977550;
}
.on-farm #story-progress { gap: 1px 2px; }
.on-farm #btn-board .chore-heading { font-size: 11px; }
.on-farm #btn-board .board-tile {
  min-width: 44px !important; min-height: 44px !important;
  height: 44px; padding-inline: 5px; font-size: 11px; box-shadow: none;
}
.on-farm #btn-board .board-tile > svg { width: 25px; height: 25px; }
.on-farm #btn-board .board-tile .chore-label { display: none; }
.on-farm #btn-board .board-tile:not([aria-current="step"]) { background: transparent; border-color: transparent; }
.on-farm #btn-board .board-tile.done { color: #51745a; }
.on-farm #btn-board .board-tile[aria-current="step"] > svg { width: 28px; height: 28px; }
.on-farm #btn-board .board-tile[aria-current="step"] { background: #fff0bb; border-color: #bc8135; }
.cue.nearby-cue { min-width: 0; min-height: 0; gap: 4px; padding: 4px 7px 4px 4px; font-size: 13px; background: #fff9e7df; box-shadow: 0 2px 4px #3428214d; }
.cue.nearby-cue .cue-face { width: 32px; height: 32px; padding: 3px; }
.cue.nearby-cue .cue-act { width: 23px; height: 23px; }
.cue.nearby-cue .cue-tick { width: 22px; height: 22px; right: -4px; top: -4px; }
.next-chore {
  position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 12px); translate: -50% 0; z-index: 22;
  width: max-content; max-width: min(calc(var(--safe-width) - 28px), 540px); min-height: 62px; padding: 6px 22px 6px 8px;
  border: 2px solid #8d5428; border-radius: 999px; background: linear-gradient(#fff0b8, #ffd779); color: #4e321f;
  box-shadow: 0 4px #7e552d, 0 6px 18px #2f25266b;
  font: 700 clamp(17px, 2.5vw, 28px)/1.1 Arial, sans-serif; text-align: start;
}
.next-chore .ico {
  flex: none; width: 44px; height: 44px; padding: 5px; border-radius: 50%; background: #fff8db;
}
.on-farm:has(.next-chore:not([hidden])) #caption { bottom: calc(var(--safe-bottom) + 84px); }
#reaction-continue { pointer-events: auto; max-width: calc(var(--safe-width) - 140px); }
#activity-ui:has(#reaction-continue:not([hidden])) ~ .caption { bottom: calc(var(--safe-bottom) + 84px); }
@media (orientation: landscape) and (min-width: 760px) and (max-height: 460px) {
  #activity-ui:not([hidden]) ~ .caption,
  #activity-ui:has(#reaction-continue:not([hidden])) ~ .caption {
    --activity-caption-beside-tray: 1;
    left: auto;
    right: calc(var(--safe-right) + 78px);
    bottom: calc(var(--safe-bottom) + 14px);
    max-width: calc((var(--safe-width) - 446px) / 2);
    transform: none;
  }
}
.guided-beacon, .cue.guided-beacon {
  position: fixed; z-index: 19; display: grid; place-items: center; min-width: 0; min-height: 0;
  width: 56px; height: 56px; padding: 8px; transform: translate(-50%, -100%);
  border: 2px solid #925726; border-radius: 50%; background: #fff0be; color: #5c3d27; cursor: pointer;
  box-shadow: 0 0 0 5px #edab49aa, 0 0 16px 8px #ffd57fb0;
}
.guided-beacon::before {
  content: ''; position: absolute; inset: -6px; border: 2px solid #ffdc80; border-radius: inherit;
  animation: guide-pulse 2.2s ease-out infinite; pointer-events: none;
}
.guided-beacon::after {
  content: ''; position: absolute; bottom: -8px; width: 12px; height: 12px;
  transform: rotate(45deg); background: #fff0be; border: solid #925726; border-width: 0 2px 2px 0;
}
.cue.guided-beacon :is(.cue-face, .cue-label, .cue-tick) { display: none; }
.guided-beacon .ico, .cue.guided-beacon .cue-act { width: 36px; height: 36px; }
.guided-beacon:focus-visible, .tidy-item:focus-visible { outline: 3px solid #3c604a; outline-offset: 4px; }
@keyframes guide-pulse {
  0% { transform: scale(.91); opacity: .95; }
  85%, 100% { transform: scale(1.35); opacity: 0; }
}
#ui:has(#story-beat:not([hidden])) > #guided-beacon { visibility: hidden; }
.tidy-item {
  position: fixed; z-index: 11; width: 48px; height: 48px; transform: translate(-50%, -50%);
  border: 3px dashed #fff5c4; border-radius: 16px; background: transparent;
  box-shadow: 0 0 0 1px #77502f, 0 0 9px #ffdb79; pointer-events: auto; cursor: grab; touch-action: none;
}
.tidy-item[data-floor-item] { width: 64px; height: 64px; }
.tidy-item::before {
  content: ''; position: absolute; inset: -4px; border: 2px solid #ffe28c; border-radius: inherit;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced) .tidy-item::before { animation: guide-pulse 2.2s ease-out infinite; }
}
.tidy-item:active { cursor: grabbing; }
#rings .shelf-ring { border-width: 3px; box-shadow: 0 0 0 2px #795326, 0 0 10px 3px #ffe395; }
#rings .shelf-ring .ring-count { top: -10px; bottom: auto; }
.tool-helper {
  position: fixed; z-index: 12; height: 5px; pointer-events: none; transform-origin: left center;
  border-top: 5px dotted #fff1b2; filter: drop-shadow(0 1px 2px #694326);
}
.tool-helper::after {
  content: ''; position: absolute; right: 0; top: -10px; width: 10px; height: 10px;
  border: solid #fff1b2; border-width: 4px 4px 0 0; transform: rotate(45deg);
}
.tool-helper > span {
  position: absolute; top: -20px; left: 50%; width: 32px; height: 32px; padding: 4px;
  border: 1px solid #8e632d; border-radius: 50%; background: #fff8db; color: #563b23;
  transform: translateX(-50%) rotate(var(--helper-tilt, 0rad));
}
@keyframes helper-point {
  0%, 12% { left: 0; opacity: .5; }
  70%, 100% { left: 100%; opacity: 1; }
}
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced) .tool-helper > span { animation: helper-point 1.75s ease-in-out infinite; }
}
#cutscene-overlay .chapter-actions:has(#cutscene-choose-story:not([hidden])) { flex-wrap: wrap; }
.theater-program :is(#cutscene-choose-story, #cutscene-play-next-story, #cutscene-next:has(.ico))::before { content: none; }
#cutscene-next > .ico { width: 26px; height: 26px; flex: none; }
.theater-program .chapter-actions #cutscene-play-next-story {
  min-height: 58px; padding-inline: 18px; background: #fff8e9; color: #50321a; font: 800 clamp(16px, 2vw, 22px)/1.1 Arial, sans-serif;
  border-color: #baa17c; box-shadow: 0 2px 0 #c8b18e;
}
/* Keep the illustrated ticket usable during the film, but celebrate its actual ending. */
.theater-program .chapter-actions:has(.movie-finished) #cutscene-play-next-story {
  background: linear-gradient(#fff0b8, #ffd779); border-color: #b77c28;
  box-shadow: 0 0 0 2px #edc477;
}
#cutscene-play-next-story .ico { width: 24px; height: 24px; flex: none; }
.theater-program .chapter-actions:has(#cutscene-choose-story:not([hidden])) #cutscene-continue {
  min-height: 44px; background: transparent; color: #344e43; box-shadow: none; font-size: 13px;
}
@media (orientation: landscape) and (max-height: 520px) and (max-width: 700px) {
  #cutscene-overlay .chapter-actions:has(#cutscene-choose-story:not([hidden])) {
    display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); gap: 4px; margin-inline: 6px;
  }
  #cutscene-overlay .chapter-actions:has(#cutscene-choose-story:not([hidden])) .btn {
    min-height: 48px; padding: 5px 3px; font-size: 13px;
  }
  #cutscene-overlay .chapter-actions:has(#cutscene-choose-story:not([hidden])) #cutscene-continue { grid-column: auto; }
  #cutscene-play-next-story .ico, .theater-program .chapter-actions:has(#cutscene-choose-story:not([hidden])) #cutscene-continue::before { display: none; }
}
/* Keep a single large action at the bottom center, separate from the smaller utilities. */
.on-farm .farm-library {
  padding: 2px; gap: 0; border-radius: 12px; background: #fff8e8e6;
}
.on-farm .farm-library .btn, .on-farm .farm-library #farm-wide {
  min-width: 48px; min-height: 44px; padding: 3px 6px; font-size: 10px;
}
.on-farm #btn-board .board-tile[aria-current="step"] {
  background: #f5e5bc; border-color: #b9a27c;
}
.on-farm #btn-next-chore {
  min-height: 68px; width: max-content; max-width: min(calc(var(--safe-width) - 28px), 540px);
  padding-right: 19px; gap: 10px; font-size: clamp(19px, 2.45vw, 29px);
}
.on-farm #btn-next-chore::after {
  content: ''; flex: none; width: 11px; height: 11px; margin-inline: 2px 0;
  border: solid currentColor; border-width: 3px 3px 0 0; transform: rotate(45deg);
}
.on-farm:has(#btn-next-chore:not([hidden])) #caption { bottom: calc(var(--safe-bottom) + 90px); }
@media (max-width: 1100px) {
  .on-farm #btn-next-chore { bottom: calc(var(--safe-bottom) + 66px); }
  .on-farm:has(#btn-next-chore:not([hidden])) #caption { bottom: calc(var(--safe-bottom) + 141px); }
  .on-farm #btn-board { top: calc(var(--safe-top) + 8px); }
}
@media (orientation: portrait) and (max-width: 620px) {
  .on-farm #btn-next-chore { width: min(340px, calc(var(--safe-width) - 26px)); justify-content: space-between; }
  .on-farm #btn-next-chore .next-label { flex: 1; text-align: center; }
}
@media (max-width: 420px) and (orientation: portrait) {
  .on-farm #btn-board:has(.chore-heading + .chore-heading) {
    top: calc(var(--safe-top) + 8px); max-width: calc(var(--safe-width) - 106px);
  }
}
@media (max-height: 540px), (max-width: 620px) {
  .next-chore { min-height: 52px; padding-inline: 7px 14px; }
  .next-chore .ico { width: 36px; height: 36px; }
}
@media (max-width: 470px) {
  #cutscene-overlay .chapter-actions:has(#cutscene-choose-story:not([hidden])) {
    display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  }
  .theater-program .chapter-actions:has(#cutscene-choose-story:not([hidden])) #cutscene-continue {
    grid-column: 1 / -1; justify-self: end; min-height: 44px;
  }
}
body.reduced .guided-beacon::before { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .guided-beacon::before { animation: none; }
}
.ghost.drop-ready::after {
  content: 'Let go'; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  color: #fffbea; background: #2f5845; border: 2px solid #f5edd4; border-radius: 12px; padding: 3px 8px;
  font: 700 15px/1.1 system-ui, sans-serif; white-space: nowrap;
}

@media (orientation: landscape) and (max-height: 460px) {
  .on-farm .farm-library {
    top: auto; bottom: calc(var(--safe-bottom) + 8px);
    right: calc(var(--safe-right) + 8px);
  }
  .on-farm #btn-next-chore { bottom: calc(var(--safe-bottom) + 12px); min-height: 56px; max-width: min(36vw, 420px); font-size: clamp(17px, 2.4vw, 22px); }
  .on-farm:has(.next-chore:not([hidden])) #caption { bottom: calc(var(--safe-bottom) + 84px); }
}

.cue.nearby-cue .cue-label, .cue.nearby-cue .cue-face { display: none; }
.cue.nearby-cue { width: 44px; height: 44px; justify-content: center; padding: 5px; border: 1px solid #af956f; }
@media (orientation: landscape) and (max-height: 460px) and (max-width: 760px) {
  .on-farm #btn-next-chore { bottom: calc(var(--safe-bottom) + 65px); max-width: calc(var(--safe-width) - 28px); }
  .on-farm:has(.next-chore:not([hidden])) #caption { bottom: calc(var(--safe-bottom) + 123px); }
}

#rings .shelf-ring .ring-count { background: #fff2c9; color: #593c24; border-color: #9c642d; }
#rings .shelf-ring .ring-count svg { width: 24px; height: 24px; }
.tidy-item[data-floor-item] {
  width: 68px; height: 68px; border-radius: 50%; border-width: 3px;
}

@media (min-width: 1101px) {
  .on-farm #btn-next-chore { max-width: min(calc(100vw - 520px), 540px); }
}

/* The story continuation is the primary choice, with a quiet farm return. */
.theater-program .chapter-actions #cutscene-next:has(.ico) {
  background: linear-gradient(#fff0b8, #ffd779); color: #50321a;
  font: 800 clamp(16px, 2.3vw, 23px)/1.1 Arial, sans-serif;
}
.theater-program .chapter-actions:has(#cutscene-next .ico) #cutscene-continue {
  background: #f4ecdb; color: #3b5144; box-shadow: none; font-size: 14px;
}
@media (orientation: landscape) and (max-height: 520px) and (max-width: 700px) {
  #cutscene-overlay .chapter-actions #cutscene-next:has(.ico) {
    flex: 1.3; font-size: 15px; text-wrap: balance;
  }
  #cutscene-next > .ico { display: none; }
}

/* A quiet top corner strip leaves the bottom-center action free at every size. */
.on-farm .farm-library {
  inset: calc(var(--safe-top) + 8px) calc(var(--safe-right) + 8px) auto auto;
  max-width: calc(var(--safe-width) - 68px);
  padding: 2px;
  background: #fff8e8f2;
}
.on-farm .farm-library .btn, .on-farm .farm-library #farm-wide,
.on-farm .farm-library #btn-speaker {
  position: static; flex: none; width: auto; height: auto; min-width: 44px; min-height: 44px;
  padding: 3px 5px; gap: 2px; font: 700 10px/1.1 Arial, sans-serif;
  box-shadow: none;
}
.on-farm .farm-library #btn-speaker .ico { width: 22px; height: 22px; }
.on-farm .farm-library .voice-label { font: inherit; }
.on-farm .farm-library #btn-speaker.halo-on { box-shadow: inset 0 0 0 1px #be903e; }
.on-farm #btn-corner { top: calc(var(--safe-top) + 8px); left: calc(var(--safe-left) + 8px); width: 48px; height: 48px; }
.on-farm #btn-corner svg { width: 28px; height: 28px; }
.on-farm #btn-board { top: calc(var(--safe-top) + 8px); }
.on-farm #btn-board .board-tile.done { outline: none; }
.on-farm #story-progress .board-tile.extra:not(.done,.in-progress) { background: transparent; border-color: transparent; }
.on-farm #btn-next-chore {
  bottom: calc(var(--safe-bottom) + 14px);
  max-width: min(calc(var(--safe-width) - 28px), 540px);
  min-height: 64px;
  box-shadow: 0 4px #7e552d, 0 6px 18px #2f25266b, 0 0 0 4px #fff1ba66;
}
.on-farm:has(#btn-next-chore:not([hidden])) #caption { bottom: calc(var(--safe-bottom) + 88px); }
@media (max-width: 1050px) and (min-width: 570px) {
  .on-farm #btn-board, .on-farm #btn-board:has(.chore-heading + .chore-heading) {
    left: calc(var(--safe-left) + 64px); transform: none; max-width: calc(var(--safe-width) - 342px);
  }
}
@media (max-width: 569px) {
  .on-farm #btn-board, .on-farm #btn-board:has(.chore-heading + .chore-heading) {
    top: calc(var(--safe-top) + 64px); max-width: calc(var(--safe-width) - 16px);
  }
  .on-farm .farm-library .btn, .on-farm .farm-library #farm-wide, .on-farm .farm-library #btn-speaker {
    padding-inline: 3px; min-width: 44px;
  }
}
@media (max-width: 350px) {
  .on-farm .farm-library .btn > span:not(.ico) { display: none; }
}
@media (max-height: 460px) {
  .on-farm #btn-next-chore { min-height: 52px; bottom: calc(var(--safe-bottom) + 9px); }
  .on-farm:has(#btn-next-chore:not([hidden])) #caption { bottom: calc(var(--safe-bottom) + 72px); }
}

/* Four pictures become checkmarks as the real objects reach their shelf. */
#care-progress.tidy-progress { gap: 5px; }
#care-progress.tidy-progress i {
  position: relative; flex: none; width: 23px; height: 23px; padding: 2px;
  border: 1px solid #d6bf96; border-radius: 7px; background: #fff7df; box-shadow: none;
}
#care-progress.tidy-progress i.filled { background: #d7e8ca; border-color: #527a56; }
#care-progress.tidy-progress i.filled::after {
  content: ''; position: absolute; right: -2px; bottom: -2px; width: 8px; height: 5px;
  border: solid #356044; border-width: 0 0 3px 3px; transform: rotate(-45deg);
  background: #d7e8ca;
}
#care-progress.tidy-progress i:not(.filled):first-child,
#care-progress.tidy-progress i.filled + i:not(.filled) { border-color: #b37d32; background: #ffeabb; }
.tidy-item[data-floor-item] { border-color: #fff9dd; box-shadow: 0 0 0 2px #9c632d, 0 0 14px 5px #ffdb79aa; }
.tidy-item[data-floor-item]::before { inset: -5px; }
/* A close tabletop supply keeps its 48px hit area without competing with the destination ring. */
.tidy-item[data-compact-marker] { border-color: transparent; box-shadow: none; }
.tidy-item[data-compact-marker]::before {
  inset: 7px; border: 2px dashed #fff5c4; border-radius: 9px;
  box-shadow: 0 0 0 1px #77502f; animation: none;
}
#rings .shelf-ring { background: #fff2a61a; }
#rings .shelf-ring .ring-count { font-size: 12px; padding: 2px 6px; }

@media (orientation: landscape) and (min-width: 760px) and (max-height: 460px) {
  #activity-ui.tidy-aisle #tray {
    left: calc(var(--safe-left) + 12px); right: auto; transform: none;
  }
}

/* A short name below each small picture keeps the optional chores discoverable. */
.on-farm #btn-board .board-tile { height: 50px; padding: 2px 4px; }
.on-farm #btn-board .board-tile .chore-label {
  display: block; font: 700 10px/1 Arial, sans-serif; white-space: nowrap;
}
.on-farm #btn-board .board-tile > svg { width: 24px; height: 24px; }
.on-farm #btn-board .board-tile[aria-current="step"] > svg { width: 26px; height: 26px; }
@media (max-width: 759px) {
  .on-farm #btn-board, .on-farm #btn-board:has(.chore-heading + .chore-heading) {
    top: calc(var(--safe-top) + 64px); left: 50%; transform: translateX(-50%);
    max-width: calc(var(--safe-width) - 16px);
  }
}
.guided-beacon.offscreen-guide::after {
  top: 50%; left: 50%; bottom: auto; width: 16px; height: 16px;
  border: solid #925726; border-width: 3px 3px 0 0; background: #fff0be;
  transform: translate(-50%, -50%) rotate(var(--guide-angle)) translateX(32px) rotate(45deg);
}
#tidy-instruction { display: block; margin-top: 3px; font: 700 11px/1.1 Arial, sans-serif; }
#tidy-instruction[hidden] { display: none; }

/* Let the film yield height to the actual chapter caption and action row. */
@media (orientation: landscape) and (min-width: 641px) and (min-height: 521px) {
  #cutscene-overlay .theater-program {
    max-height: 100%; grid-template-rows: auto minmax(0, 1fr) auto auto;
    overflow-y: auto;
  }
  .theater-program #cutscene-frame { min-height: 0; max-height: 100%; align-self: stretch; }
  .theater-program #cutscene-frame .storybook-kenburns { background-size: contain; }
}

/* Cycle 25: keep the destination, real item and next action easy to recognize. */
.on-farm .farm-library { gap: 0; }
.on-farm #btn-next-chore { min-width: min(290px, calc(var(--safe-width) - 28px)); justify-content: center; }
.on-farm #btn-next-chore .next-label { text-align: center; }
#tidy-instruction { font-size: 14px; line-height: 1.2; color: #644019; }
#rings .shelf-ring .ring-count { font-size: 13px; }
.tool-helper.tap-only { border: 0; }
.tool-helper.tap-only::after { display: none; }
.tool-helper.tap-only > span { left: 0; }
@media (max-width: 420px) {
  .on-farm .farm-library .btn, .on-farm .farm-library #farm-wide, .on-farm .farm-library #btn-speaker {
    min-width: 44px; width: 44px; padding: 2px;
  }
  .on-farm .farm-library .btn > span:not(.ico) { font-size: 9px; white-space: normal; text-align: center; }
  #tidy-instruction { font-size: 12px; }
}

/* Cycle 26: keep optional shortcuts visually quiet and the next step dominant. */
.on-farm .farm-library {
  background: #fff8e9df;
  border: 1px solid #bda98c;
  box-shadow: 0 1px 3px #32251926;
}
.on-farm .farm-library .btn, .on-farm .farm-library #farm-wide,
.on-farm .farm-library #btn-speaker {
  background: transparent;
  border-color: transparent;
}
.on-farm #btn-board {
  background: #fff8e9cf;
  box-shadow: none;
}
.on-farm #btn-board .board-tile {
  height: 44px;
  padding: 1px 4px;
}
.on-farm #btn-board .board-tile[aria-current="step"] {
  color: #30533d;
  background: #e8efdb;
  border-color: #91a98a;
  box-shadow: none;
}
.on-farm #btn-board .board-tile[aria-current="step"] > svg { width: 24px; height: 24px; }
.on-farm #btn-next-chore {
  background: linear-gradient(#fff4c8, #ffd16d);
  border-color: #805022;
  font-weight: 800;
}
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced).on-farm #btn-next-chore[aria-current="step"]::before {
    content: '';
    position: absolute;
    inset: -4px;
    border: 2px solid #ffdf89;
    border-radius: inherit;
    pointer-events: none;
    animation: next-action-pulse 2.6s ease-out infinite;
  }
}
@keyframes next-action-pulse {
  0% { opacity: .9; transform: scale(1); }
  85%, 100% { opacity: 0; transform: scale(1.035, 1.15); }
}
@media (max-width: 759px) {
  .on-farm #btn-board .board-tile .chore-label { font-size: 9px; }
  .on-farm #btn-board, .on-farm #btn-board:has(.chore-heading + .chore-heading) {
    top: calc(var(--safe-top) + 66px);
  }
}

/* The real source is the first thing to look at. The tray remains a large
   accessible shortcut and the shelf stays visibly tappable. */
#activity-ui[data-supply-visible] .tool[data-tool="tool_tidy"].required {
  animation: none;
  box-shadow: inset 0 0 0 2px #bca27d;
  background: #fff8e8;
}
#activity-ui[data-supply-visible] .tool[data-tool="tool_tidy"].required:is(:active, :focus-visible) {
  box-shadow: inset 0 0 0 3px #c68a2d;
}
#activity-ui.tidy-aisle[data-supply-visible] #rings .shelf-ring {
  animation: none;
  border-color: #f6d78f;
  box-shadow: 0 0 0 2px #8c632d, 0 0 8px #ffe9a5;
}
#activity-ui.tidy-aisle #rings .shelf-ring .ring-count {
  top: -13px;
  bottom: auto;
  background: #fff6db;
  font-size: 12px;
}
#activity-ui.tidy-aisle #rings .shelf-ring .ring-count svg { width: 20px; height: 20px; }
#activity-ui.tidy-aisle .tidy-item {
  border: 3px dashed #fff8d4;
  box-shadow: 0 0 0 2px #855324, 0 0 18px 5px #ffd46b9c;
}
#tidy-instruction { white-space: nowrap; min-height: 1.2em; }
.tidy-finished {
  position: fixed;
  z-index: 15;
  left: 50%;
  top: calc(var(--safe-top) + 12px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  color: #315e40;
  background: #fff8df;
  border: 2px solid #80a16f;
  border-radius: 20px;
  font: 800 clamp(16px, 2vw, 24px)/1.1 Arial, sans-serif;
  white-space: nowrap;
  pointer-events: none;
}
.tidy-finished > span { display: grid; place-items: center; width: 32px; height: 32px; }
.tidy-finished svg { width: 100%; height: 100%; }
.tool-helper.tap-only > span { animation: none; }
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced) .tool-helper.tap-only > span { animation: helper-tap 1.3s ease-in-out infinite; }
}
@keyframes helper-tap {
  0%, 100% { transform: translateX(-50%) scale(1); }
  45% { transform: translateX(-50%) scale(.8); }
}

/* The sticker reward must not cover the clean-barn celebration. */
#ui:has(#tidy-finished:not([hidden])) > #sticker-toast { top: calc(var(--safe-top) + 66px); }
/* Wide but short screens have room for both rewards across the header.
   Leave the pony and the newly sorted shelf clear beneath them. */
@media (min-width: 720px) and (orientation: landscape) {
  #ui:has(#sticker-toast:not([hidden])) #tidy-finished:not([hidden]) {
    left: calc(50% - 6px); transform: translateX(-100%);
  }
  #ui:has(#tidy-finished:not([hidden])) > #sticker-toast {
    left: calc(50% + 6px); top: calc(var(--safe-top) + 12px); transform: none;
    max-width: min(370px, calc((var(--safe-width) - 160px) / 2));
  }
}

/* Cycle 27: the next job is the only strong call to action on the farm.
   The progress pictures are still individual, accessible replay shortcuts. */
.on-farm .farm-library { background: #fff8e9d9; border-color: #c8bba7; }
.on-farm #btn-board { background: #fff8e9bd; border: 1px solid #ccbfa9; }
.on-farm #btn-board .board-tile {
  width: 44px; min-width: 44px; height: 44px; padding: 5px;
  border: 1px solid transparent; background: transparent;
}
.on-farm #btn-board .board-tile .chore-label { display: none; }
.on-farm #btn-board .board-tile[aria-current="step"] {
  background: transparent; border-color: #bba581;
}
.on-farm #btn-board .board-tile:is(:hover, :focus-visible) {
  background: #fff4ce; border-color: #9a835d;
}
.on-farm #story-progress:has(.chore-heading + .chore-heading) .board-tile:not(.done,.in-progress) {
  border-top-width: 1px; border-top-color: transparent;
}
.on-farm #btn-next-chore {
  min-width: min(340px, calc(var(--safe-width) - 28px));
  border-width: 3px; gap: 12px;
}
.on-farm #btn-next-chore .ico { width: 44px; height: 44px; }
#tidy-instruction:not([hidden]) {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  white-space: nowrap; text-align: center; min-height: 23px;
}
.tidy-prompt-icon { display: inline-grid; place-items: center; flex: none; width: 23px; height: 23px; }
.tidy-prompt-icon svg { width: 100%; height: 100%; }
#activity-ui.tidy-aisle #rings .shelf-ring .ring-count {
  color: #4f331d; border-color: #88532a; background: #fff8e0;
}
#activity-ui.tidy-aisle[data-supply-visible] #rings .shelf-ring {
  border-color: #fff0a3; box-shadow: 0 0 0 2px #8c632d, 0 0 14px #ffe9a5;
}
@media (max-height: 460px) {
  .on-farm #btn-next-chore { min-width: min(290px, calc(var(--safe-width) - 28px)); }
  .on-farm #btn-next-chore .ico { width: 35px; height: 35px; }
  .tidy-prompt-icon { width: 18px; height: 18px; }
  #tidy-instruction:not([hidden]) { min-height: 18px; }
}

/* Short landscape phones need the whole height for the shelf and four items.
   Keep the tool and words at the edges instead of squeezing the camera upward. */
@media (orientation: landscape) and (min-width: 480px) and (max-width: 759px) and (max-height: 460px) {
  #activity-ui.tidy-aisle #tray {
    left: calc(var(--safe-left) + 8px); right: auto; transform: none;
    padding: 4px; bottom: calc(var(--safe-bottom) + 8px);
  }
  #activity-ui.tidy-aisle #tray .tool {
    width: 90px; min-width: 90px; height: 74px;
  }
  #activity-ui.tidy-aisle #tray .tool-name { font-size: 11px; }
  #activity-ui.tidy-aisle:not([hidden]) ~ .caption {
    --activity-caption-beside-tray: 1;
    left: auto; right: calc(var(--safe-right) + 8px);
    bottom: calc(var(--safe-bottom) + 64px); transform: none;
    max-width: 124px; padding: 6px; font-size: 13px;
  }
}

/* Cycle 28: one large play action, with small, consistent utility targets. */
.on-farm .farm-library .btn, .on-farm .farm-library #farm-wide,
.on-farm .farm-library #btn-speaker {
  min-height: 44px; min-width: 44px; padding: 3px 4px;
  border-radius: 8px; box-shadow: none;
}
.on-farm .farm-library #farm-wide[aria-pressed="true"] { background: #d6e7d2; color: #315d43; }
.on-farm #btn-board { border-radius: 10px; background: #fff8e9b8; }
.on-farm #story-progress .board-tile[aria-current="step"] {
  border-color: transparent; background: #eee4cb;
}
.on-farm #story-progress .board-tile.extra:not(.done,.in-progress) { opacity: .72; }
.on-farm #story-progress .board-tile.extra:is(:hover,:focus-visible) { opacity: 1; }
@media (min-width: 570px) and (max-width: 1050px) {
  .on-farm #btn-board, .on-farm #btn-board:has(.chore-heading + .chore-heading) {
    max-width: calc(var(--safe-width) - 306px);
  }
}
@media (orientation: landscape) and (max-height: 460px) {
  .on-farm #btn-next-chore { bottom: calc(var(--safe-bottom) + 9px); max-width: calc(var(--safe-width) - 28px); }
  .on-farm:has(#btn-next-chore:not([hidden])) #caption { bottom: calc(var(--safe-bottom) + 72px); }
}
/* Compact the duplicate tool shortcut so the physical shelf and the four
   floor objects have room to be the actual game. */
@media (min-height: 461px) and (min-width: 761px) {
  #activity-ui.tidy-aisle #tray { padding: 5px; border-radius: 17px; }
  #activity-ui.tidy-aisle #tray .tool { width: 112px; height: 78px; padding: 5px; }
  #activity-ui.tidy-aisle #tray .tool-name { font-size: 12px; }
  #activity-ui.tidy-aisle:not([hidden]) ~ .caption { bottom: calc(var(--safe-bottom) + 118px); }
}
/* A touch pictogram is attached to the real item, never in front of it. */
.source-hand {
  position: absolute; right: -9px; bottom: -9px; width: 24px; height: 24px;
  padding: 3px; border: 1px solid #805424; border-radius: 50%;
  background: #fff6ce; color: #533922; pointer-events: none;
}
.tidy-item[data-compact-marker] .source-hand {
  display: block; right: auto; bottom: auto;
  left: calc(50% + var(--source-hand-x, 24px));
  top: calc(50% + var(--source-hand-y, 24px));
  transform: translate(-50%, -50%);
}
#rings .collection-ring[data-shared-source] .ring-count { border-color: #a16a33; background: #ffedac; color: #553f26; }
.tidy-item[data-floor-item] .source-hand { width: 27px; height: 27px; }
.tidy-item:active .source-hand { opacity: .55; }
#activity-ui.tidy-aisle #rings .shelf-ring { background: #fff2a626; }
/* On short landscape screens the utility bar and progress fit in one row.
   The next-step pill stays at the bottom and the play area is unobstructed. */
@media (orientation: landscape) and (min-width: 480px) and (max-height: 460px) {
  .on-farm .farm-library .btn, .on-farm .farm-library #farm-wide,
  .on-farm .farm-library #btn-speaker { width: 44px; height: 44px; padding: 5px; }
  .on-farm .farm-library .btn > span:not(.ico) { display: none; }
  .on-farm #btn-board, .on-farm #btn-board:has(.chore-heading + .chore-heading) {
    top: calc(var(--safe-top) + 8px); left: calc(var(--safe-left) + 64px); transform: none;
    max-width: calc(var(--safe-width) - 304px); padding: 1px;
  }
  .on-farm #story-progress { grid-template-rows: auto; }
  .on-farm #story-progress .chore-heading { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .on-farm #story-progress .board-tile { grid-row: 1; }
}
#activity-ui:has(#tool-helper:not([hidden])) .source-hand { display: none; }

/* In the whole-yard view, use a smaller beacon on short phones so the bay
   landmarks stay readable. The button still exceeds a 44px touch target. */
@media (orientation: landscape) and (max-height: 460px) {
  .on-farm:has(#farm-wide[aria-pressed="true"]) .guided-beacon {
    width: 48px; height: 48px; padding: 6px;
    box-shadow: 0 0 0 3px #edab49aa, 0 0 10px 4px #ffd57f99;
  }
  .on-farm:has(#farm-wide[aria-pressed="true"]) .guided-beacon::before { inset: -4px; }
  .on-farm:has(#farm-wide[aria-pressed="true"]) .guided-beacon .ico,
  .on-farm:has(#farm-wide[aria-pressed="true"]) .cue.guided-beacon .cue-act { width: 30px; height: 30px; }
}

/* Cycle 29: the farm has one primary action. Keep other shortcuts usable
   without making them look like competing jobs. */
.on-farm.guided-farm .farm-library {
  background: #fff8e9eb;
  border: 1px solid #c6b79e;
  box-shadow: none;
}
.on-farm.guided-farm .farm-library .btn,
.on-farm.guided-farm .farm-library #farm-wide,
.on-farm.guided-farm .farm-library #btn-speaker {
  color: #425745;
}
.on-farm.guided-farm #btn-board {
  background: #fff8e9a6;
  border-color: #d9cdb8;
  padding-block: 1px;
}
.on-farm.guided-farm #story-progress .board-tile:not([aria-current="step"]):not(:hover,:focus-visible) {
  opacity: .68;
}
.on-farm.guided-farm #story-progress .board-tile[aria-current="step"] {
  background: #fff4ce;
  border-color: #d5b374;
}
.on-farm.guided-farm #btn-next-chore {
  font-family: Arial, sans-serif;
  font-size: clamp(19px, 2.8vw, 27px);
  border-radius: 40px;
  justify-content: center;
}
.on-farm.guided-farm #btn-next-chore::after { font-size: 24px; }
.on-farm.guided-farm .nearby-cue:not(:hover,:focus-visible) {
  box-shadow: none;
  background: #fff9e7c4;
}
#tidy-slots { position: fixed; inset: 0; pointer-events: none; z-index: 9; }
.shelf-slot-picture {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: clamp(20px, 3.4vmin, 36px);
  aspect-ratio: 1;
  padding: 2px;
  background: #fff5d9;
  border: 1px solid #8a613d;
  border-radius: 5px;
  box-shadow: 0 1px 2px #4b2a2466;
}
.shelf-slot-picture svg { width: 100%; height: 100%; }
.shelf-slot-picture.current { background: #fff0ac; border: 2px solid #a86822; }
.shelf-slot-picture.stored { background: #e3f2cb; border-color: #557344; }
.shelf-slot-picture.stored::after {
  content: '';
  position: absolute;
  right: -4px;
  top: -4px;
  width: 8px;
  height: 4px;
  border: solid #478349;
  border-width: 0 0 3px 3px;
  transform: rotate(-45deg);
  filter: drop-shadow(0 1px #fff);
}
#activity-ui.tidy-aisle .shelf-ring .ring-count { top: -15px; }
#activity-ui.tidy-aisle .tidy-item[data-floor-item] { border-radius: 50%; }
@media (max-height: 460px) {
  .on-farm.guided-farm #btn-next-chore { font-size: 19px; }
  .shelf-slot-picture { width: 20px; }
}

/* The secondary Listen shortcut remains accessible without a fifth label
   competing with the four farm controls. */
.on-farm.guided-farm .farm-library #btn-speaker .voice-label { display: none; }
@media (max-width: 569px) {
  .on-farm.guided-farm #story-progress { grid-template-rows: auto; }
  .on-farm.guided-farm #story-progress .chore-heading {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
  }
  .on-farm.guided-farm #story-progress .board-tile { grid-row: 1; }
}

/* The two finale choices use recognisable pictures as well as words. */
.theater-program .chapter-actions #cutscene-choose-story {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 52px;
}
#cutscene-choose-story .ico { width: 24px; height: 24px; flex: none; }
@media (max-height: 460px) {
  .theater-program .chapter-actions #cutscene-choose-story { min-height: 44px; }
}

/* Cycle 30: a single prominent action, with extras in a quiet icon dock. */
.on-farm .farm-library {
  padding: 2px;
  gap: 0;
  border-radius: 18px;
  background: #fff8e9e8;
}
.on-farm .farm-library .btn,
.on-farm .farm-library #farm-wide,
.on-farm .farm-library #btn-speaker {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  border-radius: 12px;
}
.on-farm .farm-library .btn > span:not(.ico) { display: none; }
.on-farm .farm-library .btn .ico,
.on-farm .farm-library #farm-wide > svg { width: 25px; height: 25px; }
.on-farm .farm-library .btn:is(:hover, :focus-visible) { background: #e7eadb; }
.on-farm.guided-farm #story-progress .board-tile[aria-current="step"] {
  background: #e7eddc;
  border-color: #a8b69b;
}
.on-farm.guided-farm .nearby-cue:not(:hover,:focus-visible) {
  opacity: .78;
  background: #fff9e7b8;
}
.on-farm.guided-farm #btn-next-chore {
  min-width: min(350px, calc(var(--safe-width) - 28px));
  padding-inline: 12px 20px;
}
#rings button.ring {
  padding: 0;
  background: #fff2a619;
  pointer-events: auto;
  touch-action: none;
  cursor: pointer;
  font: inherit;
}
#rings button.ring:focus-visible { outline: 3px solid #315d43; outline-offset: 5px; }
#rings button.ring .ring-count { pointer-events: auto; }
#activity-ui.tidy-aisle .tidy-item[data-floor-item] {
  box-shadow: 0 0 0 2px #78502a, 0 0 13px 3px #ffdf80;
}
#activity-ui.tidy-aisle #rings .shelf-ring .ring-count { white-space: nowrap; }
@media (max-height: 460px) {
  .on-farm.guided-farm #btn-next-chore { min-width: min(290px, calc(var(--safe-width) - 28px)); }
}

/* Cycle 31: one warm action, quiet secondary controls, and clear shelf prompts. */
.on-farm.guided-farm #btn-next-chore { gap: 10px; }
.on-farm.guided-farm #btn-board { box-shadow: none; }
.on-farm.guided-farm #story-progress .board-tile:not([aria-current="step"]):not(:focus-visible,:hover) { opacity: .58; }
#rings button.ring { animation: none; }
#rings button.ring::before {
  content: ''; position: absolute; inset: -5px; border: 2px solid #ffe8a1;
  border-radius: inherit; pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced) #rings button.ring::before { animation: guide-pulse 1.6s ease-out infinite; }
  body:not(.reduced) #rings button.ring.strong::before { animation-duration: .7s; }
}
#activity-ui.tidy-aisle .shelf-ring .ring-count { font-weight: 800; }

/* Keep the tap helper's own visual bounds nonzero and place the hand beside
   the ring center so the object itself stays visible. */
.tool-helper.tap-only { height: 32px; }
.tool-helper.tap-only > span { top: 0; left: 50%; }

/* Cycle 32: the progress counter opens optional chores only when requested. */
.on-farm #btn-board,
.on-farm #btn-board:has(.chore-heading + .chore-heading) {
  top: calc(var(--safe-top) + 66px);
  left: calc(var(--safe-left) + 8px);
  right: auto;
  transform: none;
  width: max-content;
  max-width: calc(var(--safe-width) - 16px);
  padding: 0;
  border: 0;
  background: transparent;
}
.chores-toggle {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 5px 10px;
  border: 1px solid #c3b095; border-radius: 14px;
  background: #fff8e8e8; color: #395b45;
  font: 700 13px/1 Arial, sans-serif;
  cursor: pointer;
}
.chores-toggle .ico { width: 18px; height: 18px; }
.chores-chevron { font-size: 19px; }
.chores-toggle[aria-expanded="true"] .chores-chevron { transform: rotate(180deg); }
.on-farm #story-progress:not([hidden]) {
  margin-top: 5px; padding: 5px; border-radius: 13px;
  background: #fff8edf5; border: 1px solid #c3b095;
  max-width: calc(var(--safe-width) - 16px);
  overflow-x: auto;
}
.on-farm #story-progress[hidden] { display: none; }
.on-farm #story-progress .board-tile .chore-label {
  display: block; font-size: 12px; white-space: nowrap;
}
.on-farm #story-progress .board-tile { min-width: 52px !important; height: 54px; }
.on-farm.guided-farm #story-progress .board-tile:not([aria-current="step"]) { opacity: 1; }
@media (min-width: 760px) {
  .on-farm #btn-board,
  .on-farm #btn-board:has(.chore-heading + .chore-heading) {
    top: calc(var(--safe-top) + 8px); left: calc(var(--safe-left) + 64px);
  }
}
.on-farm #btn-board { flex-direction: column; align-items: flex-start; gap: 0; }
@media (min-width: 760px) {
  .on-farm #btn-board:has(#chores-toggle[aria-expanded="true"]) {
    top: calc(var(--safe-top) + 66px); left: calc(var(--safe-left) + 8px);
  }
}
/* Keep the actual objects visible: the hand travels beside the pickup
   outline, and the current shelf label stays above the empty slot. */
#activity-ui.tidy-aisle .tidy-item[data-floor-item] {
  background: transparent;
  border: 3px dashed #fff3bb;
}
#activity-ui.tidy-aisle .source-hand { right: -13px; bottom: -8px; }
#activity-ui.tidy-aisle #rings .shelf-ring { background: transparent; }
#activity-ui.tidy-aisle[data-item-moving] #tidy-instruction { visibility: hidden; }
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced) #activity-ui.tidy-aisle .tidy-item[data-floor-item]::before {
    content: ''; position: absolute; inset: -5px; border: 2px solid #ffdf80;
    border-radius: inherit; pointer-events: none; animation: guide-pulse 1.7s ease-out infinite;
  }
}
.chores-chevron {
  width: 8px; height: 8px; margin: -4px 2px 0;
  border: solid currentColor; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.chores-toggle[aria-expanded="true"] .chores-chevron { transform: rotate(225deg); margin-top: 4px; }
#activity-ui.tidy-aisle .tidy-item[data-floor-item] {
  box-shadow: 0 0 0 3px var(--tidy-match, #78502a), 0 0 13px 3px #ffdf80;
}
#activity-ui.tidy-aisle[data-supply-visible] #rings .shelf-ring {
  box-shadow: 0 0 0 3px var(--tidy-match, #8c632d), 0 0 10px 3px #ffe9a5;
}

/* Keep the plaque compact on short landscape phone screens. The transport
   supplies the paused status without obscuring the film or title. */
@media (orientation: landscape) and (max-height: 440px) {
  #cutscene-frame .movie-title-card strong {
    max-inline-size: 100%; font-size: clamp(16px, 5.6cqi, 24px);
  }
  #cutscene-frame .film-end { font-size: 12px; padding: 4px 7px; bottom: 7px; }
  .theater-program:has(#cutscene-pause[aria-pressed="true"]) #cutscene-frame .film-paused { display: none; }
}

/* Cycle 33: let the farm and the next job own the screen. */
.on-farm .farm-library {
  border-radius: 14px;
  box-shadow: none;
}
.on-farm #btn-corner {
  border-radius: 14px;
  box-shadow: none;
}
.on-farm #btn-next-chore {
  min-height: 68px;
  min-width: min(380px, calc(var(--safe-width) - 24px));
  font-weight: 800;
  padding-inline: 9px 18px;
}
.on-farm #btn-next-chore .ico { width: 48px; height: 48px; }
@media (min-width: 480px) {
  .on-farm #btn-board,
  .on-farm #btn-board:has(.chore-heading + .chore-heading) {
    top: calc(var(--safe-top) + 10px);
    left: calc(var(--safe-left) + 64px);
  }
  .on-farm #btn-board:has(#chores-toggle[aria-expanded="true"]) {
    top: calc(var(--safe-top) + 66px);
    left: calc(var(--safe-left) + 8px);
  }
}
@media (max-height: 460px) {
  .on-farm #btn-next-chore { min-height: 58px; min-width: min(320px, calc(var(--safe-width) - 24px)); }
  .on-farm #btn-next-chore .ico { width: 40px; height: 40px; }
  .on-farm:has(#btn-next-chore:not([hidden])) #caption { bottom: calc(var(--safe-bottom) + 80px); }
}

/* A picture-to-picture prompt shows the move without needing words. */
.tidy-prompt-destination { width: 23px; height: 23px; flex: none; }
.tidy-prompt-destination svg { width: 100%; height: 100%; }
#tidy-instruction .tidy-prompt-text { font-size: clamp(12px, 1.5vw, 16px); }
#activity-ui.tidy-aisle .source-hand { bottom: -12px; right: -15px; }
#activity-ui.tidy-aisle .shelf-slot-picture { background: #fff6df; }
#activity-ui.tidy-aisle .shelf-slot-picture.current { background: #ffea9b; }
#activity-ui.tidy-aisle .shelf-slot-picture.stored { background: #e1f4d1; }
/* On wider screens the tool and caption flank the aisle, leaving a large
   unobstructed play area for the four real objects and their storage shelf. */
@media (orientation: landscape) and (min-width: 760px) and (max-height: 460px),
       (min-width: 900px) and (min-aspect-ratio: 27/20) {
  #activity-ui.tidy-aisle #tray {
    left: calc(var(--safe-left) + 14px);
    right: auto;
    bottom: calc(var(--safe-bottom) + 14px);
    transform: none;
  }
  #activity-ui.tidy-aisle:not([hidden]) ~ .caption {
    --activity-caption-beside-tray: 1;
    left: auto;
    right: calc(var(--safe-right) + 12px);
    bottom: calc(var(--safe-bottom) + 74px);
    max-width: 172px;
    transform: none;
    font-size: clamp(13px, 1.6vw, 18px);
  }
  #activity-ui.tidy-aisle:has(#reaction-continue:not([hidden])) ~ .caption {
    bottom: calc(var(--safe-bottom) + 78px);
  }
}
/* Keep collection labels off the floor supplies and tabletop props. */
#rings .collection-ring .ring-count { top: -15px; bottom: auto; }
#rings button.collection-ring { background: transparent; }

/* Cycle 34: picture-first instructions and a clear next-story route. */
.on-farm .story-choice {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 91px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 6px 18px;
  border: 1px solid #9d8b69;
  border-radius: 24px;
  background: #fff6e1;
  color: #315d43;
  font: 700 16px/1.1 Arial, sans-serif;
  pointer-events: auto;
  white-space: nowrap;
}
.on-farm .story-choice .ico { width: 26px; height: 26px; }
.on-farm .story-choice[hidden] { display: none; }
.on-farm:has(.story-choice:not([hidden])) #caption { bottom: calc(var(--safe-bottom) + 148px); }
.tidy-prompt-arrow {
  width: 15px;
  height: 12px;
  flex: none;
  background: #a66b28;
  clip-path: polygon(0 35%, 65% 35%, 65% 0, 100% 50%, 65% 100%, 65% 65%, 0 65%);
}
#tidy-instruction .tidy-prompt-text { margin-left: 2px; }
#activity-ui[data-action-busy] .tool { opacity: .62; }
#rings .ring-repeat {
  font: 700 13px/1 Arial, sans-serif;
  padding: 3px 5px;
  border-radius: 8px;
  background: #fff9e5;
  color: #5b4329;
}
@media (max-height: 460px) {
  .on-farm .story-choice { bottom: calc(var(--safe-bottom) + 76px); }
  .on-farm:has(.story-choice:not([hidden])) #caption { bottom: calc(var(--safe-bottom) + 130px); }
}

/* Cycle 35: the next chore should read as the action, not as another HUD button.
   Keep optional controls at finger-friendly sizes but visually secondary. */
.on-farm .farm-library {
  padding: 1px;
  background: #fff8e9cb;
  border: 1px solid #b9ad97;
  gap: 0;
}
.on-farm .farm-library .btn, .on-farm .farm-library #farm-wide,
.on-farm .farm-library #btn-speaker {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: #405d4a;
}
.on-farm .farm-library .btn:is(:hover, :focus-visible, :active) { background: #eee3cc; }
.on-farm.guided-farm #btn-next-chore {
  background: linear-gradient(#fff2bc, #ffcf75);
  border-color: #84501c;
  box-shadow: 0 5px 0 #84501c, 0 0 0 5px #fff5c460;
}
.on-farm.guided-farm #btn-next-chore:active { box-shadow: 0 2px 0 #84501c; }
#activity-ui.tidy-aisle .shelf-slot-picture.current {
  border-color: #76501e;
  box-shadow: 0 0 0 2px #fff3ba, 0 0 9px #ffd466;
}
#activity-ui.tidy-aisle[data-item-moving] .shelf-slot-picture { opacity: .95; }
#activity-ui.tidy-aisle #tidy-finished { background: #eff8dc; }
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced) #activity-ui.tidy-aisle .shelf-slot-picture.current {
    animation: tidy-slot-glow 1.8s ease-in-out infinite alternate;
  }
  @keyframes tidy-slot-glow {
    to { box-shadow: 0 0 0 3px #fff3ba, 0 0 13px 2px #ffd466; }
  }
}

/* Playtest refinement: one compact header, one primary action, and room for the actual game. */
.on-farm .farm-library {
  inset: calc(var(--safe-top) + 8px) calc(var(--safe-right) + 8px) auto auto;
  width: max-content;
  max-width: calc(var(--safe-width) - 66px);
  border-radius: 12px;
  background: #fff8e9df;
}
.on-farm #btn-corner {
  box-shadow: none;
  border: 1px solid #b9ad97;
  background: #fff8e9df;
}
.on-farm.guided-farm #btn-next-chore {
  min-height: 68px;
  max-width: min(540px, calc(var(--safe-width) - 24px));
  font-size: clamp(18px, 3.1vw, 27px);
}
@media (min-width: 390px) {
  .on-farm #btn-board:not(:has(#chores-toggle[aria-expanded="true"])) {
    top: calc(var(--safe-top) + 8px);
    left: calc(var(--safe-left) + 64px);
  }
}
@media (max-width: 479px) {
  .on-farm #btn-board:has(#chores-toggle[aria-expanded="true"]) {
    top: calc(var(--safe-top) + 64px);
    left: calc(var(--safe-left) + 8px);
  }
}
@media (max-height: 460px) {
  .on-farm.guided-farm #btn-next-chore { min-height: 58px; font-size: 19px; }
}
#tidy-count {
  color: #4d6840;
  font: 800 13px/1 Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  border-radius: 10px;
  background: #e8f0ce;
  padding: 4px 6px;
}
#activity-ui.tidy-aisle #act-banner {
  border-radius: 13px;
}
#activity-ui.tidy-aisle #tray .tool {
  border-color: #b59c70;
  box-shadow: none;
}
#activity-ui.tidy-aisle #tray .tool.required {
  box-shadow: inset 0 0 0 2px #ffe6a1;
}
@media (orientation: landscape) and (max-height: 460px) {
  #activity-ui.tidy-aisle #act-banner {
    gap: 7px;
    padding: 5px 10px;
  }
  #activity-ui.tidy-aisle .act-heading {
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    column-gap: 9px;
  }
  #activity-ui.tidy-aisle #tidy-instruction { grid-column: 1 / -1; margin-top: 2px; }
  #activity-ui.tidy-aisle #act-title { font-size: 18px; }
}
@media (max-width: 375px) {
  #activity-ui.tidy-aisle #act-banner > .ico { display: none; }
  #activity-ui.tidy-aisle #act-banner { padding-inline: 8px; }
  #activity-ui.tidy-aisle #tidy-instruction { gap: 3px; }
  #tidy-count { font-size: 11px; padding: 3px 4px; }
}

/* Cycle 36: a distinct, readable chapter timeline on both phone orientations. */
.theater-program .movie-progress {
  height: 6px; background: #15282ee6; border-top: 1px solid #fff3d34d;
}
.theater-program #cutscene-progress {
  background: linear-gradient(90deg, #d8ad62, #ffe6a3); box-shadow: none;
  border-radius: 0 2px 2px 0;
}
/* The completion plaque clears the timeline, even on a compact rotated
   phone. Keep the type sharp rather than glowing. */
.theater-program .film-end { bottom: 12px; text-shadow: none; }
@media (max-height: 440px) {
  #cutscene-frame .film-end { bottom: 10px; }
}

/* Cycle 37: keep every farm utility in a compact, quiet corner. */
.on-farm .farm-library {
  background: #fffaf0e8;
  border: 1px solid #d0c3ae;
  padding: 1px;
}
.on-farm .farm-library .btn, .on-farm .farm-library #farm-wide,
.on-farm .farm-library #btn-speaker {
  width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  padding: 8px; border-radius: 10px;
}
.on-farm .farm-library #farm-wide[aria-pressed="true"] { background: #d8e8d3; }
.on-farm .farm-library .btn:focus-visible { outline: 2px solid #315d43; outline-offset: -3px; }
.on-farm #btn-next-chore .next-label { line-height: 1.12; }
.on-farm.guided-farm #btn-next-chore {
  background: linear-gradient(180deg, #fff4c8, #ffd174);
  border: 2px solid #88531e;
  box-shadow: 0 4px 0 #88531e, 0 0 0 4px #fff5c4a0;
}
@media (max-width: 389px) {
  .on-farm #btn-board:not(:has(#chores-toggle[aria-expanded="true"])) {
    top: calc(var(--safe-top) + 62px); left: calc(var(--safe-left) + 8px);
    background: transparent; border: 0;
  }
  .on-farm #btn-board:not(:has(#chores-toggle[aria-expanded="true"])) .chores-toggle {
    min-height: 44px; padding-inline: 8px; gap: 4px; background: #fff8e9cf;
  }
}
/* Keep the visual action clear: a gold ring and matching picture are enough
   while the actual object is in flight. Leave the storage slots visible. */
#activity-ui.tidy-aisle #act-banner { background: #fffaf0f5; }
#activity-ui.tidy-aisle #tidy-instruction { gap: 5px; }
#activity-ui.tidy-aisle .shelf-slot-picture {
  border: 2px solid #76502b; width: 26px; height: 26px;
}
#activity-ui.tidy-aisle .shelf-slot-picture.stored { border-color: #4d7542; }
#activity-ui.tidy-aisle .shelf-ring .ring-count { background: #fff5d6; color: #5c3b1c; }
#activity-ui.tidy-aisle .tidy-item[data-floor-item] {
  border: 3px dashed #fff7cd;
  box-shadow: 0 0 0 2px var(--tidy-match, #78502a), 0 0 14px 4px #ffe59a;
}
#activity-ui.tidy-aisle #tray .tool { background: #fff8e8; }
#activity-ui.tidy-aisle[data-supply-visible] #tray .tool.required { box-shadow: none; }
@media (max-width: 375px), (max-height: 420px) {
  #activity-ui.tidy-aisle .shelf-slot-picture { width: 20px; height: 20px; }
}

#cutscene-frame .movie-title-card { padding-block-end: max(14px, 3cqi); }

/* Keep the measured tray footprint without painting it behind the next chapter button. */
#activity-ui:has(#reaction-continue:not([hidden])) #tray {
  opacity: 0; visibility: hidden; pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .act-banner.gone { transition: none; }
}
body.reduced .act-banner.gone { transition: none; }


/* Illustrated book navigation and an unmistakable next story destination. */
.book-tabs button, #book-close, #guide-listen, #memory-listen {
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.book-tabs button svg, #book-close svg, #guide-listen svg, #memory-listen svg {
  width: 22px; height: 22px; flex: none;
}
#book-close [data-icon], #memory-listen [data-icon] { display: inline-flex; }
#memory-listen {
  min-height: 48px; margin-top: 12px; padding: 8px 14px;
  border: 1px solid #a78e6d; border-radius: 12px;
  background: #fff8e4; color: #355e4d; font: 700 15px/1.2 Arial, sans-serif;
}
#book-watch-all { margin: 0 0 14px; min-height: 56px; }
#book-watch-all small { font-size: 14px; }
#cutscene-play-next-story > span:not(.ico) { min-width: 0; }
.next-story-title {
  display: block; font-size: .66em; font-weight: 600; line-height: 1.2;
  margin-top: 3px; overflow-wrap: anywhere;
}
#rings .ring-count { font-size: 13px; }
@media (max-width: 480px) {
  .book-tabs button { flex-direction: column; gap: 3px; font-size: 13px; }
  .book-tabs button svg { width: 23px; height: 23px; }
  #book-watch-all { justify-content: center; gap: 5px; padding: 9px; }
  #book-watch-all small { flex-basis: 100%; border: 0; padding: 0; text-align: center; }
}
@media (orientation: landscape) and (max-height: 460px) {
  #book-watch-all { margin-bottom: 8px; padding: 6px 12px; min-height: 48px; }
  .book-tabs button { gap: 4px; font-size: 14px; }
  .book-tabs button svg { width: 19px; height: 19px; }
  #cutscene-play-next-story .next-story-title { font-size: 11px; }
}

/* Keep local sound within reach without leaving the illustrated book. */
.book-head .book-sound { min-width: 48px; min-height: 48px; flex: none; padding: 5px 8px; }
.book-head .book-sound [data-sound-label] { font-size: 11px; }
.book-head .book-title { flex: 1; min-width: 0; text-wrap: balance; }
#memory-listen:disabled { opacity: .6; cursor: default; }
@media (max-width: 480px), (orientation: landscape) and (max-height: 460px) {
  .book-head { gap: 5px; }
  .book-head .book-sound { width: 48px; padding: 3px; }
  .book-head .book-sound [data-sound-label] { display: none; }
  .book-head .book-title { font-size: clamp(17px, 5vw, 24px); }
  #book-close { padding: 0 8px; }
}

/* The upcoming cover is a picture cue for children who cannot read the title. */
#cutscene-play-next-story .next-story-cover { width: 46px; height: 36px; object-fit: cover; border-radius: 7px; flex: none; }
#cutscene-play-next-story:has(.next-story-cover:not([hidden])) > .ico { display: none; }
#guide-index, #memory-index, #guide-next { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
#guide-index [data-icon], #memory-index [data-icon], #guide-next [data-icon] { display: inline-flex; width: 18px; height: 18px; flex: none; }
#guide-next { padding-inline: 9px; }
#guide-next > span:first-child { font-size: 14px; }
@media (orientation: landscape) and (max-height: 460px) {
  #cutscene-play-next-story .next-story-cover { width: 36px; height: 28px; }
  #cutscene-play-next-story .next-story-title { font-size: 13px; }
}

/* Give the picture-led story handoff a full row, with two quieter exits. */
#cutscene-overlay .chapter-actions:has(#cutscene-choose-story:not([hidden])) {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px;
}
#cutscene-overlay .chapter-actions #cutscene-play-next-story {
  grid-column: 1 / -1; justify-content: center; min-height: 56px; padding: 6px 12px;
}
#cutscene-overlay .chapter-actions:has(#cutscene-choose-story:not([hidden])) :is(#cutscene-choose-story, #cutscene-continue) {
  grid-column: auto; justify-self: stretch; width: 100%;
  min-height: 44px; padding: 6px 8px; font: 700 14px/1.15 Arial, sans-serif;
}
#cutscene-play-next-story .next-story-label { display: block; }
#cutscene-play-next-story .next-story-title { font-size: 13px; }
#guide-index, #guide-next { white-space: nowrap; font: 700 14px/1.15 Arial, sans-serif; padding-inline: 8px; }
#guide-folio { white-space: nowrap; font: 600 13px/1.15 Arial, sans-serif; margin: 0 auto; }
#guide-prev, #guide-next { flex: none; }
@media (orientation: landscape) and (max-height: 460px) {
  #cutscene-overlay .chapter-actions #cutscene-play-next-story { min-height: 48px; }
}

/* Picture-first repeat markers fit inside the existing care label. */
#rings .ring-repeat:has(i) { display: inline-flex; align-items: center; gap: 3px; padding: 4px; }
#rings .ring-repeat i { display: block; width: 7px; height: 7px; border: 1px solid #8b6d40; border-radius: 50%; background: transparent; }
#rings .ring-repeat i.done { background: #b27722; border-color: #8a581b; }
#rings .ring-repeat i.current { background: #386c58; border-color: #386c58; outline: 1px solid #386c58; outline-offset: 1px; }
/* Movie Night retains the chapter meter and adds its story position in the film margin. */
#movie-position {
  position: absolute; right: 9px; top: 9px; z-index: 2; pointer-events: none;
  padding: 5px 9px; border-radius: 7px; background: #203632ee; color: #fff8e7;
  font: 700 13px/1.2 Arial, sans-serif;
}
#movie-position[hidden] { display: none; }
#guide-listen:not(:disabled) { background: #355e4d; color: #fffdf2; border-color: #355e4d; }
#guide-listen[data-listening] { background: #f5dfad; color: #4c341f; border-color: #aa864b; }
#guide-listen:not(:disabled):focus-visible { outline: 3px solid #825028; outline-offset: 2px; }

/* A little picture trail works even before a child can read the chore name. */
#care-progress.picture-progress { gap: 4px; justify-content: center; }
#care-progress.picture-progress i {
  flex: 0 1 19px; min-width: 12px; height: 19px; padding: 1px;
  position: relative; border: 1px solid #baa888; border-radius: 5px;
  background: #fff8e7; box-shadow: none; color: #5b6653;
}
#care-progress.picture-progress i svg { width: 100%; height: 100%; display: block; }
#care-progress.picture-progress i.filled { background: #d7e8ca; border-color: #527a56; }
#care-progress.picture-progress i.filled::after {
  content: ''; position: absolute; right: -2px; bottom: -1px;
  width: 6px; height: 4px; border: solid #356044; border-width: 0 0 2px 2px;
  transform: rotate(-45deg); background: #d7e8ca;
}
#care-progress.picture-progress i:not(.filled):first-child,
#care-progress.picture-progress i.filled + i:not(.filled) { background: #ffeabb; border-color: #97621f; }
.memory-tools #memory-index { margin: 0; flex: none; padding: 6px 8px; gap: 4px; font: 700 14px/1.15 Arial, sans-serif; white-space: nowrap; }
.memory-tools #memory-index::before { content: none; }
#memory-folio { margin: 0 auto; white-space: nowrap; color: #5b5442; font: 600 13px/1.15 Arial, sans-serif; }
#memory-prev, #memory-next { flex: none; }
#guide-scale, #guide-listen, #guide-together summary { font-family: Arial, sans-serif; }
#memory-next { display: inline-flex; align-items: center; gap: 5px; padding-inline: 8px; font: 700 14px/1.15 Arial, sans-serif; }
#memory-next [data-icon] svg { transform: rotate(180deg); }
#memory-next .memory-next-preview { display: grid; place-items: center; width: 32px; height: 28px; }
#memory-next .memory-next-preview svg { display: block; width: 28px; height: 28px; }
@media (max-width: 380px) {
  .memory-tools { gap: 4px; flex-wrap: wrap; }
  .memory-tools #memory-index { font-size: 13px; }
}

/* Held water targets show a cool ready glow; release remains the only commit. */
#rings button.ring[data-water-aim] {
  border-color: #8de6f5;
  box-shadow: 0 0 0 3px #286775, 0 0 0 6px #e3fcff, 0 0 18px #8edcf5;
}

/* Keep action pictograms and their labels readable without shifting the 3D hit target. */
#rings .ring-count {
  transform: translateX(clamp(var(--ring-label-left, -100vw), calc(-50% + var(--ring-label-shift, 0px)), calc(var(--ring-label-right, 100vw) - 100%)));
}
#care-progress.picture-progress i { flex-basis: 22px; height: 22px; }
#care-progress.picture-progress i:not(.filled):first-child,
#care-progress.picture-progress i.filled + i:not(.filled) { box-shadow: inset 0 0 0 1px #97621f; }
/* A returning child sees the same illustrated invitation as the finale. */
#btn-next-chore .next-story-thumb { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }

/* Finale choices occupy predictable rows even while a film finishes or rotates. */
#cutscene-overlay .chapter-actions:has(#cutscene-choose-story:not([hidden])) {
  align-items: stretch;
}
#cutscene-overlay .chapter-actions:has(#cutscene-choose-story:not([hidden])) #cutscene-play-next-story { grid-row: 1; }
#cutscene-overlay .chapter-actions:has(#cutscene-choose-story:not([hidden])) #cutscene-choose-story { grid-row: 2; grid-column: 1; align-self: stretch; }
#cutscene-overlay .chapter-actions:has(#cutscene-choose-story:not([hidden])) #cutscene-continue { grid-row: 2; grid-column: 2; align-self: stretch; }

/* The picture book keeps page turns within reach while reading a long fact. */
@media (orientation: portrait) and (max-width: 640px) {
  #care-memory .guide-tools, #guide-page .guide-tools {
    position: sticky; top: 0; z-index: 2; padding-block: 4px;
    background: #f8efd9; border-radius: 8px;
  }
}
@media (max-width: 380px) {
  #guide-page .guide-tools { gap: 4px; flex-wrap: wrap; }
  #guide-index { font-size: 13px; }
}

/* The earned picture replaces the care heading, rather than layering over it.
   Visibility preserves the measured banner footprint for the reaction camera. */
#activity-ui .act-banner.gone { visibility: hidden; }
.memory-writing #memory-story { font-family: Arial, sans-serif; }

/* The full chore board fits its picture tiles instead of clipping the last one. */
.on-farm #story-progress:not([hidden]) {
  width: min(calc(var(--board-count, 3) * 64px + 12px), calc(100vw - var(--safe-left) - var(--safe-right) - 20px));
  max-width: none; box-sizing: border-box;
}
.on-farm #story-progress .board-tile { width: 100%; min-width: 52px !important; }
.on-farm #story-progress .board-tile .chore-label {
  white-space: normal; line-height: 1.05; text-align: center; overflow-wrap: anywhere;
}
.on-farm #story-progress .chore-heading { min-width: 0; }
#btn-next-chore .farm-story-title {
  display: block; font: 700 13px/1.15 Arial, sans-serif; margin-top: 3px;
}
@media (max-width: 380px) {
  #btn-next-chore .farm-story-title { font-size: 12px; }
}

/* Match the Guide's start and stop listening affordance in care memories. */
#memory-listen:not(:disabled)[data-listening] { background: #f5dfad; color: #4c341f; border-color: #aa864b; }

/* Picture-led choices in the album and guide, with one generous target per card. */
#badge-play:not([hidden]) { display: inline-flex; align-items: center; gap: 9px; font-family: Arial, sans-serif; }
.badge-play-icon, .badge-play-icon svg { display: block; width: 24px; height: 24px; flex: none; }
#island-guide .guide-card { position: relative; }
#island-guide .guide-card-recording {
  position: absolute; top: 5px; left: 5px; display: grid; place-items: center;
  width: 25px; height: 25px; border-radius: 50%; background: #fff6d5;
  color: #315841; box-shadow: 0 1px 3px #3a382b40; pointer-events: none;
}
#island-guide .guide-card-recording svg { width: 17px; height: 17px; color: inherit; border-radius: 0; }


/* A picture checklist shares the same care symbols as the farm tickets. */
#badge-goals li:has(.badge-goal-picture) { align-items: center; gap: 8px; }
.badge-goal-picture {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px;
  background: #fff6de; border: 1px solid #b8a17d; border-radius: 8px;
}
.badge-goal-picture svg { width: 27px; height: 27px; }
#badge-goals li.done .badge-goal-picture { background: #e0ebd4; border-color: #6a8964; }
#badge-goals li:has(.badge-goal-picture):not(.done)::before { width: 14px; height: 14px; }
#badge-goals li:has(.badge-goal-picture).done::before { width: 17px; height: 17px; line-height: 17px; }
#care-progress.picture-progress i { flex-basis: 25px; height: 25px; }
#care-progress.picture-progress i:not(.filled):first-child,
#care-progress.picture-progress i.filled + i:not(.filled) { border-color: #95601e; box-shadow: inset 0 0 0 2px #b98135; }

/* Show that a completed film is waiting for its automatic handoff. */
#movie-auto-next:not([hidden]) {
  position: absolute; z-index: 2; bottom: 12px; right: 8px; pointer-events: none;
  background: #203632ed; color: #fff8dd; border-radius: 6px;
  padding: 5px 9px; font: 700 13px/1.2 Arial, sans-serif;
}
#movie-auto-next .movie-next-arrow { display: inline-block; vertical-align: -1px; border-block: 5px solid transparent; border-left: 8px solid #f9d182; margin-right: 3px; }
.theater-program:has(#cutscene-pause[aria-pressed="true"]) #movie-auto-next { display: none; }
@media (max-width: 380px) {
  #movie-auto-next:not([hidden]) { font-size: 11px; padding: 4px 6px; bottom: 10px; }
  #care-progress.picture-progress i { flex-basis: 22px; height: 22px; }
}

/* A story handoff starts a new film; it is not a skip button. */
#cutscene-next[aria-label^="Watch next:"]::before { clip-path: polygon(20% 8%, 90% 50%, 20% 92%); }
/* The picture itself remains a large toggle and now shows its zoom state. */
#guide-scale[aria-pressed="true"]::before { box-shadow: inset 0 0 0 2px #305b4d, inset 0 0 0 4px currentColor; }

/* Picture-first gesture at the destination. Kept away from its exact center. */
#rings .ring-gesture { position: absolute; right: -5px; top: -8px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #fff7df; color: #315d43; border: 1px solid #9c7945; pointer-events: none; }
#rings .ring-gesture svg { width: 21px; height: 21px; }
#rings .ring-gesture[data-gesture="rub"] svg { animation: gesture-rub 1.4s ease-in-out infinite; }
#rings .ring-gesture[data-gesture="drag"] svg { animation: gesture-drag 1.5s ease-in-out infinite; }
@keyframes gesture-rub { 0%, 100% { transform: translateX(-4px); } 50% { transform: translateX(4px); } }
@keyframes gesture-drag { 0%, 100% { transform: translate(-3px, 4px); } 60% { transform: translate(3px, -3px); } }
.reduced #rings .ring-gesture svg { animation: none; }
@media (prefers-reduced-motion: reduce) { #rings .ring-gesture svg { animation: none; } }

/* The destination remains a drop target while the first gesture belongs to the tray. */
#rings button.ring[data-pickup-first] {
  border: 2px solid #f8e8af;
  background: transparent;
  box-shadow: 0 0 0 1px #554934;
}
#rings button.ring[data-pickup-first]::before,
#rings button.ring[data-pickup-first] .ring-gesture { display: none; }
#rings button.ring[data-pickup-first] .ring-count {
  background: #fff8e8;
  color: #594b35;
  border-color: #a48b65;
  box-shadow: none;
}

/* During the wind's reward, the real bells become independent touch and keyboard targets. */
#rings .bell-answer {
  position: fixed; z-index: 11; width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  transform: translate(-50%, -50%); border-radius: 50%; padding: 0;
  border: 2px solid #fff1b2; box-shadow: 0 0 0 1px #80520b, inset 0 0 0 1px #80520b;
  background: transparent; pointer-events: auto; touch-action: manipulation; cursor: pointer;
}
#rings .bell-answer:focus-visible { outline: 3px solid #315d43; outline-offset: 4px; }
#rings .bell-answer:active { background: #fff1b233; }

/* Show the short sideways care motion without hiding the object itself. */
.tool-helper.rub-only { height: 32px; border: 0; }
.tool-helper.rub-only::after { display: none; }
.tool-helper.rub-only > span { top: 0; left: 50%; animation: none; }
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced) .tool-helper.rub-only > span { animation: helper-rub 1.45s ease-in-out infinite; }
}
@keyframes helper-rub {
  0%, 100% { transform: translateX(calc(-50% - 20px)) rotate(-12deg); }
  50% { transform: translateX(calc(-50% + 20px)) rotate(12deg); }
}

/* Just like guide pages, badge pages turn directly to the next pictured seal. */
.badge-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
#badge-folio { margin-inline: auto; white-space: nowrap; font: 600 13px/1.15 Arial, sans-serif; }
#badge-index { min-height: 44px; font: 700 14px/1.15 Arial, sans-serif; padding-inline: 8px; white-space: nowrap; }
#badge-next, #badge-prev { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.badge-next-preview:not(:empty) { display: block; width: 29px; height: 29px; }
.badge-next-preview svg { width: 100%; height: 100%; display: block; }
#badge-next [data-icon] svg { transform: rotate(180deg); }
@media (min-width: 700px) and (orientation: landscape) and (max-height: 510px) {
  .badge-tools { grid-area: 1 / 1 / 2 / 3; }
  #badge-page:not(.pony-friends) .badge-reading { grid-area: 2 / 2; }
}
/* Short landscape keeps the badge, its checklist and the play ticket together. */
@media (min-width: 700px) and (orientation: landscape) and (max-height: 460px) {
  #badge-page:not(.pony-friends) .badge-tools { margin-bottom: 0; }
  #badge-page:not(.pony-friends) #badge-title { font-size: 24px; }
  #badge-page:not(.pony-friends) #badge-instruction { margin: 3px 0; font-size: 15px; }
  #badge-page:not(.pony-friends) #badge-goals { margin-bottom: 5px; }
  #badge-page:not(.pony-friends) #badge-goals li { padding: 2px 0; font-size: 15px; }
  #badge-page:not(.pony-friends) .badge-goal-picture { width: 25px; height: 25px; border-radius: 6px; }
  #badge-page:not(.pony-friends) .badge-goal-picture svg { width: 21px; height: 21px; }
  #badge-page:not(.pony-friends) #badge-play { min-height: 44px; padding: 5px 10px; }
  .large-text #badge-page:not(.pony-friends) #badge-goals li { font-size: 1.23rem; }
}
@media (orientation: portrait) and (max-width: 640px) {
  #badge-page .badge-tools { position: sticky; top: 0; z-index: 2; padding-block: 4px; background: #f8efd9; border-radius: 8px; }
}

/* Keep the name above a collection and its gesture on the lower right arc. */
#rings .collection-ring .ring-gesture, #rings .shelf-ring .ring-gesture,
#rings .ring[data-gesture="deposit"] .ring-gesture { top: auto; right: -5px; bottom: -5px; }
#rings .ring[data-gesture="deposit"] .ring-count { top: -15px; bottom: auto; }
/* Carry a pictured handful from the tray, then release it into the feeder. */
.tool-helper.deposit-only > span::after {
  content: ''; position: absolute; left: 5px; top: -7px; width: 22px; height: 10px;
  border-radius: 35%; background: repeating-linear-gradient(112deg, #9e6b25 0 2px, #eac46a 2px 4px, #ffdc88 4px 6px);
  border: 1px solid #9e6b25; transform: rotate(-12deg);
}
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced) .tool-helper.deposit-only > span::after { animation: helper-hay-release 1.75s ease-in-out infinite; }
  body:not(.reduced) #rings .ring-gesture[data-gesture="deposit"] svg { animation: hay-drop 1.5s ease-in-out infinite; }
}
@keyframes helper-hay-release { 0%, 65% { opacity: 1; transform: translateY(0) rotate(-12deg); } 88%, 100% { opacity: 0; transform: translateY(9px) rotate(15deg); } }
@keyframes hay-drop { 0%, 100% { transform: translateY(-3px); } 65% { transform: translateY(3px); } }

/* The outgoing film names and pictures what will play next. */
#movie-auto-next:not([hidden]) { display: flex; align-items: center; gap: 5px; }
#movie-auto-next .movie-next-preview { width: 35px; height: 24px; object-fit: cover; border-radius: 4px; }
#movie-auto-next .movie-next-arrow { flex: none; margin-right: 0; }
@media (max-width: 350px) { #movie-auto-next .movie-next-preview { width: 27px; height: 19px; } }
/* One unmistakable forward ticket in each illustrated book reader. */
:is(#badge-next, #guide-next, #memory-next):not(:disabled) { background: #355e4d; border-color: #355e4d; color: #fffaf0; }
:is(#badge-next, #guide-next, #memory-next):not(:disabled):focus-visible { outline: 3px solid #9c642d; outline-offset: 2px; }
#cutscene-play-next-story:not([hidden])::after {
  content: ''; width: 10px; height: 10px; flex: none; border: solid currentColor; border-width: 0 3px 3px 0; transform: rotate(-45deg); margin-inline-start: 2px;
}
/* Keep long care trails within the header on narrow phones. */
.act-heading { min-width: 0; }
#care-progress.picture-progress i { min-width: 0; }

/* The optional musical reply is the invitation; the exit stays available. */
#reaction-continue.quiet-exit {
  color: #604a35; background: #fff8e9; border-color: #baa17c;
  box-shadow: 0 2px 0 #c8b18e; font-size: 17px;
}
#activity-ui:has(#reaction-continue.quiet-exit) #rings .bell-answer {
  border-color: #fff8d7; box-shadow: 0 0 0 2px #9c641e, inset 0 0 0 1px #9c641e;
}

/* Keep the spring tap label away from the nearby helper on a tall phone. */
#rings .ring[data-label-above] .ring-count { top: -15px; bottom: auto; }

/* Page position also reads as a small picture, without more buttons or text. */
:is(#memory-folio, #guide-folio, #badge-folio) {
  padding-bottom: 6px;
  background: linear-gradient(to right, #527a56 var(--folio-progress, 0%), #d9cbb4 0) bottom center / 100% 4px no-repeat;
}
#rings .ring[data-label-above] .ring-gesture { top: auto; bottom: -5px; left: -5px; right: auto; }

/* First collect the pictured tool, then follow the destination's action. */
#rings button.ring[data-pickup-first] .ring-count { visibility: hidden; }
.tidy-item .source-pickup-label { display: none; }
.tidy-item[data-pickup-cue]:not([hidden]) .source-pickup-label {
  display: block; position: absolute; left: 50%; top: calc(100% + 6px);
  transform: translateX(clamp(var(--source-label-left, -100vw), -50%, calc(var(--source-label-right, 100vw) - 100%)));
  padding: 4px 8px; border-radius: 9px; white-space: nowrap;
  background: #fff3c7; color: #503921; border: 1px solid #966225;
  font: 800 13px/1.2 Arial, sans-serif; pointer-events: none;
}
/* Use the existing name row so the demonstration hand never covers the words. */
#tray .tool[data-pickup-cue] .tool-name { display: none; }
#tray .tool[data-pickup-cue]::after {
  content: 'Pick up'; grid-row: 2; color: #503921;
  font: 800 clamp(12px, 1.6vw, 16px)/1.1 Arial, sans-serif;
  white-space: nowrap; pointer-events: none;
}
/* When the real pitcher has its own label, keep the familiar tray name. */
#activity-ui:has(.tidy-item[data-pickup-cue]:not([hidden])) #tray .tool[data-pickup-cue] .tool-name { display: block; }
#activity-ui:has(.tidy-item[data-pickup-cue]:not([hidden])) #tray .tool[data-pickup-cue]::after { display: none; }

/* All completed music toys are tappable as soon as the reward appears. */
#rings .bell-answer[data-wind-note] { border-color: #fffdf5; background: #ffda6238; box-shadow: 0 0 0 3px #f4bb4d, 0 0 18px 6px #ffe4a5; }

/* Bigger: distinguish a selected object from its destination. */
#activity-ui[data-tidy-match]:not([data-tidy-selected]) .shelf-ring {
  border-style: dashed;
  box-shadow: 0 0 0 2px #fff1c9;
}
#activity-ui[data-tidy-selected] .tidy-item[data-floor-item] {
  border-style: solid;
  box-shadow: 0 0 0 3px var(--tidy-match), 0 0 0 6px #fff6c1;
}
#activity-ui[data-tidy-selected] .shelf-slot-picture.current {
  outline: 3px solid #ffdf63;
  outline-offset: 2px;
}
/* Let the longer match prompt wrap inside its own header on narrow phones. */
#activity-ui.tidy-aisle #tidy-instruction:not([hidden]) {
  min-width: 0;
  white-space: normal;
}
#activity-ui.tidy-aisle #tidy-instruction .tidy-prompt-text {
  min-width: 0;
  line-height: 1.12;
}
#activity-ui.tidy-aisle #tidy-count { flex: none; }

/* The optional reply leads with the real prop, not the chapter exit. */
#reaction-continue.quiet-exit .ico { width: 22px; height: 22px; }
#reaction-continue.quiet-exit { padding-inline: 12px; min-width: 0; }

/* Keep the portrait hay picture clear of the helper. The ring stays on the net. */
#rings .ring[data-label-below] .ring-count { top: auto; bottom: -15px; }
#rings .ring[data-label-below] .ring-gesture { top: -5px; bottom: auto; right: -5px; }
/* The porch hook label should not cover the face beside the first post. */
@media (orientation: portrait) {
  #rings .ring[data-zone="zone_bells"] .ring-count { top: auto; bottom: -15px; }
  #rings .ring[data-zone="zone_bells"] .ring-gesture { top: -5px; bottom: auto; right: -5px; }
}

/* Keep the grooming cue outside the material patch without shrinking the hit area. */
#rings .ring[data-zone="zone_coat"] .ring-gesture { right: -13px; top: -13px; }
#rings .ring[data-badge-side="left"] .ring-gesture { left: -13px; right: auto; }
#rings .ring[data-badge-quiet] .ring-gesture { opacity: 0; }

/* Matching pictures stay large enough to distinguish on the phone. */
#rings .ring-count[data-pony-crate] svg { width: 27px; height: 27px; }
#rings .ring-count[data-pony-crate] { background: #fff2cc; color: #4e3929; }

/* Let the child see the material inside the ring before touching it. */
#rings .ring[data-zone="zone_coat"] .ring-count[data-coat-material] {
  top: auto; bottom: -28px; background: #fff2cc; color: #4e3929;
}
#rings .ring-count[data-coat-material] svg { width: 26px; height: 26px; }

/* Preserve the painted pony face on the near side of either pail. */
#rings .ring[data-zone="zone_bucket"] .ring-count[data-pony-crate] {
  top: auto; bottom: -28px;
}

/* Bigger tidy: one bright hand at a time. The selected floor item keeps its
   matching color, but the shelf becomes the obvious place to touch next. */
#activity-ui.tidy-aisle[data-tidy-match]:not([data-tidy-selected]) #rings .shelf-ring {
  box-shadow: 0 0 0 2px var(--tidy-match, #8c632d);
  border-style: dashed;
}
#activity-ui.tidy-aisle[data-tidy-match]:not([data-tidy-selected]) #rings .shelf-ring .ring-gesture,
#activity-ui.tidy-aisle[data-tidy-selected] .tidy-item .source-hand {
  display: none;
}
#activity-ui.tidy-aisle[data-tidy-selected] .tidy-item[data-floor-item] {
  border: 2px solid #fff3cf;
  box-shadow: 0 0 0 2px var(--tidy-match, #78502a);
}
#activity-ui.tidy-aisle[data-tidy-selected] .tidy-item[data-floor-item]::before {
  animation: none;
  content: none;
}
#activity-ui.tidy-aisle[data-tidy-selected] #rings .shelf-ring {
  border-color: #fff9d4;
  box-shadow: 0 0 0 3px var(--tidy-match, #8c632d), 0 0 15px 5px #ffe19a;
}

#rings .ring[data-zone="zone_tap"][data-label-above] .ring-count { top: -43px; }
#rings .ring[data-zone="zone_tap"][data-label-above][data-badge-side="right"] .ring-gesture {
  left: auto; right: -5px;
}
/* A present is picked up by its whole wrapping; the outline hugs the parcel
   and the hand stays a small corner pictogram. */
.tidy-item[data-gift-item] {
  border-width: 2px; border-radius: 12px;
  box-shadow: 0 0 0 1px #77502fa8, 0 0 12px 2px #ffdb7988;
}
.tidy-item[data-gift-item]::before { inset: -3px; border-width: 1.5px; }

/* Projected pickup and destination controls may contract, but stay touch-sized. */
#rings button.ring { min-width: 52px; min-height: 52px; }

/* A single control has a single painted face. Retain the camera clearance. */
#activity-ui .tray:has(> button:only-child) { background: transparent; border-color: transparent; box-shadow: none; }
body:not(.on-farm) :is(#btn-corner, #btn-speaker) { border-style: solid; box-shadow: 0 2px 5px #51372233; }
.on-farm.guided-farm #btn-next-chore { box-shadow: 0 2px 5px #51372245; }
