:root { color-scheme: dark; font-family: system-ui, sans-serif; color: #e6dfd0; background: #171616; }
* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button, .file-button { cursor: pointer; }
button { color: inherit; }
button:disabled { cursor: wait; opacity: .55; }
button:focus-visible, a:focus-visible { outline: 2px solid #e8c786; outline-offset: 5px; }
[hidden] { display: none !important; }
#player { width: 100%; height: 100dvh; overflow: hidden; background: #000; }
#canvas { display: block; width: 100%; height: 100%; outline: none; touch-action: none; }
#welcome { position: fixed; inset: 0; display: grid; place-items: center; overflow-y: auto; background: radial-gradient(ellipse at 50% 40%, #302d20 0, #1c1e18 42%, #101411 90%); }
#welcome::before { content: ''; position: fixed; inset: 22px; border: 1px solid #b8935140; pointer-events: none; }
.welcome-content { width: min(720px, 100%); text-align: center; padding: 44px 32px 32px; }
.eyebrow { font-size: 10px; letter-spacing: .32em; color: #bda678; }
h1 { font-family: Georgia, 'Times New Roman', serif; font-size: clamp(27px, 4vw, 36px); font-weight: 400; line-height: 1.16; color: #ead8b0; margin: 22px 0 0; text-shadow: 0 2px 15px #000; }
h1 span { display: block; font-size: .6em; font-style: italic; margin-bottom: 4px; }
h1 strong { display: block; font-size: 1.85em; line-height: 1.1; letter-spacing: .1em; font-weight: 400; padding-left: .1em; }
.intro { color: #a69e8e; font-family: Georgia, serif; font-style: italic; font-size: 16px; margin: 10px 0 24px; }
.map-scene { position: relative; padding: 5px; border: 1px solid #9c814e; background: #171b13; box-shadow: 0 0 0 3px #10130ed9, 0 0 0 4px #75633b55, 0 16px 48px #0005; }
.map-scene::after { content: ''; position: absolute; inset: 5px; pointer-events: none; box-shadow: inset 0 0 35px 12px #11180e77; border: 1px solid #bbaa6340; }
#adventure-map { display: block; width: 100%; height: auto; aspect-ratio: 20 / 9; image-rendering: pixelated; background: #24351b; }
.map-caption { position: absolute; bottom: 16px; left: 18px; z-index: 1; color: #e7d7aa; font: italic 13px Georgia, serif; text-shadow: 0 1px 4px #000, 0 0 12px #000; }
.map-compass { position: absolute; right: 18px; top: 17px; color: #efe0b8; font: 9px Georgia, serif; text-shadow: 0 1px 4px #000; }
.map-compass span { display: block; font-size: 33px; line-height: 1; }
.loading { margin: 25px auto 14px; max-width: 480px; text-align: left; }
.loading-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; color: #e4d1a2; font-size: 12px; letter-spacing: .025em; }
#loading-percent { font-size: 11px; color: #c4ae7c; font-variant-numeric: tabular-nums; }
progress { appearance: none; display: block; overflow: hidden; width: 100%; height: 6px; border: 1px solid #74613c66; border-radius: 1px; background: #11160f; accent-color: #bfa16b; }
progress::-webkit-progress-bar { background: #11160f; }
progress::-webkit-progress-value { background: linear-gradient(90deg, #846738, #dbc38a); }
progress::-moz-progress-bar { background: linear-gradient(90deg, #846738, #dbc38a); }
progress:indeterminate { background: repeating-linear-gradient(110deg, #9b815233 0 12px, #11160f 12px 24px); background-size: 200% 100%; animation: loading-road 2s linear infinite; }
progress:indeterminate::-webkit-progress-bar { background: transparent; }
.loading[data-state="error"] .loading-heading, .loading[data-state="error"] #loading-percent { color: #e9a594; }
.loading[data-state="error"] progress { border-color: #c98e7d; }
.map-scene[data-state="error"] { filter: saturate(.5); }
#status { font-size: 11px; color: #b4aa99; min-height: 19px; margin: 9px 0 0; line-height: 1.7; font-variant-numeric: tabular-nums; }
@keyframes loading-road { to { background-position: -48px 0; } }
.primary { min-width: 220px; padding: 15px 25px; border: 1px solid #c6a567; background: #ad884731; letter-spacing: .08em; font-size: 13px; color: #f1dfb9; border-radius: 2px; }
.primary:hover:enabled { background: #ad884755; }
.welcome-note { margin-top: 16px; font-size: 11px; color: #9f9585; }
#toolbar { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 1px; padding: 3px; background: #151514db; border: 1px solid #8c795444; border-radius: 5px; opacity: .12; transition: opacity .2s; }
#toolbar:hover, #toolbar:focus-within, #toolbar.visible { opacity: 1; }
#toolbar button { background: transparent; border: 0; border-radius: 3px; padding: 6px 12px; font-size: 11px; }
#toolbar button:hover { background: #cab38425; }
#notice { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: #181816f5; border: 1px solid #897343; padding: 12px 20px; margin: 0; max-width: 90vw; font-size: 12px; border-radius: 3px; text-align: center; }
#notice.error { border-color: #c98e7d; color: #ffccbc; }
dialog { background: #211f1b; border: 1px solid #8f7950; color: #e6dfd0; max-width: min(460px, calc(100vw - 32px)); max-height: 85dvh; padding: 32px; border-radius: 4px; box-shadow: 0 15px 70px #000a; }
dialog::backdrop { background: #0009; }
dialog h2 { font: 28px Georgia, serif; color: #e5cc96; }
dialog p { font-size: 12px; line-height: 1.7; color: #b6ad9e; }
.close { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; font-size: 24px; }
dl { display: grid; grid-template-columns: 95px 1fr; gap: 16px 10px; font-size: 12px; margin: 28px 0; }
dt { color: #e5cc96; } dd { margin: 0; color: #c1b8a8; }
dialog .primary { display: block; margin: 24px auto 0; }
#save-list { list-style: none; padding: 0; max-height: 40vh; overflow: auto; }
#save-list li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid #8f795030; font-size: 12px; }
#save-list button, .file-button { border: 1px solid #8f7950; padding: 7px 10px; background: transparent; font-size: 12px; }
.file-button { display: inline-block; margin-top: 20px; position: relative; overflow: hidden; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-button:focus-within { outline: 2px solid #e8c786; outline-offset: 3px; }
.small { font-size: 11px; }
@media (max-width: 520px) {
  #welcome::before { inset: 10px; }
  .welcome-content { padding: 32px 24px 24px; }
  .map-caption { font-size: 11px; bottom: 12px; left: 12px; }
  .map-compass { top: 12px; right: 12px; }
  .map-compass span { font-size: 24px; }
  .loading { margin-top: 22px; }
}
@media (max-height: 760px) and (min-width: 521px) {
  .welcome-content { width: min(632px, 100%); padding-top: 26px; padding-bottom: 22px; }
  h1 { font-size: 30px; margin-top: 14px; }
  h1 strong { font-size: 1.5em; }
  .intro { margin: 7px 0 18px; }
  .loading { margin-top: 20px; }
}
@media (max-height: 680px) and (min-width: 521px) {
  .welcome-content { width: min(600px, 100%); padding-top: 20px; padding-bottom: 20px; }
  h1 { font-size: 28px; margin-top: 12px; }
  h1 strong { display: inline; font-size: 1.25em; padding-left: .25em; }
  .intro { margin: 8px 0 16px; }
  .loading { margin-top: 18px; margin-bottom: 12px; }
  .welcome-note { margin-top: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
