:root {
  --ink: #17232b;
  --ink-soft: #52616a;
  --paper: #f7f2e8;
  --paper-2: #efe8da;
  --blue: #2f6fb2;
  --blue-deep: #1d4d7c;
  --orange: #e8893c;
  --orange-deep: #c96825;
  --green: #5f8b5a;
  --red: #c14f3e;
  --line: rgba(23, 35, 43, 0.12);
  --panel: rgba(255, 252, 246, 0.9);
  --panel-solid: #fbf7ee;
  --shadow: 0 22px 60px rgba(23, 35, 43, 0.16), 0 2px 8px rgba(23, 35, 43, 0.08);
  --shadow-soft: 0 10px 30px rgba(23, 35, 43, 0.1);
  --radius: 18px;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: "Avenir Next", Avenir, "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #dfe9d2;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; }
button { color: inherit; }
a { color: var(--blue); }

#app {
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: default;
}

.map-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0.045;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
}

.map-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 42%, rgba(38, 50, 40, 0.16) 100%),
    linear-gradient(180deg, rgba(255, 250, 235, 0.12), transparent 30%, transparent 72%, rgba(34, 48, 42, 0.12));
}

.hidden { display: none !important; }

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
}

/* ------------------------------------------------------------------ HUD */
.hud {
  position: absolute;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto minmax(230px, 1fr);
  align-items: start;
  gap: 18px;
  padding: 18px 22px;
  pointer-events: none;
}

.hud > * { pointer-events: auto; }

.brand {
  justify-self: start;
  padding: 12px 16px 11px;
  border-radius: 14px;
  min-width: 240px;
}

.brand-kicker {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.brand-title {
  font-size: clamp(17px, 1.6vw, 22px);
  font-weight: 850;
  letter-spacing: -0.035em;
  line-height: 1;
  white-space: nowrap;
}

.brand-title span {
  color: var(--orange-deep);
  font-weight: 800;
}

.brand-title b { font-weight: 500; }

.clock-panel {
  justify-self: center;
  width: min(310px, 28vw);
  min-width: 250px;
  padding: 10px 15px 9px;
  border-radius: 14px;
}

.clock-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.clock {
  font-family: var(--mono);
  font-size: clamp(19px, 1.8vw, 25px);
  font-weight: 700;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.time-left {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.timebar {
  height: 5px;
  border-radius: 99px;
  background: rgba(23, 35, 43, 0.1);
  overflow: hidden;
  margin: 7px 0 6px;
}

.timefill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #5a9ad4);
  transition: width 0.2s linear, background 0.4s ease;
}

.timefill.warn { background: linear-gradient(90deg, var(--orange), #f2b25f); }
.timefill.danger { background: linear-gradient(90deg, var(--red), #e2775f); }

.clock-sub {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}

.hud-right {
  justify-self: end;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.stats {
  display: flex;
  gap: 18px;
  padding: 10px 15px;
  border-radius: 14px;
}

.stat { display: flex; flex-direction: column; gap: 1px; min-width: 56px; }
.stat-label { font-family: var(--mono); font-size: 8px; letter-spacing: 0.12em; color: var(--ink-soft); }
.stat-value { font-family: var(--mono); font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.04em; white-space: nowrap; }
.stat-value small { font-size: 9px; font-weight: 500; color: var(--ink-soft); letter-spacing: 0; }

.hud-buttons { display: flex; flex-direction: column; gap: 6px; }

.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.icon-btn:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.96); }
.icon-btn:active { transform: translateY(0); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg rect { fill: var(--ink); stroke: none; }
.icon-btn.muted .sound-wave { display: none; }
.icon-btn.muted::after { content: "×"; position: absolute; font-weight: 700; color: var(--red); transform: translate(9px, -7px); }

/* ------------------------------------------------------------------ bottom HUD */
.bottom-hud {
  position: absolute;
  z-index: 20;
  left: 22px;
  right: 22px;
  bottom: 18px;
  display: grid;
  grid-template-columns: minmax(250px, 340px) minmax(340px, 1fr) minmax(170px, 220px);
  align-items: end;
  gap: 18px;
  pointer-events: none;
}

.bottom-hud > * { pointer-events: auto; }

.route-card {
  border-radius: 16px;
  padding: 13px 15px 11px;
}

.route-card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.route-kicker { font-family: var(--mono); font-size: 8px; letter-spacing: 0.16em; color: var(--blue); font-weight: 700; }
.route-remaining { font-family: var(--mono); font-size: 10px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.instruction { font-size: 13px; line-height: 1.28; font-weight: 650; margin: 5px 0 9px; min-height: 32px; }

.route-progress { height: 4px; border-radius: 99px; background: rgba(23, 35, 43, 0.1); overflow: hidden; }
.route-progress > div { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--orange), #f1b36e); transition: width 0.25s linear; }
.route-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 7px; font-family: var(--mono); font-size: 8px; color: var(--ink-soft); letter-spacing: 0.03em; }

.walk-controls { display: flex; flex-direction: column; align-items: center; gap: 7px; justify-self: center; width: min(470px, 100%); }

.stamina-wrap {
  width: min(260px, 80%);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}
.stamina-wrap span { font-family: var(--mono); font-size: 7px; letter-spacing: 0.14em; color: var(--ink-soft); }
.stamina { flex: 1; height: 4px; border-radius: 99px; background: rgba(23, 35, 43, 0.13); overflow: hidden; }
.stamina > div { height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, #6a9b63, #9bc27f); transition: width 0.12s linear; }

.walk-btn {
  width: 100%;
  border: 0;
  border-radius: 18px;
  padding: 10px 13px 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  background: linear-gradient(180deg, #fffdf7, #f5efe2);
  box-shadow: 0 16px 40px rgba(23, 35, 43, 0.18), inset 0 1px 0 #fff;
  border: 1px solid rgba(255, 255, 255, 0.8);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.walk-btn:hover { transform: translateY(-1px); box-shadow: 0 20px 46px rgba(23, 35, 43, 0.2), inset 0 1px 0 #fff; }
.walk-btn.active { transform: translateY(1px) scale(0.995); background: linear-gradient(180deg, #eef6ff, #e3eef9); box-shadow: 0 8px 22px rgba(47, 111, 178, 0.22), inset 0 1px 0 #fff; }

.walk-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 12px;
  background: var(--blue);
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.walk-icon svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.walk-icon svg circle { fill: #fff; stroke: none; }

.walk-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.walk-copy b { font-size: 12px; letter-spacing: 0.05em; font-weight: 850; }
.walk-copy small { font-family: var(--mono); font-size: 7px; letter-spacing: 0.05em; color: var(--ink-soft); white-space: nowrap; }
.walk-speed { margin-left: auto; font-family: var(--mono); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.05em; white-space: nowrap; }
.walk-speed small { font-size: 8px; font-weight: 500; color: var(--ink-soft); margin-left: 2px; letter-spacing: 0; }

.right-hud { justify-self: end; }

.minimap-panel { width: 100%; border-radius: 16px; padding: 9px; }
.minimap-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 8px; letter-spacing: 0.14em; color: var(--ink-soft); padding: 0 2px 6px; }
.north { color: var(--blue); font-weight: 700; }
#minimap { display: block; width: 100%; aspect-ratio: 1; border-radius: 10px; background: #e6eedb; }
.minimap-foot { display: flex; justify-content: space-between; align-items: center; padding: 7px 2px 0; font-family: var(--mono); font-size: 9px; color: var(--ink-soft); }
.cat-count { font-size: 10px; color: var(--ink); }

/* ------------------------------------------------------------------ toast */
.toast {
  position: fixed;
  z-index: 55;
  left: 50%;
  bottom: 132px;
  transform: translate(-50%, 16px);
  background: var(--ink);
  color: #fff;
  border-radius: 99px;
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.01em;
  box-shadow: 0 12px 30px rgba(23, 35, 43, 0.24);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  max-width: min(90vw, 540px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ encounters */
.encounter-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: end center;
  padding: 24px;
  background: linear-gradient(180deg, rgba(18, 29, 36, 0.08), rgba(18, 29, 36, 0.44));
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fadeIn 0.22s ease both;
}

.encounter-card {
  width: min(590px, 100%);
  background: var(--paper);
  border-radius: 24px;
  padding: 20px 22px 20px;
  box-shadow: 0 30px 80px rgba(16, 26, 32, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.7);
  animation: slideUp 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.encounter-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.encounter-label { font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; color: var(--blue); font-weight: 700; }
.encounter-cost { font-family: var(--mono); font-size: 10px; color: var(--orange-deep); font-weight: 700; background: rgba(232, 137, 60, 0.12); padding: 4px 8px; border-radius: 99px; }
.encounter-cost.positive { color: var(--green); background: rgba(95, 139, 90, 0.12); }
.encounter-icon {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: #e9f0e2;
  font-size: 24px;
  margin: 12px 0 10px;
  border: 1px solid rgba(95, 139, 90, 0.16);
}
.encounter-card h2 { font-size: clamp(22px, 3vw, 30px); line-height: 1.02; letter-spacing: -0.045em; margin: 0 0 7px; }
.encounter-text { color: var(--ink-soft); font-size: 14px; line-height: 1.45; margin: 0 0 16px; }

.encounter-choices { display: grid; gap: 7px; }
.choice-btn {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(23, 35, 43, 0.11);
  background: rgba(255, 255, 255, 0.58);
  border-radius: 13px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}
.choice-btn:hover { background: #fff; border-color: rgba(47, 111, 178, 0.4); transform: translateY(-1px); }
.choice-btn .choice-key { font-family: var(--mono); font-size: 9px; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 6px; padding: 2px 5px; flex: 0 0 auto; }
.choice-btn .choice-main { flex: 1; }
.choice-btn .choice-meta { font-family: var(--mono); font-size: 9px; color: var(--orange-deep); white-space: nowrap; }
.choice-btn .choice-meta.good { color: var(--green); }
.choice-btn .choice-meta.bad { color: var(--red); }

.encounter-reply { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 13px; }
.encounter-reply p { margin: 0 0 12px; font-size: 14px; line-height: 1.45; color: var(--ink); }
.encounter-reply .primary-btn { width: 100%; justify-content: center; }

/* ------------------------------------------------------------------ buttons */
.primary-btn, .ghost-btn {
  border: 0;
  border-radius: 13px;
  padding: 12px 16px;
  font-weight: 750;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.primary-btn {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 10px 24px rgba(23, 35, 43, 0.22);
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(23, 35, 43, 0.28); }
.primary-btn:active { transform: translateY(0); }
.primary-btn span { color: #ffd2a8; font-size: 17px; line-height: 1; }
.ghost-btn { background: rgba(23, 35, 43, 0.06); color: var(--ink); box-shadow: none; }
.ghost-btn:hover { background: rgba(23, 35, 43, 0.1); }

kbd {
  display: inline-block;
  min-width: 18px;
  text-align: center;
  padding: 2px 5px;
  border-radius: 5px;
  border: 1px solid rgba(23, 35, 43, 0.16);
  background: rgba(255, 255, 255, 0.55);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.2;
  box-shadow: 0 1px 0 rgba(23, 35, 43, 0.08);
}

/* ------------------------------------------------------------------ intro */
.screen {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow: auto;
}

.intro-screen {
  background:
    radial-gradient(ellipse at 68% 34%, rgba(255, 239, 206, 0.36), transparent 46%),
    linear-gradient(90deg, rgba(20, 32, 38, 0.72), rgba(20, 32, 38, 0.24) 58%, rgba(20, 32, 38, 0.55));
  grid-template-columns: minmax(0, 1.1fr) minmax(220px, 0.9fr);
  align-items: center;
  justify-items: center;
  gap: 6vw;
  color: #fff;
  animation: fadeIn 0.35s ease both;
}

.intro-map-label {
  position: absolute;
  top: 22px;
  left: 24px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.66);
}

.intro-card {
  width: min(610px, 100%);
  justify-self: end;
  background: #fbf7ee;
  color: var(--ink);
  border-radius: 26px;
  padding: clamp(24px, 3.4vw, 42px);
  box-shadow: 0 40px 100px rgba(7, 16, 20, 0.38), inset 0 1px 0 #fff;
  border: 1px solid rgba(255, 255, 255, 0.8);
  animation: slideUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.13em;
  font-weight: 700;
  color: var(--blue);
  display: flex;
  align-items: center;
  gap: 7px;
  text-transform: uppercase;
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--orange); display: inline-block; box-shadow: 0 0 0 4px rgba(232, 137, 60, 0.14); }

.intro-card h1 {
  font-size: clamp(58px, 8.6vw, 104px);
  line-height: 0.78;
  letter-spacing: -0.085em;
  margin: 17px 0 13px;
  font-weight: 900;
}

.intro-route {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: clamp(12px, 1.5vw, 16px);
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--orange-deep);
  margin-bottom: 17px;
}
.intro-route i { font-style: normal; color: var(--ink-soft); font-size: 1.3em; }
.intro-route span:last-child { color: var(--blue); }

.intro-lede { font-size: 15px; line-height: 1.5; color: var(--ink-soft); max-width: 52ch; margin: 0 0 20px; }

.intro-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 22px; }
.intro-grid > div { border-top: 1px solid var(--line); padding-top: 9px; display: flex; flex-direction: column; gap: 2px; }
.intro-grid b { font-family: var(--mono); font-size: 17px; letter-spacing: -0.04em; }
.intro-grid span { font-size: 9px; line-height: 1.25; color: var(--ink-soft); }

.start-btn { width: 100%; padding: 15px 18px; font-size: 16px; }
.intro-hint { margin-top: 13px; font-family: var(--mono); font-size: 9px; color: var(--ink-soft); line-height: 1.7; }
.intro-credit { margin-top: 14px; font-size: 9px; color: var(--ink-soft); }
.intro-credit a { color: var(--ink-soft); }

.intro-side { justify-self: start; display: flex; flex-direction: column; gap: 22px; max-width: 260px; color: #fff; }
.side-stamp {
  width: 138px;
  height: 138px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 50%;
  display: grid;
  place-content: center;
  text-align: center;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  line-height: 1.7;
  transform: rotate(-8deg);
  opacity: 0.86;
}
.side-stamp b { font-size: 13px; letter-spacing: 0.06em; }
.side-stamp small { font-size: 6px; letter-spacing: 0.16em; }
.side-note { font-size: 13px; line-height: 1.5; color: rgba(255, 255, 255, 0.74); border-left: 1px solid rgba(255, 255, 255, 0.4); padding-left: 13px; }

/* ------------------------------------------------------------------ pause */
.pause-screen {
  background: rgba(18, 29, 36, 0.54);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 72;
}
.pause-card {
  width: min(440px, 100%);
  background: var(--paper);
  border-radius: 24px;
  padding: 30px;
  box-shadow: var(--shadow);
  animation: slideUp 0.25s ease both;
}
.pause-card h2 { font-size: 34px; letter-spacing: -0.055em; margin: 12px 0 6px; line-height: 1; }
.pause-card p { color: var(--ink-soft); font-size: 14px; margin: 0 0 20px; }
.pause-actions { display: grid; gap: 8px; }
.pause-actions .primary-btn { justify-content: center; }
.pause-help { margin-top: 15px; font-family: var(--mono); font-size: 9px; color: var(--ink-soft); text-align: center; }

/* ------------------------------------------------------------------ ending */
.ending-screen {
  background:
    radial-gradient(ellipse at 50% 15%, rgba(255, 238, 198, 0.2), transparent 48%),
    rgba(18, 29, 36, 0.62);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 74;
}
.ending-card {
  width: min(680px, 100%);
  background: var(--paper);
  border-radius: 26px;
  padding: clamp(24px, 4vw, 42px);
  box-shadow: 0 40px 100px rgba(7, 16, 20, 0.38), inset 0 1px 0 #fff;
  border: 1px solid rgba(255, 255, 255, 0.8);
  animation: slideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.ending-card h2 { font-size: clamp(38px, 5.6vw, 62px); line-height: 0.9; letter-spacing: -0.075em; margin: 15px 0 12px; }
.ending-lede { color: var(--ink-soft); font-size: 14px; line-height: 1.5; margin: 0 0 20px; max-width: 58ch; }
.ending-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 20px; }
.ending-stats > div { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.ending-stats b { font-family: var(--mono); font-size: 17px; letter-spacing: -0.04em; }
.ending-stats span { font-family: var(--mono); font-size: 8px; color: var(--ink-soft); letter-spacing: 0.08em; }

.mensa-menu { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin-bottom: 18px; background: rgba(255, 255, 255, 0.4); }
.menu-head { display: flex; justify-content: space-between; padding: 9px 12px; background: var(--ink); color: #fff; font-family: var(--mono); font-size: 8px; letter-spacing: 0.12em; }
.menu-options { display: grid; grid-template-columns: repeat(3, 1fr); }
.menu-options button { border: 0; border-right: 1px solid var(--line); background: transparent; text-align: left; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; transition: background 0.15s ease; }
.menu-options button:last-child { border-right: 0; }
.menu-options button:hover { background: rgba(47, 111, 178, 0.07); }
.menu-options button.selected { background: rgba(232, 137, 60, 0.13); }
.menu-options button > span { font-family: var(--mono); font-size: 8px; color: var(--orange-deep); }
.menu-options button b { font-size: 11px; line-height: 1.2; }
.menu-options button small { font-size: 9px; color: var(--ink-soft); }
.tray { display: flex; align-items: center; gap: 12px; padding: 12px; border-top: 1px solid var(--line); background: rgba(232, 137, 60, 0.08); }
.tray-art { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: #fff; font-size: 22px; }
.tray span { display: block; font-family: var(--mono); font-size: 7px; letter-spacing: 0.14em; color: var(--ink-soft); }
.tray b { font-size: 13px; }

.ending-actions { display: flex; gap: 8px; align-items: center; }
.ending-actions .primary-btn { flex: 1; justify-content: center; }
.credits { margin-top: 15px; border-top: 1px solid var(--line); padding-top: 13px; font-size: 11px; line-height: 1.55; color: var(--ink-soft); }
.credits p { margin: 0 0 8px; }
.credits b { color: var(--ink); }

/* ------------------------------------------------------------------ loading */
.loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: #dfe9d2;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}
.loading.done { opacity: 0; visibility: hidden; }
.loading-mark { font-family: var(--mono); font-size: 14px; letter-spacing: 0.14em; font-weight: 700; }
.loading-mark span { color: var(--orange-deep); }
.loading-bar { width: 190px; height: 3px; background: rgba(23, 35, 43, 0.12); border-radius: 99px; overflow: hidden; }
.loading-bar > div { height: 100%; width: 40%; background: var(--blue); border-radius: inherit; animation: load 1.1s ease-in-out infinite; }
.loading-copy { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; color: var(--ink-soft); }

/* ------------------------------------------------------------------ animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(18px) scale(0.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes load { 0% { transform: translateX(-110%); } 55% { transform: translateX(150%); } 100% { transform: translateX(150%); } }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 980px) {
  .hud { grid-template-columns: 1fr auto; gap: 8px; padding: 10px 12px; }
  .brand { min-width: 0; padding: 9px 11px; }
  .brand-kicker { display: none; }
  .brand-title { font-size: 16px; }
  .clock-panel { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; width: auto; min-width: 0; padding: 7px 11px; }
  .clock-top { align-items: center; }
  .clock { font-size: 18px; }
  .hud-right { grid-column: 2; grid-row: 1; }
  .stats { gap: 10px; padding: 8px 10px; }
  .stat { min-width: 44px; }
  .stat-value { font-size: 14px; }
  .hud-buttons { display: none; }

  .bottom-hud { left: 10px; right: 10px; bottom: 10px; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 8px; }
  .route-card { grid-column: 1; grid-row: 2; padding: 9px 11px; }
  .instruction { font-size: 11px; min-height: 0; margin: 3px 0 7px; }
  .route-meta { display: none; }
  .walk-controls { grid-column: 1 / -1; grid-row: 1; width: 100%; }
  .walk-btn { padding: 9px 11px; }
  .walk-copy small { display: none; }
  .right-hud { display: none; }
  .stamina-wrap { width: 80%; }

  .intro-screen { grid-template-columns: 1fr; gap: 0; padding: 14px; }
  .intro-side { display: none; }
  .intro-card { justify-self: center; padding: 24px; max-height: calc(100vh - 28px); overflow: auto; }
  .intro-card h1 { font-size: clamp(54px, 17vw, 80px); }
  .intro-grid { grid-template-columns: 1fr 1fr 1fr; }
  .intro-map-label { display: none; }

  .ending-stats { grid-template-columns: 1fr 1fr; }
  .menu-options { grid-template-columns: 1fr; }
  .menu-options button { border-right: 0; border-bottom: 1px solid var(--line); }
  .menu-options button:last-child { border-bottom: 0; }
}

@media (max-width: 560px) {
  .hud { padding: 8px; }
  .stats .stat:nth-child(2) { display: none; }
  .clock-sub { display: none; }
  .timebar { margin-bottom: 0; }
  .encounter-layer { padding: 10px; }
  .encounter-card { padding: 16px 16px 15px; border-radius: 19px; }
  .encounter-card h2 { font-size: 24px; }
  .encounter-text { font-size: 13px; }
  .choice-btn { padding: 9px 10px; font-size: 12px; }
  .choice-btn .choice-meta { font-size: 8px; }
  .toast { bottom: 152px; font-size: 11px; }
  .intro-card h1 { font-size: 56px; }
  .intro-lede { font-size: 13px; }
  .intro-grid { grid-template-columns: 1fr; gap: 5px; }
  .intro-grid > div { flex-direction: row; justify-content: space-between; align-items: baseline; }
  .ending-card { padding: 20px; }
  .ending-actions { flex-direction: column; align-items: stretch; }
  .pause-card { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
