@font-face {
  font-family: "Nianhua Title";
  src: url("fonts/title.woff") format("woff");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Nianhua Serif";
  src: url("fonts/serif.woff") format("woff");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Nianhua Sans";
  src: url("fonts/sans.woff") format("woff");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
:root {
  color-scheme: light;
  --paper: #f3ebdb;
  --panel: #fff9ed;
  --ink: #292820;
  --muted: #62594c;
  --rule: #dacbb2;
  --red: #962f24;
  --red-dark: #75231b;
  --green: #355c4a;
  --serif: "Nianhua Serif", "Noto Serif CJK SC", "Songti SC", "STSong", serif;
  --sans: "Nianhua Sans", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(ellipse at 48% 3%, #fff8e9 0, transparent 66%), var(--paper);
  font: 15px/1.65 var(--sans);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .57; }
a { color: inherit; text-underline-offset: 4px; }
:focus-visible { outline: 2px solid #b14b32; outline-offset: 3px; }
.mast, main { width: min(1240px, calc(100% - 72px)); margin-inline: auto; }
.mast {
  height: 61px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--rule);
}
.mast a { text-decoration: none; }
.mast-link { color: var(--muted); font-size: 13px; }
.mast-link:hover { color: var(--red); }
.brand { display: inline-flex; gap: 9px; align-items: center; font: 700 17px var(--serif); }
.seal {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 3px double #fae0bd;
  border-radius: 2px;
  background: var(--red);
  color: #fff4de;
}
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 161px;
  margin: 18px 0 15px;
  overflow: hidden;
  border: 1px solid #d8c3a5;
  background: #f1dfc2;
}
.hero::after { content: ""; position: absolute; inset: 6px; border: 1px solid #8e422c38; pointer-events: none; }
.hero-art {
  position: absolute;
  z-index: -1;
  inset: 0 0 0 37%;
  background: linear-gradient(90deg, #f1dfc2 1%, #f1dfc200 52%), url("art/fish.webp") center 36% / cover no-repeat;
}
.hero-copy { padding: 14px 34px 15px; }
.hero-copy > p:last-child { margin: 4px 0 0; color: #534539; font-size: 14px; }
.eyebrow { margin: 0; color: var(--red-dark); font-size: 12px; font-weight: 700; letter-spacing: .12em; }
h1, h2, h3 { margin: 0; font-family: var(--serif); line-height: 1.26; }
h1 { font: 400 clamp(51px, 6vw, 78px)/1.05 "Nianhua Title", var(--serif); letter-spacing: .07em; margin: 2px 0; }
.modes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-bottom: 16px; }
.modes button {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 8px;
  padding: 10px 13px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: #fbf4e6;
  text-align: left;
}
.modes button:hover { border-color: #a46048; }
.modes button[aria-pressed="true"] { background: var(--red); color: #fff5e3; border-color: var(--red); }
.modes strong { font: 700 16px var(--serif); white-space: nowrap; }
.modes small { font-size: 11px; color: var(--muted); }
.modes button[aria-pressed="true"] small { color: #ffe4c9; }
.workbench { display: grid; grid-template-columns: minmax(152px, .66fr) minmax(0, 2.36fr) minmax(230px, 1fr); gap: 14px; align-items: start; }
.panel, .station { min-width: 0; border: 1px solid var(--rule); border-radius: 4px; background: var(--panel); }
.panel { padding: 15px; }
.panel h2 { font-size: 19px; margin-bottom: 12px; }
.gallery h2 { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; }
#collection { font: 400 12px var(--sans); color: var(--red-dark); white-space: nowrap; }
.gallery-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.work { min-width: 0; padding: 4px; border: 1px solid #e0d3bd; border-radius: 3px; background: #f8eddb; text-align: left; }
.work img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.work span { display: block; padding: 5px 1px 1px; }
.work strong { display: block; font: 700 12px/1.45 var(--serif); }
.work small, .plate small { display: block; color: var(--muted); font-size: 11px; }
.work.selected { border-color: var(--red); background: #f3ddc2; box-shadow: inset 0 0 0 1px #962f2420; }
.work:disabled img { filter: saturate(.68); }
.gallery > .quiet { margin-top: 8px; }
.station { padding: 9px 11px; background: #fbf3e4; }
.station-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 2px 8px; color: var(--muted); font-size: 13px; }
.station-bar > span:first-child { font: 700 15px var(--serif); color: var(--ink); }
.station-bar.foot { padding: 7px 2px 0; min-height: 30px; }
.station-bar.foot > span:first-child { font: 400 12px/1.5 var(--sans); color: var(--muted); }
#game-tag, #view-label { background: #f0e0c6; border-radius: 2px; padding: 1px 7px; font-size: 12px; }
.mat {
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(ellipse at 50% 25%, #655247, #3a3029 88%);
  border: 1px solid #3c3028;
  box-shadow: inset 0 0 27px #1c161160;
}
.picture, #stage, #reference-image, #print-paper-back { width: min(100%, 405px); }
.picture { position: relative; }
canvas, #reference-image { display: block; height: auto; aspect-ratio: 4/5; background: #f1dfb5; box-shadow: 0 7px 16px #18130faa; }
.picture canvas { width: 100%; }
#reference-image { object-fit: cover; }
#game-art { cursor: crosshair; touch-action: manipulation; }
.picture.repairing #game-art, #stage { cursor: grab; touch-action: none; }
.picture.repairing #game-art:active, #stage:active { cursor: grabbing; }
#mobile-cue { display: none; }
#markers { position: absolute; inset: 0; pointer-events: none; }
.pin { position: absolute; transform: translate(-50%, -50%); width: 25px; height: 25px; border-radius: 50%; background: var(--red); color: #fff3d9; border: 2px solid #fff0d8; text-align: center; font: 700 14px/21px var(--sans); box-shadow: 0 0 0 2px #5d3327; }
.pin.hint { background: var(--green); box-shadow: 0 0 0 5px #f6d37b99; }
#order-brief { margin: 0 0 15px; padding: 11px 11px 9px; background: #f7ead4; border: 1px solid #e4d2b5; border-radius: 3px; }
#order-story { margin: 4px 0 8px; line-height: 1.65; }
#order-steps { padding: 0; margin: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px; }
#order-steps li { padding: 2px 4px; border: 1px solid #d8c4a6; border-radius: 2px; font-size: 10px; }
#order-steps li[aria-current] { background: var(--red); color: #fff6e7; border-color: var(--red); }
#order-steps li.done { color: var(--green); }
#order-stamp { font: 700 14px var(--serif); color: var(--red-dark); border: 3px double var(--red); white-space: nowrap; padding: 1px 6px; }
.game-panel h2 { margin: 4px 0 8px; font-size: 23px; }
.game-panel p { font-size: 13px; }
#game-intro { margin: 0 0 10px; color: var(--muted); }
#clues { margin: 7px 0 12px; padding: 0 0 0 22px; }
#clues:empty { display: none; }
#clues li { padding: 7px 2px; border-bottom: 1px solid #ecdfca; font-size: 13px; color: var(--muted); }
#clues li.found { color: var(--green); }
#clues li.current { color: var(--red-dark); font-weight: 700; }
#game-actions { display: grid; gap: 6px; }
#game-actions .quiet { justify-self: start; }
#game-actions .choice { min-height: 39px; background: #f7edda; border: 1px solid var(--rule); text-align: left; padding: 6px 8px; border-radius: 3px; }
#game-actions .choice:hover { background: #eed8ba; }
#game-actions .choice[aria-pressed="true"] { background: #efd7b6; border-color: var(--red); font-weight: 700; }
#game-actions input, #roller { width: 100%; accent-color: var(--red); }
#game-actions label { font-size: 13px; }
#game-status, #feedback { color: var(--red-dark); min-height: 19px; margin: 6px 0 0; font-size: 13px; }
.order-picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
#game-actions .order-picks .choice { text-align: center; }
.gauge-value { font-variant-numeric: tabular-nums; font-size: 13px; }
.plates { display: grid; gap: 6px; }
.plate { display: grid; grid-template-columns: 16px 1fr auto; gap: 7px; align-items: center; min-height: 39px; padding: 6px 8px; border: 1px solid var(--rule); border-radius: 3px; background: #f8eddb; text-align: left; }
.plate[aria-pressed="true"] { background: #efd7b6; border-color: var(--red); }
.swatch { width: 14px; height: 14px; border: 1px solid #70493466; border-radius: 50%; }
.swatch.ink { background: #302820; }
.swatch.red { background: #a53628; }
.swatch.green { background: #48705d; }
.actions { border-top: 1px solid var(--rule); margin-top: 14px; padding-top: 12px; }
.actions h3 { font-size: 17px; }
#alignment { color: var(--muted); margin: 3px 0 7px; font-size: 12px; }
.arrows, .secondary { display: flex; gap: 6px; }
.arrows button { background: #f3e4cc; border: 1px solid var(--rule); min-width: 38px; min-height: 39px; padding: 0; font-size: 18px; }
.arrows button:hover { background: #edd6b5; }
#game-actions .arrows button { flex: 1; }
.roller-label { display: block; font-size: 12px; margin-top: 8px; color: var(--muted); }
#roller { margin: 7px 0; cursor: ew-resize; }
.primary { width: 100%; min-height: 43px; border: 1px solid var(--red); border-radius: 3px; background: var(--red); color: #fff5e3; font-weight: 700; }
.primary:hover { background: var(--red-dark); }
.secondary { justify-content: space-between; font-size: 12px; margin-top: 4px; }
.quiet { padding: 5px 0; border: 0; background: transparent; color: var(--red-dark); text-decoration: underline; text-underline-offset: 4px; }
.craft { max-width: 720px; border-top: 1px solid var(--rule); margin: 38px 0 35px; padding-top: 20px; color: var(--muted); }
.craft h2 { color: var(--ink); margin-top: 4px; }
.craft a { color: var(--red-dark); }
@media (max-width: 1000px) {
  .mast, main { width: calc(100% - 40px); }
  .modes button { grid-template-columns: 1fr; gap: 2px; }
  .workbench { grid-template-columns: 142px minmax(0, 1fr) 218px; gap: 9px; }
  .panel { padding: 11px; }
  .mat { padding: 11px; }
}
@media (max-width: 720px) {
  .mast, main { width: calc(100% - 26px); }
  .mast { height: 50px; }
  .hero { min-height: 118px; margin: 12px 0 10px; }
  .hero-copy { padding: 12px 16px; max-width: 78%; }
  .hero-copy > p:last-child { font-size: 12px; line-height: 1.5; }
  .hero-art { left: 41%; background-image: linear-gradient(90deg, #f1dfc2 0%, #f1dfc2f0 25%, #f1dfc200 77%), url("art/fish.webp"); background-position: center, 65% 34%; }
  h1 { font-size: 48px; }
  .modes { gap: 5px; margin-bottom: 10px; }
  .modes button { padding: 8px 2px; text-align: center; min-height: 43px; }
  .modes strong { font-size: 13px; }
  .modes small { display: none; }
  .workbench { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .gallery h2 { margin-bottom: 6px; font-size: 16px; }
  .gallery-items { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .work { padding: 3px; }
  .work img { aspect-ratio: 1.52; }
  .work span { padding-top: 2px; }
  .work strong { font-size: 12px; }
  .work small { font-size: 10px; }
  .station { padding: 7px; }
  .mat { padding: 8px; }
  .picture, #stage, #reference-image, #print-paper-back { width: min(100%, 356px); }
  #mobile-cue { display: block; margin: 0 0 6px; padding: 5px 7px; background: #f0e0c6; color: var(--red-dark); font-size: 13px; }
  .arrows button { min-height: 44px; min-width: 44px; }
  .craft { margin-top: 24px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* The proof desk reuses the workshop palette and paper frame. */
.modes { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.case-files { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.case-files button { display: flex; align-items: center; gap: 9px; text-align: left; min-height: 54px; border: 1px solid var(--rule); border-radius: 3px; background: var(--panel); padding: 4px 8px; }
.case-files button[aria-pressed="true"] { border-color: var(--red); background: #f3ddc2; }
.case-files img { width: 39px; height: 43px; object-fit: cover; }
.case-files strong, .case-files small { display: block; }
.case-files small { font-size: 11px; color: var(--muted); }
.case-layout { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(270px, 1fr); align-items: start; gap: 14px; }
.case-picture { position: relative; width: min(100%, 365px); }
.case-picture canvas { width: 100%; }
#case-divider { position: absolute; inset-block: 0; left: 50%; width: 2px; background: #fff5dc; box-shadow: 0 0 0 1px #23181199; pointer-events: none; }
.case-views { display: flex; gap: 5px; margin-bottom: 8px; }
.case-views button, .case-options button { flex: 1; border: 1px solid var(--rule); border-radius: 3px; background: #f6ead5; min-height: 40px; padding: 4px; }
.case-views button[aria-pressed="true"], .case-options button[aria-pressed="true"] { background: #f1d5af; border-color: var(--red); color: var(--red-dark); font-weight: 700; }
.case-compare { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; }
.case-compare > span:not(.range-pair) { min-width: 0; }
.case-compare input, .case-adjust input { width: 100%; min-width: 0; accent-color: var(--red); }
.case-panel h2 { margin: 4px 0 8px; font-size: 24px; }
.case-panel p { margin: 5px 0 12px; font-size: 14px; }
.case-panel fieldset { min-width: 0; margin: 0 0 10px; border: 0; padding: 0; }
.case-panel legend { color: var(--muted); padding: 0; margin-bottom: 4px; font-size: 13px; }
.case-options { display: flex; gap: 5px; }
.case-adjust { margin-bottom: 12px; }
.case-adjust label { display: grid; grid-template-columns: 4em minmax(0, 1fr) 4em; align-items: center; gap: 4px; min-height: 37px; font-size: 13px; }
.case-adjust output { text-align: right; font-variant-numeric: tabular-nums; }
#case-result { min-height: 1.6em; color: var(--red-dark); }
@media(max-width: 720px) {
  .modes { grid-template-columns: repeat(6,minmax(0,1fr)); }
  .modes button { grid-column: span 2; }
  .modes button:nth-child(-n+2) { grid-column: span 3; }
  .case-layout { grid-template-columns: minmax(0,1fr); gap: 9px; }
  .case-files { gap: 4px; }
  .case-files button { flex-direction: column; gap: 3px; padding: 3px 2px; text-align: center; font-size: 12px; }
  .case-files img { width: 100%; height: 33px; }
  .case-picture { width: min(100%, 290px); }
  .case-options button { min-height: 44px; }
}
