:root {
  --ground: #050708;
  --panel: #0b0e10;
  --bone: #e8e0d2;
  --bone-2: #b1aa9e;
  --bone-3: #8a857c;
  --wire: rgba(232, 224, 210, 0.2);
  --wire-strong: rgba(232, 224, 210, 0.42);
  --dot: rgba(232, 224, 210, 0.16);
  --run: #35b45c;
  --busy: #f2a900;
  --signal: #f0402f;

  --f-display: "Tektur", "Onest", sans-serif;
  --f-text: "Onest", "Segoe UI", sans-serif;
  --f-data: "Martian Mono", ui-monospace, monospace;

  --margin: clamp(16px, 3.4vw, 48px);
  --gutter: clamp(12px, 1.7vw, 24px);
  --bar-h: 48px;
  --cell: 48px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ground); color-scheme: dark; scrollbar-color: var(--wire-strong) var(--ground); }
body {
  margin: 0;
  background: var(--ground);
  color: var(--bone);
  font: 400 17px/1.5 var(--f-text);
  /* the module grid: dots at (margin + k·cell, k·cell) */
  background-image: radial-gradient(circle, var(--dot) 1px, transparent 1.6px);
  background-size: var(--cell) var(--cell);
  background-position: calc(var(--margin) - var(--cell) / 2) calc(var(--cell) / -2);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--signal); color: var(--ground); }
input { caret-color: var(--signal); }
a { color: inherit; text-underline-offset: 0.2em; }
:focus-visible { outline: 2px solid var(--busy); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- status bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  height: var(--bar-h);
  display: flex; align-items: center; gap: 28px;
  padding: 0 var(--margin);
  background: var(--ground);
  border-bottom: 1px solid var(--wire);
  font: 500 13px/1 var(--f-text);
  color: var(--bone-2);
}
.logo {
  font: 800 19px/1 var(--f-display);
  font-variation-settings: "wdth" 90;
  letter-spacing: 0.01em;
  color: var(--bone);
  text-decoration: none;
}
.logo span { color: var(--signal); }
.bar-status { display: flex; align-items: center; gap: 8px; margin: 0; }
.bar-nav { display: flex; gap: 24px; margin-left: auto; font: 500 14px/1 var(--f-text); }
.bar-nav a { color: var(--bone-2); text-decoration: none; transition: color 0.2s; }
.bar-nav a:hover { color: var(--bone); }
.bar-clock { margin: 0; font: 400 12px/1 var(--f-data); font-variant-numeric: tabular-nums; min-width: 8ch; }
.bar-tg {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--bone); text-decoration: none;
  padding: 8px 12px; border: 1px solid var(--wire-strong);
  transition: border-color 0.2s, background 0.2s;
}
.bar-tg:hover { border-color: var(--bone); }

/* ---------- lamps ---------- */
.lamp { display: inline-block; width: 8px; height: 8px; flex: none; background: var(--bone-3); }
.lamp.is-run { background: var(--run); }
.lamp.is-busy { background: var(--busy); animation: blink 0.5s steps(2) infinite; }
.lamp.is-pilot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--busy); }
@keyframes blink { 50% { opacity: 0.25; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px;
  font: 600 16px/1 var(--f-text);
  text-decoration: none; cursor: pointer;
  border: 1px solid transparent; border-radius: 0;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn-signal { background: var(--run); color: var(--ground); }
.btn-signal:hover { background: var(--bone); }
.btn-line { background: var(--ground); color: var(--bone); border-color: var(--wire-strong); }
.btn-line:hover { border-color: var(--bone); }

@media (max-width: 1100px) {
  .bar-nav, .bar-clock { display: none; }
  .bar-status { margin-right: auto; }
}
@media (max-width: 560px) {
  .bar { gap: 14px; }
  .bar-tg span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* cookie notice: a flat panel in the corner, one action */
.cookie[hidden] { display: none; }
.cookie {
  position: fixed; left: 16px; bottom: 16px; z-index: 60;
  display: flex; align-items: center; gap: 16px;
  max-width: 560px; padding: 14px 16px;
  background: var(--panel); border: 1px solid var(--wire-strong);
  font-size: 14px; line-height: 1.45; color: var(--bone-2);
}
.cookie p { margin: 0; }
.cookie a { color: var(--bone); }
.cookie .btn { flex: none; }
@media (max-width: 560px) {
  .cookie { left: 12px; right: 12px; bottom: 12px; flex-direction: column; align-items: stretch; }
}
