:root {
  --bg: #04060b;
  --ink: #dce9f5;
  --muted: #6f849a;
  --cyan: #37e6ff;
  --violet: #8b7bff;
  --amber: #ffb15c;
  --line: rgba(94, 132, 170, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

body {
  color: var(--ink);
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;
  letter-spacing: 0;
}

.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  background:
    linear-gradient(180deg, rgba(8, 15, 26, 0.35), transparent 45%),
    repeating-linear-gradient(
      90deg,
      rgba(55, 90, 128, 0.05) 0,
      rgba(55, 90, 128, 0.05) 1px,
      transparent 1px,
      transparent 64px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(55, 90, 128, 0.05) 0,
      rgba(55, 90, 128, 0.05) 1px,
      transparent 1px,
      transparent 64px
    ),
    var(--bg);
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#scene:active {
  cursor: grabbing;
}

.frame-mark {
  position: absolute;
  width: 44px;
  height: 44px;
  border: 0 solid var(--line);
  pointer-events: none;
}

.frame-mark--tl {
  top: 18px;
  left: 18px;
  border-top-width: 1px;
  border-left-width: 1px;
}

.frame-mark--br {
  right: 18px;
  bottom: 18px;
  border-right-width: 1px;
  border-bottom-width: 1px;
}

.hud {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  width: calc(100% - 72px);
  pointer-events: none;
  user-select: none;
}

.hud--top {
  top: 22px;
  left: 74px;
  justify-content: space-between;
  gap: 20px;
}

.hud--bottom {
  bottom: 24px;
  left: 74px;
  justify-content: space-between;
  gap: 20px;
}

.hud__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand__dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  background: var(--cyan);
  box-shadow: 0 0 12px rgba(55, 230, 255, 0.9);
  animation: pulse 1.8s ease-in-out infinite;
}

.brand h1 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
}

.hud__metrics {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--muted);
}

#state {
  color: var(--amber);
}

.readout {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  font-size: 11px;
}

.readout__label {
  color: var(--violet);
}

#coords {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.action-btn {
  flex: 0 0 auto;
  padding: 9px 16px;
  border: 1px solid rgba(55, 230, 255, 0.45);
  border-radius: 4px;
  color: var(--cyan);
  background: rgba(10, 22, 34, 0.72);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0;
  pointer-events: auto;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.action-btn:hover {
  border-color: var(--cyan);
  color: #06121a;
  background: var(--cyan);
}

.action-btn:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: 3px;
}

.back-btn {
  border-color: rgba(139, 123, 255, 0.5);
  color: var(--violet);
}

.back-btn:hover {
  border-color: var(--violet);
  color: #0a0c14;
  background: var(--violet);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.72);
  }
}

@media (max-width: 640px) {
  .frame-mark,
  .frame-mark--tl,
  .frame-mark--br {
    width: 30px;
    height: 30px;
  }

  .frame-mark--tl {
    top: 12px;
    left: 12px;
  }

  .frame-mark--br {
    right: 12px;
    bottom: 12px;
  }

  .hud,
  .hud--top,
  .hud--bottom {
    width: calc(100% - 52px);
  }

  .hud--top {
    top: 16px;
    left: 50px;
  }

  .hud--bottom {
    bottom: 16px;
    left: 50px;
  }

  .brand h1 {
    font-size: 13px;
  }

  .hud__metrics {
    gap: 10px;
    font-size: 10px;
  }

  .readout {
    font-size: 10px;
  }

  .hud__actions {
    gap: 8px;
  }

  .action-btn {
    padding: 8px 12px;
    font-size: 10px;
  }
}
