:root {
  color-scheme: light;
  font-family: Georgia, "Times New Roman", serif;
  background: #f7f4ed;
  color: #111111;
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; }

body {
  min-width: 320px;
  background: #f7f4ed;
}

button, a { font: inherit; }

button {
  min-height: 44px;
  border: 1px solid #111111;
  border-radius: 2px;
  padding: 9px 14px;
  color: #111111;
  background: #f7f4ed;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible, a:focus-visible { outline: 3px solid #111111; outline-offset: 3px; }
button:disabled { opacity: .42; cursor: not-allowed; }

.shell {
  width: min(100%, 430px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(60px + env(safe-area-inset-top)) 12px calc(22px + env(safe-area-inset-bottom));
}

.topbar, .top-actions, .level-row, .map-heading, .controls, .result-actions {
  display: flex;
  align-items: center;
}

.topbar { min-height: 44px; justify-content: space-between; gap: 8px; }
.top-actions { gap: 5px; }

.lab-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #111111;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.quiet-button, .icon-button {
  min-height: 44px;
  border-color: transparent;
  padding: 7px 9px;
  background: transparent;
  color: #111111;
  font-size: 13px;
  font-weight: 750;
}

.icon-button { min-width: 44px; padding: 0 4px; }

.instruction { min-height: 1.4em; margin: 6px 2px 9px; color: #111111; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 14px; line-height: 1.4; }

/* Each letter opens on its little scene, so the cards are never a detached puzzle. */
.scene-card { display: grid; grid-template-columns: 84px 1fr; align-items: center; gap: 10px; min-height: 76px; margin: 0 0 9px; padding: 5px 8px 5px 5px; border: 1px solid #111111; background: #edeae3; }
#scene-picture { display: block; width: 84px; height: 69px; border-right: 1px solid #111111; }
.scene-copy { margin: 0; font-size: 15px; line-height: 1.34; }
.scene-seed { display: block; margin-top: 3px; color: #4b4a46; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 12px; font-variant-numeric: tabular-nums; }

.primary-button {
  border-color: #111111;
  color: #f7f4ed;
  background: #111111;
  box-shadow: 0 4px 0 #77736b;
  font-weight: 850;
}
.primary-button:active { transform: translateY(2px); box-shadow: 0 2px 0 #77736b; }

#play-screen { position: relative; padding: 4px 0 0; }
.level-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 3px; border-bottom: 1px solid #111111; }
.masthead { margin: 0; font-size: 20px; line-height: 1.3; letter-spacing: -.02em; }
.level-name { margin: 0; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; font-weight: 750; font-variant-numeric: tabular-nums; }

.board-shell {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid #111111;
  border-radius: 0;
  background: #edeae3;
  box-shadow: 3px 4px 0 rgb(17 17 17 / .15);
}

#board { display: block; width: 100%; height: auto; touch-action: none; user-select: none; }
.message { min-height: 2.7em; margin: 11px 5px 6px; color: #111111; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 14px; line-height: 1.35; }
.message.refused { color: #b22a1f; }

.controls { justify-content: center; gap: 9px; padding: 8px 0 11px; }
.controls button { min-width: 92px; font-weight: 750; }

.result-card {
  margin: 4px 0 12px;
  padding: 20px 16px 16px;
  border: 1px solid #111111;
  border-radius: 0;
  background: #edeae3;
  text-align: center;
}
.result-title { margin: 0; color: #111111; font-size: 24px; font-weight: 900; }
.result-feedback { max-width: 30ch; margin: 7px auto 10px; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 14px; line-height: 1.38; }
.result-marks { margin: 0; font-size: 16px; font-weight: 800; }
.result-target { margin: 4px 0 5px; color: #333333; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; font-weight: 750; }
.share-line { min-height: 1.4em; margin: 0 auto 14px; color: #333333; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; line-height: 1.4; }
.result-actions { justify-content: center; flex-wrap: wrap; gap: 8px; }
.result-actions button { font-weight: 750; }

.round-ended .message, .round-ended .controls { display: none; }
.round-ended .result-card { margin-top: 8px; padding: 8px 12px 10px; }
.result-head { display: flex; align-items: baseline; justify-content: center; gap: 14px; }
.round-ended .result-feedback { margin: 3px auto 2px; }
.round-ended .result-target { display: none; }
.round-ended .share-line { margin: 2px auto 8px; font-size: 12px; overflow-wrap: anywhere; }

.credit { max-width: 48ch; margin: 22px 4px 12px; color: #333333; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 12px; line-height: 1.42; }

.map-heading { justify-content: space-between; gap: 15px; padding: 28px 4px 3px; }
.map-heading h2 { margin: 0; font-size: 30px; }
.level-map { margin-top: 18px; }
.level-row-map { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.party-road { position: relative; display: grid; gap: 14px; padding-left: 29px; }
.party-road::before { content: ''; position: absolute; top: 20px; bottom: 36px; left: 11px; border-left: 1px solid #111111; }
.road-stop { position: relative; }
.road-stop h3 { margin: 0 0 7px; font-size: 16px; }
.road-mark { position: absolute; left: -28px; top: 1px; width: 18px; height: 18px; border: 1px solid #111111; background: #f7f4ed; }
.road-mark-0::after { content: '⌂'; position: absolute; inset: -3px 0 0; text-align: center; font-size: 16px; }
.road-mark-1 { transform: rotate(45deg); }.road-mark-1::after { content: ''; position: absolute; inset: 4px; border: 1px solid #111111; }
.road-mark-2 { border-radius: 50%; }.road-mark-3::after { content: '⌑'; position: absolute; inset: -4px 0 0; text-align: center; font-size: 19px; }.road-mark-4::after { content: '♔'; position: absolute; inset: -4px 0 0; text-align: center; font-size: 19px; }
.future-stop { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 1px 9px; min-height: 62px; padding: 8px; color: #77736b; border: 1px solid #77736b; background: #edeae3; }
.future-stop span { grid-row: 1 / 3; font-size: 30px; line-height: 1; }.future-stop strong, .future-stop small { display: block; }.future-stop small { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 12px; }
.chapter-heading { margin: 22px 2px 8px; padding-top: 10px; border-top: 1px solid #111111; font-size: 18px; }
.level-tile { min-height: 76px; padding: 10px 7px; text-align: left; }
.level-tile strong, .level-tile small { display: block; }
.level-tile strong { font-size: 17px; }
.level-tile small { margin-top: 4px; color: #687067; font-size: 11px; line-height: 1.25; }
.level-tile.complete { border-color: #111111; background: #edeae3; }
.generated-modes { display: grid; gap: 10px; margin: 24px 0 4px; padding-top: 14px; border-top: 3px double #111111; }
.mode-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 10px; padding: 10px; border: 1px solid #111111; background: #edeae3; }
.mode-card h3 { margin: 0; font-size: 18px; }
.difficulty-picker { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.difficulty { min-width: 48px; min-height: 44px; padding: 5px 9px; font-size: 13px; }
.difficulty.selected { color: #f7f4ed; background: #111111; }
.mode-start { grid-column: 1 / -1; width: 100%; }

.hand-demo {
  position: absolute;
  z-index: 2;
  display: none;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  pointer-events: none;
  transition: transform .12s ease-out;
}
.hand-demo svg { display: block; width: 44px; height: 44px; filter: drop-shadow(1px 2px 0 rgb(17 17 17 / .2)); }
.hand-demo.running { display: block; }
.hand-demo.pressed { transform: scale(.88); }

.success-effect { position: absolute; inset: 0; z-index: 3; overflow: hidden; pointer-events: none; }
.success-effect i { position: absolute; top: 47%; left: 50%; width: 9px; height: 9px; border-radius: 2px; opacity: 0; background: #111111; }
.success-effect.on i { animation: confetti .72s ease-out both; }
.success-effect i:nth-child(2) { background: #444; animation-delay: .05s; }
.success-effect i:nth-child(3) { background: #777; animation-delay: .1s; }
.success-effect i:nth-child(4) { background: #222; animation-delay: .02s; }
.success-effect i:nth-child(5) { background: #999; animation-delay: .12s; }
@keyframes confetti { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(var(--x, 0), var(--y, 0)) rotate(240deg); opacity: 0; } }
.success-effect i:nth-child(1) { --x: -112px; --y: -105px; }.success-effect i:nth-child(2) { --x: 106px; --y: -96px; }.success-effect i:nth-child(3) { --x: 130px; --y: 92px; }.success-effect i:nth-child(4) { --x: -126px; --y: 78px; }.success-effect i:nth-child(5) { --x: 8px; --y: -145px; }

.load-error { margin: 54px 8px; padding: 18px; border: 1px solid #c4695e; border-radius: 14px; background: #fff5f2; color: #742f27; line-height: 1.4; }
.reduced-motion *, .reduced-motion *::before, .reduced-motion *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; } }
@media (min-width: 700px) { .shell { margin-top: 18px; min-height: calc(100dvh - 36px); border: 1px solid rgb(17 17 17 / .25); border-radius: 0; background: #f7f4ed; box-shadow: 8px 10px 0 rgb(17 17 17 / .1); } }

.score-now { font-weight: 600; color: #3b3a37; }
.board-hint {
  position: absolute;
  top: 0;
  right: 8px;
  left: 44%;
  height: 7%;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: #111111;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.1;
  text-align: right;
  pointer-events: none;
}
.board-hint.free { color: #3b3a37; font-style: italic; }

/* Play Lab top bar and rules card, in the broadsheet's ink and paper. */
:root {
  --pl-font: Georgia, "Times New Roman", serif;
  --pl-topbar-bg: #f7f4ed;
  --pl-topbar-text: #111111;
  --pl-control-text: #111111;
  --pl-control-bg: #f7f4ed;
  --pl-control-border: #111111;
  --pl-focus: #111111;
  --pl-overlay: rgb(17 17 17 / .45);
  --pl-card-bg: #edeae3;
  --pl-card-text: #111111;
  --pl-card-muted: #111111;
  --pl-card-border: #111111;
  --pl-primary: #111111;
  --pl-primary-text: #f7f4ed;
  --pl-shadow: rgb(17 17 17 / .25);
  --pl-share-bg: #f7f4ed;
  --pl-radius-control: 2px;
  --pl-radius-card: 0;
  --pl-radius-picture: 0;
}
[data-pl="topbar"] { box-shadow: 0 1px 0 #111111, 0 3px 0 #edeae3, 0 4px 0 #111111; }
[data-pl="back"] { font-weight: 800; }
[data-pl="howto-card"] { box-shadow: 4px 5px 0 rgb(17 17 17 / .2); }
[data-pl="howto-card"] h2 { padding-bottom: 6px; border-bottom: 1px solid #111111; font-weight: 800; }
[data-pl="howto-lines"] { font-family: ui-sans-serif, system-ui, sans-serif; font-weight: 500; font-size: 15px; }
@media (max-width: 359px) { [data-pl="howto-lines"] { font-size: 14px; } }
@media (max-width: 359px) { .scene-copy { font-size: 14px; } .mode-card { grid-template-columns: 1fr; } .difficulty-picker { justify-content: flex-start; } }
[data-pl="howto-pictures"] canvas { width: min(calc(50vw - 40px), 160px); }
.pl-howto-start { box-shadow: 0 4px 0 #77736b; }

/* The find's own beat: the card keeps its place but stays out of sight until the family has grown. */
.result-card { transition: opacity .25s ease-out; }
.result-card.beat { visibility: hidden; opacity: 0; }

.credit { margin: 14px 6px 6px; font-size: 12px; line-height: 1.35; color: #3b3a37; }
.round-ended .credit { margin-top: 8px; }
/* The credit waits until the round is over, so the first screen is only the board and its one line. */
#play-screen:not(.round-ended) .credit, #play-screen.beating .credit { display: none; }

/* Pick: the second step of a choice. Its row keeps its height while it waits, so nothing below it jumps. */
#pick-button { min-width: 170px; }
#pick-button.waiting { display: none; }
#game-controls { min-height: 63px; }
.round-ended #pick-button { display: none; }

/* The strip: one panel per level, four to a chapter. */
.result-strip { max-width: 312px; margin: 4px auto 6px; }
.result-strip .strip-title { margin-bottom: 3px; font-size: 13px; }
.strip-title { margin: 0 0 5px; font-size: 14px; font-weight: 800; font-style: italic; }
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.strip .panel { display: block; width: 100%; height: auto; aspect-ratio: 96 / 88; box-shadow: 1px 2px 0 rgb(17 17 17 / .18); }
.strip .panel.empty { box-shadow: none; }
.strip .panel.fresh { animation: panel-in .55s ease-out both; }
.strip.whole .panel { box-shadow: 2px 3px 0 rgb(17 17 17 / .3); }
@keyframes panel-in { 0% { opacity: 0; transform: translateY(6px) scale(.94); } 100% { opacity: 1; transform: none; } }
.strips-title { margin: 18px 4px 4px; font-size: 18px; }
.strips { display: grid; gap: 12px; margin: 0 2px; }
.strip-block .strip-title { font-size: 13px; }

/* After the card closes, focus returns to How to play: keep a visible plain ring there. */
[data-pl="topbar"] :focus-visible { outline: 2px solid #111111; outline-offset: -6px; }

/* The story page: a broadsheet front page. Masthead, three short paragraphs, then the strips with captions. */
.story-entry { display: flex; width: 100%; margin: 16px 0 4px; padding: 12px 14px; justify-content: space-between; align-items: baseline; gap: 10px; text-align: left; background: #edeae3; border-width: 1px 1px 3px; }
.story-entry strong { font-size: 17px; }
.story-entry small { color: #444444; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 12px; white-space: nowrap; }
.story-kicker { margin: 0; font-size: 14px; font-weight: 800; font-style: italic; letter-spacing: .04em; }
.story-title { margin: 6px 4px 0; padding: 6px 0 8px; border-top: 3px double #111111; border-bottom: 1px solid #111111; font-size: clamp(34px, 11vw, 46px); line-height: 1; text-align: center; }
.story-copy { margin: 12px 4px 0; font-size: 16px; line-height: 1.45; }
.story-copy p { margin: 0 0 8px; }
.story-copy p:first-child::first-letter { float: left; margin: 3px 6px 0 0; font-size: 44px; line-height: .8; font-weight: 700; }
.story-scribes { padding-top: 10px; border-top: 1px solid #111111; font-style: italic; }
.story-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
.story-strip figure { margin: 0; }
.story-strip figcaption { margin-top: 5px; font-size: 13px; line-height: 1.3; }
.result-story { display: block; margin: 0 auto 6px; min-height: 40px; padding: 6px 14px; font-size: 14px; }
.result-story[hidden], .story-entry[hidden] { display: none; }
.masthead { white-space: nowrap; flex: none; }
.level-name { text-align: right; }

/* The gate */
.gate-screen { display: grid; gap: 10px; padding-bottom: 24px; }
.gate-scene { width: 168px; height: 138px; justify-self: center; border: 1px solid #0003; }
.gate-rows { display: grid; gap: 8px; }
.gate-label { margin: 0 0 3px; font-size: 14px; font-weight: 700; }
.gate-opts { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.gate-tile-pic { background: #f7f5ef; border: 1.5px solid #8a8577; border-radius: 6px; min-height: 48px; padding: 0; display: grid; place-items: center; }
.gate-tile-pic canvas { display: block; max-width: 100%; height: auto !important; }
.gate-tile-pic.picked { border-color: #1b1b1b; box-shadow: 0 0 0 2px #1b1b1b; background: #fff; }
.gate-tile-pic.ring { box-shadow: 0 0 0 3px #2d7d46; border-color: #2d7d46; }
.gate-tile-pic:disabled { opacity: 0.45; }
.gate-tile-pic.picked:disabled { opacity: 1; }
.gate-tile { min-width: 140px; }

/* ---- 2026-10-20 step loop (P1h20): goal line, story line, the chain strip, the panel under the board ---- */
[hidden] { display: none !important; }
.goal { margin: 6px 3px 4px; font-size: 19px; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; }
.story-line { margin: 0 3px 8px; color: #3b3a37; font-size: 15px; font-style: italic; line-height: 1.38; }
.chain-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 6px; min-height: 44px; }
.chain { display: block; flex: 1; min-width: 0; height: auto; aspect-ratio: 360 / 44; }
.hearts { flex: none; margin: 0; font-size: 22px; letter-spacing: 2px; line-height: 1; font-family: ui-sans-serif, system-ui, sans-serif; }
.panel { margin: 10px 0 0; padding: 12px 14px 12px; border: 1px solid #111111; background: #edeae3; }
.panel.bad { border: 2px solid #b22a1f; padding: 11px 13px 11px; }
.panel.bad .panel-title { color: #b22a1f; }
.panel-title { margin: 0 0 4px; font-size: 18px; font-weight: 800; line-height: 1.25; }
.panel-body { min-height: 0; margin: 0; color: #111111; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 15px; line-height: 1.42; }
.panel-body.refused { color: #111111; }
.panel.bad .panel-body.refused { color: #111111; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.panel-actions:empty, .panel-actions:not(:has(button:not([hidden]))) { display: none; }
.panel-actions button { font-weight: 800; }
.claim { display: block; width: 100%; margin-top: 10px; padding: 9px 10px; border-color: #77736b; color: #111111; background: transparent; font-size: 14px; font-weight: 700; }
.panel .claim { border-style: dashed; }
.progress-line { margin: 10px 3px 4px; color: #3b3a37; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; font-variant-numeric: tabular-nums; }
.result-caption { max-width: 32ch; margin: 2px auto 8px; font-size: 15px; font-style: italic; line-height: 1.35; }
/* The game's own logo and title top-left (house rule 22). */
[data-pl="topbar"] [data-pl="back"][data-brand] { display: inline-flex; align-items: center; gap: 8px; padding: 0 2px; border: 0; background: transparent; min-height: 44px; font: 800 19px/1 Georgia, "Times New Roman", serif; color: #111111; }
[data-pl="topbar"] [data-pl="back"][data-brand] .pl-brand-logo { flex: none; }
@media (max-width: 359px) { .goal { font-size: 17px; } [data-pl="topbar"] [data-pl="back"][data-brand] { font-size: 16px; } [data-pl="topbar"] [data-pl="back"][data-brand] .pl-brand-logo { width: 28px; height: 25px; } }
/* the "?" button, as in the mock: a square with a question mark */
[data-pl="topbar"] [data-pl="howto"] .pl-howto-word { display: none; }
[data-pl="topbar"] [data-pl="howto"] .pl-howto-question { display: inline; font: 800 20px/1 Georgia, serif; }
[data-pl="topbar"] [data-pl="howto"] { min-width: 44px; width: 44px; padding: 0; }

/* Guidance (P1HP02): hint and "why am I stuck" row, the board key, the rule sheet, the pointing ring on a button. */
.help-row { display: flex; gap: 8px; margin-top: 10px; }
.help-row button { flex: 1 1 0; min-height: 44px; font-size: 14px; border: 1px solid #111111; background: #f7f4ed; }
.panel.hinting { border-color: #111111; border-width: 2px; }
.guide-spot { outline: 3px solid #111111; outline-offset: 3px; animation: guide-spot 1.1s ease-in-out infinite; }
@keyframes guide-spot { 50% { outline-offset: 6px; } }
.reduced-motion .guide-spot { animation: none; }
@media (prefers-reduced-motion: reduce) { .guide-spot { animation: none; } }
.legend { margin: 4px 2px 6px; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 14px; }
.legend-toggle { min-height: 44px; padding: 0 2px; border: 0; background: none; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.legend-toggle[aria-expanded="true"] { text-decoration: none; }
.legend-list[hidden] { display: none; }
.legend-list { list-style: none; margin: 0; padding: 0 0 4px; display: grid; gap: 6px; }
.legend-list li { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 8px; line-height: 1.35; }
.legend-list svg { width: 30px; height: 22px; display: block; }
.stuck-sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 12px 10px; background: rgb(17 17 17 / .45); }
.stuck-sheet[hidden] { display: none; }
.stuck-card { width: 100%; max-width: 460px; padding: 14px 14px 16px; border: 2px solid #111111; background: #f7f4ed; }
.stuck-card h2 { margin: 0 0 6px; font-size: 22px; }
.stuck-rule { margin: 0 0 10px; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 16px; line-height: 1.4; }
.stuck-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stuck-pair figure { margin: 0; }
.stuck-pair canvas { display: block; width: 100%; height: auto; border: 1px solid #111111; }
.stuck-pair figcaption { margin-top: 6px; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; line-height: 1.35; }
.stuck-card .primary-button { width: 100%; }

/* One screen (P2FS36): this page wraps the title and marks in .result-head, so the shell sheet's ordering did not reach them and
   "Correct 7 points" sat under the buttons. Result line first, Next full width under it, the other two buttons side by side. */
:root[data-pl-screen="result"] #result-screen .result-head { order: 0 !important; }
:root[data-pl-screen="result"] #result-screen .result-actions { display: flex; flex-wrap: wrap; gap: 8px; }
:root[data-pl-screen="result"] #result-screen .result-actions button:not(#next-button) { flex: 1 1 40%; }

/* ---- Short-phone layout (P2NF04): goal, story, chain row, board, then one action row pinned under the board. The panel's words
   (title, message, Hint, Why am I stuck, the key, progress, Reset) live in a Help sheet below 900 px tall or 700 px wide; on
   a tall wide screen the sheet sits in place under the action row as before. ---- */
.story-line { font-size: 18px; line-height: 1.3; }
.action-row { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; margin: 8px 0 0; }
.action-row > button { min-height: 44px; font-size: 18px; }
.action-row .claim { flex: 1 1 0; width: auto; margin: 0; padding: 6px 10px; border-style: dashed; font-size: 18px; line-height: 1.15; }
.action-row .primary-button, .action-row #back-button { flex: 1 1 0; padding: 6px 10px; font-weight: 800; line-height: 1.15; }
.action-row:has(#commit-button:not([hidden])) .claim { display: none; }
/* While a picked card or a red note is up, the row offers Back (Try another card) instead of the claim, so it stays one row. */
.action-row:has(#back-button:not([hidden])) .claim { display: none; }
.help-button { position: relative; flex: none; min-width: 72px; height: 44px; padding: 0 12px; border-color: #77736b; background: transparent; color: #111111; font-size: 18px; font-weight: 700; }
.help-button.unread::after { content: ''; position: absolute; top: 5px; right: 5px; width: 10px; height: 10px; border-radius: 50%; background: #b22a1f; box-shadow: 0 0 0 2px #f7f4ed; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.sheet-close { display: none; flex: none; font-size: 18px; }
.legend, .progress-line { font-size: 18px; }
.help-row button { font-size: 18px; }
.board-toast { position: absolute; z-index: 4; top: 0; left: 0; right: 0; margin: 0; padding: 6px 10px; overflow: visible; white-space: normal; overflow-wrap: anywhere;
  background: #111111; color: #f7f4ed; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 18px; line-height: 1.3; pointer-events: none;
  opacity: 0; transform: translateY(-100%); transition: opacity .18s ease-out, transform .18s ease-out; }
.board-toast.bad { background: #b22a1f; }
@media (max-width: 420px) { .board-toast { padding: 5px 8px; font-size: 15px; line-height: 1.25; } }
.board-toast.on { opacity: 1; transform: none; }
.reduced-motion .board-toast { transition: none; }

@media (max-height: 899px), (max-width: 699px) {
  .shell { padding-top: calc(56px + env(safe-area-inset-top)); padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  #play-screen { padding-top: 0; }
  .goal { margin: 9px 3px 2px; font-size: 18px; }
  .story-line { margin: 0 3px 2px; }
  .chain-row { min-height: 34px; margin: 0 0 4px; }
  .action-row { margin-top: 6px; }
  .help-sheet { position: fixed; inset: 0; z-index: 35; display: flex; align-items: flex-end; justify-content: center; background: rgb(17 17 17 / .35); }
  .help-sheet:not(.open) { display: none; }
  .help-sheet .panel { width: min(100%, 430px); max-height: 62dvh; overflow-y: auto; overscroll-behavior: contain; margin: 0;
    padding: 14px 14px max(14px, env(safe-area-inset-bottom)); border: 2px solid #111111; border-bottom: 0; border-radius: 10px 10px 0 0; box-shadow: 0 -8px 28px rgb(0 0 0 / .18); }
  .help-sheet .panel.bad { border: 2px solid #b22a1f; border-bottom: 0; }
  .help-sheet .sheet-close { display: inline-flex; align-items: center; }
  .help-sheet .panel-body { font-size: 18px; }
  #game-controls { min-height: 0; padding-bottom: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  @media (max-height: 899px), (max-width: 699px) { :root:not(.reduced-motion) .help-sheet.open .panel { animation: help-up .2s ease-out; } }
}
@keyframes help-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-height: 900px) and (min-width: 700px) {
  .help-button { display: none; }
  .board-toast { display: none; }
}
/* The toast's bold title must not stretch past the toast (the 320 px overflow check reads its box). */
.board-toast b { display: inline; }
/* Very short phones (568 px tall): the board gives up width so the action row stays on the screen. */
@media (max-height: 699px) and (max-width: 699px) {
  .board-shell { max-width: max(220px, calc((100dvh - var(--above-board, 200px) - var(--below-board, 66px)) * 360 / 430)); margin-inline: auto; }
}

/* ---- Visual round (P2NV127): one news serif, the notice box, pressed states, square win sheet ---- */
@font-face { font-family: Gelasio; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/gelasio-latin.woff2) format('woff2'); }
@font-face { font-family: Gelasio; font-style: italic; font-weight: 400; font-display: swap; src: url(fonts/gelasio-italic-latin.woff2) format('woff2'); }
:root {
  --paper: #f7f4ed; --newsprint: #edeae3; --ink: #111111; --ink-soft: #333330; --proof: #b22a1f;
  --serif: Gelasio, Georgia, "Noto Serif TC", "Times New Roman", serif;
  --pl-font: var(--serif);
  font-family: var(--serif);
}
body, body *, button, input { font-family: var(--serif) !important; }
button { font-weight: 600; }
.primary-button { font-weight: 600; }
.action-row .primary-button, .action-row #back-button, .panel-actions button { font-weight: 600; }
.story-line, .result-caption, .strip-title, .story-copy, .story-scribes { color: var(--ink-soft); }

/* Pressed: on touch-down, the button sinks 1 px and its edge doubles. */
button.pressed, button:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 0 0 1px var(--ink); }
.primary-button.pressed, .primary-button:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 0 0 1px var(--ink), 0 3px 0 #8a867d; }
.reduced-motion button.pressed, .reduced-motion button:active:not(:disabled) { transform: none; }
@media (prefers-reduced-motion: reduce) { button.pressed, button:active:not(:disabled) { transform: none; } }

/* The notice box: holds the level line at rest, the first-minute guide in ink, and the reason for a wrong pick in red. */
.notice { margin: 0; padding: 8px 4px 10px; color: var(--ink); background: var(--paper); border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); font-size: 20px; line-height: 1.38; overflow-wrap: break-word; }
.notice[hidden] { display: none !important; }
.notice-head { font-weight: 700; }
.notice-rest .notice-body { font-style: italic; color: var(--ink-soft); }
.notice-reason { padding-left: 10px; border-left: 4px solid var(--proof); }
.notice-reason .notice-head { color: var(--proof); }
.notice-reason .notice-head::before { content: '\2715\00a0'; }
#board-toast { display: none !important; }
html:not(.notice-below):not(.notice-over) .notice { display: none !important; }

/* Tall phones: the notice sits under the board and the buttons go to the thumb. */
.notice-below .shell { display: flex; flex-direction: column; }
.notice-below #play-screen { flex: 1 1 auto; display: flex; flex-direction: column; }
.notice-below #play-screen[hidden] { display: none; }
.notice-below #play-screen > .notice { margin: 10px 0 12px; }
.notice-below #action-row { margin-top: auto; }
.notice-below #story-line { display: none; }
.notice-below #goal { font-size: 22px; font-weight: 700; line-height: 1.25; text-wrap: balance; margin-bottom: 6px; }

/* Short phones: the notice is pasted over the header, never over a card. */
.notice-over #play-screen > .notice { position: absolute; left: 0; right: 0; z-index: 6; overflow: hidden; }
.notice-over #goal { font-size: 17px; font-weight: 600; line-height: 1.3; white-space: normal; text-wrap: balance; }
.cover-hidden { visibility: hidden; }

/* Win sheet: cut square, with the top bar's double rule. */
:root[data-pl-screen="result"] #result-screen.result-card { border-radius: 0 !important; border: 0 !important; border-top: 4px double var(--ink) !important; box-shadow: none !important; }
#share-line { color: var(--ink-soft); font-size: 18px; font-style: italic; line-height: 1.35; }
.round-ended .share-line { font-size: 18px; }
.help-button { font-size: 18px; }
/* The win sheet scrolls inside itself instead of letting its lines squeeze into each other on short phones. */
:root[data-pl-screen="result"] #result-screen.result-card > * { flex-shrink: 0; }
