:root {
  --bg: #07090d;
  --panel: rgba(12, 16, 22, .72);
  --panel-solid: #0e131a;
  --line: rgba(255, 255, 255, .10);
  --text: #dfe6ee;
  --dim: #8794a3;
  --accent: #ffb454;
  --accent-2: #5ec4d8;
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; overscroll-behavior: none; touch-action: none;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
canvas#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }
.hidden { display: none !important; }
[hidden] { display: none !important; }

kbd { display: inline-block; min-width: 1.5em; padding: 0 .35em; margin: 0 .1em; font: 600 .78rem/1.5 ui-monospace, Consolas, monospace;
  text-align: center; color: var(--text); background: rgba(255, 255, 255, .09); border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 4px; }

button { font: inherit; color: var(--text); cursor: pointer; touch-action: manipulation; }
button.link { background: none; border: 0; color: var(--dim); text-decoration: underline; padding: .8em 1em; }
#btn-menu, #deck-chip, #drawer { display: none; }
[data-scroll] { touch-action: pan-y; overscroll-behavior: contain; }
button.primary { padding: .65em 1.6em; background: var(--accent); color: #1a1205; border: 0; border-radius: 6px; font-weight: 700; letter-spacing: .02em; }
button.primary:hover { filter: brightness(1.1); }
button.tool, button.round { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: .4em .8em; backdrop-filter: blur(8px); }
button.tool:hover, button.round:hover, #modes button:hover, #decks button:hover { border-color: rgba(255, 180, 84, .5); }
button[aria-pressed="true"] { background: rgba(255, 180, 84, .18); border-color: var(--accent); color: var(--accent); }
button.round { width: 2.4rem; height: 2.4rem; border-radius: 50%; padding: 0; font-size: 1.3rem; line-height: 1; }

/* loading */
#loading { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(7, 9, 13, .55), rgba(7, 9, 13, .94) 70%); transition: opacity .6s; }
#loading.done { opacity: 0; pointer-events: none; }
.loading-card { width: min(440px, 88vw); text-align: center; }
.loading-card h1 { margin: 0; font-size: clamp(2rem, 7vw, 3rem); letter-spacing: .28em; text-indent: .28em; font-weight: 300; text-transform: uppercase; }
.sub { margin: .3em 0 1.6em; color: var(--dim); letter-spacing: .08em; font-size: .9rem; }
.bar { height: 4px; background: rgba(255, 255, 255, .1); border-radius: 2px; overflow: hidden; }
#bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .15s; }
#prompt { margin: 1.2em 0 0; }
#prompt-text { color: var(--text); font-size: .95rem; line-height: 1.5; margin: 0 0 1em; }
.rotate-hint { display: none; color: var(--dim); font-size: .8rem; margin: .6em 0 0; }
@media (orientation: portrait) { body.touch .rotate-hint { display: block; } }
#load-status { color: var(--dim); font-size: .85rem; min-height: 1.4em; margin: .8em 0 1.2em; }
.error { color: #ff7a6b; }

/* top bar */
#top { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; gap: 1rem; padding: .7rem 1rem;
  padding-top: max(.7rem, env(safe-area-inset-top)); pointer-events: none;
  background: linear-gradient(180deg, rgba(7, 9, 13, .7), rgba(7, 9, 13, 0)); }
#top > * { pointer-events: auto; }
.brand { flex: 1 1 0; display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand b { font-weight: 300; letter-spacing: .24em; text-transform: uppercase; font-size: 1.15rem; }
.brand span { color: var(--dim); font-size: .72rem; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#modes { display: flex; gap: .25rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .2rem; backdrop-filter: blur(8px); }
#modes button { background: none; border: 1px solid transparent; border-radius: 6px; padding: .4em .9em; display: flex; gap: .5em; align-items: center; }
#modes button kbd { font-size: .65rem; opacity: .6; }
#modes button.on { background: rgba(255, 180, 84, .18); border-color: var(--accent); color: var(--accent); }
.tools { flex: 1 1 0; display: flex; justify-content: flex-end; gap: .4rem; }

/* decks */
#decks { position: fixed; left: 1rem; top: 50%; transform: translateY(-50%); z-index: 10; display: flex; flex-direction: column; gap: .35rem; }
#decks button { display: flex; align-items: center; gap: .6em; text-align: left; background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: .5em .8em; backdrop-filter: blur(8px); }
#decks button .n { color: var(--dim); font: 600 .75rem ui-monospace, Consolas, monospace; }
#decks button.on { background: rgba(255, 180, 84, .18); border-color: var(--accent); color: var(--accent); }
#decks button.on .n { color: var(--accent); }

/* showcase */
#poi-panel { position: fixed; right: 1rem; top: 4.4rem; bottom: 11rem; width: min(290px, 40vw); z-index: 10; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; backdrop-filter: blur(8px); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: .8rem; letter-spacing: .18em; text-transform: uppercase; font-weight: 600; color: var(--dim); }
#btn-tour { padding: .25em .6em; font-size: .8rem; }
#poi-list { list-style: none; margin: 0; padding: .3rem; overflow-y: auto; flex: 1; counter-reset: poi; }
#poi-list li { counter-increment: poi; padding: .5em .6em; border-radius: 5px; cursor: pointer; display: flex; gap: .6em; align-items: baseline; font-size: .9rem; border: 1px solid transparent; }
#poi-list li::before { content: counter(poi); color: var(--dim); font: 600 .72rem ui-monospace, Consolas, monospace; min-width: 1.4em; text-align: right; }
#poi-list li:hover { background: rgba(255, 255, 255, .06); }
#poi-list li.on { background: rgba(255, 180, 84, .15); border-color: rgba(255, 180, 84, .5); color: var(--accent); }
#poi-list li small { margin-left: auto; color: var(--dim); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }
#caption { position: fixed; left: 50%; bottom: 1.6rem; transform: translateX(-50%); z-index: 10; width: min(680px, 92vw); padding: .7rem .8rem .8rem;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .6rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; backdrop-filter: blur(10px); }
#caption .cap-head { display: flex; align-items: baseline; gap: .8rem; }
#caption h3 { margin: 0 0 .3em; font-weight: 500; font-size: 1.15rem; color: var(--accent); }
#caption p { margin: 0; line-height: 1.5; color: #c4cdd8; font-size: .95rem; }
#poi-count { color: var(--dim); font-size: .78rem; margin-left: auto; }

/* minimap */
#minimap { position: fixed; right: 1rem; bottom: 1rem; z-index: 9; width: 260px; height: auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; backdrop-filter: blur(8px); cursor: crosshair; transition: opacity .3s; }
body.mode-showcase #minimap { display: none; }
#legend { position: fixed; left: 1rem; bottom: 1rem; z-index: 9; font-size: .78rem; color: var(--dim); line-height: 2; pointer-events: none;
  padding: .4rem .7rem; background: rgba(7, 9, 13, .45); border-radius: 8px; transition: opacity .4s; }
body.mode-showcase #legend { bottom: 8.8rem; }
#legend div[data-for] { display: none; }
body.mode-fly #legend [data-for~="fly"], body.mode-walk #legend [data-for~="walk"], body.mode-showcase #legend [data-for~="showcase"] { display: block; }
body.touch #legend { display: none; }
#hint { position: fixed; left: 50%; top: 18%; transform: translateX(-50%); z-index: 8; padding: .5em 1.2em; background: var(--panel); border: 1px solid var(--line);
  border-radius: 20px; pointer-events: none; letter-spacing: .04em; }
#crosshair { position: fixed; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: rgba(255, 255, 255, .55); z-index: 8; pointer-events: none; }

/* touch */
#touch { position: fixed; inset: 0; z-index: 9; pointer-events: none; }
#stick { position: absolute; left: max(1.5rem, env(safe-area-inset-left)); bottom: 2.2rem; width: 130px; height: 130px; border-radius: 50%;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line); pointer-events: auto; touch-action: none; }
#stick-knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px; border-radius: 50%; background: rgba(255, 180, 84, .35);
  border: 1px solid var(--accent); }
#touch-vert { position: absolute; right: max(1rem, env(safe-area-inset-right)); bottom: 2.2rem; display: flex; flex-direction: column; gap: .6rem; pointer-events: auto; }
#touch-vert button { width: 56px; height: 56px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line); font-size: 1.2rem; touch-action: none; }
#touch-vert button:active { background: rgba(255, 180, 84, .3); }

/* help */
#help { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(7, 9, 13, .78); backdrop-filter: blur(4px); }
.help-card { width: min(720px, 94vw); max-height: 90vh; overflow-y: auto; padding: 1.6rem 1.8rem; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 12px; }
.help-card h2 { margin: 0; font-weight: 300; letter-spacing: .24em; text-transform: uppercase; }
.help-card .sub { margin-bottom: 1rem; }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 2rem; }
.help-card h4 { margin: 1em 0 .2em; color: var(--accent); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; }
.help-card p { margin: 0; line-height: 1.8; font-size: .9rem; color: #c4cdd8; }
.help-card .primary { margin-top: 1.2rem; }

body.booting #top, body.booting #decks, body.booting #legend, body.booting #minimap { visibility: hidden; }

