@font-face { font-family: "DMX Serif"; src: url("../assets/dmx-serif.woff2") format("woff2"); font-weight: 600; font-display: swap; }
:root { --paper: #f5f3ed; --ink: #152230; --muted: #657078; --blue: #005bff; --line: #d9dcd7; --serif: "DMX Serif", "Noto Serif CJK SC", "Songti SC", SimSun, serif; --sans: "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif; --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; background: var(--paper); color: var(--ink); font: 13px/1.7 var(--sans); }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; background: url("../assets/paper.svg"); opacity: .18; }
button, a { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .35; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
[hidden] { display: none !important; }
html:not(.game-ready) .level-control, html:not(.game-ready) .board, html:not(.game-ready) .game-status, html:not(.game-ready) .game-actions { display: none; }
.game-ready .load-fallback { display: none; }
.game-shell { position: relative; width: min(100% - 48px, 560px); margin: 0 auto; padding: 30px 0 42px; }
.game-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 15px; }
.eyebrow { margin: 0; font: 9px var(--mono); letter-spacing: 2px; color: var(--muted); }
h1 { margin: 7px 0 0; font: 600 30px/1.4 var(--serif); letter-spacing: 2px; }
.static-translation { display: block; margin-top: 4px; font-family: Georgia, serif; font-size: .55em; font-weight: 400; letter-spacing: 0; }
.back-link { padding-top: 13px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.back-link .static-translation, #instruction .static-translation { font-family: var(--sans); font-size: 11px; }
.back-link:hover { color: var(--blue); }
.embedded .back-link { display: none; }
.embedded .game-header { display: none; }
.embedded .game-shell { padding-top: 14px; }
.game-meta { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 0 10px; }
.game-meta p { margin: 0; color: var(--muted); font-size: 11px; text-align: right; }
html:not(.game-ready) .game-meta p { text-align: left; }
.level-control { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.level-control button { width: 32px; height: 32px; padding: 0; border: 0; background: transparent; font-size: 21px; }
.level-control span { min-width: 55px; text-align: center; font: 11px var(--mono); letter-spacing: 1px; }
.board { position: relative; width: min(100%, 360px); aspect-ratio: 1; margin: 10px auto 0; }
#instruction:focus { outline: none; }
.board svg, .nodes { position: absolute; inset: 0; width: 100%; height: 100%; }
.board svg { overflow: visible; }
.board line { stroke: #a8b3b7; stroke-width: 2; stroke-linecap: round; transition: stroke .2s, stroke-width .2s; }
.board line.drawn { stroke: var(--blue); stroke-width: 4; }
.node { position: absolute; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; transform: translate(-50%, -50%); }
.node::before { content: ""; position: absolute; width: 11px; height: 11px; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); transition: transform .2s, background .2s; }
.node:hover::before, .node:focus-visible::before { transform: scale(1.3); }
.node.start::before, .node.end::before { width: 30px; height: 30px; border-color: var(--ink); }
.node span { position: relative; font: 600 12px/1 var(--serif); }
html[lang="en"] .node span { font-family: var(--mono); }
.node.current::before { border-color: var(--blue); background: var(--blue); }
.node.current span { color: white; }
.game-status { min-height: 28px; margin: 15px 0 0; text-align: center; color: var(--muted); font-size: 11px; }
.game-status.complete { color: var(--blue); }
.game-actions { display: flex; justify-content: center; gap: 12px; margin-top: 8px; }
.game-actions button { min-width: 88px; min-height: 44px; border: 1px solid var(--line); background: transparent; color: var(--ink); }
.game-actions button:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.game-actions .next-level { color: white; background: var(--blue); border-color: var(--blue); }
.game-actions .next-level:hover { color: white; background: #0048cb; }
.noscript { margin-top: 20px; color: var(--muted); }
.load-fallback { margin-top: 20px; color: var(--muted); font-size: 11px; }
.load-fallback span { display: inline-block; margin-top: 7px; }
@media (max-width: 600px) {
  .game-shell { width: min(100% - 32px, 560px); padding-top: 18px; }
  .game-header { padding-bottom: 10px; }
  h1 { font-size: 26px; }
  .game-meta { display: block; padding-top: 10px; }
  .game-meta p { text-align: left; padding: 6px 0 0; }
  .board { margin-top: 4px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
