@font-face {
  font-family: "Pangolin";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/pangolin-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Pangolin";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/pangolin-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --panel: rgba(8, 18, 28, 0.9);
  --line: rgba(214, 186, 112, 0.45);
  --cyan: #7cecff;
  --gold: #e4c16a;
  --text: #e8f4ff;
  --muted: #8eaab8;
  --ok: #9be7b2;
  --font: "Pangolin", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html,
body,
body.map-walk {
  margin: 0;
  height: 100%;
  min-width: 0 !important;
  overflow: hidden;
  background: #071018;
  color: var(--text);
  font-family: var(--font);
  user-select: none;
}

.hud {
  position: fixed;
  z-index: 18;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  padding: 10px 200px 10px 16px;
  background: linear-gradient(180deg, rgba(5, 12, 18, 0.92), rgba(5, 12, 18, 0.35) 80%, transparent);
  pointer-events: none;
}

.mech-nav {
  position: fixed;
  z-index: 19;
  top: 12px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 172px;
  pointer-events: auto;
}

.mech-nav-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--gold);
  text-decoration: none;
  text-align: center;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

a.mech-nav-item:hover,
a.mech-nav-item:focus-visible {
  color: var(--cyan);
  border-color: rgba(124, 236, 255, 0.55);
  outline: none;
}

.mech-nav-item[disabled],
.mech-nav-item[aria-disabled="true"] {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.5;
  background: var(--panel);
}

.hud-nav,
.status,
.hint,
.mode-switch,
.hud-controls {
  pointer-events: auto;
}

.hud-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

#open-pult {
  min-width: 118px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--gold);
}

#open-pult[aria-pressed="true"] {
  background: var(--gold);
  color: #102018;
}

.hud-nav {
  display: flex;
  gap: 12px;
}

.hud-nav a,
.hud-nav button,
.ghost {
  color: var(--gold);
  text-decoration: none;
  border: 1px solid transparent;
}

.hud-nav a:hover,
.hud-nav button:hover,
.ghost:hover {
  color: var(--cyan);
}

#open-oblast {
  min-width: 118px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--gold);
}

body.oblast-open #open-oblast {
  display: none;
}

.mode-switch {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}

.mode-switch button {
  min-width: 118px;
  padding: 6px 14px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.mode-switch button[aria-pressed="true"] {
  background: var(--gold);
  color: #102018;
}

.status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: center;
  flex: 1;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-size: 15px;
  white-space: nowrap;
}

.status b { color: var(--gold); }
#clock { color: var(--cyan); }
#daypart { color: var(--gold); }
body.night #daypart { color: #9eb6ff; }
body.dawn #daypart,
body.dusk #daypart { color: #e8b48a; }
#place { color: var(--ok); }
#coords,
#pace { color: var(--muted); }
#route {
  color: var(--cyan);
}
#route[hidden] {
  display: none !important;
}
#map-scale {
  color: var(--muted);
  font-size: 13px;
}

.hint {
  margin: 0;
  max-width: 280px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  text-align: right;
}

#viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

#viewport.drag { cursor: grabbing; }
#viewport.walk { cursor: crosshair; }

#day-veil {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background: transparent;
  transition: background-color 0.9s linear, opacity 0.9s linear;
}

#day-veil[data-phase="dawn"] {
  background: rgba(48, 28, 18, 0.22);
}

#day-veil[data-phase="dusk"] {
  background: rgba(18, 14, 42, 0.3);
}

#day-veil[data-phase="night"] {
  background: rgba(3, 8, 22, 0.58);
}

body.oblast-open #day-veil {
  opacity: 0;
}

#world {
  position: absolute;
  left: 0;
  top: 0;
  width: 2048px;
  height: 1152px;
  transform-origin: 0 0;
  will-change: transform;
}

#map-art {
  display: block;
  width: 2048px;
  height: 1152px;
  pointer-events: none;
}

#fx {
  position: absolute;
  inset: 0;
  width: 2048px;
  height: 1152px;
  pointer-events: none;
}

#pins {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pin {
  position: absolute;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 1px solid rgba(228, 193, 106, 0.0);
  border-radius: 50%;
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
}

.pin:hover,
.pin:focus-visible {
  border-color: rgba(124, 236, 255, 0.85);
  box-shadow: 0 0 0 6px rgba(124, 236, 255, 0.14);
  outline: none;
}

#player.bike {
  width: 90px;
  height: 116px;
  margin: -108px 0 0 -45px;
}

#player {
  position: absolute;
  width: 84px;
  height: 108px;
  margin: -102px 0 0 -42px;
  transform-origin: 50% 100%;
  pointer-events: auto;
  cursor: pointer;
  z-index: 3;
}

#player .shadow {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 10px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.32);
}

#player .figure {
  position: absolute;
  inset: 0;
}

#player img {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  width: 100%;
  height: calc(100% - 6px);
  max-width: 100%;
  max-height: calc(100% - 6px);
  object-fit: contain;
  object-position: bottom center;
  display: block;
  background: transparent;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.28));
}

#player #player-sprite {
  width: 100%;
  height: calc(100% - 6px);
  max-width: 100%;
  max-height: calc(100% - 6px);
  object-fit: contain;
  object-position: bottom center;
  transform-origin: 50% 100%;
  background: transparent;
}

#player.flip .figure {
  transform: scaleX(-1);
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 9;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--gold);
}

#location {
  position: fixed;
  z-index: 10;
  right: 18px;
  bottom: 18px;
  width: min(340px, calc(100vw - 28px));
  padding: 16px 18px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.loc-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
}

#location h2 {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 22px;
  font-weight: 400;
}

#loc-text {
  margin: 0 0 14px;
  color: var(--text);
  line-height: 1.4;
}

.loc-actions {
  display: flex;
  gap: 8px;
}

button {
  font: inherit;
  color: #102018;
  background: var(--gold);
  border: 0;
  border-radius: 6px;
  padding: 7px 14px;
  cursor: pointer;
}

button.ghost {
  color: var(--text);
  background: transparent;
  border: 1px solid rgba(142, 170, 184, 0.4);
}

#boot {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  margin: 0;
  background: #071018;
  color: var(--muted);
}

body.ready #boot,
body.oblast-open #boot { display: none; }

#pult-overlay[hidden] {
  display: none !important;
}

#pult-overlay {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: stretch;
  padding: 0;
  overflow: hidden;
  background: rgba(5, 12, 18, 0.78);
}

#pult-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  pointer-events: auto;
}

body.pult-open {
  overflow: hidden;
}

#oblast-view {
  position: fixed;
  inset: 0;
  z-index: 16;
  display: none;
  place-items: center;
  background: #071018;
  pointer-events: auto;
}

body.oblast-open #oblast-view {
  display: grid;
}

body.oblast-open #viewport {
  pointer-events: none;
}

.oblast-stage {
  position: relative;
  width: min(100vw, calc(100vh * 1792 / 1296));
  height: min(100vh, calc(100vw * 1296 / 1792));
}

#oblast-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

#oblast-cities {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.oblast-city {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: max-content;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.oblast-city-label {
  margin: 0 0 3px;
  padding: 2px 9px 3px;
  transform: translate(var(--nx, 0px), var(--ny, 0px));
  border: 1.5px solid #7cecff;
  border-radius: 999px;
  background: rgba(6, 20, 32, 0.9);
  color: #d8fbff;
  font-size: 11px;
  letter-spacing: 0.03em;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 0 10px rgba(124, 236, 255, 0.28);
}

.oblast-city-disc {
  display: block;
  border-radius: 50%;
  box-sizing: border-box;
}

.oblast-city-stem {
  display: block;
  width: 3px;
  height: 11px;
  margin-top: -1px;
  border-radius: 1px 1px 0 0;
  background: linear-gradient(180deg, #5a4c3c, #1a1612);
}

.oblast-city[data-tier="cyan"] .oblast-city-disc {
  width: 10px;
  height: 10px;
  background: radial-gradient(circle at 35% 30%, #c9f8ff, #3ec8e8 70%, #1a8aa8);
  box-shadow: 0 0 0 1px rgba(124, 236, 255, 0.7), 0 0 8px rgba(60, 200, 230, 0.45);
}

.oblast-city[data-tier="gold"] .oblast-city-disc {
  width: 14px;
  height: 14px;
  background: radial-gradient(circle at 35% 30%, #f6e4a4, #e4c16a 62%, #b8862c);
  box-shadow: 0 0 0 1px rgba(228, 193, 106, 0.85), 0 0 8px rgba(228, 193, 106, 0.35);
}

.oblast-city[data-tier="gold"] .oblast-city-stem {
  height: 13px;
}

.oblast-city[data-tier="gold-cyan"] .oblast-city-disc {
  width: 18px;
  height: 18px;
  background: radial-gradient(circle at 35% 30%, #f6e4a4, #e4c16a 58%, #b8862c);
  box-shadow:
    0 0 0 2px #7cecff,
    0 0 10px rgba(124, 236, 255, 0.45);
}

.oblast-city[data-tier="gold-cyan"] .oblast-city-stem {
  width: 4px;
  height: 14px;
}

.oblast-city[data-tier="gold-cyan"] .oblast-city-label {
  font-size: 12px;
}

.oblast-city[data-tier="murmansk"] {
  z-index: 2;
}

.oblast-city[data-tier="murmansk"] .oblast-city-label {
  font-size: 13px;
  padding: 3px 12px 4px;
}

.oblast-city[data-tier="murmansk"] .oblast-city-disc {
  width: 28px;
  height: 28px;
  background: radial-gradient(circle, transparent 46%, #e4c16a 48%, #e4c16a 68%, transparent 70%);
  box-shadow:
    0 0 0 2px #7cecff,
    0 0 14px rgba(124, 236, 255, 0.4);
}

.oblast-city[data-tier="murmansk"] .oblast-city-stem {
  width: 5px;
  height: 17px;
  background: linear-gradient(180deg, #6a5a46, #14110e);
}

#map-art:not([src]) {
  visibility: hidden;
}

.oblast-hotspot {
  position: absolute;
  z-index: 3;
  left: calc(2 / 7 * 100%);
  top: calc(4 / 9 * 100%);
  width: calc(100% / 7);
  height: calc(100% / 9);
  margin: 0;
  padding: 0;
  border: 2px solid var(--gold);
  border-radius: 6px;
  background: rgba(124, 236, 255, 0.1);
  box-shadow:
    0 0 0 1px rgba(124, 236, 255, 0.55),
    0 0 22px rgba(228, 193, 106, 0.55),
    inset 0 0 18px rgba(124, 236, 255, 0.16);
  cursor: pointer;
  animation: oblast-glow 2.4s ease-in-out infinite;
}

.oblast-hotspot:hover,
.oblast-hotspot:focus-visible {
  border-color: var(--cyan);
  outline: none;
}

.oblast-hotspot-label {
  position: absolute;
  left: 8px;
  top: 6px;
  color: var(--gold);
  font-size: 18px;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

#enter-sector {
  position: absolute;
  left: 50%;
  bottom: 28px;
  z-index: 2;
  transform: translateX(-50%);
  min-width: 168px;
  padding: 10px 22px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--gold);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

#enter-sector:hover,
#enter-sector:focus-visible {
  color: var(--cyan);
  border-color: rgba(124, 236, 255, 0.55);
  outline: none;
}

@keyframes oblast-glow {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(124, 236, 255, 0.4),
      0 0 16px rgba(228, 193, 106, 0.4),
      inset 0 0 14px rgba(124, 236, 255, 0.1);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(124, 236, 255, 0.75),
      0 0 28px rgba(228, 193, 106, 0.7),
      inset 0 0 22px rgba(124, 236, 255, 0.22);
  }
}

@media (max-width: 900px) {
  .hud {
    gap: 6px;
    padding: 8px 168px 8px 10px;
  }
  .mech-nav {
    width: 148px;
    right: 8px;
    top: 8px;
  }
  .mode-switch button,
  #open-pult,
  #open-oblast,
  #enter-sector { min-width: 96px; }
  .status {
    justify-content: flex-start;
    font-size: 13px;
    gap: 4px 10px;
    white-space: normal;
  }
  .hint { display: none; }
}
