:root {
  color-scheme: light;
  --ink: #272622;
  --muted: #71695f;
  --paper: #f6f0e6;
  --line: #ded4c5;
  --green: #233b31;
  --rust: #a14c3e;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid #a14c3e; outline-offset: 3px; }
button:disabled { cursor: default; opacity: .45; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.shell { max-width: 1160px; margin: auto; padding: 0 32px; }
.masthead { min-height: 90px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; font-size: clamp(16px, 3.8vw, 22px); font-weight: 750; letter-spacing: .045em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 36px; border: 1px solid var(--rust); border-radius: 3px 3px 11px 3px; color: var(--rust); font-family: "Songti SC", SimSun, serif; transform: rotate(-6deg); }
.series { font-size: 12px; color: var(--muted); letter-spacing: .13em; text-align: right; }
.series span { margin: 0 .15em; color: var(--rust); }
.layout { display: grid; grid-template-columns: minmax(0, 1.28fr) minmax(320px, 1fr); align-items: start; gap: 26px; padding: 34px 0 24px; }
.theatre { min-width: 0; background: #fbf7ef; border: 1px solid var(--line); border-radius: 16px; padding: 10px; overflow: hidden; }
.screen { position: relative; isolation: isolate; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 9px; background: radial-gradient(ellipse at 55% 50%, #714351, #34202c 75%); transition: background .25s; }
.screen[data-shot="phone"] { background: radial-gradient(ellipse at 52% 42%, #acb3a7, #4c5861 74%); }
.screen[data-shot="guests"] { background: linear-gradient(160deg,#bac9ca,#7c9390 65%,#3e5551); }
.art { position: absolute; display: block; pointer-events: none; opacity: 0; transition: opacity .28s; }
.room { width: 120%; left: -10%; bottom: -1%; }
.hug { width: 87%; left: 6%; bottom: -6%; }
.phone { width: 66%; left: 17%; top: 3%; height: 82%; object-fit: contain; }
.guests { width: 98%; left: 1%; height: 90%; object-fit: contain; object-position: center bottom; bottom: 4%; }
.screen[data-shot="hug"] :is(.room,.hug), .screen[data-shot="phone"] .phone, .screen[data-shot="guests"] .guests { opacity: 1; animation: breathe 5s ease-out both; }
.screen[data-shot="hug"] .room { opacity: .84; }
.screen[data-shot="guests"][data-frame="1"] .guests { animation-name: push-in; }
@keyframes push-in { from { transform: scale(1.03); } to { transform: scale(1.13); } }
@keyframes breathe { from { transform: scale(1); } to { transform: scale(1.035); } }
.screen::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(0deg,#170d18a8,transparent 34%,transparent 78%,#17111666); z-index: 1; }
.filmbar { display: flex; align-items: center; justify-content: space-between; gap: 7px; padding: 10px 2px 7px; }
.shots { display: flex; gap: 5px; }
.shots button, .replay { min-height: 40px; border: 0; border-radius: 7px; padding: 7px 9px; background: transparent; color: #685b50; font-size: 12px; }
.shots button[aria-pressed="true"] { color: #67382d; background: #f1e1d2; }
.panel { min-width: 0; background: #fffaf2; border: 1px solid var(--line); border-radius: 16px; padding: 25px; box-shadow: 0 7px 20px #6e594509; }
.step { color: var(--rust); display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 12px; letter-spacing: .12em; }
.step span:last-child { font: 12px ui-monospace, monospace; }
h1, h2 { margin: 14px 0 10px; font-family: "Songti SC", "Noto Serif CJK SC", SimSun, serif; line-height: 1.22; letter-spacing: -.025em; }
h1 { font-size: clamp(26px, 3.15vw, 34px); text-wrap: balance; }
h2 { font-size: clamp(24px, 2.8vw, 32px); }
.prompt { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.balance { position: relative; width: min(100%, 320px); height: 149px; margin: 9px auto 0; --tilt: 0deg; }
.balance .stand { position: absolute; width: 34%; left: 33%; top: 44%; }
.moving-beam { position: absolute; top: 42%; width: 88%; left: 6%; transform: rotate(var(--tilt)); transition: transform .28s cubic-bezier(.22,.76,.34,1.2); transform-origin: center 50%; }
.moving-beam img { width: 100%; display: block; }
.blocks { position: absolute; bottom: 77%; width: 18%; display: flex; justify-content: center; gap: 2px; }
.blocks-left { left: 7%; }
.blocks-right { right: 7%; }
.blocks i { width: clamp(9px,3vw,16px); aspect-ratio: 1; border-radius: 2px; background: #ae6252; box-shadow: inset -3px -3px #0002, inset 2px 2px #fff4, 0 2px 2px #593d3440; }
.blocks-right i { background: #66877e; }
.balance.drop .blocks i { animation: drop .3s ease-out both; }
@keyframes drop { from { transform: translateY(-14px); opacity: .25; } to { transform: none; opacity: 1; } }
.rating { margin-top: 5px; }
.rating input { width: 100%; margin: 0; accent-color: var(--green); height: 25px; }
.score-buttons { display: flex; justify-content: space-between; padding: 0 0 3px; }
.score-buttons button { width: 33px; height: 34px; border: 1px solid transparent; background: transparent; color: #544c43; border-radius: 7px; }
.score-buttons button.active { border-color: #bacac2; background: #e8efe9; font-weight: 750; color: var(--green); }
.rating-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.rating-note { min-height: 19px; margin: 9px 0; color: #61594f; font-size: 12px; line-height: 1.55; }
.primary, .secondary { display: flex; gap: 10px; align-items: center; justify-content: center; width: 100%; min-height: 46px; border: 1px solid transparent; border-radius: 8px; padding: 10px; font-weight: 650; font-size: 14px; text-align: center; }
.primary { background: var(--green); color: #fff9ed; }
.secondary { background: transparent; border-color: #c8bdaf; color: var(--green); }
.primary:not(:disabled):hover { background: #355547; }
.secondary:hover { background: #eee8dc; }
.finish .prompt { margin-bottom: 16px; }
.finish-actions { display: grid; gap: 8px; margin-top: 16px; }
.finish-actions .plain { justify-self: center; }
.plain { background: transparent; border: 0; min-height: 38px; color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 4px; }
.result-card { padding: 16px; background: #f2e8d9; border-radius: 9px; margin: 13px 0; }
.result-card h3 { margin: 0 0 10px; font-size: 15px; }
.status { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.code-field { width: 100%; padding: 9px; border: 1px solid #c8bdaf; border-radius: 6px; color: var(--ink); background: #fffaf2; font-size: 12px; }
.footer { border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0 20px; }
.footer a, .footer button { color: var(--muted); font-size: 11px; }
.footer button { border: 0; background: none; padding: 8px 0; text-decoration: underline; }
dialog { background: #fffaf2; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); width: min(400px, 90vw); padding: 25px; }
dialog::backdrop { background: #29231dc0; }
dialog form { position: relative; }
dialog label { display: block; color: var(--muted); font-size: 13px; margin: 13px 0 8px; }
dialog input { width: 100%; border: 1px solid #c8bdaf; border-radius: 6px; padding: 10px; }
.close { position: absolute; top: -18px; right: -15px; background: none; border: 0; font-size: 26px; color: var(--muted); width: 42px; height: 42px; }
.error { color: #a14c3e; font-size: 13px; }
@media (max-width: 720px) {
  .shell { padding: 0 14px; max-width: 520px; }
  .masthead { min-height: 61px; }
  .layout { grid-template-columns: 1fr; gap: 13px; padding: 13px 0; }
  .screen { aspect-ratio: 1.45; }
  .panel { padding: 18px; }
  .theatre { padding: 7px; }
  .filmbar { padding-top: 4px; padding-bottom: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::after { animation: none !important; transition: none !important; }
}
.chapter-track { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 19px; border: 1px solid var(--line); border-radius: 12px; background: #fbf7ef; overflow: hidden; }
.chapter-stop { min-width: 0; padding: 10px 12px; display: flex; align-items: center; gap: 8px; border-right: 1px solid var(--line); color: #756b5e; font-size: 12px; }
.chapter-stop:last-child { border-right: 0; }
.chapter-stop b { font: 11px ui-monospace, monospace; color: #8d6c57; }
.chapter-stop span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapter-stop.active { background: #efe3d6; color: #71392e; font-weight: 700; }
.chapter-stop.done { color: #355547; }
.layout { padding-top: 17px; }
.scenery, .cast { opacity: 1; }
.scenery { width: 120%; left: -10%; bottom: -1%; opacity: .84; }
.cast { width: 94%; left: 3%; bottom: -3%; }
.screen[data-shot="hug"] .cast { width: 87%; left: 6%; bottom: -6%; }
.screen[data-shot="phone"] .cast { width: 66%; left: 17%; top: 3%; height: 82%; object-fit: contain; }
.screen[data-shot="guests"] .cast { width: 98%; left: 1%; }
.screen[data-setting="train"] { background: #66594d; }
.screen[data-setting="cabin"] { background: #789895; }
.screen .art { transition: none; }
.screen .cast.motion { animation: breathe 4.5s ease-out both; }
.screen[data-frame="1"] .cast.motion { animation-name: push-in; }
.question-actions { display: flex; gap: 7px; }
.question-actions .prev { flex: 0 0 88px; width: auto; white-space: nowrap; }
.status:empty { display: none; }
.finish h2 { text-wrap: balance; }
.finish a { color: var(--green); }
.finish .mini-balance { margin-top: 4px; }
.focus-label { display: block; margin: 15px 0 5px; font-size: 13px; color: var(--green); }
.focus-choice { width: 100%; padding: 9px; border: 1px solid #c8bdaf; border-radius: 7px; background: #fffaf2; color: var(--ink); font: inherit; font-size: 13px; }
.inbox { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 10px; }
.inbox button { margin-top: 6px; }
.share-note { font-size: 11px; color: var(--muted); line-height: 1.65; }
@media (max-width: 720px) {
  .chapter-track { margin-top: 9px; }
  .chapter-stop { padding: 7px 5px; justify-content: center; font-size: 10px; gap: 3px; }
  .chapter-stop b { display: none; }
  .layout { padding-top: 9px; }
}

.screen:is([data-shot="snack"], [data-shot="mug"], [data-shot="book"], [data-shot="map"]) .cast {
  width: 76%; height: 82%; left: 12%; top: 1%; object-fit: contain;
}
.screen:is([data-shot="snack"], [data-shot="mug"], [data-shot="book"], [data-shot="map"]) .scenery {
  opacity: .4; filter: blur(3px);
}

.reason-trigger { flex: none; border: 0; border-radius: 7px; min-height: 32px; padding: 5px 8px; background: #f4e8d9; color: #754b3e; font-size: 12px; }
#reason-dialog { position: fixed; max-height: calc(100dvh - 24px); overflow: auto; }
#reason-dialog .close { top: 7px; right: 7px; }
#reason-dialog .reason-options { display: grid; gap: 8px; margin: 12px 0; padding: 0; border: 0; min-width: 0; }
#reason-dialog .reason-options label { display: block; position: relative; margin: 0; cursor: pointer; }
#reason-dialog .reason-options span { display: block; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
#reason-dialog .reason-options input { position: absolute; width: 1px; opacity: 0; }
#reason-dialog .reason-options input:checked + span { background: #e8efe9; color: var(--green); border-color: #bacac2; }
#reason-dialog .reason-options input:focus-visible + span { outline: 2px solid var(--rust); }

@media (max-width: 720px) {
  body { min-width: 0; }
  .shell { padding-inline: 8px; }
  .masthead { min-height: 43px; gap: 8px; }
  .brand { gap: 7px; }
  .brand-mark { width: 25px; height: 27px; font-size: 14px; }
  .series { font-size: 10px; letter-spacing: .04em; }
  .chapter-track { margin-top: 5px; }
  .chapter-stop { padding-block: 5px; }
  .layout { gap: 6px; padding-block: 6px; }
  .theatre { display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 4px; border-radius: 12px; }
  .screen { grid-column: 1 / -1; aspect-ratio: auto; height: clamp(108px, 28vh, 230px); height: clamp(108px, 28dvh, 230px); }
  .screen .scenery { width: 100%; height: 100%; inset: 0; object-fit: cover; }
  .screen :is(.cast, .art.cast) { height: 105%; max-width: 100%; object-fit: contain; object-position: center bottom; }
  .screen[data-shot="hug"] .cast { height: 112%; bottom: -13%; }
  .screen[data-shot="phone"] .cast { height: 82%; }
  .screen:is([data-shot="snack"], [data-shot="mug"], [data-shot="book"], [data-shot="map"]) .cast { height: 82%; }
  .filmbar { justify-content: flex-start; gap: 1px; padding: 0; }
  .shots { gap: 1px; }
  .shots button, .replay { min-height: 32px; font-size: 11px; padding: 3px 5px; }
  #game { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 8px; padding: 8px 9px; border-radius: 12px; }
  #game > *, .score-buttons { grid-column: 1 / -1; }
  #game .rating { display: contents; }
  #game .step { font-size: 11px; }
  #game h1 { margin: 4px 0 4px; font-size: clamp(20px, 5.1vw, 25px); }
  #game .prompt { font-size: 13px; line-height: 1.42; }
  #game .balance { grid-area: 4 / 1; width: min(100%, 178px); height: 77px; margin: 2px auto 0; }
  #game #score { grid-area: 4 / 2; align-self: center; margin-bottom: 15px; }
  #game .rating-ends { grid-area: 4 / 2; align-self: center; margin-top: 24px; font-size: 10px; }
  #game[data-mode="guess"] #score { grid-column: 1 / -1; margin: 8px 0; }
  #game .rating-note { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  #game .blocks i { width: 10px; }
  .rating { margin-top: 0; }
  .rating input { display: block; height: 23px; }
  .score-buttons { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; padding-bottom: 2px; }
  .score-buttons button { width: 100%; height: 40px; border-color: var(--line); }
  #game .question-actions { gap: 5px; margin-top: 3px; }
  #game .question-actions button { min-height: 43px; padding: 6px 5px; font-size: 13px; }
  #game .question-actions .prev { flex-basis: 66px; }
  #game .reason-trigger { min-width: 60px; }
  .footer { padding-block: 1px max(5px, env(safe-area-inset-bottom)); }
  .footer button { padding-block: 7px; }
}

@media (max-width: 720px) and (max-height: 640px) {
  .screen { height: clamp(96px, 21dvh, 145px); }
  .masthead { min-height: 39px; }
  .chapter-stop { padding-inline: 2px; }
}

.welcome, .finish { grid-column: 1 / -1; width: 100%; }
.welcome { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 26px; }
.welcome-art { position: relative; aspect-ratio: 1.55; overflow: hidden; isolation: isolate; border-radius: 11px; background: #433529; }
.welcome-art img { display: block; width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; }
.welcome-art img + img { inset: auto 7% -5%; width: 86%; height: 95%; object-fit: contain; object-position: bottom; }
.welcome-copy h1 { margin-top: 0; }
.welcome-copy p { margin: 10px 0; line-height: 1.5; }
.welcome-subtitle { color: var(--rust); font-weight: 650; white-space: pre-wrap; }
.welcome-copy .primary { margin-top: 20px; max-width: 250px; }
#game .question-copy { font: 650 clamp(20px, 2.4vw, 29px)/1.52 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; text-wrap: wrap; }
.score-summary { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 0 0 15px; background: #f2e8d9; }
.score-summary p { margin: 0; color: var(--muted); font-size: 14px; }
.comparison-heading { margin-bottom: 6px; }
.comparison-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.comparison-card { padding: 12px 14px; background: #f7efe2; border: 1px solid var(--line); border-radius: 10px; }
.comparison-card h4, .comparison-card p { margin: 0; line-height: 1.55; }
.comparison-card h4 { font-size: 14px; color: var(--rust); }
.comparison-card h4 span { color: var(--ink); }
.comparison-card .comparison-scores { color: var(--green); margin: 6px 0 4px; font-size: 14px; font-weight: 700; }
.comparison-note { color: var(--muted); font-size: 13px; }
@media (max-width: 720px) {
  .welcome { grid-template-columns: 1fr; gap: 12px; padding: 12px; }
  .welcome-art { max-height: min(32dvh, 224px); }
  .welcome-copy .primary { max-width: none; margin-top: 14px; }
  #game .question-copy { font-size: clamp(15px, 4.3vw, 21px); line-height: 1.45; }
}

.score-summary { display: grid; grid-template-columns: minmax(260px, 390px) 1fr; align-items: center; gap: 20px; padding: 14px; }
.radar-figure { min-width: 0; background: #fff9ef; border: 1px solid var(--line); border-radius: 9px; padding: 8px; }
.radar-figure svg { display: block; width: 100%; height: auto; max-height: 280px; margin: auto; }
.radar-legend { display: flex; justify-content: center; gap: 15px; font-size: 12px; color: #25604b; }
.radar-legend span:last-child { color: #a04d39; }
.radar-analysis { padding: 3px 8px; }
.radar-analysis h3 { margin: 0 0 8px; color: var(--green); font-size: 18px; }
.radar-analysis p { line-height: 1.65; }
.radar-analysis .radar-note { margin-top: 9px; font-size: 11px; }
@media (max-width: 720px) {
  .score-summary { grid-template-columns: 1fr; gap: 11px; padding: 8px; }
  .radar-figure svg { max-height: 235px; }
  .radar-analysis { padding: 0 4px 3px; }
}

.finish h2:focus, #game .question-copy:focus, #welcome-title:focus { outline: none; }
