:root {
  --bg-1: #0b0e10;
  --bg-2: #1a242b;
  --ink: #eef0e8;
  --muted: #c9c5ba;
  --accent: #f4b35e;
  --panel: rgba(10, 14, 16, 0.7);
  --border: rgba(255, 255, 255, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
}

body {
  font-family: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(1000px circle at 20% 15%, #1e2a30 0%, var(--bg-1) 55%),
    radial-gradient(800px circle at 80% 85%, #2a2f22 0%, var(--bg-2) 45%);
  overflow: hidden;
}

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

#app::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.2;
  pointer-events: none;
}

#viewer {
  position: absolute;
  inset: 0;
}

#viewer canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 2;
  pointer-events: none;
  animation: float-in 0.6s ease 0.2s both;
}

.title {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 13px;
  opacity: 0.75;
  pointer-events: auto;
}

.views {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

button {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  font-size: 11px;
  padding: 8px 12px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border 0.2s ease;
}

button:hover {
  background: rgba(244, 179, 94, 0.2);
  border-color: rgba(244, 179, 94, 0.5);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.info {
  position: absolute;
  left: 20px;
  bottom: 20px;
  max-width: 320px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.35);
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 2;
}

.info.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.info-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.info-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.process-card {
  position: absolute;
  min-width: 360px;
  max-width: 520px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(38, 74, 255, 0.45), rgba(8, 12, 24, 0.92));
  border: none;
  border-radius: 4px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), 0 0 28px rgba(38, 74, 255, 0.55);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  transform: translate(-50%, -120%);
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.process-card.hidden {
  opacity: 0;
  transform: translate(-50%, -110%);
}

.process-card.region-card {
  min-width: 180px;
  max-width: 240px;
  padding: 8px 10px;
  background: linear-gradient(135deg, rgba(38, 74, 255, 0.35), rgba(8, 12, 24, 0.9));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45), 0 0 18px rgba(38, 74, 255, 0.4);
}

.process-card.region-card .process-title {
  margin-bottom: 0;
  font-size: 13px;
}

.process-card.region-card .process-body {
  display: none;
}

.process-line {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.25s ease;
}

.process-line.hidden {
  opacity: 0;
}

.process-line polyline {
  fill: none;
  stroke: #304484;
  stroke-width: 2.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(38, 74, 255, 0.65))
    drop-shadow(0 0 14px rgba(38, 74, 255, 0.85));
}

.process-title {
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
  font-size: 16px;
  color: #f2f5ff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.process-body {
  font-size: 14px;
  line-height: 20px;
  color: #e3e8ff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 12, 0.65);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  transition: opacity 0.35s ease;
  z-index: 3;
}

.loading.hidden {
  opacity: 0;
  pointer-events: none;
}

@keyframes float-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .hud {
    align-items: flex-start;
    flex-direction: column;
  }

  .views {
    flex-wrap: wrap;
  }

  .info {
    right: 18px;
    max-width: none;
  }
}
