/* ==========================================================================
   GALAXY ALIEN — DEEP GALAXY RELAY GA-7
   styles.css — single source of truth
   ========================================================================== */

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
ul, ol { list-style: none; margin: 0; padding: 0; }

/* Keyboard focus ring — only on keyboard nav, not on click. Applies to
   elements that opt out of the default focus outline. */
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Tokens ---------- */
:root {
  /* Palette */
  --bg: #050714;
  --bg-2: #0a0d1f;
  --ink: #E6E8F2;
  --ink-mute: #C8CDD9;
  --ink-dim: #8A91A8;
  --ink-faint: #4A5070;
  --line: rgba(107, 63, 160, 0.25);
  --line-strong: rgba(107, 63, 160, 0.45);

  --purple: #6B3FA0;
  --purple-glow: rgba(107, 63, 160, 0.35);
  --teal: #4FE8C9;
  --teal-glow: rgba(79, 232, 201, 0.4);
  --red: #FF6B6B;
  --amber: #E8B931;

  /* Type */
  --font-sans: "Inter", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", "Consolas", "SF Mono", monospace;

  /* Spacing */
  --shell-max: 1180px;
  --gutter: clamp(20px, 4vw, 48px);

  /* Layout */
  --bar-h: 64px;
  --foot-h: 36px;
}

/* ---------- Page shell ---------- */
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink-mute);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Body needs room for fixed bars */
body { padding-top: var(--bar-h); padding-bottom: var(--foot-h); }

::selection { background: var(--purple); color: var(--ink); }

/* ---------- Starfield background ---------- */
.starfield {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.starfield__layer {
  position: absolute;
  inset: -10%;
  background-repeat: repeat;
  background-size: cover;
  will-change: transform;
  transition: transform 80ms linear;
}

.starfield__layer--1 {
  background-image: url("assets/starfield-1.svg");
  opacity: 0.55;
}

.starfield__layer--2 {
  background-image: url("assets/starfield-2.svg");
  opacity: 0.7;
}

.starfield__layer--3 {
  background-image: url("assets/starfield-3.svg");
  opacity: 0.85;
}

/* Subtle nebula wash on top of stars */
.starfield::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 20% 30%, rgba(107, 63, 160, 0.18), transparent 60%),
    radial-gradient(ellipse 50% 35% at 80% 70%, rgba(79, 232, 201, 0.06), transparent 60%);
  pointer-events: none;
}

/* ---------- Console Bar (top) ---------- */
.console-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--bar-h);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 var(--gutter);
  background: rgba(5, 7, 20, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.console-bar__mark {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--ink);
  text-transform: uppercase;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  transition: color 180ms;
}

a.console-bar__mark:hover { color: var(--teal); }

.console-bar__mark-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--teal);
  border-radius: 50%;
  margin-right: 10px;
  box-shadow: 0 0 8px var(--teal-glow);
  vertical-align: middle;
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.console-bar__nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.console-bar__nav a {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 2px;
  transition: color 180ms, border-color 180ms, background 180ms;
}

.console-bar__nav a:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: rgba(107, 63, 160, 0.08);
}

.console-bar__nav a.is-active {
  color: var(--teal);
  border-color: var(--line-strong);
}

/* ---------- Console bar: language switcher ---------- */
.console-bar__lang {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
}
.console-bar__lang a {
  color: var(--ink-dim);
  text-decoration: none;
  padding: 2px 4px;
  transition: color 180ms;
}
.console-bar__lang a:hover { color: var(--teal); }
.console-bar__lang .is-active {
  color: var(--teal);
  padding: 2px 4px;
}
.console-bar__lang-sep { color: var(--ink-mute); }

.console-bar__clock {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  white-space: nowrap;
}

.console-bar__signal {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
}

/* ---------- Signal Meter ---------- */
.signal-meter {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
}

.signal-meter__bar {
  width: 4px;
  background: #1a1f3a;
  border-radius: 1px;
  transition: height 200ms ease, background 200ms ease;
}

.signal-meter__bar.is-on {
  background: var(--teal);
  box-shadow: 0 0 6px var(--teal-glow);
}

.signal-meter__bar:nth-child(1) { height: 6px; }
.signal-meter__bar:nth-child(2) { height: 10px; }
.signal-meter__bar:nth-child(3) { height: 14px; }
.signal-meter__bar:nth-child(4) { height: 18px; }
.signal-meter__bar:nth-child(5) { height: 22px; }

/* ---------- Transmission Footer ---------- */
.transmission-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--foot-h);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 var(--gutter);
  background: rgba(5, 7, 20, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  text-transform: uppercase;
  overflow: hidden;
}

.transmission-footer__ticker {
  margin-left: auto;
  color: var(--teal);
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  max-width: 60%;
  mask-image: linear-gradient(to right, transparent 0, #000 40px, #000 calc(100% - 40px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 40px, #000 calc(100% - 40px), transparent 100%);
}

.transmission-footer__hub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal);
  opacity: 0.85;
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  margin-left: auto;
  transition: opacity 180ms, border-color 180ms, color 180ms;
}

.transmission-footer__hub:hover {
  opacity: 1;
  color: var(--teal);
  border-color: var(--teal);
}

/* When both hub link and ticker are present, push ticker to flex-end after hub */
.transmission-footer__ticker { margin-left: 0; }
.transmission-footer__hub + .transmission-footer__ticker { margin-left: auto; }

.transmission-footer__ticker-track {
  display: inline-block;
  white-space: nowrap;
  animation: ticker 40s linear infinite;
}

@keyframes ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---------- Shell ---------- */
.shell {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: clamp(48px, 8vw, 96px) var(--gutter);
}

.shell--narrow { max-width: 780px; }

/* ---------- Type utilities ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0 0 12px;
}

.eyebrow--teal { color: var(--teal); }

.headline {
  font-family: var(--font-mono);
  font-size: clamp(28px, 5vw, 48px);
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: var(--ink);
  margin: 0 0 24px;
  text-transform: uppercase;
}

.headline--xl {
  font-size: clamp(36px, 7vw, 72px);
}

.body-text {
  color: var(--ink-mute);
  font-size: clamp(15px, 1.5vw, 17px);
  line-height: 1.8;
  max-width: 64ch;
  margin: 0 0 1em;
}

.mono { font-family: var(--font-mono); }
.teal { color: var(--teal); }
.purple { color: var(--purple); }
.red { color: var(--red); }

/* ---------- Hero (index) ---------- */
.hero {
  min-height: calc(100vh - var(--bar-h) - var(--foot-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(60px, 10vh, 120px) 0;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
  margin: 24px 0 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.hero__meta span strong {
  display: block;
  color: var(--ink);
  font-weight: 500;
  margin-top: 2px;
  letter-spacing: 0.06em;
}

/* ---------- Decode Block ---------- */
.decode-block {
  font-family: var(--font-mono);
  font-size: clamp(20px, 3vw, 36px);
  letter-spacing: 0.08em;
  line-height: 1.4;
  color: var(--ink-faint);
  margin: 32px 0;
  padding: 24px 28px;
  border-left: 2px solid var(--purple);
  background: linear-gradient(90deg, rgba(107, 63, 160, 0.06), transparent 60%);
  min-height: 80px;
  position: relative;
}

/* Garble characters (pre-decode) sit at low opacity so the block reads as
   "noise" rather than a wall of full-strength text before the animation runs. */
.decode-block__char {
  opacity: 0.28;
  transition: opacity 200ms ease-out;
}

.decode-block__char.is-locked {
  color: var(--teal);
  text-shadow: 0 0 12px var(--teal-glow);
  animation: lock-flash 320ms ease-out;
}

.decode-block__char.is-locking {
  color: var(--ink);
  text-shadow: 0 0 16px rgba(230, 232, 242, 0.6);
  animation: lock-flash 320ms ease-out;
}

@keyframes lock-flash {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.decode-block__caret {
  display: inline-block;
  width: 0.6em;
  background: var(--teal);
  height: 1em;
  vertical-align: -0.15em;
  margin-left: 2px;
  animation: caret-blink 1s steps(2) infinite;
}

@keyframes caret-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.decode-block--small {
  font-size: clamp(14px, 1.6vw, 18px);
  padding: 16px 20px;
  min-height: auto;
}

/* ---------- Reveal block (the "this is not an ad" line) ---------- */
.reveal {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(80px, 14vh, 140px) var(--gutter);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: clamp(60px, 10vh, 100px) auto;
  max-width: var(--shell-max);
}

.reveal p {
  font-family: var(--font-mono);
  font-size: clamp(18px, 2.4vw, 26px);
  letter-spacing: 0.04em;
  color: var(--ink);
  line-height: 1.6;
  max-width: 48ch;
  text-align: center;
}

.reveal p em {
  color: var(--teal);
  font-style: normal;
  text-shadow: 0 0 10px var(--teal-glow);
}

/* ---------- Stations nav ---------- */
.stations {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 0 0 clamp(60px, 10vh, 100px);
}

@media (max-width: 720px) {
  .stations { grid-template-columns: 1fr; }
}

.station {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  padding: 24px;
  border: 1px solid var(--line-strong);
  background: rgba(10, 13, 31, 0.5);
  backdrop-filter: blur(6px);
  transition: border-color 220ms, background 220ms, transform 220ms;
  text-align: left;
  width: 100%;
}

.station:hover {
  border-color: var(--teal);
  background: rgba(79, 232, 201, 0.04);
  transform: translateY(-2px);
}

.station__index {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
}

.station__title {
  font-family: var(--font-mono);
  font-size: 22px;
  letter-spacing: 0.08em;
  color: var(--ink);
  margin: 0;
  text-transform: uppercase;
}

.station__desc {
  font-size: 14px;
  color: var(--ink-dim);
  line-height: 1.6;
  margin: 8px 0 0;
}

.station__arrow {
  align-self: flex-end;
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--teal);
  transition: transform 220ms;
}

.station:hover .station__arrow {
  transform: translateX(6px);
}

/* ---------- Chapter stream (civilizations) ---------- */
.chapters {
  display: flex;
  flex-direction: column;
  gap: clamp(80px, 12vh, 140px);
  padding: clamp(40px, 8vh, 80px) 0;
}

.chapter {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: clamp(24px, 5vw, 80px);
  align-items: start;
}

@media (max-width: 760px) {
  .chapter { grid-template-columns: 1fr; }
}

.chapter__meta {
  border-left: 1px solid var(--line-strong);
  padding-left: 20px;
}

.chapter__no {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

.chapter__origin {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.16em;
  color: var(--teal);
  text-transform: uppercase;
  margin: 8px 0 16px;
}

.chapter__year {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
}

.chapter__title {
  font-family: var(--font-mono);
  font-size: clamp(22px, 3.2vw, 32px);
  letter-spacing: 0.04em;
  color: var(--ink);
  text-transform: uppercase;
  line-height: 1.2;
  margin: 0 0 20px;
}

.chapter__body p {
  font-size: clamp(15px, 1.5vw, 17px);
  line-height: 1.85;
  color: var(--ink-mute);
  margin: 0 0 1em;
}

.chapter__body p:last-child { margin-bottom: 0; }

.chapter__sig {
  margin-top: 24px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

/* ---------- Reply panel ---------- */
.reply {
  border: 1px solid var(--line-strong);
  padding: clamp(28px, 4vw, 48px);
  background: rgba(10, 13, 31, 0.6);
  backdrop-filter: blur(8px);
  margin: clamp(60px, 10vh, 100px) 0;
}

.reply__heading {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 8px;
}

.reply__intro {
  font-size: 14px;
  color: var(--ink-dim);
  margin: 0 0 24px;
  max-width: 56ch;
}

.reply__field {
  display: block;
  margin-bottom: 20px;
}

.reply__label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 8px;
}

.reply__input,
.reply__textarea {
  width: 100%;
  background: rgba(5, 7, 20, 0.7);
  border: 1px solid var(--line-strong);
  padding: 12px 14px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.04em;
  outline: none;
  transition: border-color 180ms, box-shadow 180ms;
}

.reply__textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

.reply__input:focus,
.reply__textarea:focus {
  border-color: var(--teal);
  /* Box-shadow ring is keyboard-friendly: visible on Tab focus. */
  box-shadow: 0 0 0 3px rgba(79, 232, 201, 0.25);
}

.reply__actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.reply__submit {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--teal);
  padding: 12px 22px;
  border: 1px solid var(--teal);
  transition: background 180ms, color 180ms, box-shadow 180ms;
}

.reply__submit:hover {
  background: transparent;
  color: var(--teal);
  box-shadow: 0 0 16px var(--teal-glow);
}

.reply__hint {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-dim);
}

.reply-log {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px dashed var(--line-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  max-height: 240px;
  overflow-y: auto;
}

.reply-log:empty { display: none; }

.reply-log__entry {
  padding: 8px 0;
  border-bottom: 1px dashed rgba(107, 63, 160, 0.15);
}

.reply-log__entry:last-child { border-bottom: none; }

.reply-log__ts {
  color: var(--ink-dim);
  font-size: 10px;
  letter-spacing: 0.14em;
  margin-right: 12px;
}

.reply-log__sig { color: var(--teal); margin-right: 12px; }
.reply-log__status {
  display: inline-block;
  color: var(--bg);
  background: var(--teal);
  padding: 1px 6px;
  font-size: 10px;
  letter-spacing: 0.16em;
  margin-left: 8px;
}

/* ---------- Reply: <select> styling ---------- */
.reply__select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--teal) 50%),
    linear-gradient(135deg, var(--teal) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 32px;
  cursor: pointer;
}
.reply__select option { background: #050714; color: var(--ink); }

/* ---------- Reply receipt (sig confirmation) ---------- */
.reply-receipt {
  margin-top: 24px;
  padding: 18px 20px;
  border: 1px solid rgba(79, 232, 201, 0.35);
  background: rgba(79, 232, 201, 0.06);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  position: relative;
}
.reply-receipt.is-error {
  border-color: rgba(232, 90, 90, 0.45);
  background: rgba(232, 90, 90, 0.06);
}
.reply-receipt__line {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 0 0 8px;
  flex-wrap: wrap;
}
.reply-receipt__label {
  color: var(--ink-dim);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.reply-receipt__sig {
  color: var(--teal);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-shadow: 0 0 8px var(--teal-glow);
}
.reply-receipt.is-error .reply-receipt__sig { color: #ff7a7a; text-shadow: none; }
.reply-receipt__share {
  margin: 0;
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
}
.reply-receipt__link {
  color: var(--teal);
  text-decoration: none;
  border-bottom: 1px dashed var(--teal);
}
.reply-receipt__link:hover { color: var(--ink); border-bottom-color: var(--ink); }
.reply-receipt__copy {
  margin-left: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  padding: 4px 10px;
  cursor: pointer;
  transition: all 180ms;
}
.reply-receipt__copy:hover { color: var(--teal); border-color: var(--teal); }

.reply__submit:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* ---------- Boot overlay ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--teal);
  letter-spacing: 0.08em;
  transition: opacity 600ms ease;
}

.boot.is-done {
  opacity: 0;
  pointer-events: none;
}

.boot__inner {
  max-width: 540px;
  width: 100%;
}

.boot__line {
  opacity: 0;
  white-space: pre-wrap;
  min-height: 1.6em;
}

.boot__line.is-shown { opacity: 1; }
.boot__line.is-prompt { color: var(--ink); }
.boot__line.is-success { color: var(--teal); text-shadow: 0 0 12px var(--teal-glow); }

.boot__caret {
  display: inline-block;
  width: 0.5em;
  height: 1em;
  background: var(--teal);
  vertical-align: -0.15em;
  margin-left: 4px;
  animation: caret-blink 1s steps(2) infinite;
}

/* ---------- Signal page ---------- */
.signal-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

@media (max-width: 860px) {
  .signal-grid { grid-template-columns: 1fr; }
}

.signal-panel {
  border: 1px solid var(--line-strong);
  background: rgba(10, 13, 31, 0.5);
  backdrop-filter: blur(6px);
  padding: 24px;
}

.signal-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.signal-panel__head .dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--teal);
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  box-shadow: 0 0 6px var(--teal-glow);
  animation: pulse 1.6s ease-in-out infinite;
}

.waveform-svg {
  width: 100%;
  height: 180px;
  display: block;
}

.freq-dial {
  width: 100%;
  height: 220px;
  display: block;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 24px;
}

@media (max-width: 640px) {
  .status-grid { grid-template-columns: repeat(2, 1fr); }
}

.status-cell {
  border: 1px solid var(--line);
  padding: 16px;
  background: rgba(5, 7, 20, 0.5);
}

.status-cell__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 8px;
}

.status-cell__value {
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--ink);
  letter-spacing: 0.04em;
}

.status-cell__unit {
  font-size: 11px;
  color: var(--ink-dim);
  margin-left: 4px;
  letter-spacing: 0.1em;
}

/* ---------- Archive page ---------- */
.archive-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.archive-toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.archive-toolbar select {
  background: rgba(5, 7, 20, 0.7);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 6px 10px;
  outline: none;
  transition: border-color 180ms, box-shadow 180ms;
}

.archive-toolbar select:focus,
.reply__select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(79, 232, 201, 0.25);
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.archive-card {
  text-align: left;
  width: 100%;
  padding: 20px;
  border: 1px solid var(--line-strong);
  background: rgba(10, 13, 31, 0.5);
  backdrop-filter: blur(4px);
  transition: border-color 220ms, background 220ms;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
}

.archive-card:hover {
  border-color: var(--teal);
  background: rgba(79, 232, 201, 0.04);
}

.archive-card__id {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
}

.archive-card__excerpt {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-mute);
  flex: 1;
}

.archive-card__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  text-transform: uppercase;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid currentColor;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.badge--unknown { color: var(--ink-dim); }
.badge--artifact { color: var(--teal); }
.badge--ambiguous { color: var(--amber); }
.badge--danger { color: var(--red); }

/* Drawer */
.drawer {
  position: fixed;
  top: var(--bar-h); right: 0;
  bottom: var(--foot-h);
  width: min(540px, 100%);
  background: var(--bg-2);
  border-left: 1px solid var(--line-strong);
  z-index: 60;
  transform: translateX(100%);
  transition: transform 320ms ease;
  overflow-y: auto;
  padding: 32px;
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.6);
}

.drawer.is-open { transform: translateX(0); }

.drawer__close {
  position: absolute;
  top: 16px; right: 16px;
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--ink-dim);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
}

.drawer__close:hover { color: var(--teal); }

.drawer__head {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.drawer__id {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  margin-bottom: 6px;
}

.drawer__excerpt {
  font-family: var(--font-mono);
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-transform: uppercase;
  margin: 0;
}

.drawer__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

.drawer__body p {
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink-mute);
  margin: 0 0 1em;
}

.drawer-backdrop {
  position: fixed;
  inset: var(--bar-h) 0 var(--foot-h) 0;
  background: rgba(5, 7, 20, 0.6);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms;
}

.drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Log page ---------- */
.log-timeline {
  position: relative;
  padding-left: 32px;
}

.log-timeline::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 8px;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--line-strong) 8%, var(--line-strong) 92%, transparent);
}

.log-entry {
  position: relative;
  padding: 24px 28px;
  margin-bottom: 32px;
  border: 1px solid var(--line);
  background: rgba(232, 185, 49, 0.02);
  /* Slightly off-grid, warmer */
  margin-left: -8px;
}

.log-entry::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 32px;
  width: 11px; height: 11px;
  background: var(--amber);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(232, 185, 49, 0.5);
}

.log-entry__date {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--amber);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.log-entry__title {
  font-family: var(--font-mono);
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-transform: uppercase;
  margin: 0 0 12px;
}

.log-entry__body p {
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink-mute);
  margin: 0 0 1em;
  font-family: "Georgia", "Source Serif Pro", serif;
}

.log-entry__body p:last-child { margin-bottom: 0; }

.log-entry__waveform {
  margin-top: 16px;
  width: 100%;
  max-width: 280px;
  opacity: 0.7;
}

.log-tags {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

.log-tag {
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
}

/* ---------- Log: fresh entry highlight ---------- */
.log-entry--fresh {
  position: relative;
  padding: 24px 22px;
  margin: 0 0 36px;
  background: linear-gradient(180deg, rgba(79, 232, 201, 0.04), transparent 80%);
  border-left: 2px solid var(--teal);
}
.log-entry--fresh::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -10px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(79, 232, 201, 0.4), transparent);
}
.log-entry__badge {
  display: inline-block;
  margin-left: 10px;
  padding: 1px 6px;
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--bg);
  background: var(--teal);
  vertical-align: 2px;
  animation: badge-pulse 2.4s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 232, 201, 0.6); }
  50%      { box-shadow: 0 0 0 6px rgba(79, 232, 201, 0); }
}

/* ---------- Misc utility ---------- */
.divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: clamp(40px, 8vh, 80px) 0;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0 0 32px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .transmission-footer__ticker-track { animation: none; }
}

/* ---------- Hover-capable devices only ----------
   Cards' translateY on hover shouldn't trigger on touch devices (which
   often "stick" in the :hover state after tap). */
@media (hover: none) {
  .station:hover,
  .wall-card:hover,
  .archive-card:hover {
    transform: none;
    border-color: var(--line-strong);
    background: rgba(10, 13, 31, 0.5);
  }
}

/* ---------- Tablet (≤ 1024px) — guard against crowded console bar ----------
   With 4 nav links + lang switcher + clock + signal meter, the bar can
   become cramped on 1024px viewports. Tighten gaps. */
@media (max-width: 1024px) {
  .console-bar { gap: 16px; }
  .console-bar__nav a { padding: 8px 10px; }
  .console-bar__clock { display: none; }   /* clock hides earlier on tablet */
}

/* ========================================================================
   RESPONSIVE — mobile (≤ 720px)
   Console bar wraps to 2 rows; nav stays flat (no hamburger); clock hidden
   for breathing room. Headlines break naturally; <br/> in source HTML is
   overridden on narrow screens so the title can reflow.
   ======================================================================== */
@media (max-width: 720px) {
  /* Console bar: row 1 = mark + signal meter; row 2 = nav (full width).
     Clock hides; nav is the primary wayfinding. */
  .console-bar {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--bar-h);
    padding: 10px var(--gutter);
    gap: 8px 16px;
  }
  .console-bar__mark {
    font-size: 11px;
    letter-spacing: 0.12em;
    flex: 1 1 auto;
    min-width: 0;
  }
  .console-bar__mark-dot { margin-right: 8px; }
  .console-bar__nav {
    order: 3;
    flex-basis: 100%;
    margin-left: 0;
    margin-top: 4px;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 2px;
  }
  .console-bar__nav a {
    padding: 6px 10px;
    font-size: 10px;
    letter-spacing: 0.12em;
  }
  .console-bar__clock { display: none; }
  .signal-meter { order: 2; height: 18px; }
  .signal-meter__bar { width: 3px; }

  /* Hero h1 — break naturally on mobile (overrides <br/> in source) */
  .headline br { display: none; }
  .headline--xl br { display: none; }

  /* Chapter meta keeps its left border, but tighter on mobile */
  .chapter__meta { padding-left: 14px; }

  /* Reply form — keep clean, don't shrink labels too much */
  .reply__actions { flex-wrap: wrap; gap: 10px; }
  .reply__hint { font-size: 10px; }

  /* Stations / chapters — already collapse to 1 col from existing media */
}

/* Extra-narrow phones (≤ 420px) */
@media (max-width: 420px) {
  .console-bar { padding: 8px 14px; }
  .console-bar__mark { font-size: 10px; letter-spacing: 0.08em; }
  .console-bar__nav a { padding: 5px 8px; font-size: 9px; letter-spacing: 0.1em; }
  .reply { padding: 22px 18px; }
  .reply-receipt__line { flex-direction: column; align-items: flex-start; gap: 4px; }
  .reply-receipt__sig { font-size: 14px; }
}

/* Archive filter toolbar: wrap selects, full-width on small screens */
@media (max-width: 720px) {
  .archive-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .archive-toolbar label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .archive-toolbar select {
    min-width: 0;
    flex: 1;
    max-width: 60%;
  }
  .archive-grid { grid-template-columns: 1fr; }

  /* Reply wall toolbar — chips wrap */
  .wall-toolbar { gap: 6px; }
  .wall-toolbar__chip { padding: 5px 9px; font-size: 10px; letter-spacing: 0.12em; }
  .wall-grid { grid-template-columns: 1fr; }
}