:root {
  --bg: #060b0f;
  --bg-panel: #0c161c;
  --bg-panel-raised: #101e26;
  --border: #1d3540;
  --fg: #d8ecf0;
  --fg-dim: #7fa3ad;
  --accent: #49d7ec;
  --accent-bright: #bdf4ff;
  --accent-warm: #e0b96a;
  --danger: #e0896a;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  min-height: 100%;
}

body {
  position: relative;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- background art --- */

.bg-roots {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.roots-group path {
  stroke-dasharray: 6 10;
  animation: driftRoots 14s linear infinite;
}

.core-glow {
  animation: pulseGlow 5s ease-in-out infinite;
  transform-origin: 800px 450px;
}

.core-crystal {
  animation: rotateCrystal 22s linear infinite;
  transform-origin: 800px 450px;
}

@keyframes driftRoots {
  to { stroke-dashoffset: -160; }
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.6; r: 140px; }
  50% { opacity: 0.95; r: 165px; }
}

@keyframes rotateCrystal {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .roots-group path, .core-glow, .core-crystal { animation: none; }
}

/* --- layout --- */

.page {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 20px 32px;
}

.hero {
  text-align: center;
  margin-bottom: 36px;
}

.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0;
}

.hero .dim { color: var(--fg-dim); }
.hero .accent { color: var(--accent); }

.tagline {
  color: var(--fg-dim);
  margin: 10px 0 0;
  font-size: 1.05rem;
}

/* --- tabs --- */

.tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.tab {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--fg-dim);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.tab:hover { color: var(--fg); border-color: var(--accent); }

.tab.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.tab-icon { margin-right: 6px; }

/* --- panels --- */

.panels { min-height: 420px; }

.panel { display: none; }
.panel.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-head h2 {
  margin: 0 0 6px;
  font-size: 1.4rem;
}

.panel-sub {
  color: var(--fg-dim);
  margin: 0 0 14px;
  max-width: 680px;
  line-height: 1.5;
}

.stat-row {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.stat {
  font-size: 0.9rem;
  color: var(--fg-dim);
}

.stat strong {
  color: var(--accent-bright);
  font-size: 1.1rem;
}

/* --- flight map --- */

.map-wrap {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.map-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

.map-wrap canvas.dragging {
  cursor: grabbing;
}

.map-hint {
  position: absolute;
  bottom: 10px;
  left: 14px;
  margin: 0;
  font-size: 0.78rem;
  color: var(--fg-dim);
  background: rgba(6, 11, 15, 0.6);
  padding: 4px 10px;
  border-radius: 999px;
  pointer-events: none;
}

.flight-detail {
  position: absolute;
  top: 14px;
  right: 14px;
  width: min(280px, calc(100% - 28px));
  background: rgba(12, 22, 28, 0.95);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  backdrop-filter: blur(6px);
}

.flight-detail-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: var(--fg-dim);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

.flight-detail-close:hover { color: var(--fg); }

.flight-detail h4 {
  margin: 0 0 4px;
  font-size: 1.1rem;
  color: var(--accent-bright);
  padding-right: 20px;
}

.flight-detail .fd-sub {
  color: var(--fg-dim);
  font-size: 0.85rem;
  margin: 0 0 10px;
}

.flight-detail dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 10px;
  font-size: 0.86rem;
}

.flight-detail dt { color: var(--fg-dim); }
.flight-detail dd {
  margin: 0;
  font-family: var(--font-mono);
  text-align: right;
}

.flight-detail .fd-route {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.86rem;
  line-height: 1.5;
}

.flight-detail .fd-route .arrow { color: var(--accent); margin: 0 6px; }

/* --- server info grid --- */

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.info-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}

.info-card h3 {
  margin: 0 0 10px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-warm);
}

.info-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(84px, auto) 1fr;
  gap: 10px 12px;
  font-size: 0.9rem;
  align-items: start;
}

.info-card dt {
  color: var(--fg-dim);
  padding-top: 1px;
}

.info-card dd {
  margin: 0;
  min-width: 0;
  font-family: var(--font-mono);
  overflow-wrap: break-word;
  line-height: 1.5;
}

.info-card dd.prose {
  font-family: var(--font);
}

.dd-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.dd-list .chip {
  background: var(--bg-panel-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.82rem;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-all;
}

.loading, .error {
  color: var(--fg-dim);
  font-style: italic;
}

.error { color: var(--danger); }

/* --- footer --- */

.site-footer {
  text-align: center;
  margin-top: 40px;
  color: var(--fg-dim);
  font-size: 0.85rem;
}

@media (max-width: 480px) {
  .page { padding: 32px 14px 24px; }
  .tabs { gap: 8px; }
  .tab { padding: 8px 14px; font-size: 0.88rem; }
}
