:root {
  --paper: #f7f0de;
  --paper-2: #ece1c6;
  --paper-line: #d9cba8;
  --ink: #26323a;
  --ink-soft: #5e6a6c;
  --pine: #17302a;
  --pine-2: #204239;
  --pine-3: #2f5a4c;
  --sun: #f2b63c;
  --rust: #c2552d;
  --moss: #2f8f55;
  --cream: #fbf6e8;
  --scene-bg: #111;
  --display: 'Lilita One', 'Arial Black', Impact, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --hand: 'Caveat', 'Segoe Print', 'Bradley Hand', cursive;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--body);
  color: var(--cream);
  background: var(--pine);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }

.btn {
  border: 2px solid var(--ink);
  background: var(--cream);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 16px;
  font-weight: 800;
  box-shadow: 0 3px 0 var(--ink);
  transition: transform .08s, box-shadow .08s, background .15s;
  white-space: nowrap;
}
.btn:hover { background: #fff; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: default; transform: none; box-shadow: 0 3px 0 var(--ink); }
.btn.primary { background: var(--sun); }
.btn.primary:hover { background: #f8c658; }
.btn.ghost { background: transparent; color: var(--cream); border-color: var(--cream); box-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
.btn.ghost:hover { background: rgba(255, 255, 255, .1); }
.btn.ghost b { color: var(--sun); margin-left: 4px; }

.icon-btn {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border: 2px solid rgba(255, 255, 255, .28);
  border-radius: 10px;
  background: rgba(255, 255, 255, .07);
  color: var(--cream);
  padding: 0;
}
.icon-btn:hover { background: rgba(255, 255, 255, .17); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg .fill { fill: currentColor; stroke: none; }
#btnMute .cross { display: none; }
#btnMute.muted .cross { display: block; }
#btnMute.muted .wave { display: none; }

/* ---------- menu ---------- */
#menu {
  overflow-x: clip;
  min-height: 100dvh;
  padding: clamp(18px, 3.4vw, 44px) clamp(16px, 4vw, 56px) 24px;
  max-width: 1360px;
  margin: 0 auto;
}
body[data-screen="menu"], body[data-screen="notes"] {
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(242, 182, 60, .22), transparent 70%),
    radial-gradient(900px 600px at 0% 110%, rgba(47, 143, 85, .25), transparent 70%),
    var(--pine);
  background-attachment: fixed;
}
.hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.hero h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(46px, 8vw, 104px);
  line-height: .95;
  margin: 0;
  color: var(--sun);
  letter-spacing: .5px;
  text-shadow: 0 5px 0 #8a4a14;
}
.hero h1 span { display: block; font-size: .56em; color: var(--cream); text-shadow: 0 3px 0 rgba(0, 0, 0, .35); margin-bottom: 6px; }
.hero p { max-width: 54ch; font-size: clamp(15px, 1.5vw, 18px); line-height: 1.5; margin: 16px 0 0; color: #dfe6d9; }
.lens {
  position: relative; flex: none;
  width: clamp(96px, 16vw, 200px); aspect-ratio: 1;
  border-radius: 50%;
  border: clamp(8px, 1.2vw, 14px) solid var(--ink);
  outline: 3px solid var(--sun);
  background: radial-gradient(circle at 35% 30%, #d6f1f4, #7fbcd0);
  transform: rotate(-8deg);
  margin-right: clamp(10px, 3vw, 40px);
}
.lens img { position: absolute; inset: 8%; width: 84%; height: 84%; object-fit: contain; filter: brightness(0) opacity(.82); clip-path: circle(50%); }
.lens i { position: absolute; left: 84%; top: 84%; width: 62%; height: 16%; border-radius: 99px; background: var(--rust); border: 3px solid var(--ink); transform-origin: 0 50%; transform: rotate(45deg); }

.menu-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.segmented { display: inline-flex; background: rgba(0, 0, 0, .28); border-radius: 12px; padding: 4px; gap: 4px; max-width: 100%; }
.segmented button {
  border: 0; background: transparent; color: var(--cream);
  padding: 7px 16px; border-radius: 9px; display: grid; text-align: left; min-width: 0;
}
.segmented strong { font-size: 15px; }
.segmented small { font-size: 11.5px; opacity: .78; }
.segmented button:hover { background: rgba(255, 255, 255, .08); }
.segmented button[aria-checked="true"] { background: var(--sun); color: var(--ink); }
.segmented button[aria-checked="true"] small { opacity: .85; }

.scene-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 18px; }
.scene-card {
  position: relative; display: flex; flex-direction: column;
  padding: 0; text-align: left; overflow: hidden;
  border: 0; border-radius: 14px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 6px 0 rgba(0, 0, 0, .3);
  transition: transform .16s, box-shadow .16s;
}
.scene-card:hover { transform: translateY(-4px) rotate(-.5deg); box-shadow: 0 10px 0 rgba(0, 0, 0, .3); }
.scene-card:active { transform: translateY(1px); box-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
.scene-card img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: #33423c; }
.card-biome {
  position: absolute; top: 10px; left: 10px;
  background: var(--paper); color: var(--ink);
  font-size: 12px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase;
  padding: 3px 9px; border-radius: 99px; box-shadow: 0 2px 0 rgba(0, 0, 0, .35);
}
.card-body { padding: 12px 14px 12px; display: grid; gap: 3px; flex: 1; align-content: start; }
.card-body strong { font-family: var(--display); font-weight: 400; font-size: 21px; letter-spacing: .3px; }
.card-body small { font-size: 13.5px; line-height: 1.35; color: var(--ink-soft); min-height: 2.7em; }
.card-foot { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 800; color: var(--ink-soft); margin-top: 3px; }
.mini-stars { font-size: 18px; letter-spacing: 1px; color: #cfc2a0; line-height: 1; }
.mini-stars .on { color: #e29a16; }
.legal { margin-top: 26px; font-size: 12px; line-height: 1.5; color: #a6b6ab; max-width: 90ch; }
.legal a { color: inherit; }

/* ---------- play ---------- */
#play {
  height: 100dvh;
  display: grid;
  grid-template: "hud hud" auto "stage book" minmax(0, 1fr) / minmax(0, 1fr) 262px;
  background: var(--scene-bg);
}
.hud {
  grid-area: hud;
  display: flex; align-items: center; gap: 14px;
  padding: 7px 12px;
  background: var(--pine);
  border-bottom: 2px solid #0c1c18;
  min-width: 0;
}
.hud-title { display: grid; min-width: 0; line-height: 1.15; margin-right: auto; }
.hud-title strong { font-family: var(--display); font-weight: 400; font-size: 20px; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-title small { font-size: 12px; color: #a9bdb0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-stats { display: flex; gap: 20px; margin: 0; }
.hud-stats div { text-align: center; line-height: 1.05; }
.hud-stats dt { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: #a9bdb0; font-weight: 800; }
.hud-stats dd { margin: 2px 0 0; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hud-tools { display: flex; align-items: center; gap: 7px; margin-left: 8px; }
.btn.hint { background: var(--sun); padding: 7px 12px; }
.btn.hint b { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 3px; border-radius: 99px; background: var(--ink); color: var(--cream); font-size: 12px; }

.stage {
  grid-area: stage;
  position: relative; min-height: 0; min-width: 0;
  display: grid; place-items: center;
  overflow: hidden;
  background: var(--scene-bg);
}
.scene-wrap {
  position: relative; overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'%3E%3Cpath d='M22 22l11 11' stroke='%2326323a' stroke-width='8' stroke-linecap='round'/%3E%3Cpath d='M23 23l9 9' stroke='%23c2552d' stroke-width='4.5' stroke-linecap='round'/%3E%3Ccircle cx='14' cy='14' r='10.500' fill='%23ffffff40' stroke='%2326323a' stroke-width='5'/%3E%3Ccircle cx='14' cy='14' r='10.500' fill='none' stroke='%23f2b63c' stroke-width='2'/%3E%3C/svg%3E") 14 14, crosshair;
}
.scene-wrap.over-cover { cursor: pointer; }
.scene-wrap.dragging { cursor: grabbing; }
.scene-wrap.startled { cursor: not-allowed; animation: shake .36s; }
.scene-wrap > svg, .scene-wrap > canvas, #lantern { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#particles, #fxSvg, #lantern, #toast, #loading { pointer-events: none; }
#fxSvg { overflow: hidden; }

/* Dark everywhere except a pool of warm light that follows the pointer. A radial gradient's
   last colour carries on to the edges, so this one layer darkens the whole scene. */
#lantern {
  background:
    radial-gradient(circle var(--lr, 240px) at var(--lx, 50%) var(--ly, 45%), rgba(255, 196, 110, .12), rgba(255, 196, 110, 0) 82%),
    radial-gradient(circle var(--lr, 240px) at var(--lx, 50%) var(--ly, 45%), rgba(6, 7, 16, 0) 55%, rgba(6, 7, 16, .5) 80%, rgba(6, 7, 16, .84) 100%);
}

.sprite { pointer-events: auto; }

/* Scenery that opens or shakes. fill-box keeps every pivot on the prop itself at any zoom. */
.leaf { transform-box: fill-box; transition: transform .42s cubic-bezier(.3, 1.25, .5, 1); }
.cover.hover:not(.open) .leaf { filter: brightness(1.14); }
/* The shake sits on its own element, so it can't fight the leaf's move for the same property. */
.shake { transform-box: fill-box; transform-origin: inherit; }
.leaf[data-hinge="left"] { transform-origin: 0% 50%; }
.leaf[data-hinge="right"] { transform-origin: 100% 50%; }
.leaf[data-hinge="fold-left"] { transform-origin: 0% 100%; }
.leaf[data-hinge="fold-right"] { transform-origin: 100% 100%; }
.leaf[data-hinge="top"] { transform-origin: 50% 0%; }
.leaf[data-hinge="bottom"], .leaf[data-hinge="part"] { transform-origin: 50% 100%; }
.leaf[data-hinge="part-top"] { transform-origin: 50% 0%; }
.leaf[data-hinge="lift"] { transform-origin: 50% 50%; }
.cover.open .leaf[data-hinge="left"] { transform: scaleX(-.56) skewY(-7deg); }
.cover.open .leaf[data-hinge="right"] { transform: scaleX(-.56) skewY(7deg); }
.cover.open .leaf[data-hinge="fold-left"], .cover.open .leaf[data-hinge="fold-right"] { transform: scale(.34, .6); }
.cover.open .leaf[data-hinge="top"] { transform: scaleY(-.8); }
.cover.open .leaf[data-hinge="lift"] { transform: translate(var(--lx), var(--ly)) rotate(var(--lr)); }
.cover.open .leaf[data-hinge="bottom"] { transform: scale(1.14, .3); }
.cover.open .leaf[data-hinge="part"], .cover.open .leaf[data-hinge="part-top"] { transform: translateX(var(--gap)) rotate(var(--tilt)); }
/* Shaken things tremble first, then give way. */
.cover[data-how="part"] .leaf, .cover[data-how="spill"] .leaf { transition: transform .4s .26s ease-out; }
.cover[data-how="part"].open .shake, .cover[data-how="spill"].open .shake { animation: cover-shake .28s linear; }
@keyframes cover-shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-3deg); }
  40% { transform: rotate(3deg); }
  60% { transform: rotate(-2.4deg); }
  80% { transform: rotate(2.4deg); }
}
.cover.rustle .shake { animation: cover-rustle .6s ease-in-out; }
.cover[data-how="door"].rustle .shake { animation-name: cover-rattle; }
@keyframes cover-rustle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-1.6deg); }
  50% { transform: rotate(1.6deg); }
  75% { transform: rotate(-.8deg); }
}
@keyframes cover-rattle {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-1.6px); }
  50% { transform: translateX(1.6px); }
  75% { transform: translateX(-.8px); }
}
.sprite.emerge, .sprite.emerge-tall { transform-box: fill-box; animation: emerge .4s cubic-bezier(.2, 1.3, .4, 1) both; }
.sprite.emerge-tall { --rise: 46%; }
@keyframes emerge { from { transform: translateY(var(--rise, 10%)); } to { transform: translateY(0); } }
.fx-fleck { transform-box: fill-box; transform-origin: center; animation: fleck 1s ease-in both; }
@keyframes fleck {
  from { transform: translate(0, 0) rotate(0); opacity: 1; }
  to { transform: translate(var(--dx), var(--dy)) rotate(var(--spin)); opacity: 0; }
}
.fx-empty { font: 700 26px Caveat, 'Comic Sans MS', cursive; fill: #fff; stroke: #26323a; stroke-width: 4px; paint-order: stroke; text-anchor: middle; animation: empty-note 1.2s ease-out both; }
@keyframes empty-note {
  0% { opacity: 0; transform: translateY(8px); }
  18%, 70% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); }
}
.sprite.peek { animation: peek var(--peek-dur, 8s) ease-in-out var(--peek-delay, 0s) infinite; }
@keyframes peek {
  0%, 82%, 100% { transform: translate(0, 0); }
  88%, 94% { transform: translate(var(--px, 0), var(--py, 0)); }
}

.fx-pop { transform-box: fill-box; transform-origin: center; animation: pop 1.6s cubic-bezier(.2, 1.3, .4, 1) both; }
.fx-pop.rare { animation-duration: 1.7s; }
@keyframes pop {
  0% { transform: scale(.7); opacity: 0; }
  14% { transform: translateY(-14%) scale(1.3); opacity: 1; }
  78% { transform: translateY(-14%) scale(1.3); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 0; }
}
.fx-ring { fill: none; stroke-width: 7; transform-box: fill-box; transform-origin: center; animation: ring .7s ease-out both; }
@keyframes ring { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
.fx-spark { animation: spark .7s ease-out both; }
@keyframes spark { from { transform: translate(0, 0); opacity: 1; } to { transform: translate(var(--dx), var(--dy)); opacity: 0; } }
.fx-badge { transform-box: fill-box; transform-origin: center; animation: badge .35s .5s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes badge { from { transform: scale(0); } to { transform: scale(1); } }
.fx-miss { transform-box: fill-box; transform-origin: center; animation: miss .6s ease-out both; }
@keyframes miss { 0% { transform: scale(.4); opacity: 0; } 20% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }
.fx-hint circle { fill: rgba(255, 224, 120, .06); stroke: #ffe078; stroke-width: 6; transform-box: fill-box; transform-origin: center; }
.fx-hint { animation: fade-out 4.2s linear both; }
.fx-hint .hint-b { fill: none; stroke-dasharray: 18 14; animation: spin 7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-out { 0%, 76% { opacity: 1; } 100% { opacity: 0; } }
.fx-reveal { fill: none; stroke: #ffd24a; stroke-width: 7; stroke-dasharray: 16 12; transform-box: fill-box; transform-origin: center; animation: spin 7s linear infinite; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

#toast {
  position: absolute; left: 50%; bottom: 14px;
  width: min(460px, calc(100% - 24px));
  transform: translate(-50%, 16px);
  opacity: 0;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 8px 14px 9px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .4);
  transition: opacity .18s, transform .18s;
  display: grid;
  z-index: 3;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast strong { font-family: var(--display); font-weight: 400; font-size: 19px; color: var(--moss); letter-spacing: .3px; }
#toast span { font-family: var(--hand); font-weight: 600; font-size: 21px; line-height: 1.1; }
#toast.rare { background: #ffeeb5; }
#toast.rare strong { color: #b5720c; }
#toast.warn strong { color: var(--rust); }

#loading {
  position: absolute; inset: 0;
  background: var(--scene-bg);
  display: grid; place-content: center; justify-items: center; gap: 12px;
  color: var(--cream); font-weight: 800; z-index: 5;
}
#loading p { margin: 0; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 5px solid rgba(255, 255, 255, .22); border-top-color: var(--sun); animation: spin 1s linear infinite; }

/* ---------- field notebook ---------- */
.notebook {
  grid-area: book;
  min-height: 0;
  overflow-y: auto;
  color: var(--ink);
  background:
    linear-gradient(90deg, transparent 27px, rgba(194, 85, 45, .35) 27px, rgba(194, 85, 45, .35) 29px, transparent 29px),
    repeating-linear-gradient(0deg, transparent 0 25px, var(--paper-line) 25px 26px),
    var(--paper);
  border-left: 2px solid #0c1c18;
  padding: 12px 10px 18px;
}
.notebook h2 { font-family: var(--hand); font-weight: 700; font-size: 29px; line-height: 1; margin: 0 0 10px 26px; }
#targets { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
#targets li {
  display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 8px; align-items: center;
  padding: 5px 7px;
  background: rgba(255, 255, 255, .62);
  border-radius: 10px;
  border: 1.5px solid var(--paper-line);
  cursor: pointer;
}
#targets li:hover { background: #fff; }
.t-pic { position: relative; width: 58px; height: 58px; border-radius: 9px; background: var(--paper-2); display: grid; place-items: center; font-family: var(--display); font-size: 28px; color: var(--ink-soft); }
.t-pic img { width: 54px; height: 54px; object-fit: contain; }
.t-text { display: grid; min-width: 0; }
.t-text strong { font-weight: 800; font-size: 15px; line-height: 1.15; }
.t-text small { font-size: 12px; line-height: 1.22; color: var(--ink-soft); margin-top: 1px; }
#targets li.done { background: #dcf1dc; border-color: #8fcb9c; }
#targets li.done strong { text-decoration: line-through; text-decoration-color: var(--moss); text-decoration-thickness: 2px; }
#targets li.done .t-pic::after {
  content: '✓'; position: absolute; right: -4px; bottom: -4px;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--moss); color: #fff; font: 800 14px var(--body); border: 2px solid #fff;
}
#targets li.rare-row { border-style: dashed; border-color: #b59b58; background: rgba(255, 238, 181, .6); cursor: default; }
#targets li.rare-row.done { background: #ffeeb5; border-style: solid; border-color: #e0a112; }
#targets li.rare-row.done strong { text-decoration: none; }
#targets li.rare-row.done .t-pic::after { background: #e0a112; content: '★'; }

/* ---------- field notes screen ---------- */
#notes { min-height: 100dvh; padding: clamp(14px, 3vw, 36px) clamp(14px, 4vw, 56px) 40px; max-width: 1360px; margin: 0 auto; }
.notes-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.notes-head h2 { font-family: var(--display); font-weight: 400; font-size: clamp(30px, 5vw, 48px); margin: 0; color: var(--sun); line-height: 1; }
.notes-head p { margin: 4px 0 0; color: #dfe6d9; }
.notes-group h3 { font-family: var(--display); font-weight: 400; font-size: 24px; margin: 26px 0 10px; letter-spacing: .3px; }
.notes-group h3 small { font-family: var(--body); font-size: 14px; font-weight: 700; color: #a9bdb0; margin-left: 6px; }
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 268px), 1fr)); gap: 10px; }
.note-card {
  display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; align-items: center;
  background: var(--paper); color: var(--ink); border-radius: 12px; padding: 8px 10px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .3);
}
.note-pic { width: 70px; height: 70px; background: var(--paper-2); border-radius: 10px; display: block; }
.note-pic img { width: 100%; height: 100%; object-fit: contain; display: block; filter: brightness(0) opacity(.42); }
.note-card.got img { filter: none; }
.note-card strong { font-weight: 800; font-size: 15px; }
.note-card p { margin: 2px 0 0; font-size: 12.5px; line-height: 1.3; color: var(--ink-soft); }
.note-card:not(.got) strong { color: var(--ink-soft); }
.chips { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: 1px; }
.chips i { font-style: normal; font-size: 10px; font-weight: 800; color: #fff; background: var(--c); padding: 1px 6px; border-radius: 99px; text-transform: capitalize; }

/* ---------- results ---------- */
#result {
  width: min(430px, calc(100vw - 24px));
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  text-align: center;
  padding: 18px 22px 22px;
  box-shadow: 0 10px 0 rgba(0, 0, 0, .45);
}
#result::backdrop { background: rgba(8, 14, 12, .46); }
.res-eyebrow { margin: 0; font-size: 13px; font-weight: 800; color: var(--ink-soft); }
#result h2 { font-family: var(--display); font-weight: 400; font-size: 38px; margin: 2px 0 2px; color: var(--moss); letter-spacing: .4px; }
.stars { font-size: 48px; line-height: 1; letter-spacing: 3px; color: #d6c9a6; }
.stars .on { color: #e29a16; text-shadow: 0 2px 0 #9f6a07; }
.res-table { margin: 12px 0; display: grid; gap: 3px; text-align: left; }
.res-table div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1.5px dashed var(--paper-line); }
.res-table dt { color: var(--ink-soft); font-weight: 700; }
.res-table dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; }
.res-table div:last-child { border: 0; font-size: 19px; }
.res-table div:last-child dt { color: var(--ink); }
.res-rare { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 2px 0 12px; font-family: var(--hand); font-size: 22px; font-weight: 600; line-height: 1.05; text-align: left; }
.res-rare img { width: 52px; height: 52px; object-fit: contain; flex: none; }
.res-rare.missed img { filter: brightness(0) opacity(.65); }
.res-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* ---------- small and tall screens: notebook becomes a strip under the scene ---------- */
@media (max-width: 960px), (max-aspect-ratio: 11/10) {
  #play { grid-template: "hud" auto "stage" minmax(0, 1fr) "book" auto / minmax(0, 1fr); }
  .notebook {
    border-left: 0; border-top: 2px solid #0c1c18;
    background: var(--paper);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    overflow: hidden;
  }
  .notebook h2 { display: none; }
  #targets { display: flex; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  #targets li { flex: 0 0 74px; grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 2px; padding: 4px 3px; }
  .t-pic { width: 46px; height: 46px; }
  .t-pic img { width: 44px; height: 44px; }
  .t-text small { display: none; }
  .t-text strong { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 68px; }
  #targets li.rare-row { cursor: default; }
}
@media (max-width: 720px) {
  .hud { gap: 7px; padding: 6px 7px; flex-wrap: wrap; }
  .hud-title { flex: 1 1 110px; }
  .hud-title strong { font-size: 16px; }
  .hud-title small { font-size: 11px; }
  .hud-stats { gap: 11px; order: 3; flex: 1 1 100%; justify-content: space-around; }
  .hud-stats div { display: flex; gap: 5px; align-items: baseline; }
  .hud-stats dd { font-size: 15px; margin: 0; }
  .hud-tools { margin: 0; gap: 4px; }
  .icon-btn { width: 36px; height: 36px; }
  .btn.hint { padding: 5px 8px; }
  .hero { gap: 12px; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; padding: 6px 8px; }
  #toast { bottom: 6px; padding: 5px 10px 6px; }
  #toast span { font-size: 18px; }
}
@keyframes cover-glow { 50% { filter: brightness(1.45); } }
@media (prefers-reduced-motion: reduce) {
  .sprite.peek, .fx-hint .hint-b, .fx-reveal, .fx-empty, .scene-wrap.startled, .leaf, .shake, .sprite.emerge, .sprite.emerge-tall { animation: none !important; transition: none !important; }
  /* Stirring is a clue, so it brightens instead of moving. */
  .cover.rustle .leaf { animation: cover-glow .6s ease-in-out !important; }
  .scene-card, .btn { transition: none; }
  .fx-pop { animation-duration: 1.6s; animation-timing-function: linear; }
}
