:root {
  --ink: #e8e4d8;
  --ink-dim: #a9a79c;
  --warm: #ffb347;
  --warm-deep: #e0742a;
  --cold: #7fd0ff;
  --bg: #070b12;
  --panel: rgba(9, 14, 22, 0.86);
  --panel-border: rgba(255, 200, 120, 0.22);
  --danger: #ff6a55;
  --text-scale: 1;
  --focus: #ffd27a;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}
html, body { margin: 0; padding: 0; width: 100%; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; }
body { font-size: calc(16px * var(--text-scale)); -webkit-font-smoothing: antialiased; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; cursor: crosshair; touch-action: none; }
body.menu-open canvas#game { cursor: default; }
.hidden { display: none !important; }
.ui-layer { position: fixed; inset: 0; pointer-events: none; }
.ui-layer .screen { pointer-events: auto; }
button, select, input { font: inherit; color: inherit; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* ---------- HUD ---------- */
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud-topleft { position: absolute; left: 22px; top: 18px; display: flex; flex-direction: column; gap: 8px; }
.glass { display: flex; gap: 5px; }
.glass .seg { width: 26px; height: 34px; border: 2px solid rgba(255, 230, 190, 0.85); border-radius: 6px 6px 10px 10px; background: rgba(20, 20, 30, 0.6); position: relative; overflow: hidden; box-shadow: 0 0 8px rgba(0,0,0,0.6); transition: transform 0.15s; }
.glass .seg::after { content: ""; position: absolute; left: 3px; right: 3px; bottom: 3px; height: 0; background: linear-gradient(180deg, #fff3c4, #ffb347 60%, #e0742a); border-radius: 3px; transition: height 0.25s ease-out; box-shadow: 0 0 10px rgba(255, 179, 71, 0.8); }
.glass .seg.full::after { height: 24px; }
.glass .seg.lost { transform: scale(0.85); opacity: 0.6; }
.glass .seg.shake { animation: segshake 0.35s; }
@keyframes segshake { 0% { transform: translateX(0); } 25% { transform: translateX(-4px) rotate(-6deg); } 50% { transform: translateX(4px) rotate(6deg); } 100% { transform: translateX(0); } }
.light-wrap { width: 190px; }
.light-bar { position: relative; height: 12px; border-radius: 6px; background: rgba(10, 14, 22, 0.7); border: 1.5px solid rgba(255, 220, 160, 0.6); overflow: hidden; }
.light-fill { height: 100%; width: 40%; background: linear-gradient(90deg, #e0742a, #ffb347, #fff0c0); box-shadow: 0 0 12px rgba(255, 190, 90, 0.9); transition: width 0.12s linear; }
.light-cost { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,0.7); left: 30%; }
.light-bar.pulse .light-fill { animation: lightpulse 0.4s; }
@keyframes lightpulse { 0% { filter: brightness(1); } 40% { filter: brightness(1.8); } 100% { filter: brightness(1); } }
.abilities { display: flex; gap: 8px; margin-top: 4px; }
.hud-row { display: flex; align-items: center; gap: 8px; }
.hud-row .hud-label { min-width: 3.3em; font-size: 0.78em; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); text-align: right; text-shadow: 0 1px 2px rgba(0,0,0,0.8); }
.ability .name { position: absolute; left: 0; right: 0; bottom: 0; padding: 1px 0 2px; font-size: 0.66em; font-weight: 600; background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,0.65) 40%);  letter-spacing: 0.03em; text-align: center; color: var(--ink); text-shadow: 0 1px 2px rgba(0,0,0,0.9); pointer-events: none; }
.ability { position: relative; width: 3.5em; height: 2.9em; padding: 0; font: inherit; border-radius: 8px; border: 1.5px solid rgba(255, 220, 160, 0.45); background: rgba(10, 14, 22, 0.7); display: flex; align-items: center; justify-content: center; font-size: 0.7em; color: var(--ink-dim); overflow: hidden; }
.ability .glyph { position: absolute; inset: 0; }
.ability .glyph svg { width: 100%; height: 100%; display: block; }
.ability.locked .glyph { filter: grayscale(1); }
.ability .keycap { position: absolute; right: 2px; top: 2px; font-size: 0.7em; line-height: 1; white-space: nowrap; padding: 2px 4px; border-radius: 4px; border: 1px solid rgba(255, 230, 190, 0.6); background: rgba(8, 10, 16, 0.85); color: var(--ink); font-family: ui-monospace, Menlo, monospace; z-index: 3; }
.ability .cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0%; background: rgba(255, 200, 120, 0.28); z-index: 2; }
.ability.locked { opacity: 0.6; border-style: dashed; cursor: default; }
.ability .lock { display: none; position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-size: 0.95em; z-index: 3; filter: drop-shadow(0 1px 2px #000); }
.ability.locked .lock { display: block; }
.ability.locked .glyph { filter: grayscale(1) brightness(0.55); }
.ability.locked .keycap { display: none; }
.abilities { pointer-events: auto; }
.ability { cursor: pointer; }
.ability.pressed { transform: scale(0.92); filter: brightness(1.4); }
.ability.ready { border-color: rgba(255, 220, 160, 0.9); box-shadow: 0 0 10px rgba(255, 190, 90, 0.5); }
.ability.new { animation: abilitypop 0.8s; }
@keyframes abilitypop { 0% { transform: scale(0.6); } 50% { transform: scale(1.25); } 100% { transform: scale(1); } }
.hud-topcenter { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); text-align: center; }
.objective { max-width: min(60vw, 40em); font-size: 1.05em; letter-spacing: 0.02em; color: var(--ink); text-shadow: 0 2px 8px #000, 0 0 2px #000; padding: 6px 16px; background: rgba(9, 14, 22, 0.45); border-radius: 20px; opacity: 0.95; transition: opacity 0.4s; }
.objective.flash { animation: objflash 1s; }
@keyframes objflash { 0% { background: rgba(255, 179, 71, 0.5); } 100% { background: rgba(9, 14, 22, 0.45); } }
.hud-topright { position: absolute; right: 22px; top: 64px; text-align: right; }
body.map-shown .hud-topright { top: 256px; }
.wisps { font-size: 1.1em; display: inline-flex; align-items: center; gap: 8px; text-shadow: 0 2px 6px #000; }
.wisp-dot { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle, #fff, #7fd0ff 45%, rgba(127, 208, 255, 0) 75%); box-shadow: 0 0 10px #7fd0ff; display: inline-block; }
.levelname { font-size: 0.85em; color: var(--ink-dim); text-shadow: 0 2px 6px #000; margin-top: 2px; }
.marker { position: absolute; width: 44px; height: 30px; margin: -15px 0 0 -22px; pointer-events: none; display: flex; align-items: center; justify-content: center; }
.marker.enemy .marker-ring { width: 9px; height: 9px; border: none; border-radius: 50%; background: #ff8a5c; box-shadow: 0 0 8px 3px rgba(255, 120, 80, 0.75), 0 0 18px 6px rgba(255, 100, 60, 0.35); animation: dotpulse 1s infinite ease-in-out; }
.marker.enemy .marker-ring::before, .marker.enemy .marker-ring::after { display: none; }
@keyframes dotpulse { 0%, 100% { transform: scale(0.85); opacity: 0.8; } 50% { transform: scale(1.15); opacity: 1; } }
/* the go-here mark: a small X on the ground that strobes, lying flat (squashed like everything on the ground) */
.marker-ring { position: relative; width: 30px; height: 20px; animation: xstrobe 1.1s infinite ease-in-out; }
.marker-ring::before, .marker-ring::after { content: ''; position: absolute; left: 50%; top: 50%; width: 30px; height: 3px; border-radius: 2px; background: rgba(255, 210, 130, 0.95); box-shadow: 0 0 8px rgba(255, 179, 71, 0.8), 0 0 16px rgba(255, 150, 50, 0.4); transform: translate(-50%, -50%) rotate(35deg) scaleY(1); }
.marker-ring::after { transform: translate(-50%, -50%) rotate(-35deg); }
@keyframes xstrobe { 0%, 100% { opacity: 0.35; transform: scale(0.92); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes ringpulse { 0%, 100% { transform: scale(0.85); opacity: 0.6; } 50% { transform: scale(1.1); opacity: 1; } }
.compass { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-bottom: 8px; pointer-events: none; }
.compass-dial { position: relative; width: 58px; height: 58px; border-radius: 50%; border: 1.5px solid rgba(255, 220, 160, 0.55); background: radial-gradient(circle at 50% 50%, rgba(20, 26, 36, 0.85), rgba(6, 9, 14, 0.9)); box-shadow: 0 4px 14px rgba(0,0,0,0.5); }
.compass-needle { position: absolute; left: 50%; top: 50%; width: 0; height: 0; margin: -22px 0 0 -8px; border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 24px solid var(--warm); transform-origin: 50% 22px; filter: drop-shadow(0 0 5px rgba(255, 179, 71, 0.8)); }
.compass-dot { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: #fff3c4; box-shadow: 0 0 6px rgba(255,243,196,0.8); }
.compass-text { text-align: right; text-shadow: 0 2px 6px #000; }
.compass-label { font-size: 0.72em; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); }
.compass-dist { font-size: 1.05em; color: var(--ink); }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-6px); } }
.bossbar { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); width: min(560px, 70vw); text-align: center; }
.bossname { font-size: 1em; letter-spacing: 0.12em; text-transform: uppercase; color: #cfe; text-shadow: 0 2px 8px #000; margin-bottom: 4px; }
.bossfill-wrap { height: 10px; border: 1.5px solid rgba(200, 240, 255, 0.7); border-radius: 5px; background: rgba(0, 10, 20, 0.7); overflow: hidden; }
.bossfill { height: 100%; width: 100%; background: linear-gradient(90deg, #3aa0b0, #9fe8ff); box-shadow: 0 0 10px rgba(127, 208, 255, 0.8); transition: width 0.2s; }
.msgs { position: absolute; left: 50%; bottom: 1.6em; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 0.5em; max-width: min(900px, 90vw); pointer-events: none; }
.msgs .hidden { display: none; }
body.touch-scheme .msgs { bottom: 13.6em; }
.prompt { position: relative; display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--panel-border); padding: 8px 14px; border-radius: 10px; font-size: 1em; }
.prompt-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,0.1); border-radius: 0 0 10px 10px; overflow: hidden; }
.prompt-progress > div { height: 100%; width: 0; background: var(--warm); }
.key { display: inline-block; min-width: 1.3em; padding: 2px 8px; border-radius: 6px; border: 1.5px solid rgba(255, 230, 190, 0.7); background: rgba(255, 230, 190, 0.1); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85em; text-align: center; box-shadow: 0 2px 0 rgba(255, 230, 190, 0.3); }
.hint { position: relative; display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--panel-border); padding: 8px 14px; border-radius: 10px; animation: fadein 0.4s; }
.subtitle { position: relative; max-width: min(820px, 80vw); text-align: center; font-size: 1.15em; line-height: 1.35; padding: 8px 18px; background: rgba(6, 9, 14, 0.62); border-radius: 8px; text-shadow: 0 1px 3px #000; animation: fadein 0.3s; }
.subtitle .speaker { color: var(--warm); margin-right: 8px; font-variant: small-caps; letter-spacing: 0.05em; }
.banner { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); text-align: center; animation: bannerin 0.6s ease-out; }
.banner-title { font-size: 2em; letter-spacing: 0.08em; color: var(--warm); text-shadow: 0 0 24px rgba(255, 179, 71, 0.8), 0 2px 8px #000; }
.banner-line { font-size: 1.05em; color: var(--ink); text-shadow: 0 2px 8px #000; margin-top: 6px; background: rgba(6, 9, 14, 0.55); padding: 6px 14px; border-radius: 8px; }
@keyframes bannerin { from { opacity: 0; transform: translateX(-50%) translateY(14px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.card { position: absolute; left: 50%; top: 22%; width: 90vw; transform: translateX(-50%); text-align: center; animation: cardin 1.2s ease-out; }
.card-title { font-size: clamp(1.5em, 4.5vw, 2.6em); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); text-shadow: 0 2px 20px #000, 0 0 40px rgba(127, 208, 255, 0.35); }
.card-sub { font-size: 1.15em; font-style: italic; color: var(--ink-dim); margin-top: 8px; text-shadow: 0 2px 10px #000; }
@keyframes cardin { from { opacity: 0; letter-spacing: 0.3em; } to { opacity: 1; } }
.toast { position: relative; background: var(--panel); border: 1px solid var(--panel-border); padding: 8px 14px; border-radius: 10px; font-size: 0.95em; animation: fadein 0.3s; }
.demo-tag { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); letter-spacing: 0.2em; font-size: 0.8em; color: var(--ink-dim); text-shadow: 0 2px 6px #000; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.fadeout { animation: fadeout 0.5s forwards; }
@keyframes fadeout { to { opacity: 0; } }

/* ---------- Screens ---------- */
.screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.title { background: radial-gradient(ellipse at 50% 55%, rgba(6, 10, 18, 0.55), rgba(3, 6, 12, 0.2) 55%, rgba(3, 6, 12, 0.6) 100%); }   /* a lit market behind the menu: dim only behind the buttons, dark toward the edges */
.title-inner { text-align: center; max-width: 720px; padding: 24px; }
.logo { font-size: clamp(3em, 9vw, 6.5em); margin: 0; letter-spacing: 0.12em; font-weight: 400; line-height: 1; }
.logo-wren { display: block; color: var(--warm); text-shadow: 0 0 40px rgba(255, 179, 71, 0.55), 0 4px 20px #000; }
.logo-of { display: block; font-size: 0.34em; letter-spacing: 0.28em; text-transform: uppercase; color: #dfe9ee; margin-top: 0.35em; text-shadow: 0 0 30px rgba(127, 208, 255, 0.5), 0 4px 20px #000; }
.tagline { font-style: italic; color: var(--ink-dim); margin: 6px 0 28px; letter-spacing: 0.2em; font-size: 1.15em; }
.menu { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.menu.row { flex-direction: row; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.menu-btn { min-width: 260px; padding: 12px 22px; background: rgba(12, 18, 28, 0.8); border: 1.5px solid rgba(255, 220, 160, 0.35); color: var(--ink); border-radius: 10px; font-size: 1.15em; letter-spacing: 0.05em; cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.1s; }
.menu-btn:hover, .menu-btn:focus-visible { background: rgba(255, 179, 71, 0.16); border-color: var(--warm); transform: translateY(-1px); }
.menu-btn.danger:hover { border-color: var(--danger); background: rgba(255, 106, 85, 0.15); }
.save-info { color: var(--ink-dim); font-size: 0.9em; margin-top: 16px; min-height: 1.2em; }
.footnote { color: rgba(169, 167, 156, 0.7); font-size: 0.8em; margin-top: 36px; line-height: 1.5; }
.dialog { background: rgba(3, 6, 12, 0.72); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dialog-inner { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 16px; padding: 28px 36px; min-width: 320px; max-width: min(92vw, 560px); max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
.dialog-inner.wide { max-width: min(94vw, 860px); }
.dialog h2 { margin: 0 0 18px; font-weight: 400; letter-spacing: 0.12em; text-transform: uppercase; color: var(--warm); text-align: center; }
.small { font-size: 0.85em; color: var(--ink-dim); text-align: center; margin: 14px 0 0; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 28px; }
.settings-grid label { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.settings-grid input[type=range] { width: 46%; accent-color: var(--warm); }
.settings-grid input[type=checkbox] { width: 24px; height: 24px; margin: 0; accent-color: var(--warm); order: 2; }
.settings-grid select { background: #0d131d; border: 1px solid rgba(255, 220, 160, 0.35); border-radius: 6px; padding: 4px 8px; }
.settings-grid .blurb { grid-column: 1 / -1; margin: -6px 0 0; text-align: left; font-style: italic; }
.controls-table { width: 100%; border-collapse: collapse; font-size: 0.95em; }
.controls-table th, .controls-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,0.08); vertical-align: top; }
.controls-table th { color: var(--warm); font-weight: 400; letter-spacing: 0.06em; }
.controls-table td:first-child { color: var(--ink); white-space: nowrap; }
.death-title { color: var(--cold) !important; }
.death-line { text-align: center; font-style: italic; color: var(--ink-dim); margin: 0 0 20px; }
.ending { background: radial-gradient(ellipse at 50% 30%, rgba(255, 179, 71, 0.18), rgba(3, 6, 12, 0.9) 70%); }
.ending-text { line-height: 1.6; font-size: 1.1em; white-space: pre-line; }
.stats { display: grid; grid-template-columns: auto auto; gap: 6px 24px; margin: 18px auto 0; width: max-content; }
.stats dt { color: var(--ink-dim); } .stats dd { margin: 0; text-align: right; }
.debug { position: absolute; left: 22px; top: 140px; font: 12px ui-monospace, Menlo, monospace; color: #9fe; background: rgba(0,0,0,0.55); padding: 8px 10px; border-radius: 6px; white-space: pre; pointer-events: none; }

/* high contrast */
body.high-contrast { --panel: rgba(0, 0, 0, 0.94); --panel-border: #ffd27a; --ink: #ffffff; --ink-dim: #e0e0e0; }
body.high-contrast .objective, body.high-contrast .subtitle { background: rgba(0,0,0,0.9); }
body.high-contrast .menu-btn { background: #000; border-color: #fff; }

@media (max-width: 900px) {
  .settings-grid { grid-template-columns: 1fr; }
  .hud-topleft { left: 12px; top: 10px; }
  .hud-topright { right: 12px; top: 10px; }
  .glass .seg { width: 20px; height: 28px; }
  .light-wrap { width: 140px; }
  .controls-table td:last-child { display: none; } .controls-table th:last-child { display: none; }
}
@media (prefers-reduced-motion: reduce) { .banner, .card, .subtitle, .hint, .toast { animation: none; } }
body.reduced-motion .banner, body.reduced-motion .card, body.reduced-motion .subtitle, body.reduced-motion .hint, body.reduced-motion .toast, body.reduced-motion .marker-ring, body.reduced-motion .marker.enemy .marker-ring, body.reduced-motion .ability.new, body.reduced-motion .glass .seg.shake, body.reduced-motion .light-bar.pulse .light-fill, body.reduced-motion .objective.flash { animation: none; }
body.reduced-motion .marker-ring { opacity: 0.9; }


/* ---------- Corner tray (menu / mute / map) ---------- */
.tray { position: absolute; right: 16px; top: 12px; display: flex; gap: 8px; align-items: center; pointer-events: auto; z-index: 5; }
.tray-btn, .tray-check { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 5px 12px; border-radius: 8px; background: rgba(9, 14, 22, 0.78); border: 1px solid rgba(255, 220, 160, 0.4); color: var(--ink); font-size: 0.82em; letter-spacing: 0.04em; cursor: pointer; user-select: none; }
.tray-btn:hover, .tray-check:hover { border-color: var(--warm); background: rgba(255, 179, 71, 0.14); }
.tray-glyph { font-size: 1.2em; line-height: 1; }
.tray-check input { width: 22px; height: 22px; accent-color: var(--warm); margin: 0; cursor: pointer; }
.minimap-wrap { position: absolute; right: 16px; top: 50px; width: 176px; pointer-events: none; border-radius: 10px; border: 1px solid rgba(255, 220, 160, 0.32); background: rgba(6, 9, 14, 0.62); box-shadow: 0 6px 20px rgba(0,0,0,0.5); overflow: hidden; }
.minimap-wrap canvas { display: block; width: 176px; height: 176px; }
.minimap-name { font-size: 0.72em; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); text-align: center; padding: 3px 0 4px; background: rgba(6, 9, 14, 0.7); }

/* ---------- Cinematic ---------- */
.cine { position: absolute; inset: 0; pointer-events: none; }
.cine-bars::before, .cine-bars::after { content: ""; position: absolute; left: 0; right: 0; height: 7vh; background: #000; }
.cine-bars::before { top: 0; } .cine-bars::after { bottom: 0; }
.caption { position: absolute; left: 50%; bottom: 11vh; transform: translateX(-50%); max-width: min(900px, 84vw); text-align: center; font-size: clamp(1.1em, 2.1vw, 1.55em); line-height: 1.45; letter-spacing: 0.03em; color: var(--ink); text-shadow: 0 2px 12px #000, 0 0 30px rgba(0,0,0,0.9); opacity: 0; transition: opacity 0.6s; font-style: italic; }
.caption.show { opacity: 1; }
.skip-btn { position: absolute; right: 24px; top: calc(7vh + 14px); pointer-events: auto; padding: 8px 16px; background: rgba(9, 14, 22, 0.75); border: 1px solid rgba(255, 220, 160, 0.4); color: var(--ink); border-radius: 8px; font-size: 0.95em; letter-spacing: 0.06em; cursor: pointer; z-index: 6; }
.skip-btn:hover, .skip-btn:focus-visible { border-color: var(--warm); background: rgba(255, 179, 71, 0.16); }
.cine-title { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); }

/* ---------- Touch controls ---------- */
.touch { position: absolute; inset: 0; pointer-events: none; }
.touch .stick-zone { position: absolute; left: 0; top: 18%; width: 46%; bottom: 0; pointer-events: auto; touch-action: none; }
.touch .stick { position: absolute; left: 0; top: 0; width: 120px; height: 120px; pointer-events: none; }
.touch .stick-base { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255, 220, 160, 0.45); background: rgba(9, 14, 22, 0.35); }
.touch .stick-knob { position: absolute; left: 36px; top: 36px; width: 48px; height: 48px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff0c0, #ffb347 55%, #b8652a); box-shadow: 0 0 14px rgba(255, 179, 71, 0.7); }
.touch .tbtns { position: absolute; right: 22px; bottom: 26px; display: grid; grid-template-columns: 76px 76px; grid-template-rows: 76px 76px; gap: 14px; pointer-events: auto; }
.touch .tbtn { pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; border-radius: 50%; border: 2px solid rgba(255, 220, 160, 0.55); background: rgba(9, 14, 22, 0.6); color: var(--ink); font-size: 0.95em; letter-spacing: 0.04em; box-shadow: 0 4px 14px rgba(0,0,0,0.5); }
.touch .tbtn.big { grid-row: 1 / span 2; grid-column: 2; width: 76px; height: 166px; border-radius: 40px; font-size: 1.1em; align-self: center; }
.touch .tbtn.down { background: rgba(255, 179, 71, 0.55); border-color: #fff3c4; }
.touch .tbtn.locked { opacity: 0.25; }
.touch .tbtn.interact { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); width: auto; min-width: 150px; height: 52px; border-radius: 26px; padding: 0 22px; background: rgba(255, 179, 71, 0.25); border-color: var(--warm); font-size: 1.05em; }


/* ---------- Scheme chooser ---------- */
.scheme-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 8px; }
.scheme-card { text-align: left; padding: 16px 18px; background: rgba(12, 18, 28, 0.8); border: 1.5px solid rgba(255, 220, 160, 0.35); border-radius: 12px; color: var(--ink); cursor: pointer; transition: border-color 0.15s, transform 0.1s, background 0.15s; }
.scheme-card:hover, .scheme-card:focus-visible { border-color: var(--warm); background: rgba(255, 179, 71, 0.12); transform: translateY(-2px); }
.scheme-card.current { border-color: var(--warm); box-shadow: 0 0 14px rgba(255, 179, 71, 0.35); }
.scheme-card .sc-glyph { font-size: 1.6em; line-height: 1; margin-bottom: 10px; color: var(--warm); letter-spacing: 0.1em; font-family: ui-monospace, Menlo, monospace; }
.scheme-card .sc-name { font-size: 1.15em; letter-spacing: 0.04em; margin-bottom: 6px; }
.scheme-card .sc-blurb { font-size: 0.9em; color: var(--ink-dim); line-height: 1.4; }
.scheme-card .sc-keys { margin-top: 10px; font-size: 0.82em; color: var(--ink); line-height: 1.7; }
.centered { text-align: center; }

/* ---------- Dialog close + danger ---------- */
.dialog-inner { position: relative; }
.close-x { position: absolute; right: 8px; top: 8px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 220, 160, 0.4); background: rgba(12, 18, 28, 0.8); color: var(--ink); font-size: 1.4em; line-height: 1; cursor: pointer; padding: 0; }
.close-x:hover, .close-x:focus-visible { border-color: var(--warm); background: rgba(255, 179, 71, 0.18); }
.settings-footer { justify-content: space-between; align-items: center; }
.danger-small { padding: 6px 12px; font-size: 0.82em; color: var(--danger); background: transparent; border: 1px solid rgba(255, 106, 85, 0.45); border-radius: 8px; cursor: pointer; margin-left: auto; letter-spacing: 0.03em; }
.danger-small:hover, .danger-small:focus-visible { background: rgba(255, 106, 85, 0.12); border-color: var(--danger); }

@media (max-width: 900px) {
  .scheme-cards { grid-template-columns: 1fr; }
  .minimap-wrap { width: 120px; top: 48px; } .minimap-wrap canvas { width: 120px; height: 120px; }
  .hud-topright { top: 200px; }
  .tray-btn, .tray-check { padding: 5px 8px; font-size: 0.78em; }
}
@media (max-height: 520px) { .minimap-wrap { display: none; } }

.glossary { font-size: 0.82em; line-height: 1.5; color: #c9c4b6; margin: 10px 0 4px; max-width: 760px; }
.glossary i { color: #ffd9a0; font-style: normal; font-weight: 600; }
.gamepad-note { max-width: none; margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255, 220, 160, 0.2); }
