:root {
  color-scheme: dark;
  --bg: #070a09;
  --ink: #e9fff4;
  --muted: #8eaea0;
  --emerald: #3dff9a;
  --cyan: #7af7ff;
  --line: rgba(122, 247, 255, 0.28);
  --panel: rgba(8, 16, 13, 0.78);
  font-family: "Segoe UI", "Liberation Sans", "DejaVu Sans", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  background:
    radial-gradient(900px 480px at 20% 0%, rgba(61, 255, 154, 0.16), transparent 55%),
    radial-gradient(700px 420px at 90% 10%, rgba(122, 247, 255, 0.12), transparent 50%),
    var(--bg);
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 3px 3px;
  mix-blend-mode: overlay;
  z-index: 4;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--cyan);
  color: #04221a;
  padding: 8px 12px;
  z-index: 6;
}
.skip:focus { top: 12px; }

.top, .disclaimer, .dock { width: min(1280px, calc(100% - 28px)); margin-inline: auto; }

.top {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-top: 18px;
}

.brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.logo { width: 46px; height: 46px; filter: drop-shadow(0 0 12px rgba(61, 255, 154, 0.45)); }
.eyebrow {
  margin: 0;
  color: var(--cyan);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
}
.word {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 0.9;
  background: linear-gradient(100deg, #f4fff8 0%, var(--emerald) 42%, var(--cyan) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.channels {
  margin: 0 0 4px;
  color: var(--cyan);
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-family: "DejaVu Sans Mono", "Liberation Mono", ui-monospace, monospace;
}
.badge {
  margin-left: auto;
  border: 1px solid rgba(231, 255, 106, 0.45);
  border-radius: 999px;
  padding: 8px 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: #e7ff6a;
}

.layout {
  width: min(1280px, calc(100% - 28px));
  height: 560px;
  min-height: 560px;
  max-height: 560px;
  margin: 12px auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-rows: 560px;
  gap: 12px;
}

.stage {
  position: relative;
  height: 560px;
  min-height: 560px;
  max-height: 560px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35), inset 0 0 80px rgba(61, 255, 154, 0.04);
  background: #10210f;
}

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

.hud span {
  position: absolute;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(122, 247, 255, 0.8);
  z-index: 2;
}
.hud span:nth-child(1) { top: 12px; left: 12px; border-right: 0; border-bottom: 0; }
.hud span:nth-child(2) { top: 12px; right: 12px; border-left: 0; border-bottom: 0; }
.hud span:nth-child(3) { bottom: 12px; left: 12px; border-right: 0; border-top: 0; }
.hud span:nth-child(4) { bottom: 12px; right: 12px; border-left: 0; border-top: 0; }

.caption, .fleet {
  position: absolute;
  z-index: 2;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 8px #000;
}
.caption { left: 18px; bottom: 14px; }
.fleet { right: 18px; bottom: 14px; }

.panel {
  width: 300px;
  height: 560px;
  min-height: 560px;
  max-height: 560px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  padding: 16px 16px 12px;
  overflow: hidden;
}

.kicker { margin: 0; color: var(--cyan); letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.72rem; }
#node-id { margin: 6px 0 10px; font-size: 2rem; letter-spacing: 0.08em; font-weight: 700; }
.panel h2 { margin: 16px 0 8px; font-size: 0.95rem; }
.panel dl { margin: 0; display: grid; gap: 8px; }
.panel dt { color: var(--muted); font-size: 0.75rem; }
.panel dd { margin: 0; height: 1.25em; overflow: hidden; white-space: nowrap; }
.fine, .local, details p { color: var(--muted); line-height: 1.45; font-size: 0.88rem; }
#sim-log { margin: 0; padding-left: 18px; height: 9.5rem; overflow: hidden; }
#sim-log li { margin: 0 0 6px; font-family: "DejaVu Sans Mono", "Liberation Mono", ui-monospace, monospace; font-size: 0.75rem; }

.dock {
  display: grid;
  gap: 10px;
  padding: 12px 0 18px;
}
.controls, .scenes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.speed { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.85rem; }
input[type="range"] { width: min(180px, 40vw); accent-color: var(--emerald); }

button {
  font: inherit;
  color: var(--ink);
  background: rgba(8, 20, 16, 0.85);
  border: 1px solid rgba(61, 255, 154, 0.35);
  border-radius: 999px;
  min-height: 44px;
  width: 8.6rem;
  padding: 0 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  cursor: pointer;
}
#speed-label { display: inline-block; width: 3.2rem; }
button[aria-pressed="true"], button:hover { border-color: var(--cyan); box-shadow: 0 0 18px rgba(122, 247, 255, 0.16); }
.vote-link { color: var(--muted); }
.mark {
  margin-left: 1.1rem;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  color: #c5e6d8;
}

.noscript {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto 18px;
  color: var(--muted);
}

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

@media (max-width: 900px) {
  body { display: block; }
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 420px 280px;
    height: 712px;
    min-height: 712px;
    max-height: 712px;
  }
  .stage, .panel {
    width: auto;
    height: auto;
    min-height: 0;
    max-height: none;
  }
  .stage { height: 420px; min-height: 420px; max-height: 420px; }
  .panel { height: 280px; min-height: 280px; max-height: 280px; }
  .top { flex-wrap: wrap; }
  .badge { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .grain { display: none; }
}
