:root {
  color-scheme: light;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #f4efe4;
  color: #282a23;
  --ink: #282a23;
  --sub: #504d40;
  --paper: #fbf7ed;
  --line: #ded4bf;
  --accent: #a13829;
  --accent-dark: #83291f;
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
html, body { overflow: hidden; overscroll-behavior: none; }
button, input, a { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .6; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .25em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.kitchen { width: min(1180px, calc(100% - 64px)); margin: auto; }
.masthead { display: flex; align-items: center; justify-content: space-between; height: 66px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: .65rem; font-size: .81rem; font-weight: 650; letter-spacing: .1em; }
.brand:hover { text-decoration: none; }
.brand img { display: block; width: 26px; height: 26px; border-radius: 5px; }
.masthead-end { display: flex; align-items: center; gap: 14px; }
.games-link { color: var(--sub); font-size: .85rem; }
.brand span { display: grid; place-items: center; color: #fff5e5; background: var(--accent); font: 700 .95rem "Songti SC", SimSun, serif; width: 23px; height: 25px; border-radius: 3px; }
.heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; padding: 30px 0 22px; }
h1, h2 { font-family: "Songti SC", "Noto Serif SC", SimSun, serif; margin: 0; }
h1 { font-size: clamp(2.7rem, 6.4vw, 4.7rem); line-height: 1; font-weight: 800; letter-spacing: .025em; }
.stages { list-style: none; display: flex; gap: 16px; font-size: .82rem; padding: 0; margin: 0 0 4px; color: var(--sub); white-space: nowrap; }
.stages li:not(:last-child)::after { content: "·"; padding-left: 16px; color: #968873; }
.stages [aria-current] { color: var(--accent-dark); font-weight: 800; }
.workbench { display: grid; grid-template-columns: minmax(0, 2.18fr) minmax(268px, 1fr); min-height: 445px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--paper); }
.stage { position: relative; overflow: hidden; isolation: isolate; min-height: 445px; background: #ae8060; }
.music-control, .music-status { position: absolute; z-index: 3; right: 12px; border-radius: 6px; }
.music-control { top: 12px; min-height: 44px; padding: 0 13px; border: 1px solid #e6d8bc;
  background: #312a21; color: #fff4e1; font-size: .82rem; font-weight: 700; }
.music-control:hover { background: #493a2b; }
.music-control[aria-pressed="true"] { background: #fbf4e5; color: #4d3124; }
.music-control:focus-visible { outline-color: #fff5df; }
.music-status { top: 62px; max-width: min(240px, calc(100% - 24px)); margin: 0; padding: 7px 10px;
  background: #312a21; color: #fff4e1; font-size: .74rem; line-height: 1.45; }
.scene { position: absolute; inset: 0; }
.scene canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.gesture-zones { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.gesture-zone { position: absolute; cursor: grab; pointer-events: auto; touch-action: none; }
.gesture-zone:active { cursor: grabbing; }
[data-gesture="pinch"] { cursor: crosshair; }
[data-phase="result"] canvas { cursor: grab; touch-action: pan-y; }
[data-phase="result"] canvas:active { cursor: grabbing; }
.scene canvas:focus-visible { outline-offset: -5px; outline-color: #fff1d5; }
.scene-tag { position: absolute; pointer-events: none; bottom: 18px; left: 18px; margin: 0; color: #fff5e7; background: #36291fbd; border-radius: 5px; padding: 6px 9px; font-size: .73rem; letter-spacing: .06em; }
.scene-tag:empty { display: none; }
/* While the kitchen loads: a quiet note in the middle of the stage, clear of the masthead. */
#loading { position: absolute; z-index: 2; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; padding: 9px 16px; border-radius: 999px; background: rgba(40, 30, 22, .45); color: #fff4e4; font-size: .9rem; white-space: nowrap; }
.pinch-guide { position: absolute; pointer-events: none; inset: 0; }
[data-phase="pinch"] .pinch-guide { animation: find-seam 150ms 230ms both; }
@keyframes find-seam { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  [data-phase="pinch"] .pinch-guide { animation: none; }
}
.pinch-guide svg { width: 100%; height: 100%; overflow: visible; }
.pinch-guide path { stroke: #904133; fill: none; stroke-dasharray: 2 5; vector-effect: non-scaling-stroke; stroke-width: 2.4; stroke-linecap: round; }
.pinch-guide .loose-seam { stroke: #bd8b50; stroke-dasharray: 3 6; }
.pinch-guide span { position: absolute; width: 20px; height: 20px; border: 2px solid #fff1d4; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 0 2px #802e28; }
.actions { display: flex; flex-direction: column; gap: 22px; border-left: 1px solid var(--line); padding: clamp(19px, 3vw, 37px); }
.slots { display: flex; flex-wrap: wrap; gap: clamp(8px, 2.2vw, 13px); }
.slot { display: inline-flex; align-items: center; justify-content: center; white-space: nowrap;
  min-width: 60px; min-height: 37px; padding: 5px 10px; letter-spacing: .025em;
  border-radius: 6px; background: #eee7d7; border: 1px solid transparent; color: #675f50; font-size: .79rem; }
.slot[aria-current] { border-color: #ab4b39; background: #f5e1cf; color: #7b2d23; font-weight: 700; }
.slot[data-filled] { color: #71372a; }
.instruction h2, dialog h2 { font-size: clamp(1.44rem, 2.5vw, 2rem); line-height: 1.3; letter-spacing: .02em; }
.instruction p, .result-detail { color: var(--sub); line-height: 1.63; margin: 9px 0 0; font-size: .9rem; }
.shared-note { margin: 0; padding: 10px 13px; border-radius: 6px; background: #f3e3d3; color: #71372a; font-size: .88rem; line-height: 1.55; }
.instruction .result-score.is-legend { color: #9a7322; background: linear-gradient(180deg, #d0a345, #8a6417); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.legend-seal { display: inline-block; margin-left: 12px; padding: 2px 9px 3px; background: #fbf1d6; border: 1.5px solid #c49a3a; color: #9a7322; -webkit-text-fill-color: #9a7322; font-size: .95rem; letter-spacing: .08em; border-radius: 2px; transform: rotate(-3deg); vertical-align: 3px; }
/* The same switch as the food quiz's share dialog: whether the share card carries its QR code. */
.share-qr { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 12px 0 0; color: var(--sub); font-size: .8rem; cursor: pointer; user-select: none; }
.share-qr b { font-weight: inherit; }
.share-qr small { margin-left: 6px; font-size: inherit; opacity: .8; }
.share-qr small::before { content: "· "; }
.share-qr input { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 32px; height: 18px; margin: 0; border-radius: 999px; background: #c8bfb0; cursor: pointer; transition: background .15s ease; }
.share-qr input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s ease; }
.share-qr input:checked { background: var(--accent); }
.share-qr input:checked::after { transform: translateX(14px); }
.share-qr input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.title-part { display: inline-block; }
.instruction .result-score { margin: 4px 0 0; color: var(--accent); font-family: "Songti SC", SimSun, serif; font-size: 1.5rem; font-weight: 700; letter-spacing: .04em; }
.instruction .result-line { color: #71372a; font-family: "Songti SC", SimSun, serif; font-size: 1.12rem; font-weight: 650; }
.buttons { display: flex; flex-wrap: wrap; column-gap: 10px; row-gap: 9px; margin-top: auto; }
.buttons > button { width: 100%; }
button.primary { display: flex; justify-content: space-between; align-items: center; border: 0; min-height: 46px; padding: 10px 15px; border-radius: 6px; background: var(--accent); color: #fff8ee; font-weight: 650; font-size: .91rem; }
button.primary:hover { background: var(--accent-dark); }
button.quiet { min-height: 42px; padding: 8px 11px; background: transparent; border: 1px solid var(--line); color: var(--ink); border-radius: 5px; font-size: .8rem; }
/* Buttons side by side in the panel share one size, so the second choice does not look like an afterthought. */
.buttons > button.quiet { min-height: 46px; padding: 10px 15px; border-radius: 6px; font-size: .86rem; text-align: left; }
button.quiet:hover { border-color: #a94b3b; }
.feedback { margin: -10px 0 0; color: #6f3329; font-size: .8rem; }
.feedback:empty { display: none; }
.result-detail { border-top: 1px solid var(--line); margin: 0; padding-top: 13px; }
.read-more { color: var(--sub); font-size: .82rem; }
dialog { width: min(460px, calc(100% - 28px)); border: 1px solid var(--line); color: var(--ink); border-radius: 12px; background: var(--paper); padding: 27px; }
dialog form { position: relative; }
dialog .close { position: absolute; top: -7px; right: -7px; }
/* How to play: each step's name in a narrow column, its line beside it, all in one ink colour. */
.how-to { max-height: calc(100dvh - 24px); overflow: auto; }
.how-to h2 { margin: 0 44px 0 0; }
.how-to h2:focus { outline: none; }
.how-to .close { top: -9px; right: -9px; width: 34px; min-height: 34px; padding: 0; border-radius: 50%; font-size: 1rem; }
.steps { margin: 16px 0 0; }
.steps > div { display: grid; grid-template-columns: 2.6em 1fr; gap: 10px; padding: 6px 0; line-height: 1.6; }
.steps dt { font-weight: 700; }
.steps dd { margin: 0; color: var(--sub); }
.secret { margin: 18px 0 16px; padding: 12px 16px 13px; border-radius: 8px; background: #f2ebdc; }
.secret h3 { margin: 0; font-size: .86rem; color: var(--accent-dark); letter-spacing: .04em; }
.secret .steps { margin-top: 6px; }
.secret .steps > div { padding: 4px 0; font-size: .92rem; }
.secret p { margin: 6px 0 0; color: var(--sub); font-size: .86rem; }
.mode { display: flex; align-items: center; gap: 7px; margin: 0 0 18px; font-size: .88rem; }
.mode input { width: 17px; height: 17px; accent-color: var(--accent); }
.keys { margin: 0 0 15px; color: var(--sub); font-size: .81rem; line-height: 1.6; }
/* 晒一晒: the card first, scaled so the whole of it shows with the title and buttons on any screen. */
.share-dialog { width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 22px 22px 20px; }
.share-dialog::backdrop { background: rgba(20, 18, 15, .6); }
.share-dialog .close { position: absolute; top: 12px; right: 12px; min-height: 34px; width: 34px; padding: 0; }
.share-dialog h2 { margin: 0 40px 4px 0; }
.share-hint { margin: 0 0 12px; color: var(--sub); font-size: .84rem; line-height: 1.55; }
.share-hint span { display: inline-block; }
.share-hint[hidden] { display: none; }
.share-preview { display: grid; place-items: center; min-height: 200px; padding: 8px; border-radius: 10px; background: #ece4d5; color: var(--sub); font-size: .86rem; }
.share-preview img { display: block; width: 100%; max-height: max(180px, calc(100dvh - 300px)); object-fit: contain; border-radius: 4px; box-shadow: 0 2px 10px rgba(60, 40, 20, .18); -webkit-touch-callout: default; }
.share-press { display: flex; align-items: center; justify-content: center; gap: 8px; width: fit-content; max-width: 100%; margin: 12px auto 0; padding: 8px 15px; border-radius: 999px; background: rgba(161, 56, 41, .1); color: var(--accent-dark); font-size: .9rem; font-weight: 600; }
.share-press[hidden] { display: none; }
.share-press .ring { transform-origin: 10px 10px; animation: press-ring 1.6s ease-out 3; }
@keyframes press-ring { 0% { opacity: .9; transform: scale(.7); } 70%, 100% { opacity: 0; transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .share-press .ring { animation: none; } }
.share-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
/* English page: posting to X is the main way to share, so it takes the whole first row. */
.share-buttons > .share-x { flex-basis: 100%; justify-content: center; text-align: center; min-height: 48px; border: 0; border-radius: 6px; background: #14171a; color: #fff; font-size: .95rem; font-weight: 700; }
.share-buttons > .share-x:hover { background: #000; }
a.button.quiet { display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 15px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); font-size: .88rem; text-decoration: none; }
a.button.quiet:hover { border-color: #a94b3b; }
.share-buttons[hidden] { display: none; }
.share-buttons > * { flex: 1; justify-content: center; text-align: center; min-height: 46px; }
.share-buttons > [hidden] { display: none; }
a.button.primary { display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 15px; border-radius: 6px; background: var(--accent); color: #fff8ee; font-weight: 650; font-size: .91rem; text-decoration: none; }
a.button.primary:hover { background: var(--accent-dark); }
.share-buttons > button.quiet { border-radius: 6px; font-size: .88rem; }
/* The game fills the window, as the dashimaki game does, with no page to scroll: the site's logo, the
   title and the steps sit small at the top left, the games link, help and sound at the top right, and
   the current dumpling, the step and its buttons in a small see-through group at the bottom left. The
   foot of the window stays clear: when a bottom ad runs, set --ad-band to its height and the board ends
   above it, carrying the buttons with it. The verdict comes up as a card over the board's right side
   (at the bottom on phones, next block). */
:root { --ad-band: 0px; }
.kitchen { position: relative; width: 100%; }
.workbench { display: block; position: relative; border: 0; border-radius: 0; }
.stage { height: calc(100svh - var(--ad-band)); min-height: 320px; }
.masthead { position: absolute; z-index: 6; top: 0; left: 0; right: 0; height: 56px; padding: 0 16px; border: 0; pointer-events: none; }
.masthead > * { pointer-events: auto; }
.brand, .games-link { color: #fff7ea; text-shadow: 0 1px 3px rgba(30, 20, 10, .45); }
.masthead .help, .music-control, .masthead .games-link { min-height: 36px; border: 1px solid rgba(255, 255, 255, .4); background: rgba(255, 250, 240, .28); color: #fff7ea;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.music-control[aria-pressed="true"] { background: rgba(255, 250, 240, .28); color: #fff7ea; }
.music-control:hover, .masthead .help:hover, .masthead .games-link:hover { background: rgba(255, 250, 240, .42); }
/* Back to the games page: a pill like the sound button, so it reads as a way out, not a caption. */
.masthead .games-link { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; padding: 0 13px 0 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; text-decoration: none; text-shadow: none; }
.masthead .games-link::before { content: "‹"; font-size: 1.15rem; line-height: 1; margin-top: -2px; }
/* The other language's version of the game: a small round tag beside help. */
.masthead .lang-link { white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 36px; padding: 0 9px; border: 1px solid rgba(255, 255, 255, .4); border-radius: 999px; background: rgba(255, 250, 240, .28); color: #fff7ea; font-size: .78rem; font-weight: 700; text-decoration: none; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.masthead .lang-link:hover { background: rgba(255, 250, 240, .42); }
.music-control { top: 64px; right: 16px; }
/* Help is one round "?" at the top right, as in the dashimaki game. */
.masthead .help { width: 36px; min-width: 36px; padding: 0; border-radius: 50%; font-weight: 700; font-size: .95rem; }
/* While playing, the group holds only which dumpling it is and the buttons: no step name, no hints.
   The steps along the top left already say where the game is. */
.workbench:not(:has([data-phase="result"])) .instruction { display: none; }
.heading { position: absolute; z-index: 6; top: 52px; left: 16px; display: block; padding: 0; pointer-events: none; }
h1 { font-size: 1.7rem; color: #fff7ea; text-shadow: 0 1px 4px rgba(30, 20, 10, .45); }
.stages { margin-top: 8px; gap: 10px; font-size: .76rem; color: rgba(255, 247, 234, .85); text-shadow: 0 1px 3px rgba(30, 20, 10, .5); }
.stages li:not(:last-child)::after { padding-left: 10px; color: rgba(255, 247, 234, .6); }
.stages [aria-current] { color: #fff7ea; }
.actions { position: absolute; z-index: 4; left: 16px; bottom: 16px; width: 240px; flex-direction: column; align-items: stretch; gap: 10px;
  padding: 12px; border: 1px solid rgba(255, 255, 255, .38); border-left: 1px solid rgba(255, 255, 255, .38); border-radius: 12px;
  background: rgba(255, 250, 240, .3); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.actions .slots { flex-wrap: nowrap; gap: 5px; }
.actions .slot { flex: 1; min-width: 0; min-height: 28px; padding: 3px 4px; background: rgba(255, 250, 240, .55); font-size: .74rem; }
.actions .slot[aria-current] { background: #f5e1cf; }
.actions .instruction h2 { font-size: 1.2rem; }
.actions .buttons { flex-direction: column; margin: 0; }
.actions .buttons > button { width: 100%; }
.actions .buttons > button.quiet { background: rgba(255, 250, 240, .6); border-color: rgba(255, 255, 255, .5); }
.actions .shared-note, .actions .feedback { margin: 0; }
.workbench:has([data-phase="result"]) .actions { top: 108px; bottom: 16px; left: auto; right: 16px; width: clamp(300px, 30%, 380px); gap: 14px; padding: 22px; overflow-y: auto;
  border-color: rgba(255, 255, 255, .55); background: rgba(251, 247, 237, .92); box-shadow: 0 6px 24px rgba(40, 25, 10, .18); }
.workbench:has([data-phase="result"]) .instruction h2 { font-size: clamp(1.3rem, 2vw, 1.7rem); }
.workbench:has([data-phase="result"]) .slots { display: none; }
.workbench:has([data-phase="result"]) .buttons { margin: auto 0 0; }
/* From the plating on, the 3D view reaches past the board's left edge by the card's width, so the
   camera centres the plate in the space left of the card instead of behind it. */
[data-phase="reveal"] .scene, [data-phase="result"] .scene { left: calc(-1 * clamp(300px, 30%, 380px) - 32px); }
@media (max-width: 740px) {
  .masthead { height: 48px; padding: 0 12px; }
  .masthead-end { gap: 6px; }
  .brand { white-space: nowrap; font-size: .82rem; letter-spacing: .02em; gap: .5rem; }
  /* Phones keep the way back to the games page and help; the other language is one tap away there. */
  .masthead .lang-link { display: none; }
  .masthead .games-link { padding: 0 11px 0 8px; }
  .heading { top: 44px; left: 12px; }
  h1 { font-size: 1.35rem; }
  .stages { margin-top: 6px; gap: 7px; font-size: .7rem; }
  .stages li:not(:last-child)::after { padding-left: 7px; }
  .music-control { top: 52px; right: 12px; }
  .stage { min-height: 0; }
  .actions { left: 12px; bottom: 12px; width: min(260px, calc(100% - 24px)); gap: 8px; padding: 10px; }
  .actions .instruction h2 { font-size: 1.05rem; }
  .actions .buttons { flex-direction: row; }
  .actions .buttons > button { flex: 1; width: auto; min-height: 42px; padding: 8px 12px; }
  .actions .buttons > .primary { flex: 2; }
  /* The verdict takes the lower half and the plate moves into the upper half. */
  /* Compact, so the whole card (both buttons and the link) fits even when a bottom ad takes its band. */
  .workbench:has([data-phase="result"]) .actions { top: auto; left: 10px; right: 10px; bottom: 10px; width: auto; max-height: 60%; gap: 8px; padding: 14px 14px 12px; }
  .workbench:has([data-phase="result"]) .instruction h2 { font-size: 1.15rem; line-height: 1.35; }
  .workbench:has([data-phase="result"]) .result-score { font-size: 1.2rem; }
  .workbench:has([data-phase="result"]) .result-line { font-size: .95rem; line-height: 1.5; }
  .workbench:has([data-phase="result"]) .result-detail { font-size: .8rem; line-height: 1.5; padding-top: 8px; }
  .workbench:has([data-phase="result"]) .buttons { flex-direction: row; }
  .workbench:has([data-phase="result"]) .buttons > button { min-height: 40px; }
  .workbench:has([data-phase="result"]) .read-more { font-size: .8rem; }
  [data-phase="reveal"] .scene, [data-phase="result"] .scene { left: 0; bottom: 42%; }
  .workbench:has([data-phase="result"]) .scene-tag { top: auto; bottom: calc(60% + 20px); }
}
@media (hover: none) and (pointer: coarse) { .keys { display: none; } }
