:root {
  color-scheme: light;
  --paper: #f8f1e8;
  --ink: #302829;
  --muted: #675754;
  --line: #e5d3c3;
  font: 16px/1.55 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at 65% 12%, #fff9ee, transparent 57%), var(--paper); color: var(--ink); }
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid #a54941; outline-offset: 4px; }
button, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
.shell { width: min(100% - 32px, 760px); margin: 0 auto; }
.bar { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.bar img { display: block; width: 66px; height: auto; }
.back { color: var(--muted); font-size: .82rem; text-underline-offset: 5px; }
.landing, .game { padding: 28px 0 36px; }
h1 { margin: 5px 0 7px; font: 700 clamp(2rem, 8vw, 3.35rem)/1.08 "Songti SC", "Noto Serif CJK SC", SimSun, serif; }
.intro p, .landing > p { margin: 10px 0 0; color: var(--muted); }
.intro { text-align: center; }
.game-mark, .tile-mark { display: grid; place-content: center; color: var(--accent); background: #fff8ee; border: 1px solid var(--line); }
.game-mark { width: 54px; height: 54px; margin: 0 auto; border-radius: 50%; font-size: 30px; }
.intro .game-type { color: var(--accent); font-size: .8rem; letter-spacing: .18em; font-weight: 750; }
.table { width: min(100%, 530px); margin: 22px auto 0; background: #fffaf4; border: 1px solid var(--line); border-radius: 23px; padding: 15px 16px 20px; box-shadow: 0 10px 22px #6841260c; }
.table > p { margin: 0 0 9px; }
#instructions { color: var(--muted); font-size: .87rem; }
#status { color: var(--accent); font-weight: 730; }
#status:empty { display: none; }
#game-board { display: grid; gap: 12px; }
.primary, .control, .lane, .memory-pad { min-height: 44px; border-radius: 14px; border: 1px solid var(--line); color: var(--ink); background: #fffdf7; font-weight: 740; padding: 9px 13px; }
.primary { justify-self: start; background: var(--accent); color: #fff; border-color: var(--accent); }
.controls, .code-form { display: flex; flex-wrap: wrap; gap: 8px; }
.lanes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.lane { min-height: 116px; display: grid; align-content: space-around; color: var(--accent); }
.lane[data-lit="true"], .memory-pad[data-lit="true"] { background: var(--accent); color: #fff; }
.lane strong { font-size: 2rem; line-height: 1; }
.lane small { font-size: .73rem; }
.memory { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.memory-pad { min-height: 62px; font-size: 1.55rem; }
.memory-pad:disabled { opacity: 1; }
.beat-track { position: relative; height: 44px; border-radius: 15px; background: #e9dde2; overflow: hidden; }
.beat-window { position: absolute; inset: 0 35% 0 42%; background: #f4cf89; }
.beat-dot { top: 9px; height: 26px; width: 12px; border-radius: 12px; background: var(--accent); position: absolute; transform: translateX(-50%); }
.crates { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: #f0e4d4; border: 1px solid var(--line); padding: 4px; gap: 3px; max-width: 350px; border-radius: 12px; }
.cell { display: grid; place-items: center; aspect-ratio: 1; border-radius: 5px; background: #fff9ee; color: var(--accent); font-size: clamp(.86rem, 4vw, 1.4rem); font-weight: 800; }
.cell.wall { background: #605247; }
.cell.target { background: #ffe4a8; }
.cell.box { background: #d2a566; color: #332419; }
.cell.player { background: #4b426d; color: #fff; }
.code-form input { width: 9.5ch; min-height: 44px; border: 1px solid #a89082; border-radius: 12px; background: #fff; padding: 6px 10px; }
.guesses { margin: 0; padding-left: 1.85em; font-variant-numeric: tabular-nums; }
.guesses li { padding: 3px 0; }
.game-tile { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 12px; color: inherit; text-decoration: none; background: #fffaf4; border: 1px solid var(--line); border-radius: 14px; padding: 11px; }
.game-tile:hover { border-color: var(--accent); }
.game-tile strong, .game-tile .description, .game-tile small { display: block; }
.game-tile small, .tile-arrow { color: var(--accent); font-weight: 750; }
.game-tile .description { color: var(--muted); font-size: .82rem; }
.tile-mark { width: 42px; height: 42px; border-radius: 11px; font-size: 25px; }
.library { display: grid; gap: 9px; list-style: none; padding: 0; margin: 21px 0 0; }
footer { color: var(--muted); font-size: .8rem; padding: 14px 0 25px; border-top: 1px solid var(--line); }
.result-card { display: grid; gap: 12px; margin-top: 18px; }
.result-card img { width: min(100%, 288px); height: auto; border-radius: 12px; }
.result-card a { display: inline-flex; align-items: center; text-decoration: none; }
