:root {
  --ink: #15201a; --ink2: #4c5a52; --paper: rgb(255 255 255 / .86); --paper-solid: #fff; --line: rgb(21 32 26 / .1); --shadow: 0 8px 30px rgb(10 20 15 / .18);
  --orange: #e87500; --orange2: #c96300; --green: #154734; --blue: #2f7df6;
  --st: env(safe-area-inset-top, 0px); --sr: env(safe-area-inset-right, 0px); --sb: env(safe-area-inset-bottom, 0px); --sl: env(safe-area-inset-left, 0px);
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) { :root { --ink: #eef3ef; --ink2: #a9b6ae; --paper: rgb(22 28 25 / .82); --paper-solid: #1a201d; --line: rgb(255 255 255 / .1); --shadow: 0 8px 30px rgb(0 0 0 / .4); } }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0f1512; color: var(--ink); font: 400 14px/1.4 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; touch-action: none; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; flex: none; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
kbd { font: 500 11px Inter, system-ui, sans-serif; padding: 2px 6px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink2); background: rgb(127 127 127 / .08); }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

.pill, .round, .btn, .panel, .modebar, .mini, .chip, .prompt, .toast, .discover, .dash, .tagbar, .map-sheet, .map-pop { background: var(--paper); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); box-shadow: var(--shadow); border: 1px solid var(--line); color: var(--ink); }

/* ---------- title ---------- */
.boot { position: fixed; inset: 0; z-index: 9; pointer-events: none; background: linear-gradient(160deg, #10241b, #1f3b2c 50%, #b85a12); transition: opacity 1.2s ease; }
.boot.done { opacity: 0; }
.title { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; padding: calc(28px + var(--st)) calc(28px + var(--sr)) calc(28px + var(--sb)) calc(28px + var(--sl)); background: linear-gradient(90deg, rgb(8 14 11 / .62), rgb(8 14 11 / .18) 55%, rgb(8 14 11 / 0)); transition: opacity .6s ease, visibility 0s .6s; color: #fff; }
.title.off { opacity: 0; visibility: hidden; pointer-events: none; }
.title.sub .title-card { opacity: 0; transform: translateX(-12px); pointer-events: none; }
.title-card { width: min(540px, 100%); margin-left: clamp(0px, 4vw, 60px); transition: opacity .4s ease, transform .5s var(--ease); }
.app-icon { width: 64px; height: 64px; border-radius: 16px; background: var(--orange); display: grid; place-items: center; box-shadow: 0 8px 24px rgb(232 117 0 / .35); margin-bottom: 22px; }
.app-icon svg { width: 40px; height: 40px; }
.title h1 { margin: 0 0 12px; font-weight: 700; font-size: clamp(32px, 5vw, 52px); letter-spacing: -.02em; line-height: 1.05; text-shadow: 0 2px 24px rgb(0 0 0 / .35); }
.lede { margin: 0 0 26px; font-size: clamp(15px, 1.6vw, 18px); line-height: 1.5; color: rgb(255 255 255 / .88); max-width: 470px; text-shadow: 0 1px 12px rgb(0 0 0 / .4); }
.title-load { display: grid; gap: 10px; margin-bottom: 18px; }
.title.ready .title-load { display: none; }
.title-bar { width: min(280px, 70vw); height: 4px; border-radius: 2px; background: rgb(255 255 255 / .2); overflow: hidden; }
.title-bar b { display: block; height: 100%; background: #fff; transform-origin: 0 50%; transform: scaleX(0); transition: transform .5s ease; }
.title-note { margin: 0; font-size: 13px; color: rgb(255 255 255 / .8); }
.title-actions { display: flex; flex-wrap: wrap; gap: 10px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .6s ease .1s, transform .7s var(--ease) .1s; }
.title.ready .title-actions { opacity: 1; transform: none; pointer-events: auto; }
.title-time { display: flex; align-items: center; gap: 8px; margin: 22px 0 0; font-size: 13px; color: rgb(255 255 255 / .85); opacity: 0; transition: opacity .6s ease .2s; }
.title.ready .title-time { opacity: 1; }
.link { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; color: #fff; font-weight: 500; }
.title-foot { position: absolute; left: calc(28px + var(--sl)); right: calc(28px + var(--sr)); bottom: calc(20px + var(--sb)); display: flex; justify-content: space-between; gap: 16px; font-size: 13px; color: rgb(255 255 255 / .85); opacity: 0; transition: opacity 1s ease; }
.title-foot > span { display: flex; align-items: center; gap: 8px; } .title-foot svg { width: 16px; height: 16px; }
.title.ready .title-foot { opacity: 1; }
#title-place { transition: opacity .5s ease; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 20px; border-radius: 14px; font-weight: 600; font-size: 15px; transition: transform .2s var(--ease), background .2s, box-shadow .2s; }
.title .btn:not(.primary) { background: rgb(255 255 255 / .14); color: #fff; border-color: rgb(255 255 255 / .22); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(.98); }
.btn.primary { background: #fff; color: #15201a; border-color: transparent; }
.panel .btn.primary, .map-pop .btn.primary { background: var(--orange); color: #fff; }
.btn:disabled { opacity: .4; }

/* ---------- panels ---------- */
.panel { border-radius: 20px; padding: 22px; }
.panel h2 { margin: 0 0 6px; font-size: 18px; font-weight: 700; }
.panel label { display: block; margin: 16px 0 8px; font-size: 12px; font-weight: 600; color: var(--ink2); text-transform: uppercase; letter-spacing: .06em; }
.panel input { width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: rgb(127 127 127 / .08); outline: none; font-size: 15px; user-select: text; -webkit-user-select: text; }
.panel input:focus { border-color: var(--orange); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 20px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: rgb(127 127 127 / .1); }
.seg.wrap { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); }
.seg button { height: 36px; border-radius: 9px; border: 0; background: none; font-weight: 500; font-size: 13px; white-space: nowrap; color: var(--ink2); }
.seg button.on { background: var(--paper-solid); color: var(--ink); box-shadow: 0 1px 4px rgb(0 0 0 / .12); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 34px; height: 34px; border-radius: 50%; border: 0; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .15); }
.swatches button.on { box-shadow: 0 0 0 2px var(--paper-solid), 0 0 0 4px var(--orange); }
.look { position: fixed; z-index: 12; left: calc(24px + var(--sl)); top: 50%; transform: translateY(-50%); width: min(350px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 12px; background: rgb(5 10 8 / .3); }
.set { width: min(440px, 100%); max-height: calc(100vh - 24px); overflow: auto; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 13px; }
.keys dt { font-weight: 600; } .keys dd { margin: 0; color: var(--ink2); }
.fine { margin: 16px 0 0; font-size: 12px; color: var(--ink2); }

/* ---------- HUD ---------- */
.hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.hud > * { position: absolute; }
.hud button, .hud form, .mini, .pill { pointer-events: auto; }
.pill { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 16px 0 14px; border-radius: 14px; }
.pill svg { color: var(--green); }
@media (prefers-color-scheme: dark) { .pill svg { color: #ffb467; } }
.place-pill { left: calc(14px + var(--sl)); top: calc(14px + var(--st)); height: auto; min-height: 46px; padding: 8px 16px 8px 12px; max-width: min(420px, calc(100vw - 210px)); }
.place-pill svg { width: 22px; height: 22px; padding: 3px; border-radius: 50%; background: var(--green); color: #fff; }
.place-pill b { display: block; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place-pill i { display: block; font-style: normal; font-size: 12px; color: var(--ink2); }
.top-right { right: calc(14px + var(--sr)); top: calc(14px + var(--st)); display: flex; gap: 8px; }
.round { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 20px; font-weight: 500; }
#time-pill { font-weight: 600; font-size: 15px; }
.modebar { left: calc(14px + var(--sl)); bottom: calc(14px + var(--sb)); display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 16px; pointer-events: auto; }
.modebar button { width: 44px; height: 40px; border-radius: 11px; border: 0; background: none; display: grid; place-items: center; color: var(--ink2); }
.modebar button svg { width: 22px; height: 22px; }
.modebar button.on { background: var(--paper-solid); color: var(--ink); box-shadow: 0 1px 5px rgb(0 0 0 / .15); }
.modebar .sep { width: 1px; height: 26px; background: var(--line); margin: 0 6px; }
.modebar .spd { width: 32px; font-size: 18px; color: var(--ink); }
.speed { min-width: 62px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.mini { right: calc(14px + var(--sr)); bottom: calc(14px + var(--sb)); width: 156px; height: 156px; border-radius: 18px; overflow: hidden; cursor: pointer; }
.mini canvas { width: 100%; height: 100%; display: block; }
.mini-n { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px; border-radius: 50%; background: #fff; color: #15201a; font-size: 10px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 1px 4px rgb(0 0 0 / .3); }
.discover { left: 50%; top: calc(16px + var(--st)); transform: translate(-50%, -140%); display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 10px; border-radius: 16px; transition: transform .6s var(--ease); max-width: calc(100vw - 32px); }
.discover.on { transform: translate(-50%, 0); }
.disc-icon { width: 38px; height: 38px; border-radius: 11px; background: var(--orange); color: #fff; display: grid; place-items: center; }
.discover small { display: block; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--orange); }
.discover b { display: block; font-weight: 600; font-size: 15px; } .discover i { display: block; font-style: normal; font-size: 12px; color: var(--ink2); }
#disc-count { font-size: 12px; font-weight: 600; color: var(--ink2); white-space: nowrap; }
.chip { height: 32px; padding: 0 12px; border-radius: 10px; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.dash { right: calc(14px + var(--sr)); top: calc(72px + var(--st)); width: 230px; padding: 14px 16px; border-radius: 16px; }
.dash h3 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--orange); }
.dash-time { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 0 8px; }
.dash ul { list-style: none; margin: 0 0 10px; padding: 0; font-size: 13px; }
.dash li { display: flex; justify-content: space-between; padding: 3px 0; color: var(--ink2); }
.dash li.done { color: var(--ink); font-weight: 500; } .dash li.done::after { content: '✓'; color: var(--orange); }
.dash-best { margin: 0 0 10px; font-size: 12px; color: var(--ink2); }
.tagbar { top: calc(70px + var(--st)); left: 50%; transform: translateX(-50%); display: flex; gap: 14px; align-items: center; padding: 6px 6px 6px 16px; border-radius: 14px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.tagbar.it { box-shadow: 0 0 0 2px var(--orange), var(--shadow); }
.prompts { left: 50%; bottom: calc(80px + var(--sb)); transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; }
.prompt { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 12px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.toast { left: 50%; top: 24%; transform: translate(-50%, 8px); padding: 10px 18px; border-radius: 14px; font-size: 14px; font-weight: 500; text-align: center; opacity: 0; transition: opacity .35s ease, transform .5s var(--ease); max-width: 90vw; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.chat { left: calc(14px + var(--sl)); bottom: calc(76px + var(--sb)); width: min(340px, 70vw); display: grid; gap: 8px; justify-items: start; }
.chat-log { display: grid; gap: 4px; font-size: 13px; max-height: 150px; overflow: hidden; align-content: end; }
.chat-log p { margin: 0; padding: 4px 10px; border-radius: 10px; background: rgb(10 16 13 / .45); color: #fff; animation: fade 14s forwards; justify-self: start; }
.chat-log b { font-weight: 600; color: #ffc48a; } .chat-log .sys { font-style: italic; color: rgb(255 255 255 / .8); }
@keyframes fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
.chat form { width: 100%; } .chat input { width: 100%; height: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--orange); background: var(--paper); outline: none; user-select: text; -webkit-user-select: text; }
.reticle { left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 3px rgb(0 0 0 / .6); opacity: 0; }
.fp .reticle { opacity: 1; }
.credit { right: calc(180px + var(--sr)); bottom: calc(16px + var(--sb)); font-size: 10px; color: rgb(255 255 255 / .8); text-shadow: 0 1px 3px rgb(0 0 0 / .8); }

/* ---------- map ---------- */
.mapview { position: fixed; inset: 0; z-index: 20; background: #e7dcc0; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#map.drag { cursor: grabbing; }
.map-tools { position: absolute; right: calc(14px + var(--sr)); top: calc(14px + var(--st)); display: grid; gap: 8px; }
.map-sheet { position: absolute; left: calc(14px + var(--sl)); bottom: calc(14px + var(--sb)); top: calc(14px + var(--st)); width: min(380px, calc(100vw - 90px)); border-radius: 20px; display: flex; flex-direction: column; overflow: hidden; }
.search { display: flex; align-items: center; gap: 10px; margin: 12px 12px 8px; padding: 0 12px; height: 44px; border-radius: 12px; background: rgb(127 127 127 / .1); }
.search svg { color: var(--ink2); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 15px; user-select: text; -webkit-user-select: text; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 0 12px 6px; padding: 4px; border-radius: 12px; background: rgb(127 127 127 / .1); }
.tabs button { height: 32px; border: 0; border-radius: 9px; background: none; font-weight: 500; font-size: 13px; color: var(--ink2); }
.tabs button.on { background: var(--paper-solid); color: var(--ink); box-shadow: 0 1px 4px rgb(0 0 0 / .12); }
#map-list { list-style: none; margin: 0; padding: 0 6px 10px; overflow: auto; flex: 1; }
#map-list li { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; cursor: pointer; }
#map-list li:hover, #map-list li.sel { background: rgb(127 127 127 / .12); }
#map-list .ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; }
#map-list .ic.land { background: var(--orange); } #map-list .ic.food { background: #8a5a2b; }
#map-list .ic.seen::after { content: ''; position: absolute; }
#map-list b { display: block; font-weight: 600; font-size: 14px; } #map-list i { display: block; font-style: normal; font-size: 12px; color: var(--ink2); }
#map-list .dist { font-size: 12px; color: var(--ink2); white-space: nowrap; }
#map-list .seen-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); margin-left: 6px; vertical-align: middle; }
.map-pop { position: absolute; left: 50%; bottom: calc(18px + var(--sb)); transform: translateX(-50%); display: grid; grid-template-columns: 1fr auto; column-gap: 16px; align-items: center; padding: 12px 12px 12px 18px; border-radius: 16px; min-width: 280px; max-width: calc(100vw - 32px); }
.map-pop b { font-weight: 600; font-size: 15px; } .map-pop i { grid-column: 1; font-style: normal; font-size: 12px; color: var(--ink2); } .map-pop .btn { grid-row: 1 / span 2; grid-column: 2; height: 40px; }

/* ---------- touch ---------- */
.touch { inset: 0; display: none; }
.touch .stick { position: absolute; left: calc(26px + var(--sl)); bottom: calc(96px + var(--sb)); width: 120px; height: 120px; border-radius: 50%; background: rgb(255 255 255 / .18); border: 1px solid rgb(255 255 255 / .3); pointer-events: auto; }
.touch .stick i { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px; border-radius: 50%; background: rgb(255 255 255 / .7); }
.touch button { position: absolute; right: calc(22px + var(--sr)); width: 62px; height: 62px; border-radius: 50%; background: rgb(255 255 255 / .2); border: 1px solid rgb(255 255 255 / .35); color: #fff; font-size: 11px; font-weight: 600; pointer-events: auto; }
#t-jump { bottom: calc(190px + var(--sb)); } #t-run { bottom: calc(190px + var(--sb)); right: calc(94px + var(--sr)); } #t-dash { bottom: calc(262px + var(--sb)); } #t-down { bottom: calc(262px + var(--sb)); right: calc(94px + var(--sr)); }
#t-run.on { background: rgb(232 117 0 / .7); }
.is-touch .touch { display: block; } .is-touch kbd { display: none; } .is-touch .chat { display: none; }
.is-touch .mini { width: 112px; height: 112px; bottom: auto; top: calc(70px + var(--st)); }
.is-touch .credit { display: none; }
@media (max-width: 640px) {
  .title { align-items: flex-end; background: linear-gradient(0deg, rgb(8 14 11 / .7), rgb(8 14 11 / .1) 70%); }
  .title-card { margin: 0 0 40px; } .app-icon { width: 52px; height: 52px; margin-bottom: 16px; }
  .title-actions .btn { flex: 1 1 auto; height: 44px; padding: 0 14px; }
  .place-pill { max-width: calc(100vw - 180px); } #time-pill span { display: none; } #time-pill { padding: 0 13px; }
  .modebar button { width: 38px; } .speed { min-width: 52px; font-size: 13px; }
  .map-sheet { top: auto; height: 46vh; width: calc(100vw - 28px); }
  .dash { width: 190px; }
}
@media (prefers-reduced-motion: reduce) { * { transition-duration: .01s !important; } }
.is-touch .discover { left: calc(14px + var(--sl)); top: calc(70px + var(--st)); transform: translateY(-180%); max-width: calc(100vw - 160px); padding: 8px 12px 8px 8px; }
.is-touch .discover.on { transform: none; }
.is-touch .discover b { font-size: 14px; } .is-touch #disc-count { display: none; }
.is-touch .prompts { bottom: auto; top: calc(200px + var(--st)); }
.is-touch .dash { top: calc(196px + var(--st)); }
