:root {
  --bg: #05080a;
  --green: #33ff8c;
  --green-dim: #1a7a48;
  --green-faint: #0e3d26;
  --amber: #ffb033;
  --text: #d6ffe8;
  --font: ui-monospace, "SFMono-Regular", "Courier New", monospace;
}

* { box-sizing: border-box; }

html.theme-dark {
  filter: grayscale(1);
}

html.theme-light {
  filter: grayscale(1) invert(1);
}

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

svg symbol path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }

.hidden { display: none !important; }

.screen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

button, input, select {
  font-family: var(--font);
}

/* ============ LOADING ============ */
#screen-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #071a12 0%, #05080a 70%);
}

.loading-sky {
  position: relative;
  width: 100%;
  height: 140px;
  overflow: hidden;
  margin-bottom: 24px;
}

.plane-fly {
  position: absolute;
  top: 50%;
  width: 72px;
  height: 72px;
  color: var(--green);
  fill: none;
  stroke: var(--green);
  stroke-width: 1.5;
  filter: drop-shadow(0 0 6px var(--green));
  transform: translate(110vw, -50%) rotate(-90deg);
  animation: fly-across 2.6s linear infinite, bob 1.3s ease-in-out infinite;
}

.plane-fly path { fill: none; stroke: currentColor; stroke-width: 1.5; }

@keyframes fly-across {
  from { transform: translate(110vw, -50%) rotate(-90deg); }
  to   { transform: translate(-20vw, -50%) rotate(-90deg); }
}

@keyframes bob {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -10px; }
}

.loading-text { text-align: center; }

.loading-text h1 {
  font-size: 1.8rem;
  letter-spacing: 0.5em;
  margin: 0 0 12px 0;
  color: var(--green);
  text-shadow: 0 0 12px var(--green-dim);
}

.status-line {
  color: var(--green-dim);
  letter-spacing: 0.2em;
  font-size: 0.85rem;
}

.dots span {
  opacity: 0;
  animation: dot-blink 1.2s infinite;
}
.dots span:nth-child(1) { animation-delay: 0s; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-blink {
  0%, 20% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

/* ============ HOME ============ */
#screen-home {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.home-card {
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--green-faint);
  border-radius: 8px;
  padding: 32px 28px;
  background: linear-gradient(180deg, rgba(51,255,140,0.04), transparent);
  box-shadow: 0 0 40px rgba(51,255,140,0.06) inset;
}

.home-card h1 {
  font-size: 1.4rem;
  letter-spacing: 0.35em;
  color: var(--green);
  text-shadow: 0 0 10px var(--green-dim);
  margin: 0 0 6px 0;
  text-align: center;
}

.subtitle {
  text-align: center;
  color: var(--green-dim);
  font-size: 0.8rem;
  margin: 0 0 28px 0;
}

label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--green-dim);
  margin: 14px 0 6px 0;
}

input[type="number"] {
  width: 100%;
  background: #05100a;
  border: 1px solid var(--green-faint);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 0.95rem;
  outline: none;
}

input[type="number"]:focus {
  border-color: var(--green);
  box-shadow: 0 0 8px rgba(51,255,140,0.3);
}

.form-error {
  color: #ff5c5c;
  font-size: 0.75rem;
  margin: 10px 0 0 0;
}

.home-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.btn {
  font-family: var(--font);
  background: transparent;
  border: 1px solid var(--green-faint);
  color: var(--green);
  padding: 10px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background 0.15s, box-shadow 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--green);
  box-shadow: 0 0 10px rgba(51,255,140,0.25);
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  flex: 1;
  background: var(--green-faint);
}

.btn-ghost {
  flex: 1;
  color: var(--green-dim);
}

.btn-select {
  color: var(--green);
}

.btn-icon {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 200;
  width: 42px;
  height: 42px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(3, 10, 6, 0.6);
  transition: opacity 0.3s ease, background 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.theme-icon {
  width: 20px;
  height: 20px;
  color: var(--green);
}

.attribution {
  text-align: center;
  color: #1f5a3a;
  font-size: 0.65rem;
  margin: 22px 0 0 0;
  letter-spacing: 0.05em;
}

/* ============ RADAR ============ */
#screen-radar {
  display: flex;
  flex-direction: column;
  background: #030504;
}

.radar-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--green-dim);
  flex-shrink: 0;
}

#hud-status { color: var(--green); }

.radar-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0 12px 10px 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
  transition: opacity 0.3s ease;
}

.radar-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 10px;
}

.radar-scope {
  position: relative;
  width: min(85vmin, 82vh, 900px);
  height: min(85vmin, 82vh, 900px);
  border-radius: 50%;
  background: radial-gradient(circle, #061a10 0%, #030a06 75%, #020403 100%);
  box-shadow: 0 0 40px rgba(51,255,140,0.08), inset 0 0 60px rgba(0,0,0,0.6);
}

.scope-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.scope-grid circle, .scope-grid line {
  fill: none;
  stroke: var(--green-faint);
  stroke-width: 0.4;
}

.scope-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-size: 0.7rem;
  color: var(--green-dim);
}

.compass {
  position: absolute;
  letter-spacing: 0.05em;
}
.compass-n { top: 2%; left: 50%; transform: translateX(-50%); }
.compass-s { bottom: 2%; left: 50%; transform: translateX(-50%); }
.compass-e { right: 2%; top: 50%; transform: translateY(-50%); }
.compass-w { left: 2%; top: 50%; transform: translateY(-50%); }

.ring-label {
  position: absolute;
  left: 50.8%;
  font-size: 0.6rem;
  color: var(--green-faint);
}
.ring-25 { top: 37.5%; }
.ring-50 { top: 25%; }
.ring-75 { top: 12.5%; }
.ring-100 { top: 1%; }

.radar-sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(51,255,140,0.35), rgba(51,255,140,0) 60deg, rgba(51,255,140,0) 360deg);
  animation: sweep-rotate 4s linear infinite;
  mix-blend-mode: screen;
}

@keyframes sweep-rotate {
  to { transform: rotate(360deg); }
}

.scope-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  background: var(--amber);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--amber);
}

.aircraft-layer {
  position: absolute;
  inset: 0;
}

.aircraft {
  position: absolute;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.aircraft svg {
  width: 18px;
  height: 18px;
  color: var(--green);
  filter: drop-shadow(0 0 4px var(--green));
}

.aircraft-label {
  position: absolute;
  top: 16px;
  left: 16px;
  font-size: 0.6rem;
  line-height: 1.4;
  color: var(--green);
  white-space: nowrap;
  text-shadow: 0 0 4px #000, 0 0 4px #000;
}

.aircraft.selected svg {
  color: var(--amber);
  filter: drop-shadow(0 0 6px var(--amber));
}

.aircraft-info {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(3, 10, 6, 0.92);
  border: 1px solid var(--green-faint);
  border-radius: 6px;
  padding: 12px 18px;
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--text);
  min-width: 220px;
  box-shadow: 0 0 20px rgba(51,255,140,0.15);
}

.aircraft-info .info-title {
  color: var(--green);
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.aircraft-info .info-close {
  position: absolute;
  top: 6px;
  right: 10px;
  cursor: pointer;
  color: var(--green-dim);
  background: none;
  border: none;
  font-size: 0.9rem;
}

/* ---- Projector / kiosk mode ---- */
body.kiosk .radar-controls,
body.kiosk #btn-theme {
  opacity: 0;
  pointer-events: none;
}
body.kiosk.show-controls .radar-controls,
body.kiosk.show-controls #btn-theme {
  opacity: 1;
  pointer-events: auto;
}
body.kiosk .radar-hud {
  opacity: 0.6;
}

@media (max-width: 640px) {
  .radar-controls { gap: 6px; }
  .btn, .btn-select { padding: 8px 10px; font-size: 0.68rem; }
  .home-card h1 { letter-spacing: 0.2em; }
}

/* ---- Change location modal ---- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 340px;
  background: #05100a;
  border: 1px solid var(--green-faint);
  border-radius: 8px;
  padding: 24px 22px;
  box-shadow: 0 0 40px rgba(51,255,140,0.1);
}

.modal-card h2 {
  margin: 0 0 4px 0;
  font-size: 1rem;
  color: var(--green);
  letter-spacing: 0.15em;
}
