@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;1,400&family=Space+Mono&display=swap');

:root {
  --bg: #050505;
  --text-main: #e0e0e0;
  --text-muted: #666666;
  --accent: #ffffff;
  --ui-bg: rgba(5, 5, 5, 0.85);
  --ui-border: rgba(255, 255, 255, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow: hidden;
  background-color: var(--bg);
  font-family: 'Space Mono', monospace;
  color: var(--text-main);
  user-select: none;
  -webkit-user-select: none;
}

body.app-started {
  cursor: none;
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: auto;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.85);
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

#intro-text {
  font-family: 'Playfair Display', serif;
  text-align: center;
  transition: opacity 2s ease-in-out;
  padding: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 5, 5, 0.72);
}

#intro-text h1 {
  font-size: 4vw;
  font-weight: 400;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

#intro-text p {
  font-family: 'Space Mono', monospace;
  color: var(--text-muted);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#btn-start-app {
  margin-top: 1.2rem;
  min-width: 220px;
}

#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

#app-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.72) inset;
  pointer-events: none;
  z-index: 160;
  opacity: 0;
  transition: opacity 0.12s ease;
}

#app-cursor.visible {
  opacity: 1;
}

#compass-hud {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: min(72vw, 560px);
  pointer-events: none;
}

#compass-canvas {
  width: 100%;
  height: 62px;
}

#inspect-modal {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

#inspect-modal.active {
  opacity: 1;
  pointer-events: auto;
}

#inspect-canvas {
  width: 512px;
  height: 512px;
  background: #000;
  border: 1px solid var(--ui-border);
  image-rendering: pixelated;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.inspect-details {
  margin-top: 2rem;
  text-align: center;
  width: 100%;
  max-width: 600px;
  padding: 0 1rem;
}

.inspect-coord {
  color: var(--text-muted);
  font-size: 0.8rem;
  word-break: break-all;
  margin-bottom: 2rem;
  line-height: 1.6;
  max-height: 6em;
  overflow: hidden;
}

.btn-group {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

button {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--ui-border);
  padding: 0.8rem 1.5rem;
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover {
  background: var(--text-main);
  color: var(--bg);
}

#hud {
  position: absolute;
  top: 2rem;
  left: 2rem;
  z-index: 20;
  pointer-events: none;
  transition: opacity 1s;
}

.hud-location {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  line-height: 1.5;
}

.hud-controls {
  margin-top: 1rem;
  font-size: 0.7rem;
  color: #444;
}

.hud-minimap {
  margin-top: 1rem;
  width: 132px;
  pointer-events: auto;
}

#minimap-canvas {
  width: 132px;
  height: 132px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(6, 6, 6, 0.9);
}

.hud-minimap-label {
  margin-top: 0.35rem;
  font-size: 0.58rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #565656;
}

.hud-map-btn {
  margin-top: 0.55rem;
  width: 132px;
  padding: 0.45rem 0.5rem;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: #9a9a9a;
}

#map-modal {
  position: absolute;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#map-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.map-shell {
  width: min(92vw, 1040px);
  max-height: 92vh;
  border: 1px solid var(--ui-border);
  background: rgba(6, 6, 6, 0.92);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.map-toolbar-left {
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
  min-width: 0;
}

#map-hover {
  font-size: 0.72rem;
  color: #8a8a8a;
  letter-spacing: 0.06em;
}

.map-zoom-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.map-zoom-btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}

#map-zoom-label {
  font-size: 0.66rem;
  color: #9a9a9a;
  letter-spacing: 0.06em;
  min-width: 170px;
}

#btn-map-close {
  padding: 0.5rem 0.9rem;
  font-size: 0.68rem;
}

#map-canvas {
  width: min(84vw, 78vh, 860px);
  height: min(84vw, 78vh, 860px);
  align-self: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(4, 4, 4, 0.95);
  cursor: crosshair;
}

.map-hint {
  font-size: 0.63rem;
  color: #6a6a6a;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

#navigator {
  position: absolute;
  top: 0;
  right: -400px;
  width: 380px;
  height: 100vh;
  background: var(--ui-bg);
  border-left: 1px solid var(--ui-border);
  backdrop-filter: blur(10px);
  z-index: 50;
  padding: 3rem 2rem;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}

#navigator.active {
  right: 0;
}

.nav-header {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--ui-border);
  padding-bottom: 1rem;
}

.nav-section {
  margin-bottom: 2rem;
}

.nav-section label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.nav-btn {
  width: 100%;
  margin-bottom: 0.8rem;
}

.nav-range-wrap {
  margin-top: 0.35rem;
}

.nav-range {
  width: 100%;
  accent-color: rgba(255, 255, 255, 0.9);
}

.nav-range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
  font-size: 0.6rem;
  color: #5f5f5f;
  letter-spacing: 0.08em;
}

.nav-description {
  font-size: 0.65rem;
  color: #555;
  margin-top: 0.5rem;
}

.nav-footer {
  font-size: 0.7rem;
  color: #666;
  margin-top: auto;
  text-align: center;
}

#toast {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text-main);
  color: var(--bg);
  padding: 0.8rem 1.5rem;
  font-size: 0.8rem;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 200;
  pointer-events: none;
  text-align: center;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#file-input {
  display: none;
}

@media (max-width: 900px) {
  #navigator {
    width: min(100vw, 380px);
  }

  #inspect-canvas {
    width: min(85vw, 512px);
    height: min(85vw, 512px);
  }

  #intro-text h1 {
    font-size: min(12vw, 2.2rem);
  }

  .btn-group {
    flex-direction: column;
    align-items: center;
  }

  .btn-group button {
    width: min(320px, 85vw);
  }

  #hud {
    left: 1rem;
    top: 1rem;
  }

  #compass-hud {
    top: 0.45rem;
    width: min(90vw, 560px);
  }

  .map-shell {
    width: min(96vw, 1040px);
  }

  #map-canvas {
    width: min(90vw, 70vh, 640px);
    height: min(90vw, 70vh, 640px);
  }

  .map-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .map-toolbar-left {
    width: 100%;
  }

  #btn-map-close {
    align-self: flex-end;
  }
}
