:root {
  --parch: #efe3c4;
  --parch2: #e3d3ad;
  --ink: #3a2a1a;
  --ink2: #6a5238;
  --rub: #8e2c1c;
  --bronze: #b08d45;
  --shadow: 0 6px 24px rgba(20, 12, 4, .35);
}
html, body { margin: 0; height: 100%; overflow: hidden; background: #1c160f; color: var(--ink); font-family: 'EB Garamond', Georgia, serif; -webkit-user-select: none; user-select: none; touch-action: none; -webkit-tap-highlight-color: transparent }
canvas { display: block }
#gl { position: fixed; inset: 0; width: 100%; height: 100% }
button { font: inherit; cursor: pointer; color: inherit }

#hud { position: fixed; inset: 0; pointer-events: none; display: none }
#hud.on { display: block }
#hud button, #choose button, #station button { pointer-events: auto }

#date { position: absolute; left: max(16px, env(safe-area-inset-left)); top: max(14px, env(safe-area-inset-top)); color: #fff8e8; text-shadow: 0 1px 3px rgba(0,0,0,.7), 0 0 14px rgba(0,0,0,.35); line-height: 1.15 }
#date b { display: block; font-family: Cinzel, serif; font-weight: 700; font-size: 19px; letter-spacing: .04em }
#date span { display: block; font-size: 16px; opacity: .92 }
#date i { display: block; font-size: 15px; color: #ffe2a0; margin-top: 2px }

#corner { position: absolute; right: max(12px, env(safe-area-inset-right)); top: max(12px, env(safe-area-inset-top)); display: flex; gap: 8px }
#corner button { width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid rgba(255, 240, 210, .55); background: rgba(40, 28, 16, .5); color: #fff4dc; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 16px; backdrop-filter: blur(3px) }
#corner button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round }
#corner button.off { opacity: .5 }

#road { position: absolute; left: max(16px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom)); color: #fff8e8; text-shadow: 0 1px 3px rgba(0,0,0,.75), 0 0 12px rgba(0,0,0,.4); max-width: calc(100% - 250px) }
#road b { display: block; font-family: Cinzel, serif; font-size: 20px; letter-spacing: .05em }
#road span { display: block; font-size: 17px; opacity: .92 }

#hodo { position: absolute; right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); width: 176px; height: 176px; pointer-events: auto; cursor: pointer; filter: drop-shadow(0 4px 10px rgba(0,0,0,.45)) }
#hodoCv { width: 100%; height: 100% }
#hodoN { position: absolute; left: 0; right: 0; bottom: -2px; text-align: center; color: #fff4dc; font-size: 15px; text-shadow: 0 1px 3px #000 }

#choose { position: absolute; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: none; flex-direction: column; align-items: center; gap: 8px; width: min(94vw, 560px) }
#choose.on { display: flex }
#choose h3 { margin: 0 0 2px; font-family: Cinzel, serif; font-size: 17px; letter-spacing: .06em; color: #fff4dc; text-shadow: 0 1px 4px #000 }
#choose .opts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center }
#choose button, #station button { display: flex; align-items: center; gap: 10px; padding: 9px 16px 9px 12px; border-radius: 6px; border: 1px solid #b89a64; background: var(--parch); color: var(--ink); box-shadow: var(--shadow); font-size: 17px; text-align: left; line-height: 1.1 }
#choose button:hover, #station button:hover { background: #fff3d6 }
#choose button .ar { width: 26px; height: 26px; flex: none }
#choose button .ar svg { width: 26px; height: 26px; fill: none; stroke: var(--rub); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round }
#choose button small { display: block; color: var(--ink2); font-size: 14px }
#choose button b { font-family: Cinzel, serif; font-size: 15px; font-weight: 700; letter-spacing: .03em }

#station { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); display: none; min-width: min(90vw, 360px); max-width: 94vw; padding: 18px 22px 16px; background: var(--parch); border: 1px solid #b89a64; border-radius: 4px; box-shadow: var(--shadow), inset 0 0 40px rgba(140, 100, 40, .18); text-align: center; pointer-events: auto }
#station.on { display: block }
#station h3 { margin: 0; font-family: Cinzel, serif; font-size: 26px; letter-spacing: .06em; color: var(--rub) }
#station p { margin: 6px 0 12px; font-size: 18px }
#station .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap }
#station button { justify-content: center }
#station button.main { background: var(--rub); color: #fff4e0; border-color: #6a1f12 }
#pebbles { height: 36px; margin: 4px auto 6px; position: relative; width: 240px }
#pebbles i { position: absolute; width: 11px; height: 9px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #e8e2d6, #8a8478); box-shadow: 0 1px 1px rgba(0,0,0,.4); transition: transform .5s cubic-bezier(.3,1.5,.5,1), opacity .4s }

#toast { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); color: #fff8e8; font-size: 18px; text-shadow: 0 1px 4px #000, 0 0 12px rgba(0,0,0,.5); opacity: 0; transition: opacity .6s; text-align: center; max-width: 90vw }
#toast.on { opacity: 1 }
#big { position: absolute; left: 0; right: 0; top: 30%; text-align: center; color: #fff8e8; font-family: Cinzel, serif; font-size: clamp(34px, 7vw, 72px); letter-spacing: .12em; text-shadow: 0 2px 10px rgba(0,0,0,.7); opacity: 0; transition: opacity 1.2s }
#big small { display: block; font-family: 'EB Garamond', serif; font-size: 20px; letter-spacing: .02em; margin-top: 6px }
#big.on { opacity: 1 }

#mapWrap { position: fixed; inset: 0; display: none; background: #d9c69a }
#mapWrap.on { display: block }
#mapCv { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none }
#mapHead { position: absolute; left: 0; right: 0; top: max(14px, env(safe-area-inset-top)); text-align: center; pointer-events: none }
#mapHead h2 { margin: 0; font-family: Cinzel, serif; font-weight: 700; font-size: clamp(20px, 3vw, 30px); letter-spacing: .18em; color: var(--rub) }
#mapHead span { font-size: 16px; color: var(--ink2) }
#mapClose, #bookClose { position: absolute; right: max(12px, env(safe-area-inset-right)); top: max(12px, env(safe-area-inset-top)); width: 44px; height: 44px; border-radius: 50%; border: 1px solid #a88a54; background: var(--parch); font-size: 26px; line-height: 1; color: var(--ink) }
#mapHint { position: absolute; left: 0; right: 0; bottom: max(14px, env(safe-area-inset-bottom)); text-align: center; font-size: 16px; color: var(--ink2); pointer-events: none; padding: 0 16px }

#book { position: fixed; inset: 0; display: none; background: rgba(20, 12, 4, .55) }
#book.on { display: flex; align-items: center; justify-content: center }
#bookIn { position: relative; width: min(92vw, 560px); max-height: 84vh; overflow: auto; padding: 22px 26px; background: var(--parch); border-radius: 4px; box-shadow: var(--shadow), inset 0 0 50px rgba(140, 100, 40, .2); touch-action: pan-y }
#bookIn h2 { margin: 0 0 6px; font-family: Cinzel, serif; color: var(--rub); letter-spacing: .12em }
#bookStats { font-size: 17px; margin-bottom: 10px; color: var(--ink2) }
#bookList { margin: 0; padding-left: 22px; font-size: 18px; line-height: 1.35 }
#bookList li { margin: 4px 0 }
#bookList li em { color: var(--ink2); font-size: 15px }
#bookList li b { font-family: Cinzel, serif; font-size: 15px; color: var(--rub) }
#bookClose { top: 10px; right: 10px }

#title { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 40%, rgba(40,26,12,.1), rgba(20,12,4,.72)); padding: 16px }
#title.off { display: none }
.tIn { width: min(94vw, 600px); text-align: center; color: #fff4dc; text-shadow: 0 1px 4px rgba(0,0,0,.8) }
.tIn h1 { margin: 0; font-family: Cinzel, serif; font-weight: 700; font-size: clamp(52px, 12vw, 96px); letter-spacing: .16em; color: #fff0cc }
.tIn p { font-size: clamp(17px, 2.3vw, 20px); line-height: 1.4; margin: 10px 0 }
.tIn .lead { font-size: clamp(19px, 2.6vw, 23px) }
.btns { display: flex; gap: 12px; justify-content: center; margin-top: 22px; flex-wrap: wrap }
.go { font-family: Cinzel, serif; font-weight: 700; font-size: 22px; letter-spacing: .12em; padding: 12px 34px; border-radius: 4px; border: 1px solid #6a1f12; background: var(--rub); color: #fff4e0; box-shadow: var(--shadow) }
.go:disabled { opacity: .5; cursor: wait }
.alt { font-size: 17px; padding: 10px 18px; border-radius: 4px; border: 1px solid rgba(255,240,210,.5); background: rgba(40,28,16,.55); color: #fff4dc; display: none }
.alt.on { display: inline-block }
#load { margin-top: 14px; font-size: 16px; opacity: .85; min-height: 20px }
.keys { font-size: 15px !important; opacity: .7; margin-top: 18px !important }

#fade { position: fixed; inset: 0; background: #0a0806; opacity: 0; pointer-events: none; transition: opacity 1.4s }
#fade.on { opacity: 1 }

@media (max-width: 600px) {
  #hodo { width: 132px; height: 132px }
  #road { max-width: calc(100% - 160px) }
  #road b { font-size: 17px }
  #road span { font-size: 15px }
  #date b { font-size: 16px }
  #corner button { width: 38px; height: 38px }
  #corner { gap: 6px; flex-direction: column }
}
.cred { font-size: 13px !important; opacity: .6; margin-top: 8px !important }
.cred a { color: inherit }
