/* Ink on paper: a field-guide plate.  One warm colour for the creature,
   grey for the ghost of the best answer, red for waste. */
:root {
  --paper: #f3ead6;
  --paper-2: #e9dcc0;
  --paper-3: #fbf6ea;
  --ink: #2a2520;
  --ink-soft: #5d544a;
  --line: #c9bda8;
  --warm: #e0701f;
  --warm-dark: #b4530f;
  --ghost: #9a9286;
  --waste: rgb(198 47 38);
  --berry: #4b3a8f;
  --pinned: #a8a196;
  --bronze: #b5753d;
  --silver: #9fa3a8;
  --gold: #d4a72c;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --board: min(calc(100vw - 24px), 600px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100svh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.35;
}
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
button:focus { outline: none; }
button:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--warm); outline-offset: 2px; }

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 12px max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Play Lab bar: back left, Levels and How to play right ------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  max-width: 640px; margin: 0 auto;
  height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0;
  display: flex; align-items: center; gap: 8px;
  background: var(--paper);
}
.pl-back {
  margin-right: auto; min-height: 44px; display: inline-flex; align-items: center; padding: 0 4px;
  color: var(--ink); font-size: 16px; text-decoration: none; white-space: nowrap;
}
.pl-back { gap: 8px; font-weight: 600; }
.pl-back .pl-logo { flex: none; border-radius: 6px; }
.pl-back:focus-visible { outline: 3px solid var(--warm); outline-offset: 2px; }
.pl-btn {
  min-height: 44px; min-width: 44px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper-3); border: 1.5px solid var(--ink); border-radius: 4px; cursor: pointer; font-size: 15px; white-space: nowrap;
}
.pl-btn.news { box-shadow: inset 0 -4px 0 var(--warm); }
.pl-howto .short { display: none; font-weight: 600; font-size: 19px; }
@media (max-width: 359px) {
  .pl-howto { padding: 0; width: 44px; }
  .pl-howto .long { display: none; }
  .pl-howto .short { display: inline; }
}

/* ---- top line ---------------------------------------------------------- */
.top {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
.boards-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; min-width: 44px; padding: 0 12px 0 10px;
  background: var(--paper-3); border: 1.5px solid var(--ink); border-radius: 4px;
  cursor: pointer; font-size: 15px;
}
.boards-btn svg { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 2; }
.today-btn {
  min-width: 44px; min-height: 44px; padding: 0 10px; display: inline-flex; align-items: center; gap: 5px;
  background: var(--paper-3); border: 1.5px solid var(--ink); border-radius: 4px; cursor: pointer; font-size: 15px;
}
.today-btn svg { width: 18px; height: 18px; flex: none; }
.today-btn[hidden] { display: none; }
.where { text-align: left; line-height: 1.15; min-width: 0; }
.where { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-name { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); margin-right: 8px; }
.where strong { font-size: 18px; font-weight: 600; font-style: italic; }
.badge { display: none; }
.badge svg { width: 30px; height: 30px; }
.themes { width: var(--board); min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px; margin: 1px 0 2px; color: var(--ink-soft); font-size: 14px; }
.theme { min-height: 44px; padding: 0 8px; border: 1.5px solid var(--ink-soft); border-radius: 999px; background: var(--paper-3); color: var(--ink); cursor: pointer; font-size: 14px; }
.theme[aria-pressed="true"] { color: var(--paper-3); background: var(--ink); border-color: var(--ink); }

.hint {
  position: relative;
  margin: 0 0 6px; width: 100%; max-width: var(--board);
  font-size: 16px; line-height: 1.2; text-align: center; color: var(--ink);
  height: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
}
.hint-text { font-weight: 600; }
.hint.busy .hint-text { opacity: 0; visibility: hidden; }
.hint.busy { height: 44px; min-height: 44px; margin: 0 0 6px; }
.daily-note { width: min(100%, var(--board)); margin: -4px 0 6px; text-align: center; font-size: 15px; color: var(--ink-soft); }
.daily-note[hidden] { display: none; }
.unlock { display: flex; align-items: center; gap: 10px; justify-content: center; text-align: left; line-height: 1.2; }
.unlock > svg { width: 26px; height: 26px; flex: none; }
.unlock strong { font-size: 16px; }
.unlock .go { flex: none; white-space: nowrap; }
.unlock strong { font-weight: 600; }
.go {
  min-height: 44px; padding: 0 16px; border-radius: 4px; border: 1.5px solid var(--ink);
  background: var(--paper-3); color: var(--ink); cursor: pointer; font-size: 16px;
  animation: nudge 1.4s ease-in-out 3;
}

/* ---- key line under the board ----------------------------------------- */
.key {
  width: var(--board); margin: 12px 0 0; font-size: 16px; color: var(--ink);
  display: flex; flex-wrap: wrap; justify-content: center; gap: 5px 12px; line-height: 1.35;
}
.key .k { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.key .key-copy { flex-basis: 100%; justify-content: center; }
.key .k svg { flex: none; }
.key .pairs { gap: 7px; flex-basis: 100%; justify-content: center; color: var(--ink); }
.key .pair { display: inline-flex; align-items: center; gap: 1px; padding: 1px 6px; border: 1px solid rgba(42, 37, 32, .25); border-radius: 3px; }
.key .pair i { font-style: normal; font-size: 15px; line-height: 16px; margin: 0 3px 0 2px; }
.key .pair svg { display: block; }
.key .cycle { flex-basis: 100%; justify-content: center; color: var(--ink); gap: 3px; }
.key .cycle .cy { display: inline-flex; align-items: center; gap: 2px; }
.key .cycle i { font-style: normal; font-size: 15px; }
.key .cycle b { font-weight: 400; color: var(--ink-soft); margin: 0 2px; }

/* The opening is a picture. The header is deliberately the only type until
   the player has made the first move. */
#app.opening .hint-text, #app.opening .key, #app.opening .meter,
#app.opening .actions, #app.opening .run-controls, #app.opening .why, #app.opening .play-lab-footer,
#app.opening .result-links { display: none; }

/* ---- the plate (board) -------------------------------------------------- */
.plate {
  position: relative;
  width: var(--board); height: var(--board);
  background: var(--paper-3);
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 0 0 0 5px var(--paper), 0 0 0 6px rgba(42, 37, 32, .55);
}
#board { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
#board [tabindex]:focus { outline: none; }
#board [tabindex]:focus-visible .hit { stroke: var(--warm); stroke-width: 5; stroke-dasharray: 10 8; }
#board .grid line { stroke: rgba(42, 37, 32, .07); stroke-width: 2; }
.meadow-sky { fill: #fffaf0; }
.meadow-hill { pointer-events: none; }
.hill-one { fill: #edf1cf; opacity: .8; }
.hill-two { fill: #dce8bd; opacity: .82; }
.grass path { fill: none; stroke: #7e9b56; stroke-width: 5; stroke-linecap: round; opacity: .72; }
.grass .flower { fill: #f5a8a5; stroke: #8c5a59; stroke-width: 2; }

/* forager */
.ghost { fill: none; stroke: var(--ghost); stroke-width: 5; stroke-dasharray: 16 13; stroke-linecap: round; stroke-linejoin: round; }
.ghost.preview-muted { opacity: .62; }
.route { fill: none; stroke: var(--warm); stroke-width: 11; stroke-linecap: round; stroke-linejoin: round; opacity: .92; }
.extra-stretch { fill: none; stroke: var(--waste); stroke-width: 14; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.extra-stretch.preview { opacity: .7; stroke-width: 15; }
.extra-stretch.settled { opacity: .92; }
.extra-stretch.route-reveal { animation: route-reveal .36s ease-out; }
@keyframes route-reveal { 0% { opacity: .16; stroke-width: 25; } 100% { opacity: .92; stroke-width: 14; } }
.chev { fill: none; stroke: var(--warm-dark); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.berry .body { fill: var(--berry); stroke: var(--ink); stroke-width: 4; stroke-linejoin: round; }
.berry .shine { fill: rgba(255, 255, 255, .62); }
.berry .berry-dimple { fill: none; stroke: rgba(42, 37, 32, .42); stroke-width: 3; stroke-linecap: round; }
.berry .seed { fill: rgba(42, 37, 32, .52); }
.berry .berry-duck .body { fill: #d14f65; }
.berry .berry-squirrel .body { fill: #b53e55; }
.berry .leaf { fill: #6f8f3c; stroke: var(--ink); stroke-width: 3; }
.berry .shadow { fill: rgba(42, 37, 32, .22); opacity: .42; transform-box: fill-box; transform-origin: center; transition: transform 100ms ease-out, opacity 100ms ease-out; }
.berry .art { transform-box: fill-box; transform-origin: center; transition: transform 100ms ease-out; }
.berry.pinned .body { fill: var(--pinned); }
.berry.pinned .pin { stroke: var(--ink); stroke-width: 5; stroke-linecap: round; }
.berry.pinned .pinhead { fill: var(--ink); }
.berry.free { cursor: grab; }
.berry.free.dragging { cursor: grabbing; }
.berry.free.dragging .body { stroke-width: 6; }
.berry.free.dragging .shadow { transform: translateY(4px) scaleX(1.2); opacity: .22; }
.berry.free.dragging .leaf { animation: leaf-flick 150ms ease-out; transform-box: fill-box; transform-origin: 10% 100%; }
.berry.landing .art { animation: berry-land 160ms cubic-bezier(.34,1.56,.64,1); transform-box: fill-box; transform-origin: center; }
@keyframes leaf-flick { 0% { transform: rotate(-15deg); } 100% { transform: rotate(0); } }
@keyframes berry-land { 0% { transform: scale(1); } 42% { transform: scale(1.15, .8); } 100% { transform: scale(1); } }
.berry.guided .body { stroke: var(--warm); stroke-width: 7; }
.berry.guided .leaf { stroke: var(--warm-dark); stroke-width: 4; }
.berry.timed-hint .body { animation: hint-pulse 1.2s ease-in-out infinite; }
@keyframes hint-pulse { 50% { stroke-width: 10; } }
.berry .hit { fill: transparent; }
.berry { transition: opacity .2s; }
.berry.eaten { opacity: .18; }
.pulse { fill: none; stroke: var(--berry); stroke-width: 5; transform-box: fill-box; transform-origin: center; animation: pulse 1.6s ease-out infinite; pointer-events: none; }
@keyframes pulse { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(2.6); opacity: 0; } }
.choice { fill: none; stroke: var(--warm); stroke-width: 3; stroke-dasharray: 10 10; pointer-events: none; }
.choice-dot { fill: var(--warm); stroke: var(--ink); stroke-width: 2; pointer-events: none; }
.berry.rival .body { stroke: var(--warm); stroke-width: 7; }
.finger { fill: rgba(224, 112, 31, .18); stroke: var(--warm); stroke-width: 4; stroke-dasharray: 6 6; pointer-events: none; }
.finger-head { fill: none; stroke: var(--warm); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; opacity: .8; }
.finger-trail { fill: none; stroke: var(--warm); opacity: .82; stroke-width: 5; stroke-dasharray: 2 12; stroke-linecap: round; pointer-events: none; animation: drag-dashes 1.1s linear infinite; }
.finger-spot { fill: rgba(224, 112, 31, .08); stroke: var(--warm); stroke-width: 4; stroke-dasharray: 8 8; pointer-events: none; }
.landing-ring { fill: rgba(224, 112, 31, .14); stroke: var(--warm-dark); stroke-width: 5; stroke-dasharray: 9 8; transform-box: fill-box; transform-origin: center; pointer-events: none; animation: landing-ring 200ms ease-out forwards; }
@keyframes landing-ring { 0% { transform: scale(1); opacity: 1; } 55% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }
.late-line { stroke: var(--waste); stroke-width: 4; stroke-dasharray: 12 10; opacity: .72; pointer-events: none; }
.late-label { font: 700 26px var(--serif); fill: var(--waste); text-anchor: middle; pointer-events: none; }
.drag-cue { font: 700 46px var(--serif); fill: var(--ink); stroke: var(--paper-3); stroke-width: 10; paint-order: stroke fill; text-anchor: middle; pointer-events: none; }
.drag-target { fill: var(--warm-dark); }
@keyframes drag-dashes { to { stroke-dashoffset: -28; } }
.readout { opacity: 0; pointer-events: none; transition: opacity .12s; }
.readout.show { opacity: 1; }
.readout rect { fill: var(--paper-3); stroke: var(--ink); stroke-width: 4; }
.readout text { font: 600 50px var(--serif); fill: var(--ink-soft); text-anchor: middle; dominant-baseline: central; font-variant-numeric: tabular-nums; }
.readout .readout-goal { font-size: 27px; fill: var(--ink); font-weight: 600; }
.readout.hot text { fill: var(--waste); }
.readout.m1 rect { stroke: var(--bronze); stroke-width: 9; }
.readout.m2 rect { stroke: var(--silver); stroke-width: 9; }
.readout.m3 rect { stroke: var(--gold); stroke-width: 9; }
.move-demo { pointer-events: none; }
.demo-trail { fill: none; stroke: var(--warm); stroke-width: 5; stroke-dasharray: 3 13; stroke-linecap: round; opacity: .86; }
.demo-target { fill: rgba(224, 112, 31, .06); stroke: var(--warm-dark); stroke-width: 6; stroke-dasharray: 9 8; }
.demo-berry .body { fill: var(--berry); stroke: var(--ink); stroke-width: 4; }
.demo-berry .shine { fill: rgba(255,255,255,.55); }
.demo-berry .leaf { fill: #6f8f3c; stroke: var(--ink); stroke-width: 3; }
.demo-hand { fill: var(--paper-3); stroke: var(--warm); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.demo-hand.released { opacity: 0; }
.move-demo.resting .demo-berry { display: none; }
.move-demo.resting .demo-trail, .move-demo.resting .demo-target { opacity: .55; }
.route-story { opacity: 0; pointer-events: none; transition: opacity 140ms ease-out; }
.route-story.show { opacity: 1; }
.route-story-line { fill: none; stroke-linecap: round; }
.route-story-line.orange { stroke: var(--warm); stroke-width: 11; }
.route-story-line.grey { stroke: var(--ghost); stroke-width: 6; stroke-dasharray: 14 10; }
.route-story-copy { font: 600 40px var(--serif); fill: var(--ink); }
.demo-drop-copy { font: 600 28px var(--serif); fill: var(--ink); text-anchor: middle; }
.ghost-clock { opacity: 0; pointer-events: none; }
.ghost-clock.show { opacity: .58; }
.ghost-clock-face { fill: var(--paper-3); stroke: var(--ink-soft); stroke-width: 3; }
.ghost-clock-pie { fill: var(--waste); opacity: .55; }
.ghost-medal circle { stroke: var(--ink-soft); stroke-width: 3; }
.ghost-coin-ring, .ghost-coin-star { fill: none; stroke: var(--ink-soft); stroke-width: 2.4; stroke-linejoin: round; }
.art.nope { animation: wiggle .4s ease-in-out; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes wiggle { 20% { transform: rotate(-14deg); } 45% { transform: rotate(12deg); } 70% { transform: rotate(-7deg); } 100% { transform: rotate(0); } }
.berry.pinned .art.nope { animation: pinned-strain 240ms cubic-bezier(.34,1.56,.64,1); }
.berry.pinned.nope-lock .pinhead { animation: pin-wobble 240ms ease-out; transform-box: fill-box; transform-origin: center; }
@keyframes pinned-strain { 0% { transform: translate(0); } 35% { transform: translate(6px, -2px); } 100% { transform: translate(0); } }
@keyframes pin-wobble { 25% { transform: rotate(-16deg); } 60% { transform: rotate(10deg); } 100% { transform: rotate(0); } }
.look { fill: none; stroke: var(--warm); stroke-width: 4; stroke-dasharray: 6 10; opacity: .8; pointer-events: none; }
.nest .bowl { fill: #a3774a; stroke: var(--ink); stroke-width: 4; }
.nest .twig { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; opacity: .6; }
.bird .b-body, .bird .b-head, .wise-bird .b-body, .wise-bird .b-head { fill: var(--warm); stroke: var(--ink); stroke-width: 4; stroke-linejoin: round; }
.bird .b-wing, .wise-bird .b-wing { fill: var(--warm-dark); stroke: var(--ink); stroke-width: 3.5; stroke-linejoin: round; transform-box: fill-box; transform-origin: 50% 90%; }
.bird.flying .b-wing, .wise-bird.flying .b-wing { animation: flap .16s ease-in-out infinite alternate; }
@keyframes flap { from { transform: scaleY(1); } to { transform: scaleY(-.7); } }
.bird .b-ink, .wise-bird .b-ink { fill: var(--ink); }
.bird .b-cheek, .wise-bird .b-cheek { fill: #f3a16d; opacity: .78; }
.bird .b-tail, .wise-bird .b-tail { fill: var(--warm-dark); stroke: var(--ink); stroke-width: 3.5; stroke-linejoin: round; }
.wise-bird { opacity: .94; pointer-events: none; }
.wise-bird .b-body, .wise-bird .b-head { fill: #b6b0a6; }
.wise-bird .b-wing, .wise-bird .b-tail { fill: #7f786e; }
.bird, .wise-bird { pointer-events: none; }
.step-reason { pointer-events: none; }
.step-reason line { stroke-width: 6; stroke-linecap: round; }
.step-reason .nearest { stroke: var(--ghost); stroke-dasharray: 10 8; }
.step-reason .shortest { stroke: var(--warm); }
.step-reason text { font: 700 25px var(--serif); paint-order: stroke; stroke: var(--paper-3); stroke-width: 8px; stroke-linejoin: round; }
.step-reason .grey-words { fill: var(--ink-soft); }
.step-reason .orange-words { fill: var(--warm-dark); }
body[data-theme="duck"] .b-body, body[data-theme="duck"] .b-head { fill: #f3c84b; }
body[data-theme="duck"] .wise-bird .b-body, body[data-theme="duck"] .wise-bird .b-head { fill: #b9b2a5; }
body[data-theme="duck"] .b-wing, body[data-theme="duck"] .b-wing-fold { fill: #e0aa27; }
body[data-theme="squirrel"] .b-body, body[data-theme="squirrel"] .b-head { fill: #b96d3f; }
body[data-theme="squirrel"] .wise-bird .b-body, body[data-theme="squirrel"] .wise-bird .b-head { fill: #91887b; }
body[data-theme="squirrel"] .b-wing, body[data-theme="squirrel"] .b-wing-fold { fill: #f1d4a1; }
body[data-theme="squirrel"] .b-tail { fill: #b96d3f; }
body[data-theme="duck"] .b-cheek { fill: #ef8d57; }
body[data-theme="squirrel"] .b-cheek { fill: #e7b58e; }
body[data-theme="squirrel"] .b-beak, body[data-theme="squirrel"] .b-beak-open { display: none; }
body[data-theme="duck"] .b-tail { display: none; }
.bird.crouch .b-body, .bird.crouch .b-head { transform: scaleY(.85); transform-box: fill-box; transform-origin: 50% 100%; }
.bird.spring .b-body, .bird.spring .b-head { animation: bird-spring 140ms cubic-bezier(.34,1.56,.64,1); transform-box: fill-box; transform-origin: 50% 100%; }
.bird.gulp .b-body { animation: bird-gulp 120ms ease-out; transform-box: fill-box; transform-origin: center; }
.bird.happy .b-body, .bird.happy .b-head, .bird.happy .b-wing-fold { animation: bird-hop 260ms cubic-bezier(.34,1.56,.64,1); transform-box: fill-box; transform-origin: center; }
.bird.shrug .b-head { animation: bird-shrug 300ms ease-out; transform-box: fill-box; transform-origin: 30% 80%; }
@keyframes bird-spring { 0% { transform: scaleY(.85); } 55% { transform: scale(1.08, .94); } 100% { transform: scale(1); } }
@keyframes bird-gulp { 0%, 100% { transform: scale(1); } 45% { transform: scale(1.2); } }
@keyframes bird-hop { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-10px); } }
@keyframes bird-shrug { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(10deg); } }
.b-wing-fold, .b-eye-closed, .b-beak-open, .b-ruffle, .b-spiral, .b-stars, .b-foot { display: none; }
.perched .b-wing { display: none; }
.perched .b-wing-fold { display: block; fill: var(--warm-dark); stroke: var(--ink); stroke-width: 3.5; stroke-linejoin: round; }
.wise-bird.perched .b-wing-fold { fill: #7f786e; }
.closed-eye .b-eye { display: none; }
.closed-eye .b-eye-closed { display: block; fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.waiting .b-foot { display: block; fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; animation: foot-tap .28s ease-in-out infinite alternate; }
@keyframes foot-tap { to { transform: translateY(6px); } }
.result-bronze .b-beak-open, .result-bronze .b-foot { display: block; fill: var(--ink); stroke: var(--ink); stroke-width: 2; }
.result-bronze .b-wing-fold { display: none; }
.result-bronze .b-wing { display: block; transform: rotate(30deg); }
.result-silver .b-ruffle { display: block; fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.result-gold .b-eye, .result-star .b-eye { display: none; }
.result-gold .b-spiral, .result-star .b-spiral, .result-gold .b-stars, .result-star .b-stars { display: block; fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.race-clock { opacity: 0; pointer-events: none; }
.race-clock.show { opacity: 1; }
.race-clock-face { fill: var(--paper-3); stroke: var(--ink); stroke-width: 3; }
.race-clock-pie { fill: var(--waste); opacity: .72; }
.race-clock text { text-anchor: middle; font-variant-numeric: tabular-nums; }
.race-clock-text { font: 700 32px var(--serif); stroke: var(--paper-3); stroke-width: 6; paint-order: stroke fill; fill: var(--ink); }
.race-clock.counting .race-clock-face { stroke: var(--waste); }
.race-leg { fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: .3; }
.race-leg.orange { stroke: var(--warm); stroke-width: 11; }
.race-leg.grey { stroke: var(--ghost); stroke-width: 5; stroke-dasharray: 15 12; }
.race-leg.lit { opacity: 1; }
.extra-stretch.racing { opacity: .38; }
.extra-stretch.racing.active { animation: waste-glow 180ms ease-in-out infinite alternate; }
@keyframes waste-glow { to { opacity: 1; stroke-width: 20; } }
.nest.winner { animation: nest-flash 300ms ease-out; }
@keyframes nest-flash { 0%, 100% { filter: none; } 45% { filter: saturate(1.8) brightness(1.25); } }
.sparkle { fill: var(--gold); stroke: var(--ink); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: sparkle 360ms cubic-bezier(.2,.8,.3,1.25) both; }
@keyframes sparkle { 0% { transform: scale(.2); opacity: 0; } 55% { transform: scale(1.25); opacity: 1; } 100% { transform: scale(1); opacity: .9; } }

/* bead worlds */
.bead .shape { stroke: var(--ink); stroke-width: 4; stroke-linejoin: round; }
.bead text { font: 600 30px var(--serif); fill: var(--ink); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.bead .hit { fill: transparent; }
.bead.free { cursor: pointer; }
.bead.pinned .shape { stroke-dasharray: 7 6; fill-opacity: .42; }
.lock .shackle { fill: none; stroke: var(--ink); stroke-width: 5; }
.lock .lock-body { fill: var(--ink); }
.bead.nope-lock .lock { animation: lockpop .4s ease-out; transform-box: fill-box; transform-origin: center; }
@keyframes lockpop { 40% { transform: scale(1.5); } }
.bead.suggest .invite { display: block; animation: pulse 1.8s ease-out infinite; }
.bead.guide .shape { stroke: var(--warm); stroke-width: 7; }
.bead.changing .art { animation: bead-change-out .2s ease-in forwards; transform-box: fill-box; transform-origin: center; }
.bead.changed .art { animation: bead-change-in .4s cubic-bezier(.2, .9, .3, 1.35); transform-box: fill-box; transform-origin: center; }
@keyframes bead-change-out { 0% { transform: scale(1); opacity: 1; } 55% { transform: scale(1.28) rotate(12deg); opacity: 1; } 100% { transform: scale(.78) rotate(24deg); opacity: .2; } }
@keyframes bead-change-in { 0% { transform: scale(.72) rotate(-20deg); opacity: .2; } 65% { transform: scale(1.2) rotate(8deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
.cmp { fill: none; stroke: var(--warm); stroke-width: 8; pointer-events: none; opacity: .9; }
.peek { fill: none; stroke: var(--ink-soft); stroke-width: 6; stroke-dasharray: 9 8; pointer-events: none; }
.peek.hit { stroke: var(--warm); }
.peek-line { fill: none; stroke: var(--ink-soft); stroke-width: 5; stroke-dasharray: 2 12; stroke-linecap: round; pointer-events: none; }
.peek-line.hit { stroke: var(--warm-dark); }
.critter .c-art { transition: transform .2s ease-out; }
.critter.parked .c-art { transform: scale(.8); }
.start-arrow { pointer-events: none; }
.start-arrow .arc { fill: none; stroke: var(--warm-dark); stroke-width: 6; stroke-linecap: round; }
.start-arrow .head { fill: none; stroke: var(--warm-dark); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.start-arrow .dot { fill: var(--warm); stroke: var(--ink); stroke-width: 3; }
.ghosts { transition: opacity .35s; }
.ghosts.later { opacity: 0; }
.critter.zip, .critter.fold { transition: transform .2s ease-out; }
.bead .can { fill: none; stroke: var(--ink-soft); stroke-width: 4; stroke-dasharray: 3 7; opacity: 0; transition: opacity .2s; }
.bead.partner .can { opacity: 1; }
.bead .invite { display: none; fill: none; stroke: var(--warm); stroke-width: 5; transform-box: fill-box; transform-origin: center; pointer-events: none; }
#board.inviting .bead .invite { display: block; animation: pulse 1.8s ease-out infinite; }
.bead .skip { fill: none; stroke: var(--waste); stroke-width: 6; opacity: 0; transition: opacity .15s; }
.bead.skipped .skip { opacity: 1; }
.bead.pop .shape { animation: pop .25s ease-out; transform-box: fill-box; transform-origin: center; }
@keyframes pop { 0% { transform: scale(.75); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
.zlink { stroke-linecap: round; fill: none; }
.zlink.match { stroke: var(--warm); stroke-width: 28; stroke-dasharray: 9 9; stroke-linecap: butt; }
.zlink.match-core { stroke: var(--warm-dark); stroke-width: 5; }
.zlink.miss { stroke: var(--waste); stroke-width: 6; }
.zlink.stub { stroke: var(--waste); stroke-width: 6; stroke-dasharray: 3 9; }
.zx { stroke: var(--waste); stroke-width: 6; stroke-linecap: round; }
.zghost { stroke: var(--ghost); stroke-width: 5; stroke-dasharray: 14 12; stroke-linecap: round; fill: none; }
.guide-caption { font: 600 24px var(--serif); fill: var(--ink-soft); text-anchor: middle; }
.guide-change { font: 600 26px var(--serif); fill: var(--warm-dark); text-anchor: middle; }
.guide-future-skip { fill: none; stroke: var(--waste); stroke-width: 5; stroke-dasharray: 8 8; opacity: .72; pointer-events: none; }
.guide-next-link { fill: none; stroke: var(--warm); stroke-width: 9; stroke-dasharray: 4 12; stroke-linecap: round; opacity: .85; pointer-events: none; animation: guide-route 1.4s linear infinite; }
.guide-next { fill: none; stroke: var(--warm); stroke-width: 5; stroke-dasharray: 9 8; pointer-events: none; }
@keyframes guide-route { to { stroke-dashoffset: -32; } }
.zipper-lesson .ghosts { opacity: 0; }
.zipper-lesson .bead.lesson-muted,
.zipper-lesson .step.lesson-muted,
.zipper-lesson .backbone { opacity: .2; }
.zipper-lesson .bead.lesson-muted .lock { display: none; }
.zipper-lesson-waiting .links { opacity: 0; }
.zipper-lesson-waiting .critter { opacity: .16; }
.step { transition: opacity .15s; }
.step.later { opacity: 0; }
.backbone { fill: none; stroke: var(--ink); stroke-width: 4; opacity: .55; }
.chord { fill: none; stroke: var(--warm); stroke-width: 11; stroke-linecap: round; }
.chord-ghost { fill: none; stroke: var(--ghost); stroke-width: 5; stroke-dasharray: 14 12; stroke-linecap: round; }
.critter .c-body { fill: var(--warm); stroke: var(--ink); stroke-width: 4; }
.critter .c-hole { fill: var(--paper-3); stroke: var(--ink); stroke-width: 3; }
.critter .c-ink { fill: var(--ink); }
.critter { pointer-events: none; }
.endmark { font: italic 26px var(--serif); fill: var(--ink-soft); text-anchor: middle; }

/* ---- messages: they take the hint line for a moment, never the board ---- */
.toast {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 17px; font-weight: 600; color: var(--ink); text-align: center;
  opacity: 0; pointer-events: none; transform: none;
}
.toast.show { opacity: 1; }
.toast svg { width: 26px; height: 26px; flex: none; }

/* ---- waste meter ------------------------------------------------------- */
.meter { width: var(--board); margin-top: 6px; }
.meter.previewing { visibility: hidden; }
.meter-head { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; min-height: 46px; padding-right: 42px; }
.meter-label { font-size: 18px; color: var(--ink); }
.meter-label.late-flip { animation: late-flip 150ms ease-out both; transform-origin: center; }
@keyframes late-flip { 0% { transform: rotateX(90deg); opacity: .15; } 100% { transform: rotateX(0); opacity: 1; } }
.meter-value { font-size: 27px; color: var(--ink); font-variant-numeric: tabular-nums; min-width: 3.2em; }
.meter-value.zero { color: var(--ink-soft); }
.earned-medal { position: absolute; right: 0; top: 4px; width: 38px; height: 38px; display: grid; place-items: center; }
.earned-medal svg { width: 34px; height: 34px; opacity: 0; }
.earned-medal.show svg { opacity: 1; animation: medal-stamp 220ms cubic-bezier(.34,1.56,.64,1); }
.earned-medal.flash svg { opacity: 1; animation: medal-flash 300ms ease-out; }
@keyframes medal-stamp { 0% { transform: scale(1.5); } 100% { transform: scale(1); } }
@keyframes medal-flash { 0%, 100% { filter: saturate(1); } 48% { filter: saturate(2.4) brightness(1.35); } }
.best {
  grid-column: 1 / -1; justify-self: end; margin-left: 0; min-height: 38px; padding: 0 10px; border-radius: 4px;
  border: 1.5px dashed var(--ink-soft); background: transparent; cursor: pointer; font-size: 15px; color: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.best[hidden] { display: none; }
.best svg { width: 18px; height: 18px; }
.track { position: relative; height: 16px; margin: 4px 0 10px; border: 1.5px solid var(--ink); border-radius: 9px; background: var(--paper-3); }
.fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background-color: var(--waste); background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.22) 0 3px, transparent 3px 7px); border-radius: 8px 0 0 8px; transition: width .12s linear; }
.fill[hidden] { display: none; }
.fill.full { border-radius: 8px; }
.tick {
  position: absolute; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  opacity: 0; transition: opacity .3s, transform .2s;
}
.track.ready .tick { opacity: 1; }
.tick svg { width: 22px; height: 22px; display: block; }
.tick[hidden] { display: none; }
.tick b {
  display: none;
  position: absolute; top: 21px; left: 50%; transform: translateX(-50%);
  font-weight: 600; font-size: 14px; color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.tick.on b { color: var(--ink); font-weight: 600; }
.tick.on { transform: scale(1.12); }
.medal-words { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 8px; margin: 0 0 2px; color: var(--ink-soft); font-size: 14px; line-height: 1.25; }
.medal-words.intro { grid-template-columns: 1fr; text-align: center; }
.medal-word { min-width: 0; text-align: center; }
.medal-word b { display: flex; align-items: center; justify-content: center; gap: 4px; color: var(--ink); font-size: 15px; font-weight: 600; }
.medal-word b .medal-icon { width: 19px; height: 19px; flex: none; }
.medal-word.earned { padding: 3px 4px; margin: -3px 0; border-radius: 5px; background: var(--paper-3); box-shadow: inset 0 0 0 1.5px var(--ink); }
.medal-word.earned-bronze { box-shadow: inset 0 0 0 2px var(--bronze); }
.medal-word.earned-silver { box-shadow: inset 0 0 0 2px var(--silver); }
.medal-word.earned-gold { box-shadow: inset 0 0 0 2px var(--gold); }
.medal-word span { display: block; }

/* ---- buttons ------------------------------------------------------------ */
.actions { width: var(--board); display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.actions .btn { flex: 1 1 0; white-space: nowrap; }
.run-controls { width: var(--board); display: grid; grid-template-columns: 1fr 1fr minmax(132px, 1.35fr); gap: 8px; margin-top: 8px; }
.run-controls .btn { min-width: 0; }
.route-dashboard, .route-ledger { width: var(--board); box-sizing: border-box; margin-top: 10px; border: 1px solid var(--line); border-radius: 18px; background: color-mix(in srgb, var(--paper-2) 76%, white); box-shadow: 0 5px 15px rgb(57 43 27 / .06); }
.goal-strip { width: var(--board); box-sizing: border-box; min-height: 34px; margin: 4px 0 8px; padding: 8px 10px; border-left: 4px solid var(--warm); color: var(--ink); background: var(--paper-3); font-size: 13px; line-height: 1.2; }
.goal-strip b { color: var(--warm-dark); font-variant-numeric: tabular-nums; }
.route-dashboard { padding: 11px 12px 12px; }
.route-dashboard-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.route-dashboard h2, .route-ledger h2 { margin: 0; font: 700 16px/1 var(--serif); letter-spacing: .01em; }
.route-dashboard-head p, .route-ledger > p { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.25; text-align: right; }
.distance-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 10px; }
.distance-card { min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.distance-card > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; }
.distance-card strong { font-size: 14px; }
.distance-card span { color: var(--ink-soft); font-size: 11px; }
.distance-card .distance-destination { display: block; overflow: hidden; margin-top: 6px; font-size: 13px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.distance-card .distance-number { display: block; margin-top: 3px; font-variant-numeric: tabular-nums; }
.distance-track { height: 8px; margin-top: 8px; overflow: hidden; border-radius: 99px; background: #dfd7c7; }
.distance-track i { display: block; width: 0; height: 100%; border-radius: inherit; transition: width .25s ease-out; }
.grey-distance .distance-track i { background: #7e776d; }
.orange-distance .distance-track i { background: var(--warm); }
#step-controls { width: var(--board); margin-top: 9px; }
#step-controls .plc-steps { border-color: var(--line); background: var(--paper-2); }
#step-controls .plc-control { border-color: var(--line); color: var(--ink); background: var(--paper); font-family: var(--sans); }
#step-controls .plc-control--primary, #step-controls .plc-speed[aria-pressed='true'] { border-color: var(--warm-dark); background: var(--warm-dark); color: white; }
#step-controls .plc-steps__readout { color: var(--ink-soft); }
.route-ledger { padding: 11px 12px 12px; }
.route-ledger-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.moss-toggle { min-width: 44px; min-height: 34px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--paper); font: 700 12px/1 var(--sans); }
.moss-toggle[aria-pressed='true'] { color: white; border-color: #577865; background: #577865; }
.route-ledger > p { margin-top: 5px; text-align: left; }
#route-lines { display: grid; gap: 8px; margin-top: 10px; }
.route-line { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 7px; align-items: start; }
.route-line-title { padding-top: 6px; font: 700 12px/1 var(--sans); }
.route-line.grey .route-line-title { color: #605a52; }
.route-line.orange .route-line-title { color: var(--warm-dark); }
.route-line.moss .route-line-title { color: #456950; }
.route-stops { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; min-width: 0; padding: 1px 0 4px; }
.route-stop { flex: 0 0 auto; padding: 6px 7px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink-soft); background: var(--paper); font: 700 11px/1 var(--sans); }
.route-stop.active { color: var(--ink); border-color: var(--warm); background: #fff0d6; box-shadow: 0 0 0 2px rgb(224 112 31 / .13); }
.route-stop.home { background: #e8e1d2; }
.route-arrow { flex: 0 0 auto; padding: 0 3px; color: var(--ink-soft); font-size: 13px; }
.berry-id { font-family: var(--serif); font-weight: 700; font-size: 30px; line-height: 1; fill: var(--ink); stroke: var(--paper); stroke-width: 8px; paint-order: stroke; text-anchor: middle; pointer-events: none; }
.berry-id.free-id { fill: var(--warm-dark); }
.moss-route { fill: none; stroke: #577865; stroke-width: 5; stroke-dasharray: 3 13; stroke-linecap: round; opacity: .8; pointer-events: none; }
.speed { min-height: 50px; border: 1.5px solid var(--ink); border-radius: 4px; background: var(--paper-3); padding: 0 10px; display: grid; grid-template-columns: auto minmax(42px, 1fr) auto; gap: 7px; align-items: center; font-size: 15px; white-space: nowrap; }
.speed input { width: 100%; min-width: 42px; accent-color: var(--warm-dark); cursor: pointer; }
.speed output { min-width: 20px; font-variant-numeric: tabular-nums; font-weight: 600; }
.btn[hidden] { display: none; }
.btn.nudge { animation: nudge .55s ease-out 1; }
.btn {
  min-height: 50px; border-radius: 4px; border: 1.5px solid var(--ink);
  background: var(--paper-3); font-size: 17px; cursor: pointer; padding: 0 12px;
}
.btn.primary { background: var(--ink); color: var(--paper-3); }
.btn:disabled { background: transparent; color: var(--ink-soft); border-color: var(--ink-soft); cursor: default; }
.btn:active { transform: translateY(1px); }
.btn.primary.nudge { animation: nudge .55s ease-out 1; }
.result-links { display: none !important; }
.result-links a { color: var(--ink); }
.result-links[hidden] { display: none; }
@keyframes nudge { 0%, 100% { box-shadow: 0 0 0 0 rgba(42, 37, 32, 0); } 50% { box-shadow: 0 0 0 5px rgba(42, 37, 32, .35); } }

/* ---- why fold ----------------------------------------------------------- */
.why { width: var(--board); margin-top: 16px; border-top: 1px solid rgba(42, 37, 32, .25); }
.why summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-style: italic; color: var(--ink-soft); list-style: none; }
.why summary::-webkit-details-marker { display: none; }
.why summary::before { content: '+'; display: inline-block; width: 1.2em; font-style: normal; }
.why[open] summary::before { content: '−'; }
.why p { margin: 0 0 10px; font-size: 16px; }
.clear-progress { min-height: 44px; padding: 0; margin: 2px 0 10px; border: 0; background: transparent; color: var(--ink-soft); text-decoration: underline; cursor: pointer; font-size: 15px; }
.play-lab-footer { width: var(--board); }
.play-lab-footer a { min-height: 44px; display: inline-flex; align-items: center; color: var(--ink-soft); font-size: 15px; }
.play-lab-footer a:focus-visible { outline: 3px solid var(--warm); outline-offset: 2px; }

/* ---- boards sheet ------------------------------------------------------- */
.scrim { position: fixed; inset: 0; top: calc(56px + env(safe-area-inset-top)); background: rgba(42, 37, 32, .35); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.scrim[hidden] { display: none; }
.sheet-open #app { visibility: hidden; }
.sheet {
  width: min(640px, 100%); min-height: calc(100% - 8px); max-height: calc(100% - 8px); overflow-y: auto;
  background: var(--paper-2); border: 2px solid var(--ink); border-bottom: 0; border-radius: 8px 8px 0 0;
  padding: 6px 16px max(18px, env(safe-area-inset-bottom));
}
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { min-height: 0; max-height: 88svh; border-radius: 8px; border-bottom: 2px solid var(--ink); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet h2 { font-size: 22px; font-style: italic; margin: 8px 0; }
.sheet-count { margin: 0 0 10px; font-size: 16px; color: var(--ink-soft); }
.close { width: 44px; height: 44px; border: 0; background: transparent; font-size: 30px; cursor: pointer; }
.world { margin: 10px 0 16px; }
.world h3 { margin: 0 0 8px; font-size: 18px; font-style: italic; display: flex; align-items: baseline; gap: 8px; }
.world h3 small { font-weight: 400; font-size: 15px; color: var(--ink-soft); font-variant-caps: small-caps; font-style: normal; }
.world-state { font-style: normal; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--ink-soft); border-radius: 2px; padding: 1px 4px; color: var(--ink-soft); }
.world-state.open { border-color: var(--warm-dark); color: var(--warm-dark); }
.world-state.locked { border-style: dashed; }
.dots { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 8px; }
.dot {
  position: relative; min-width: 48px; min-height: 48px; border-radius: 4px; border: 1.5px solid var(--ink); background: var(--paper-3);
  cursor: pointer; font-size: 16px; display: grid; place-items: center; font-variant-numeric: tabular-nums; width: 100%;
}
.dot > svg { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; }
.dot.here { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }
.dot:disabled { opacity: .35; cursor: default; }
.daily-btn {
  width: 100%; min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1.5px solid var(--ink); border-radius: 4px; background: var(--paper-3); padding: 0 14px; cursor: pointer; font-size: 17px; text-align: left;
}
.daily-btn small { color: var(--ink-soft); font-size: 14px; display: block; }
.daily-btn .dl { min-width: 0; }
.daily-btn .dm { flex: none; width: 34px; height: 34px; display: grid; place-items: center; }
.daily-btn .dm svg { width: 34px; height: 34px; }
.week-label { margin: 12px 0 4px; color: var(--ink-soft); font-size: 15px; font-style: italic; }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(44px, 1fr)); gap: 3px; margin: 10px 0 14px; }
.day-cell { min-width: 44px; min-height: 44px; padding: 2px; border: 1px solid var(--ink); border-radius: 4px; background: var(--paper-3); display: grid; place-items: center; cursor: pointer; }
.day-cell svg { width: 22px; height: 22px; }
.day-cell small { font-size: 13px; line-height: 1; color: var(--ink-soft); }
.day-cell.here { box-shadow: 0 0 0 2px var(--paper-3), 0 0 0 4px var(--ink); }
.world-summary .dots { margin-bottom: 16px; }
.summary-next, .summary-back { width: 100%; margin: 5px 0; }
.world h3 .new { font-style: normal; font-weight: 400; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; background: var(--ink); color: var(--paper-3); border-radius: 2px; padding: 1px 5px; }
.boards-btn { position: relative; }
.boards-btn.news { box-shadow: inset 0 -4px 0 var(--warm); }
.boards-btn.news::after { content: none; }
.locked-note { font-style: italic; color: var(--ink-soft); font-size: 15px; margin: 0; }

@media (max-width: 359px) {
  .where strong { font-size: 16px; }
  .btn { font-size: 16px; padding: 0 8px; }
  .top { gap: 5px; }
  .sheet { padding-left: 4px; padding-right: 4px; }
  .week-strip { gap: 0; }
  .themes { gap: 4px; font-size: 13px; }
  .theme { padding: 0 6px; font-size: 13px; }
  /* One row under the board, so Play stays in view with the board on a 568 px tall phone. */
  .run-controls { grid-template-columns: 1fr 1fr 1.25fr; gap: 6px; }
  .speed { grid-template-columns: minmax(42px, 1fr) auto; padding: 0 8px; }
  .speed > span { display: none; }
  .route-dashboard-head { display: block; }
  .route-dashboard-head p { margin-top: 4px; text-align: left; }
  .distance-bars { gap: 6px; }
  .distance-card { padding: 8px; }
  .distance-card .distance-destination { font-size: 12px; }
  .route-line { grid-template-columns: 46px minmax(0, 1fr); gap: 5px; }
  .route-stop { padding: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .pulse, .bird.flying .b-wing, .wise-bird.flying .b-wing, .waiting .b-foot, #board.inviting .bead .invite, .bead.suggest .invite, .btn.primary.nudge, .btn.nudge, .go, .art.nope, .bead.changing .art, .bead.changed .art, .guide-next-link, .finger-trail, .berry.free.dragging .leaf, .berry.landing .art, .bird.spring .b-body, .bird.spring .b-head, .bird.gulp .b-body, .bird.happy .b-body, .bird.happy .b-head, .bird.happy .b-wing-fold, .bird.shrug .b-head, .earned-medal.show svg, .sparkle, .extra-stretch.racing.active, .meter-label.late-flip { animation: none; }
  .critter .c-art, .hint-text { transition: none; }
  .critter.zip, .critter.fold, .ghosts { transition: none; }
  .fill, .tick, .toast, .step { transition: none; }
  .berry.free.dragging .body { stroke-width: 8; }
  .landing-ring { fill: var(--warm); animation: reduced-ring 200ms linear forwards; }
  .earned-medal.flash svg { animation: medal-flash 300ms ease-out; }
  @keyframes reduced-ring { from { opacity: 1; } to { opacity: 0; } }
}

/* ---- How to play card (Play Lab rules card) ---------------------------- */
.howto-scrim {
  position: fixed; inset: 0; z-index: 40; background: rgba(42, 37, 32, .45);
  display: flex; align-items: center; justify-content: center; padding: 12px;
}
.howto-scrim[hidden] { display: none; }
.howto-card {
  width: min(100%, 440px); max-height: calc(100svh - 24px); overflow: auto;
  background: var(--paper-3); border: 2px solid var(--ink); border-radius: 8px; padding: 14px 16px 16px;
  box-shadow: 0 0 0 5px var(--paper), 0 0 0 6px rgba(42, 37, 32, .55);
}
.howto-card h2 { margin: 0 0 8px; font-size: 22px; font-style: italic; font-weight: 600; }
.howto-pictures { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.howto-pictures figure { margin: 0; text-align: center; }
.howto-pictures img { display: block; width: 100%; height: auto; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 4px; }
.howto-pictures figcaption { font-size: 14px; color: var(--ink-soft); margin-top: 3px; }
.howto-legend { grid-column: 1 / -1; display: flex; justify-content: center; gap: 14px; font-size: 14px; color: var(--ink); }
.howto-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.howto-lines { margin: 12px 0 14px; padding: 0 0 0 1.1em; font-size: 17px; line-height: 1.3; }
.howto-lines li { margin: 0 0 4px; }
.howto-start { width: 100%; }
.best-ghost { fill: none; stroke: var(--warm); stroke-width: 7; stroke-linejoin: round; stroke-linecap: round; opacity: .22; stroke-dasharray: 2 14; pointer-events: none; }
.meter-best { font-size: 14px; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.meter-best[hidden] { display: none; }
#meter.beat .medal-words { animation: beat-pulse 600ms ease-out 1; }
@keyframes beat-pulse { 0% { transform: scale(1); } 35% { transform: scale(1.06); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { #meter.beat .medal-words { animation: none; outline: 2px solid var(--warm); outline-offset: 2px; } }

/* ---- guardrails while dragging (boards 1 to 3 get the arrow) ---------- */
.heat { opacity: 0; pointer-events: none; fill: none; stroke-width: 22; transition: stroke .15s, opacity .15s; }
.heat.show { opacity: .5; }
.heat.even { stroke: var(--ghost); opacity: .28; }
.heat.warm { stroke: var(--warm); fill: rgba(224, 112, 31, .16); }
.heat.cold { stroke: #4f7fae; fill: rgba(79, 127, 174, .14); }
.steer { opacity: 0; pointer-events: none; transition: opacity .15s; }
.steer.show { opacity: .95; }
.steer-line { fill: none; stroke: var(--warm-dark); stroke-width: 11; stroke-linecap: round; stroke-linejoin: round; }
.ghost-clock { transition: opacity .18s ease-out; }
.ghost-clock.show { opacity: .95; }
.ghost-clock-pie { opacity: .8; }
.ghost-clock-mark { stroke: var(--ink); stroke-width: 5; stroke-linecap: round; }
.ghost-mood { opacity: 0; pointer-events: none; transition: opacity .15s; }
.ghost-mood.show { opacity: 1; }
.mood-text { font: 600 46px var(--serif); }
.ghost-mood.better .mood-text, .ghost-mood.better .mood-arrow { fill: var(--warm-dark); }
.ghost-mood.worse .mood-text, .ghost-mood.worse .mood-arrow { fill: #3f6c99; }
.mood-text { paint-order: stroke; stroke: var(--paper-3); stroke-width: 8px; stroke-linejoin: round; }
.hint-text.coach { transition: opacity .6s ease; }
.hint-text.coach-out { opacity: 0; }
#app.opening .hint-text.coach { display: block; }
.was { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1.5px; background: var(--ink); border-radius: 2px; pointer-events: none; }
.was[hidden] { display: none; }
.delta { grid-column: 1; justify-self: start; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .25s; }
.delta.show { opacity: 1; }
.delta.better { color: var(--warm-dark); }
.delta.worse { color: #3f6c99; }
.delta:empty { display: none; }
.delta.show ~ .best { grid-column: 2; }
@media (prefers-reduced-motion: reduce) {
  .heat, .steer, .ghost-clock, .ghost-mood, .hint-text.coach, .delta { transition: none; }
}
.race-clock.hush { opacity: 0; }

/* P1FG00: a flight you can follow. Never put a CSS transform animation on .bird or .wise-bird themselves:
   their position is the SVG transform attribute, and a CSS transform replaces it (the top-left jump). */
.trail { fill: none; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.trail-grey { stroke: #5f584f; stroke-width: 9; }
.trail-orange { stroke: var(--warm); stroke-width: 7; stroke-dasharray: 2 14; opacity: .95; }
.leg-num circle { fill: var(--ink); stroke: var(--paper-3); stroke-width: 5; }
.leg-num text { fill: var(--paper-3); font: 700 30px var(--serif); text-anchor: middle; }
.cand-ring { fill: none; stroke: var(--ink-soft); stroke-width: 5; stroke-dasharray: 10 10; pointer-events: none; }
.cand-ring.chosen { stroke: var(--ink); stroke-width: 9; stroke-dasharray: none; }
.cand-dist { font: 700 28px var(--serif); text-anchor: middle; fill: var(--ink-soft); paint-order: stroke; stroke: var(--paper-3); stroke-width: 8px; stroke-linejoin: round; pointer-events: none; }
.cand-dist.chosen { fill: var(--ink); }
.trace-line { width: var(--board); box-sizing: border-box; min-height: 64px; margin: 10px 0 0; padding: 10px 12px; border-left: 5px solid var(--ink); background: var(--paper-3); font-size: 22px; line-height: 1.45; color: var(--ink); }
.route-dashboard h2 { font-size: 24px; }
.distance-bars { grid-template-columns: 1fr; gap: 10px; }
.distance-card { padding: 10px 12px; }
.distance-card strong { font-size: 22px; }
.distance-card span { font-size: 20px; color: var(--ink-soft); }
.distance-card .distance-number { display: block; margin-top: 4px; font-size: 24px; color: var(--ink); font-variant-numeric: tabular-nums; }
.distance-card .distance-destination { font-size: 20px; margin-top: 2px; }
.distance-track { height: 16px; transition: none; }
.distance-track i { transition: none; }
.trip-result { margin: 8px 0 0; font-size: 22px; line-height: 1.45; }
.trip-result span { display: inline-block; margin-right: 10px; }
.trip-result .tr-orange { color: var(--warm-dark); }
#step-controls .plc-control { min-height: 48px; font-size: 20px; }
#step-controls .pp-btn { display: inline-flex; align-items: center; gap: 8px; min-width: 132px; justify-content: center; }
#step-controls .pp-btn .pp-icon { flex: none; }
.distance-card { display: grid; grid-template-columns: 1fr auto; column-gap: 10px; align-items: baseline; }
.distance-card > div:first-child { grid-column: 1 / -1; }
.distance-card .distance-number { grid-column: 1; }
.distance-card .distance-destination { grid-column: 2; margin: 0; }
.distance-card .distance-track { grid-column: 1 / -1; }
.route-dashboard { margin-top: 10px; }
.trip-result span, .trip-result b { display: block; margin: 0; }

/* ---- One screen (P1FS02, Chen 2026-10-24) -------------------------------------------------------------------
   The play page fits the phone: the board side comes from onescreen.js (--board-fit = the room left), the watch
   controls are one row, and the trip numbers, berry routes, picture choice and the why sit in the Details sheet. */
html { touch-action: manipulation; overscroll-behavior: none; }
.plate { width: min(var(--board), var(--board-fit, var(--board))); height: min(var(--board), var(--board-fit, var(--board))); flex: none; }
#app { padding-bottom: max(6px, env(safe-area-inset-bottom)); }
.goal-strip { margin: 2px 0 6px; }
.trace-line { min-height: 0; margin: 8px 0 0; padding: 6px 10px; font-size: 18px; line-height: 1.35; }
.trace-line:empty { display: none; }
#step-controls { width: var(--board); margin-top: 6px; }
#step-controls .plc-steps { grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 6px; padding: 6px; }
#step-controls .plc-steps__readout { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#step-controls .plc-steps__speed { grid-column: auto; gap: 3px; }
#step-controls .plc-speed { min-height: 44px; padding: 0 5px; min-width: 44px; flex: none; }
#step-controls .plc-control { min-height: 44px; min-width: 0; padding: 4px 6px; font-size: 18px; line-height: 1.1; white-space: normal; }
.meter { margin-top: 4px; }
.meter-head { min-height: 40px; }
.medal-words { display: none; }
.actions { margin-top: 8px; gap: 6px; }
.play-lab-footer:empty { display: none; }
.more-scrim { top: 0; align-items: flex-end; z-index: 30; }
.more-sheet { min-height: 0; max-height: 86dvh; overflow-y: auto; overscroll-behavior: contain; width: min(100%, 640px); }
.more-sheet .route-dashboard, .more-sheet .route-ledger, .more-sheet .key, .more-sheet .why, .more-sheet .themes { width: 100%; }
.more-sheet .themes { justify-content: flex-start; margin: 12px 0 4px; }
.more-open #app { visibility: hidden; }
/* after a trip the result line says what the trace line says: show it once, on one wrapped line */
#app:has(#trip-result:not([hidden])) .trace-line { display: none; }
.trip-result { margin: 4px 0 0; font-size: 18px; line-height: 1.3; }
.trip-result span, .trip-result b { display: inline; margin: 0 8px 0 0; }
@media (max-height: 760px) {
  .hint, .hint.busy { height: 32px; min-height: 32px; margin-bottom: 2px; font-size: 15px; }
  .top { min-height: 40px; }
  .meter-head { grid-template-columns: minmax(0, 1fr) auto auto; min-height: 38px; }
  .meter-head .best { grid-column: auto; min-height: 44px; }
  .meter-value { font-size: 22px; min-width: 0; }
  .meter-label { font-size: 16px; }
  .track { margin: 2px 0 8px; }
}
@media (max-height: 700px) {
  /* the goal strip above the board already names the goal: the meter keeps the number, the change and See the best */
  .meter-head { grid-template-columns: auto minmax(0, 1fr) auto; }
  .meter-head .meter-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .meter-head .best { font-size: 14px; padding: 0 8px; }
  .meter-head .meter-value { grid-column: 1; grid-row: 1; }
  .meter-head .delta { grid-column: 2; grid-row: 1; align-self: center; }
  .meter-head .best { grid-column: 3; grid-row: 1; }
  .trip-result { font-size: 16px; }
}
#step-controls .pp-btn { gap: 4px; } #step-controls .pp-btn svg, #step-controls .pp-btn .pp-icon { width: 18px; height: 18px; }
.top { grid-template-columns: minmax(0, 1fr) auto auto auto; }
@media (max-width: 380px) { .actions { flex-wrap: nowrap; gap: 5px; } .actions .btn { min-width: 0; padding: 0 7px; font-size: 15px; } }

/* One screen (P1FS11): Grey is marked at first open, because the goal sentence names it. */
.grey-tag { display: none; pointer-events: none; }
#app.opening .grey-tag { display: inline; }
.grey-tag-ring { fill: none; stroke: #2a2520; stroke-width: 6; stroke-dasharray: 14 10; }
.grey-tag-name { font: 700 76px Georgia, "Times New Roman", serif; fill: #2a2520; text-anchor: middle; paint-order: stroke; stroke: #fbf7ec; stroke-width: 10px; stroke-linejoin: round; }
/* Say the name once: it is in the top bar. */
.where .game-name { display: none; }

/* 320 px: the Play / Pause / Replay button is about 56 px wide, too narrow for the icon and the word.
   The word says the state, so the icon steps aside rather than the word being cut. */
@media (max-width: 359px) { #step-controls .pp-btn .pp-icon, #step-controls .pp-btn svg { display: none; } }

/* The rule, always on screen (P2NF49). */
.rule-line { margin: 2px 0 4px; text-align: center; font: 700 15px/1.2 Georgia, serif; color: var(--ink, #2a2520); }

/* ===== One screen (P2NF50): rule, score, board, step line, one controls row. Fits 390x844, 360x640, 320x568. ===== */
#app { gap: 0; }
.top { display: none; }
.rule-line { margin: 0; padding: 2px 0 4px; font-size: 16px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { margin: 0; padding: 0; }
.meter .meter-head { display: flex; flex-wrap: nowrap; align-items: baseline; gap: 6px; min-height: 0; padding: 0; }
.meter .meter-value { order: 1; font-size: 30px; line-height: 1.1; min-width: 0; }
.meter .meter-label { order: 2; position: static; width: auto; height: auto; clip: auto; overflow: visible; font-size: 14px; color: var(--ink-soft); white-space: nowrap; }
.meter .goal-strip { order: 3; margin: 0 0 0 auto; padding: 0; background: none; border: 0; font-size: 15px; white-space: nowrap; }
.meter .goal-strip b { color: var(--warm-dark, #b4530f); }
.meter .earned-medal, .meter .delta { order: 4; }
.meter .best { order: 5; min-height: 32px; padding: 0 8px; font-size: 13px; }
.meter .track { margin: 2px 0 4px; }
.meter .medal-words, .meter .trip-result, .meter .was { display: none !important; }
.hint { min-height: 24px; height: auto; margin: 0 0 2px; }
.hint .hint-text { font-size: 16px; line-height: 1.25; }
.daily-note { margin: 0; }
.trace-line { margin: 4px 0 0; min-height: 40px; font-size: 16px; line-height: 1.25; }
#app:has(#trip-result:not([hidden])) .trace-line { display: block; }
#step-controls { margin: 4px 0 0; }
#step-controls .plc-steps { display: flex; gap: 6px; padding: 0; border: 0; background: none; }
#step-controls .plc-steps > :not(.plc-control):not(.btn) { display: none; }
#step-controls .plc-control, #step-controls .btn { flex: 1 1 0; min-width: 0; min-height: 48px; padding: 0 6px; font-size: 16px; }
#step-controls #b-reset { order: 1; } #step-controls #b-step { order: 2; } #step-controls #b-play { order: 3; } #step-controls #b-next { order: 4; }
#app:not(.board-earned) #b-next, #app:not(.board-earned) #b-watch { display: none; }
/* The first-berry question is not answered on screen: Grey's route waits for the tap. */
#app.predicting .route, #app.predicting .extra-stretch, #app.predicting .chev, #app.predicting .ghost, #app.predicting .moss-route, #app.predicting .best-ghost { display: none !important; }
#app.board-earned #b-play { display: none; }
.actions:not(:has(#b-share:not([hidden]))) { display: none; }
.actions { margin: 4px 0 0; }
/* the prediction beat: no hint, no ring, controls asleep */
#app.predicting #step-controls { pointer-events: none; opacity: .45; }
#app.predicting .hand, #app.predicting .finger-spot, #app.predicting .pulse, #app.predicting .heat, #app.predicting .grey-tag, #app.predicting .plc-hint { display: none !important; }
#app.predicting .hint .hint-text { font-weight: 700; }
/* the board: Grey's line is grey and solid; Orange's dotted shortest way shows only on the result */
.route { stroke: #6f675c; stroke-width: 10; opacity: .9; }
.ghost { display: none; }
#board.short-on .ghost { display: inline; stroke: var(--warm, #e0701f); stroke-width: 8; stroke-dasharray: 2 15; stroke-linecap: round; opacity: 1; transform: translate(6px, 6px); }
.trail-orange { display: none; }
.race-leg.orange { display: none; }
#board.short-on .race-leg.orange { display: none; }
.berry-id { stroke: none; font-size: 34px; fill: #fffaf0; }
.berry.pinned .berry-id { fill: var(--ink); }
.berry.dragging .berry-id { transform: translateY(-110px); fill: var(--ink); stroke: var(--paper); stroke-width: 7px; paint-order: stroke; }
.cand-ring { stroke-width: 5; }
/* Orange on the nest: rounder as the score grows, asleep at gold */
.bird .b-body { transform-box: fill-box; transform-origin: 50% 70%; transform: scale(var(--puff, 1)); }
.b-zzz { display: none; fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.bird.asleep .b-zzz { display: inline; }
.bird.asleep .b-eye { display: none; } .bird.asleep .b-eye-closed { display: inline; }
/* the nest on Levels: a feather for each medal */
.nest-fig { margin: 0 0 8px; text-align: center; }
.nest-fig figcaption { font-size: 14px; color: var(--ink-soft); }
.feather { stroke: var(--ink); stroke-width: 1.2; } .feather.t1 { fill: #b87333; } .feather.t2 { fill: #b9b9bf; } .feather.t3 { fill: #e3b83a; }
.nest-bowl { fill: #a9773f; stroke: var(--ink); stroke-width: 2; } .nest-twig { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.howto-pace { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.howto-pace span { font-size: 15px; margin-right: 4px; }
.pace-btn { min-height: 44px; padding: 0 12px; border: 2px solid var(--ink); border-radius: 8px; background: var(--paper); font: inherit; }
.pace-btn[aria-pressed="true"] { background: var(--warm); color: #fffaf0; }
@media (max-height: 700px) { .hint { min-height: 22px; } .trace-line { min-height: 36px; font-size: 15px; } .meter .meter-value { font-size: 26px; } }
/* the first-visit opening is the prediction beat now: the score row and the hint stay */
#app.opening .hint-text, #app.opening .meter, #app.opening .run-controls { display: block; }
#app.opening #step-controls { display: block; }
#app.opening .meter .meter-head { display: flex; }
#app.predicting .finger-trail, #app.predicting .finger-head, #app.predicting .finger, #app.predicting .drag-cue, #app.predicting .hand-dot { display: none !important; }
#app.predicting .move-demo, #app.predicting .look { display: none !important; }
.meter .meter-label { margin-left: 2px; }
.meter .meter-head { gap: 8px; }
#app.opening .grey-tag { display: none !important; }
#board[data-flight] .move-demo { display: none; }
.meter .meter-value { flex: none; min-width: 0; margin-right: 4px; }
.chick-head { fill: #f2d36b; stroke: var(--ink); stroke-width: 3; } .chick-eye { fill: var(--ink); }
.chick-beak { fill: var(--warm); stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; transform-box: fill-box; transform-origin: 50% 0; }
#board[data-flight="ended"] .chick-beak { transform: scale(1.25, 1.9); }
.bowl-front { fill: #a9773f; stroke: var(--ink); stroke-width: 4; }
.bird.asleep { opacity: .96; }
.race-clock, .ghost-clock { display: none !important; }
.meter .meter-head { flex-wrap: wrap; row-gap: 0; }
@media (max-width: 400px) { .meter .delta, .meter .earned-medal { display: none; } }
.meter .best { margin-left: auto; }
.meter .goal-strip { margin-left: 4px; }
#b-next { white-space: nowrap; } #b-next span { display: none; }
.actions .btn { min-height: 40px; }
.berry-id.free-id { fill: #fffaf0; } .berry.dragging .berry-id.free-id { fill: var(--ink); }
/* nothing above the board may change height: the board never moves under a finger */
.hint { height: 24px; min-height: 24px; overflow: hidden; }
.hint .hint-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.meter .meter-head { flex-wrap: nowrap; height: 40px; overflow: hidden; align-items: center; }
.meter .goal-strip { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter .best { flex: none; }
@media (max-width: 400px) { .meter #b-best { display: none; } }
.trace-line { height: 44px; min-height: 44px; overflow: hidden; }
@media (max-height: 700px) { .hint { height: 22px; min-height: 22px; } .trace-line { height: 40px; min-height: 40px; } }
.hint, .hint.busy { height: 24px !important; min-height: 24px !important; max-height: 24px !important; }
@media (max-height: 700px) { .hint, .hint.busy { height: 22px !important; min-height: 22px !important; max-height: 22px !important; } }
.hint, .hint.busy { margin: 0 0 4px !important; }

/* Short phones (320x568): when a result is up the hint line is empty, so it gives its 24 px to the board. */
@media (max-height: 640px) {
  #app:not(.opening):not(.predicting) .hint:has(.hint-text:empty):not(:has(.toast.show)) { display: none; }
  #app:not(.opening):not(.predicting) .meter { margin-bottom: 4px; }
}
/* 320 px: the goal line keeps its number ("Star at 3.5") when See the best sits beside it. */
@media (max-width: 340px) {
  .meter .meter-label { font-size: 12px; }
  .meter #b-ceiling { font-size: 12px; padding: 0 6px; }
  .meter .goal-strip { font-size: 14px; }
  .meter .meter-head { gap: 4px; }
}
/* P2NV116: on a short phone the result line would only repeat the score row ("2.4 extra wingbeats", "Star earned"), so it
   gives its room back and the board keeps its opening size (284 at 320x568, was 241) */
@media (max-height: 700px) { #app:has(#board[data-flight="ended"]) .trace-line { display: none; } }
