:root {
  --bg:     #000000;
  --fg:     #33ff33;
  --accent: #ffcc00;
  --grid:   #1a1a1a;
  --glow:   #33ff33;
}
.theme-amber { --fg: #ffb347; --accent: #ffd166; --glow: #ff9f1a; }
.theme-blue  { --fg: #4fc3f7; --accent: #81d4fa; --glow: #0288d1; }

/* ── Base ─────────────────────────────────────────────────── */
html, body { height: 100%; }
body {
  margin: 0; padding: 12px; background: var(--bg); color: var(--fg);
  font-family: "Fixedsys", "Terminal", "Lucida Console", "Courier New", monospace;
  font-size: 16px; line-height: 1.25;
}

/* ── CRT effects ─────────────────────────────────────────── */
@keyframes flicker {
  0%,19%,21%,23%,25%,54%,56%,100% { opacity: 1;   }
  20%,22%,24%,55%                  { opacity: .85; }
}
.crt {
  animation: flicker .15s infinite;
  text-shadow: 0 0 2px var(--glow), 0 0 6px var(--glow);
}
.scanlines::before {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,.03), rgba(255,255,255,.03) 1px,
    transparent 2px, transparent 3px
  );
  mix-blend-mode: soft-light;
}
@media (prefers-reduced-motion: reduce) {
  .crt { animation: none; }
  .scanlines::before { display: none; }
}

/* ── Layout ──────────────────────────────────────────────── */
.shell {
  width: min(100%, 980px); margin: 0 auto;
  display: grid; gap: 10px;
}
.header-title {
  font-weight: bold; letter-spacing: 1px;
  text-align: center; margin: 6px 0 8px;
}

/* ── Panels ──────────────────────────────────────────────── */
.panel {
  border: 1px solid var(--fg); padding: 10px; overflow: auto;
  text-align: center;
  background:
    linear-gradient(0deg, rgba(255,255,255,.02), transparent),
    repeating-linear-gradient(90deg, var(--grid) 0 2px, transparent 2px 4px);
}
.panel-title { color: var(--accent); font-weight: bold; margin-bottom: 6px; }

/* ── Text / pre ─────────────────────────────────────────── */
pre { margin: 0; white-space: pre; color: var(--fg); }
.pre-wrap { display: inline-block; text-align: left; }
.panel pre { width: fit-content; margin: 0 auto; text-align: left; }

/* ── Interactive links ───────────────────────────────────── */
.station {
  color: var(--accent); cursor: pointer;
  background: none; border: none;
  font-family: inherit; font-size: inherit; padding: 0;
}
.station:hover, .station:focus { text-decoration: underline; outline: none; }
a.ext-link { color: var(--accent); }
a.ext-link:hover { text-decoration: underline; }

/* ── Navigation overlay ─────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.92);
  color: var(--fg); z-index: 9999; display: none;
  place-items: center; padding: 24px; text-align: center;
  text-shadow: 0 0 6px var(--glow); white-space: pre;
}
.overlay.show { display: grid; }

/* ── Toggle buttons (top-right) ─────────────────────────── */
.toggles {
  position: fixed; top: 8px; right: 8px; z-index: 10000;
  display: flex; flex-direction: column; gap: 6px;
}
.toggle-btn {
  background: transparent; color: var(--fg);
  border: 1px solid var(--fg); font-family: inherit;
  font-size: 14px; padding: 6px 10px; cursor: pointer;
  text-shadow: 0 0 2px var(--glow), 0 0 6px var(--glow);
  width: 158px; text-align: left; /* fixed width — prevents layout shift on label change */
  box-sizing: border-box;
}
.toggle-btn:hover { background: rgba(255,255,255,.06); }

/* ── Back link ───────────────────────────────────────────── */
.back-link { margin-bottom: 4px; text-align: center; }

/* ── Form elements ───────────────────────────────────────── */
input[type="text"], textarea {
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--fg); font-family: inherit;
  font-size: inherit; padding: 4px 8px;
  width: 100%; box-sizing: border-box;
  text-shadow: 0 0 2px var(--glow);
}
input[type="text"]:focus, textarea:focus {
  outline: 1px solid var(--accent);
}
textarea { resize: vertical; min-height: 60px; }
label { display: block; margin: 8px 0 2px; color: var(--accent); }

.submit-btn {
  background: transparent; color: var(--accent);
  border: 1px solid var(--accent); font-family: inherit;
  font-size: inherit; padding: 6px 16px; cursor: pointer;
  text-shadow: 0 0 4px var(--accent); margin-top: 8px;
}
.submit-btn:hover { background: rgba(255,204,0,.08); }

/* ── Blinking cursor ─────────────────────────────────────── */
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
.cursor { animation: blink 1s step-end infinite; }

/* ── Table styles ────────────────────────────────────────── */
.tt-table { border-collapse: collapse; width: 100%; }
.tt-table th, .tt-table td {
  border: 1px solid var(--fg); padding: 3px 8px;
  text-align: left; white-space: nowrap;
}
.tt-table th { color: var(--accent); }
.tt-table tr:hover td { background: rgba(255,255,255,.04); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  body { font-size: 14px; padding: 8px; }
  .shell { gap: 8px; }
  .toggle-btn { font-size: 13px; padding: 6px 8px; width: 148px; }
}
@media (max-width: 400px) { body { font-size: 13px; } }
/* ============================================================
   STJERNSFORS RAILROAD TERMINAL — common.js
   Shared utilities for all inner pages (home, about, etc.)
   ============================================================ */
