:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #f4f0e7;
  background: #242824;
  font-synthesis: none;
  --paper: #f4f0e7;
  --muted: #cbc9c0;
  --serif: Charter, "Bitstream Charter", "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body { min-width: 280px; }
button, input, summary { -webkit-tap-highlight-color: transparent; }
button, input, a { font: inherit; }
button { color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { cursor: default; opacity: .4; }
a { color: inherit; text-underline-offset: 5px; }
button, a, summary, input { touch-action: manipulation; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible { outline: 1px solid currentColor; outline-offset: 6px; }
[hidden] { display: none !important; }
svg { display: block; }
kbd { font: 11px -apple-system, BlinkMacSystemFont, sans-serif; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.player, .viewport { position: relative; width: 100%; height: 100%; height: 100dvh; isolation: isolate; overflow: hidden; }
#town-canvas { display: block; width: 100%; height: 100%; background: #242824; outline: none; }
.entry-art { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.entry-art img { width: 100%; height: 100%; object-fit: cover; object-position: 48% 50%; }
.entry-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #141b1b5c, transparent 65%), linear-gradient(0deg, #151c22a3, transparent 52%); }
.scene-fade { position: absolute; inset: 0; background: #171b1b; opacity: 0; z-index: 3; pointer-events: none; }
.exploration-gate { position: absolute; inset: 0; z-index: 20; background: linear-gradient(0deg, #151b20b3, #17202016 55%); }
.entry-title { position: absolute; left: 9%; top: 32%; max-width: 78%; text-shadow: 0 2px 24px #1017104d; }
.entry-title h1 { font: 400 clamp(40px, 5vw, 76px)/1.4 var(--serif); letter-spacing: .035em; margin: 0; }
#gate-context { font-size: 12px; letter-spacing: .18em; color: var(--muted); margin: 0 0 18px; }
#gate-context:empty { display: none; }
.entry-action { position: absolute; left: 50%; bottom: 18%; transform: translateX(-50%); width: min(520px, calc(100% - 48px)); text-align: center; }
.journey-button { display: inline-flex; align-items: center; justify-content: center; gap: 24px; min-height: 52px; padding: 10px 8px; font-size: 16px; letter-spacing: .16em; border-bottom: 1px solid #f4f0e754; }
.journey-button span { font-size: 20px; font-weight: 300; transition: transform .18s ease; }
.journey-button:hover span { transform: translateX(4px); }
.journey-button:hover { border-color: #f4f0e7; }
.gate-message { margin: 16px auto 0; max-width: 420px; color: #e0d8c6; font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.gate-message:empty { display: none; }
.entry-intro { position: absolute; bottom: max(32px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(600px, calc(100% - 150px)); margin: 0; color: #e4e1d6; text-align: center; font: 400 14px/1.8 var(--serif); letter-spacing: .1em; }
.pause-actions { display: flex; justify-content: center; gap: 26px; margin-top: 24px; }
.pause-actions button { font-size: 12px; padding: 8px 0; color: #d0d1ca; }
.pause-actions button:hover { color: #fff; }
.pause-actions kbd { padding-left: 6px; opacity: .65; }
.settings { position: absolute; left: max(28px, env(safe-area-inset-left)); bottom: max(24px, env(safe-area-inset-bottom)); z-index: 5; }
.settings > summary { list-style: none; padding: 10px 2px; cursor: pointer; font-size: 12px; letter-spacing: .12em; color: #e4e1d6; }
.settings > summary::-webkit-details-marker { display: none; }
.settings > summary:hover { color: #fff; }
.settings-panel { position: absolute; left: -4px; bottom: 48px; width: min(328px, calc(100vw - 48px)); max-height: calc(100dvh - 112px); overflow-y: auto; overscroll-behavior: contain; padding: 24px; background: #292e2cf5; box-shadow: 0 12px 48px #0003; scrollbar-width: thin; }
.settings-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.settings-heading h2 { margin: 0; font: 400 22px var(--serif); }
.settings-heading button { font-size: 24px; width: 32px; height: 32px; margin: -8px; }
.look-setting { display: block; font-size: 12px; }
.look-setting > span { display: flex; justify-content: space-between; }
.look-setting output { font-variant-numeric: tabular-nums; color: #bbbeb7; }
.look-setting input { display: block; width: 100%; height: 24px; margin: 12px 0 24px; accent-color: #e8e4d8; }
fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
legend { padding: 0; font-size: 12px; }
.backend-options { display: flex; gap: 24px; margin-top: 14px; font-size: 12px; }
.backend-options label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; }
.backend-options input { margin: 0; accent-color: #e8e4d8; }
.backend-options label:has(:disabled) { opacity: .4; cursor: not-allowed; }
.backend-status { display: grid; gap: 5px; margin: 16px 0 8px; font-size: 11px; color: #dddcd5; }
.settings-note { font-size: 10px; line-height: 1.8; color: #aeb4aa; overflow-wrap: anywhere; }
.setting-action { display: block; width: 100%; padding: 11px 0; margin: 10px 0 4px; border-top: 1px solid #ffffff24; text-align: left; font-size: 12px; }
.setting-action:hover:not(:disabled) { color: #fff; }
.control-guide { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 11px; margin: 18px 0; padding-top: 16px; border-top: 1px solid #ffffff24; }
.control-guide > div { display: flex; gap: 10px; }
.control-guide dt { min-width: 38px; color: #e3e1d7; }
.control-guide dd { margin: 0; color: #aeb4aa; }
.loading { position: absolute; z-index: 25; left: 50%; bottom: 18%; transform: translateX(-50%); width: min(360px, calc(100% - 64px)); text-align: center; pointer-events: none; }
.loading h2 { margin: 0 0 13px; font: 400 17px var(--serif); letter-spacing: .1em; }
.loading p { margin: 0 0 24px; font-size: 11px; line-height: 1.8; color: #e1ded4; }
progress { display: block; width: 100%; height: 2px; border: 0; border-radius: 0; background: #f4f0e729; accent-color: var(--paper); }
progress::-webkit-progress-bar { background: #f4f0e729; }
progress::-webkit-progress-value { background: var(--paper); }
progress::-moz-progress-bar { background: var(--paper); }
.error { position: absolute; z-index: 50; inset: 0; padding: 32px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #202726f0; text-align: center; }
.error h2 { font: 400 clamp(24px, 4vw, 36px) var(--serif); }
.error p { max-width: 580px; font-size: 13px; line-height: 1.9; overflow-wrap: anywhere; }
.error > div { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px; margin-top: 20px; font-size: 13px; }
.error button { padding: 6px 0; border-bottom: 1px solid currentColor; }
.error a { padding: 6px 0; }
@media (max-width: 600px) {
  .entry-title { left: 10%; top: 29%; }
  .entry-title h1 { font-size: 42px; letter-spacing: .15em; }
  .entry-action, .loading { bottom: 22%; }
  .entry-intro { bottom: 74px; width: calc(100% - 56px); font-size: 12px; }
  .settings { left: 24px; }
  .entry-art img { object-position: 53% 50%; }
}
@media (max-height: 530px) and (min-width: 601px) {
  .entry-title { top: 20%; }
  .entry-title h1 { font-size: 42px; }
  .entry-action, .loading { bottom: 23%; }
  .entry-intro { bottom: 24px; font-size: 12px; }
  .pause-actions { margin-top: 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
