/* ============================================================
   AGORA COSMICA — THE LONGWAVE
   A longwave receiver for the deep past.
   Brand tokens come from ../shared/brand.css (imported before this).
   ============================================================ */

:root {
  --ease-brand: cubic-bezier(0.22, 0.08, 0.02, 1);   /* long settle, no bounce */
  --ease-tune: cubic-bezier(0.65, 0, 0.18, 1);       /* sweep in and out */
  --dur-1: 0.35s;
  --dur-2: 0.7s;
  --dur-3: 1.2s;
  --hairline: 1px solid rgba(230, 188, 92, 0.14);
  --hairline-dim: 1px solid rgba(180, 200, 255, 0.08);
  --panel-grad: linear-gradient(168deg, rgba(28, 36, 92, 0.34), rgba(12, 17, 51, 0.1) 58%);
  --amp: 0;   /* live voice amplitude, set from JS */
  --sig: 0;   /* tuning signal strength, set from JS */
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(130% 100% at 50% 0%, #151C47 0%, #0C1133 52%, #080B20 100%);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-weight: 350;
  font-size: var(--step-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

@media (min-width: 921px) and (min-height: 620px) {
  html, body { height: 100%; overflow: hidden; }
}

::selection { background: rgba(230, 188, 92, 0.28); color: #F6D55C; }

[hidden] { display: none !important; }

img { max-width: 100%; display: block; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: var(--gold-ui); text-decoration: none; }

:focus-visible {
  outline: 1.5px solid var(--gold-hover);
  outline-offset: 3px;
  border-radius: 4px;
}

.skiplink {
  position: fixed; top: -80px; left: 24px; z-index: 400;
  padding: 10px 18px; background: var(--bg-card); color: var(--text-primary);
  border: var(--hairline); border-radius: 8px;
  font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  transition: top var(--dur-1) var(--ease-brand);
}
.skiplink:focus-visible { top: 16px; }

.nowrap { white-space: nowrap; }
.dotsep { margin: 0 0.6em; color: var(--gold-deep); }

/* ---------- atmosphere ---------- */

#grain {
  position: fixed; inset: -80px; z-index: 120; pointer-events: none;
  opacity: 0.08; background-repeat: repeat; background-size: 176px 176px;
  animation: grain-shift 0.85s steps(4) infinite;
}
@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-38px, 22px); }
  50% { transform: translate(24px, -30px); }
  75% { transform: translate(-16px, -12px); }
  100% { transform: translate(30px, 26px); }
}

#vignette {
  position: fixed; inset: 0; z-index: 110; pointer-events: none;
  background:
    radial-gradient(125% 95% at 50% 40%, transparent 52%, rgba(5, 7, 20, 0.52) 100%),
    linear-gradient(180deg, rgba(5, 7, 20, 0.24), transparent 14%, transparent 88%, rgba(5, 7, 20, 0.38));
}

#lamp {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(52% 42% at 32% 30%, rgba(230, 188, 92, 0.075), transparent 70%),
    radial-gradient(40% 34% at 74% 78%, rgba(42, 51, 116, 0.5), transparent 72%);
  opacity: calc(0.55 + var(--amp) * 0.45);
  transition: opacity 0.3s linear;
}

/* ---------- custom cursor ---------- */

#cursor { position: fixed; top: 0; left: 0; z-index: 350; pointer-events: none; }
#cursor .cursor-dot,
#cursor .cursor-ring, #cursor .cursor-tag { position: fixed; top: 0; left: 0; will-change: transform; }
#cursor .cursor-dot {
  width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%;
  background: var(--gold-primary);
  box-shadow: 0 0 10px rgba(230, 188, 92, 0.55);
}
#cursor .cursor-ring {
  width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  border: 1px solid rgba(230, 188, 92, 0.38);
  transition: width 0.28s var(--ease-brand), height 0.28s var(--ease-brand),
    margin 0.28s var(--ease-brand), border-color 0.28s, opacity 0.28s;
}
#cursor .cursor-tag {
  font-size: 9px; font-weight: 500; letter-spacing: 0.34em; text-transform: uppercase;
  color: var(--gold-primary); white-space: nowrap;
  opacity: 0; transition: opacity 0.25s;
}
body[data-cursor="act"] #cursor .cursor-ring {
  width: 48px; height: 48px; margin: -24px 0 0 -24px;
  border-color: rgba(246, 213, 92, 0.65);
}
body[data-cursor="drag"] #cursor .cursor-ring {
  width: 58px; height: 26px; margin: -13px 0 0 -29px; border-radius: 13px;
  border-color: rgba(246, 213, 92, 0.7);
}
body[data-cursor="drag"] #cursor .cursor-tag { opacity: 0.9; }
@media (hover: none), (pointer: coarse) {
  #cursor { display: none; }
}
@media (hover: hover) and (pointer: fine) {
  body.has-cursor, body.has-cursor a, body.has-cursor button,
  body.has-cursor #band { cursor: none; }
}

/* ---------- top bar ---------- */

#topbar {
  position: relative; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  height: 64px; padding: 0 clamp(16px, 3vw, 32px);
  border-bottom: var(--hairline-dim);
}
.wordmark {
  display: flex; align-items: center; gap: 12px; margin: 0;
  font-size: 12px; font-weight: 450; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--text-secondary);
}
.wordmark img { filter: drop-shadow(0 0 6px rgba(230, 188, 92, 0.4)); }
.wordmark-sub {
  color: var(--gold-ui); font-weight: 350; letter-spacing: 0.34em;
  padding-left: 12px; border-left: 1px solid rgba(230, 188, 92, 0.25);
}
.topbar-tagline {
  position: absolute; left: 50%; transform: translateX(-50%);
  margin: 0; font-family: var(--font-content); font-style: italic;
  font-size: 15px; color: var(--text-tertiary);
}
.topbar-controls { display: flex; align-items: center; gap: 14px; }

.ctl {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 10.5px; font-weight: 450; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--text-tertiary); padding: 8px 10px; border-radius: 8px;
  transition: color var(--dur-1) var(--ease-brand);
}
.ctl:hover { color: var(--text-primary); }
.ctl-dot {
  width: 7px; height: 7px; border-radius: 50%;
  border: 1px solid var(--gold-deep); transition: all var(--dur-1) var(--ease-brand);
}
.ctl[aria-pressed="true"] { color: var(--gold-primary); }
.ctl[aria-pressed="true"] .ctl-dot {
  background: var(--gold-primary); border-color: var(--gold-primary);
  box-shadow: 0 0 9px rgba(230, 188, 92, 0.8);
}

/* ---------- buttons ---------- */

.btn-gold {
  display: inline-flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 14px 26px; border-radius: 10px;
  background: linear-gradient(180deg, #E6BC5C, #D4A539);
  color: #131A45; font-weight: 500; font-size: 14.5px; letter-spacing: 0.04em;
  box-shadow: 0 6px 26px rgba(230, 188, 92, 0.22), inset 0 1px 0 rgba(255, 235, 170, 0.6);
  transition: transform var(--dur-1) var(--ease-brand), box-shadow var(--dur-1) var(--ease-brand),
    background var(--dur-1) linear;
}
.btn-gold:hover {
  background: linear-gradient(180deg, #F6D55C, #E6BC5C);
  transform: translateY(-1px);
  box-shadow: 0 10px 34px rgba(246, 213, 92, 0.3), inset 0 1px 0 rgba(255, 240, 190, 0.7);
}
.btn-gold span { font-weight: 400; font-size: 10.5px; letter-spacing: 0.14em; opacity: 0.78; text-transform: uppercase; }
.btn-small { padding: 9px 16px; font-size: 12px; border-radius: 8px; flex-direction: row; }

.btn-ghost {
  display: inline-flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 13px 22px; border-radius: 10px;
  border: 1px solid rgba(230, 188, 92, 0.3); color: var(--text-secondary);
  font-size: 14px; letter-spacing: 0.03em;
  transition: border-color var(--dur-1), color var(--dur-1), background var(--dur-1);
}
.btn-ghost:hover { border-color: var(--gold-hover); color: var(--gold-hover); background: rgba(230, 188, 92, 0.05); }
.btn-ghost span { font-size: 10.5px; letter-spacing: 0.14em; color: var(--text-tertiary); text-transform: uppercase; }

.btn-close { position: absolute; top: 22px; right: 22px; padding: 9px 16px; font-size: 12px; z-index: 5; }

/* ---------- the set ---------- */

#set {
  position: relative; z-index: 10;
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  transition: opacity var(--dur-3) var(--ease-brand), filter var(--dur-3) var(--ease-brand);
}
body[data-mode="signon"] #set,
body[data-mode="warmup"] #set { opacity: 0.22; filter: saturate(0.7); pointer-events: none; }

/* ---------- stage ---------- */

#stage {
  flex: 1; min-height: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  gap: clamp(28px, 4.5vw, 76px);
  padding: clamp(14px, 2.6vh, 30px) clamp(20px, 4vw, 56px);
}

#tube-wrap { position: relative; flex: 0 0 auto; }
#tube {
  position: relative; margin: 0;
  width: clamp(228px, min(28vw, 46vh * 0.827), 380px);
  aspect-ratio: 744 / 990; /* portrait plus plate */
  display: flex; flex-direction: column;
  border-radius: 16px;
  border: 1px solid rgba(230, 188, 92, 0.2);
  background: linear-gradient(170deg, #10173F, #0A0E2B);
  box-shadow:
    inset 0 0 0 1px rgba(8, 11, 32, 0.8),
    inset 0 0 44px rgba(4, 6, 18, 0.65),
    0 18px 60px rgba(4, 6, 18, 0.55),
    0 0 calc(26px + var(--amp) * 44px) rgba(230, 188, 92, calc(0.07 + var(--amp) * 0.16));
  transition: box-shadow 0.25s linear;
}
#scan-canvas {
  flex: 1; width: 100%; min-height: 0; display: block;
  border-radius: 15px 15px 0 0;
}
.tube-glass {
  position: absolute; inset: 0; border-radius: 16px; pointer-events: none;
  background:
    linear-gradient(115deg, rgba(210, 235, 255, 0.065) 0%, transparent 26%),
    radial-gradient(130% 90% at 50% 108%, rgba(8, 11, 32, 0.5), transparent 55%);
}
.tube-glass::after {
  content: ""; position: absolute; inset: 0; border-radius: 16px;
  background: repeating-linear-gradient(180deg, rgba(8, 11, 32, 0.14) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply; opacity: 0.8;
}
#tube-plate {
  position: relative; z-index: 2;
  padding: 12px 10px; text-align: center;
  border-top: 1px solid rgba(230, 188, 92, 0.16);
  font-size: 8.8px; font-weight: 450; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-tertiary); text-wrap: balance; line-height: 1.75;
  text-shadow: 0 1px 0 rgba(4, 6, 18, 0.9);
}
#tube-status {
  position: absolute; top: 12px; right: 14px; z-index: 3; margin: 0;
  display: flex; align-items: center; gap: 7px;
  font-size: 9px; font-weight: 500; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--text-secondary);
  text-shadow: 0 1px 6px rgba(8, 11, 32, 0.95);
}
#tube-status::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold-deep); opacity: 0.5;
  transition: opacity 0.3s, box-shadow 0.3s;
}
#tube-status.live::before {
  background: var(--gold-primary); opacity: 1;
  box-shadow: 0 0 10px rgba(246, 213, 92, 0.9);
  animation: led 1.6s var(--ease-tune) infinite;
}
@keyframes led { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ---------- stage panels ---------- */

#panel-slot { display: grid; align-items: center; width: min(560px, 100%); }
.stage-panel { grid-area: 1 / 1; width: 100%; max-width: min(65ch, 100%); }

.sr-live {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* letter-settle treatment for the figure name */
#fig-name .w { display: inline-block; margin-right: 0.26em; }
#fig-name .w:last-child { margin-right: 0; }
#fig-name .c { display: inline-block; will-change: transform; }

.fig-eyebrow {
  margin: 0 0 8px; font-size: 10px; font-weight: 500;
  letter-spacing: 0.32em; text-transform: uppercase; color: var(--gold-ui);
}
#figure-panel h2, .cw-title {
  margin: 0 0 4px; font-size: min(var(--step-4), 2.85rem); font-weight: 300;
  letter-spacing: 0.01em; line-height: 1.05; color: var(--text-primary);
}
.fig-epithet {
  margin: 0 0 3px; font-family: var(--font-content); font-style: italic;
  font-size: var(--step-1); color: var(--gold-primary);
}
.fig-era {
  margin: 0 0 14px; font-size: 11px; font-weight: 400;
  letter-spacing: 0.24em; text-transform: uppercase; color: var(--text-tertiary);
}
.fig-seed { position: relative; margin: 0 0 8px; padding-left: 26px; }
.fig-seed::before {
  content: "\201C"; position: absolute; left: -2px; top: -8px;
  font-family: var(--font-content); font-size: 2.6em; line-height: 1; color: var(--gold-deep);
}
.fig-seed p {
  margin: 0; font-family: var(--font-content); font-style: italic;
  font-size: var(--step-2); line-height: 1.38; color: var(--text-secondary);
  max-width: min(30ch, 100%);
}
.fig-seednote {
  margin: 0 0 14px; padding-left: 26px;
  font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-tertiary);
}

.audio-row { display: flex; align-items: center; gap: 18px; margin-bottom: 12px; }
.btn-receive {
  position: relative; flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 12px;
  padding: 13px 22px 13px 16px; border-radius: 999px;
  border: 1px solid rgba(230, 188, 92, 0.45);
  color: var(--gold-primary); font-size: 13px; font-weight: 450; letter-spacing: 0.08em;
  transition: all var(--dur-1) var(--ease-brand);
}
.btn-receive:hover { border-color: var(--gold-hover); color: var(--gold-hover); background: rgba(230, 188, 92, 0.06); }
.btn-receive .rec-ring {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1.5px solid currentColor; position: relative;
}
.btn-receive .rec-ring::after {
  content: ""; position: absolute; inset: 2.5px; border-radius: 50%;
  background: currentColor; transform: scale(0); transition: transform var(--dur-1) var(--ease-brand);
}
.btn-receive[data-state="playing"] { background: rgba(230, 188, 92, 0.1); border-color: var(--gold-primary); }
.btn-receive[data-state="playing"] .rec-ring::after { transform: scale(1); animation: led 1.4s var(--ease-tune) infinite; }
.audio-meta { flex: 1; min-width: 0; }
.audio-meta p { margin: 0 0 7px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-tertiary); }
.progress {
  position: relative; height: 2px; border-radius: 1px;
  background: rgba(180, 200, 255, 0.14); overflow: hidden;
}
.progress span {
  position: absolute; inset: 0; transform-origin: left center; transform: scaleX(0);
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-primary));
  display: block;
}
.audio-time { margin: 6px 0 0 !important; font-variant-numeric: tabular-nums; letter-spacing: 0.2em !important; }

.quiet-row { margin-bottom: 10px; }
.quiet-line {
  margin: 0 0 10px; font-size: 12.5px; color: var(--text-tertiary);
  font-style: normal; max-width: min(52ch, 100%);
}
.quiet-row .btn-ghost { padding: 8px 14px; font-size: 12.5px; }

.fig-media {
  margin: 12px 0 0; display: flex; align-items: center; gap: 14px;
}
.fig-media img {
  width: 116px; height: 64px; object-fit: cover; border-radius: 6px;
  border: 1px solid rgba(230, 188, 92, 0.2);
  box-shadow: 0 8px 26px rgba(4, 6, 18, 0.5);
}
.fig-media figcaption { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-tertiary); max-width: min(38ch, 100%); line-height: 1.55; }

/* shorter rooms: fold the postcard away, keep the voice */
@media (min-width: 921px) and (max-height: 802px) {
  .fig-media { display: none; }
  .fig-seed p { font-size: var(--step-1); }
  #tube { width: clamp(210px, min(26vw, 42vh * 0.827), 330px); }
}

/* empty state */
#empty-panel .empty-kicker {
  margin: 0 0 12px; font-size: 10.5px; font-weight: 500; letter-spacing: 0.32em;
  text-transform: uppercase; color: var(--text-tertiary);
}
#empty-panel .empty-line {
  margin: 0 0 18px; font-family: var(--font-content); font-style: italic;
  font-size: var(--step-2); line-height: 1.45; color: var(--text-secondary); max-width: min(26ch, 100%);
}
#empty-panel .empty-hint { margin: 0; font-size: 12.5px; color: var(--text-tertiary); max-width: min(44ch, 100%); line-height: 1.7; }

/* critical window panel */
.cw-body {
  margin: 18px 0 12px; font-family: var(--font-content);
  font-size: var(--step-1); line-height: 1.55; color: var(--text-secondary); max-width: min(44ch, 100%);
}
.cw-detail { margin: 0 0 28px; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold-ui); }
.cw-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ---------- band zone ---------- */

#bandzone {
  position: relative; z-index: 15;
  display: flex; align-items: stretch;
  height: 148px; flex: 0 0 auto;
  border-top: var(--hairline);
  background: linear-gradient(180deg, rgba(13, 19, 56, 0.72), rgba(8, 11, 32, 0.92));
  box-shadow: inset 0 14px 34px rgba(4, 6, 18, 0.45);
}

#meter {
  flex: 0 0 148px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; border-right: var(--hairline-dim);
}
#meter svg { width: 104px; height: 56px; overflow: visible; }
#meter-needle { transform-origin: 60px 56px; transition: transform 0.12s linear; }
#meter p { margin: 0; font-size: 9px; font-weight: 500; letter-spacing: 0.4em; text-transform: uppercase; color: var(--text-tertiary); }

#band {
  position: relative; flex: 1; overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none;
  outline-offset: -4px;
}
#band-tape {
  position: absolute; top: 0; bottom: 0; left: 0; width: 3600px;
  will-change: transform;
  background:
    repeating-linear-gradient(90deg, rgba(180, 200, 255, 0.06) 0 1px, transparent 1px 36px);
}

/* ruler */
.ruler-mark {
  position: absolute; top: 12px; transform: translateX(-50%);
  font-size: 9.5px; font-weight: 450; letter-spacing: 0.26em; text-transform: uppercase;
  color: rgba(158, 158, 158, 0.75); white-space: nowrap;
}
.ruler-mark::after {
  content: ""; position: absolute; left: 50%; top: 17px; width: 1px; height: 8px;
  background: rgba(180, 200, 255, 0.22);
}

/* station ticks */
.tick {
  position: absolute; bottom: 0; width: 44px; height: 74px; margin-left: -22px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 0; border-radius: 0;
}
.tick::after {
  content: ""; width: 2px; height: 30px; border-radius: 1px;
  background: var(--gold-deep); opacity: 0.75;
  box-shadow: 0 0 0 rgba(230, 188, 92, 0);
  transition: height var(--dur-1) var(--ease-brand), box-shadow var(--dur-1), background var(--dur-1), opacity var(--dur-1);
}
.tick-label {
  margin-bottom: 8px; font-size: 9px; font-weight: 500; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--gold-primary); white-space: nowrap;
  opacity: 0; transform: translateY(5px);
  transition: opacity var(--dur-1) var(--ease-brand), transform var(--dur-1) var(--ease-brand);
}
.tick.near::after { height: 44px; background: var(--gold-primary); opacity: 1; box-shadow: 0 0 14px rgba(230, 188, 92, 0.7); }
.tick.nearest .tick-label { opacity: 1; transform: translateY(0); }
.tick:hover::after { opacity: 1; background: var(--gold-hover); }
.tick:hover .tick-label { opacity: 1; transform: translateY(0); }

/* special band marks */
.now-mark {
  position: absolute; bottom: 0; height: 96px; width: 1px;
  background: linear-gradient(180deg, transparent, rgba(210, 235, 255, 0.4));
}
.now-mark span {
  position: absolute; bottom: 100px; left: 50%; transform: translateX(-50%);
  font-size: 9px; font-weight: 500; letter-spacing: 0.4em; text-transform: uppercase;
  color: var(--star-blue-2); opacity: 0.85; white-space: nowrap;
}
.unwritten-zone {
  position: absolute; bottom: 0; height: 100%;
  border-left: 1px dashed rgba(230, 188, 92, 0.3);
  border-right: 1px dashed rgba(230, 188, 92, 0.3);
  background: repeating-linear-gradient(-58deg, rgba(230, 188, 92, 0.045) 0 8px, transparent 8px 18px);
}
.unwritten-zone span {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  font-size: 9.5px; font-weight: 500; letter-spacing: 0.42em; text-transform: uppercase;
  color: var(--gold-ui); white-space: nowrap;
}

/* needle */
#needle {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 0; pointer-events: none;
}
#needle::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: -0.75px; width: 1.5px;
  background: linear-gradient(180deg, var(--gold-hover), var(--gold-primary) 55%, rgba(230, 188, 92, 0.15));
  box-shadow: 0 0 12px rgba(246, 213, 92, calc(0.35 + var(--sig) * 0.55));
}
#needle::after {
  content: ""; position: absolute; top: 3px; left: -4.5px;
  width: 9px; height: 9px; transform: rotate(45deg);
  background: var(--gold-primary);
  box-shadow: 0 0 14px rgba(246, 213, 92, 0.8);
}

.band-question {
  position: absolute; top: 34px; left: 50%; transform: translateX(-50%);
  margin: 0; font-family: var(--font-content); font-style: italic;
  font-size: clamp(15px, 1.5vw, 19px); color: var(--gold-primary);
  text-shadow: 0 2px 18px rgba(8, 11, 32, 0.9);
  opacity: 0; pointer-events: none; white-space: nowrap;
}

#readout {
  flex: 0 0 172px; display: flex; flex-direction: column; justify-content: center; gap: 5px;
  padding: 0 22px; border-left: var(--hairline-dim);
}
#readout-year {
  margin: 0; font-size: 10px; font-weight: 500; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--gold-ui); font-variant-numeric: tabular-nums;
}
#readout-name { margin: 0; font-size: 13.5px; font-weight: 400; letter-spacing: 0.06em; color: var(--text-secondary); }

/* ---------- presets ---------- */

#presets {
  position: relative; z-index: 15; flex: 0 0 auto;
  display: flex; gap: 10px; align-items: stretch;
  padding: 12px clamp(16px, 3vw, 32px) 14px;
  border-top: var(--hairline-dim);
  background: linear-gradient(180deg, rgba(8, 11, 32, 0.9), rgba(8, 11, 32, 0.98));
}
#preset-questions {
  flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
}
.preset {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px; text-align: left;
  border: 1px solid rgba(180, 200, 255, 0.1);
  color: var(--text-tertiary); font-size: 11.5px; font-weight: 400; letter-spacing: 0.04em;
  line-height: 1.3;
  transition: border-color var(--dur-1) var(--ease-brand), color var(--dur-1), background var(--dur-1), box-shadow var(--dur-1);
}
.preset .preset-num {
  font-size: 9px; font-weight: 500; letter-spacing: 0.2em; color: var(--gold-deep);
  font-variant-numeric: tabular-nums;
}
.preset:hover { border-color: rgba(230, 188, 92, 0.4); color: var(--text-primary); }
.preset.active {
  border-color: var(--gold-ui); color: var(--gold-primary);
  background: rgba(230, 188, 92, 0.06);
  box-shadow: 0 0 22px rgba(230, 188, 92, 0.12), inset 0 0 12px rgba(230, 188, 92, 0.05);
}
.preset-special { display: flex; flex-direction: column; gap: 8px; }
.preset.special {
  flex: 1; justify-content: center; text-align: center;
  border-color: rgba(230, 188, 92, 0.3); color: var(--gold-ui);
  font-size: 10.5px; font-weight: 500; letter-spacing: 0.24em; text-transform: uppercase;
  padding: 8px 18px;
}
.preset.special:hover { border-color: var(--gold-hover); color: var(--gold-hover); }

/* ---------- overlays shared ---------- */

.overlay-base { position: fixed; inset: 0; z-index: 150; }

#signon {
  position: fixed; inset: 0; z-index: 160;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 20px;
  background:
    radial-gradient(90% 70% at 50% 36%, rgba(21, 28, 71, 0.985), rgba(12, 17, 51, 0.99) 60%, rgba(8, 11, 32, 1) 100%);
  overflow-y: auto;
}
.signon-inner { max-width: 640px; text-align: center; }
.signon-eyebrow {
  margin: 0 0 18px; font-size: 11px; font-weight: 500; letter-spacing: 0.44em;
  text-transform: uppercase; color: var(--gold-ui);
}
.signon-title {
  margin: 0 0 30px; font-size: var(--step-5); font-weight: 300; letter-spacing: 0.04em;
  line-height: 1; color: var(--text-primary);
  text-shadow: 0 0 60px rgba(230, 188, 92, 0.18);
}
.signon-poem { margin: 0 0 30px; }
.signon-poem p {
  margin: 0 0 6px; font-family: var(--font-content); font-style: italic;
  font-size: var(--step-1); line-height: 1.6; color: var(--text-secondary);
}
.signon-poem p:last-child { color: var(--gold-primary); }
.signon-body {
  margin: 0 auto 22px; max-width: min(52ch, 100%); font-size: var(--step-0); font-weight: 350;
  line-height: 1.75; color: var(--text-secondary); text-wrap: balance;
}
.signon-honesty {
  margin: 0 auto 36px; max-width: min(62ch, 100%); font-size: 11.5px; letter-spacing: 0.08em;
  line-height: 2; color: var(--text-tertiary); text-transform: uppercase; text-wrap: balance;
}
.signon-honesty strong { color: var(--gold-ui); font-weight: 500; letter-spacing: 0.14em; }
.signon-actions { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-bottom: 34px; }
.signon-foot { margin: 0; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-tertiary); }

/* council */
#council {
  position: fixed; inset: 0; z-index: 150; overflow-y: auto;
  background: linear-gradient(180deg, rgba(8, 11, 32, 0.992), rgba(13, 19, 56, 0.992));
}
.council-scenes { position: fixed; inset: 0; pointer-events: none; }
.council-scenes .scene {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; filter: saturate(0.75) brightness(0.5);
}
.council-scenes::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8, 11, 32, 0.82), rgba(8, 11, 32, 0.55) 40%, rgba(8, 11, 32, 0.94) 88%);
}
.council-inner {
  position: relative; z-index: 2; max-width: 760px; margin: 0 auto;
  padding: 86px 24px 70px;
}
.council-head { text-align: center; margin-bottom: 44px; }
.council-emblem { display: flex; justify-content: center; margin-bottom: 22px; }
.council-emblem img {
  filter: drop-shadow(0 0 calc(10px + var(--amp) * 30px) rgba(230, 188, 92, calc(0.35 + var(--amp) * 0.5)));
  transform: scale(calc(1 + var(--amp) * 0.05));
  transition: transform 0.18s linear;
}
#council-title { margin: 0 0 14px; font-size: var(--step-4); font-weight: 300; line-height: 1.05; }
.council-sub {
  margin: 0 auto 16px; max-width: min(46ch, 100%); font-family: var(--font-content);
  font-size: var(--step-0); line-height: 1.7; color: var(--text-secondary);
}
.council-plate { margin: 0; font-size: 10px; font-weight: 500; letter-spacing: 0.26em; text-transform: uppercase; color: var(--text-tertiary); }

.council-programs { display: flex; flex-direction: column; gap: 26px; }
.program {
  border: var(--hairline); border-radius: 14px; padding: 26px 28px;
  background: var(--panel-grad);
  box-shadow: 0 16px 44px rgba(4, 6, 18, 0.4);
}
.program h3 { margin: 0 0 6px; font-size: var(--step-2); font-weight: 350; line-height: 1.15; }
.program-meta { margin: 0 0 18px; font-size: 10.5px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--gold-ui); }
.parts { list-style: none; margin: 0; padding: 0; }
.parts li { border-top: var(--hairline-dim); }
.part-btn {
  position: relative; width: 100%; display: flex; align-items: center; gap: 14px;
  padding: 13px 6px; text-align: left; border-radius: 6px;
  color: var(--text-secondary); font-size: 14px;
  transition: color var(--dur-1), background var(--dur-1);
}
.part-btn:hover { color: var(--gold-hover); background: rgba(230, 188, 92, 0.04); }
.part-btn .part-state {
  flex: 0 0 auto; width: 11px; height: 11px; border-radius: 50%;
  border: 1.5px solid rgba(230, 188, 92, 0.5); position: relative;
}
.part-btn .part-state::after {
  content: ""; position: absolute; inset: 2px; border-radius: 50%;
  background: var(--gold-primary); transform: scale(0); transition: transform var(--dur-1) var(--ease-brand);
}
.part-btn.playing { color: var(--gold-primary); }
.part-btn.playing .part-state::after { transform: scale(1); animation: led 1.4s var(--ease-tune) infinite; }
.part-btn .part-time { margin-left: auto; font-size: 11px; letter-spacing: 0.14em; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.part-progress {
  position: absolute; left: 6px; right: 6px; bottom: 6px; height: 1.5px;
  background: rgba(180, 200, 255, 0.1); border-radius: 1px; overflow: hidden; opacity: 0;
}
.part-btn.playing .part-progress, .part-btn.paused .part-progress { opacity: 1; }
.part-progress span {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-primary));
  transform-origin: left center; transform: scaleX(0);
}
.council-engraving {
  margin: 40px 0 0; text-align: center;
  font-size: 11px; font-weight: 500; letter-spacing: 0.42em; text-transform: uppercase; color: var(--text-tertiary);
}

/* station card */
#stationcard {
  position: fixed; inset: 0; z-index: 155; overflow-y: auto;
  display: flex; align-items: center; justify-content: center; padding: 30px 20px;
  background: rgba(8, 11, 32, 0.9);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.card-inner {
  position: relative; max-width: 560px; width: 100%;
  border: var(--hairline); border-radius: 18px;
  background: linear-gradient(172deg, #151C47, #0C1133 70%);
  box-shadow: 0 30px 90px rgba(4, 6, 18, 0.7), 0 0 60px rgba(230, 188, 92, 0.06);
  padding: 56px 46px 40px; text-align: center;
}
.card-mark { margin: 0 auto 20px; }
#card-title { margin: 0 0 18px; font-size: var(--step-3); font-weight: 300; line-height: 1.12; }
.card-body { margin: 0 auto 20px; max-width: min(52ch, 100%); font-size: 14.5px; line-height: 1.8; color: var(--text-secondary); }
.card-stat { margin: 0 0 26px; font-size: 11px; font-weight: 500; letter-spacing: 0.4em; text-transform: uppercase; color: var(--gold-ui); }
.card-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 28px; }
.card-links { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.card-links a { font-size: 12px; letter-spacing: 0.1em; color: var(--text-secondary); border-bottom: 1px solid rgba(230, 188, 92, 0.25); padding-bottom: 2px; transition: color var(--dur-1), border-color var(--dur-1); }
.card-links a:hover { color: var(--gold-hover); border-color: var(--gold-hover); }
.card-trust { margin: 0 0 6px; font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-tertiary); }
.card-company { margin: 0; font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-tertiary); }

/* overlay motion states (JS adds .open) */
#council, #stationcard, #signon { opacity: 0; visibility: hidden; transition: opacity var(--dur-2) var(--ease-brand), visibility var(--dur-2); }
#council.open, #stationcard.open, #signon.open { opacity: 1; visibility: visible; }

/* ---------- footer ---------- */

#foot {
  position: relative; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: 46px; padding: 8px clamp(16px, 3vw, 32px);
  border-top: var(--hairline-dim);
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-tertiary);
}
#foot p { margin: 0; }
.foot-links { display: flex; align-items: center; gap: 18px; }
.foot-links a { color: var(--text-tertiary); transition: color var(--dur-1); text-transform: none; letter-spacing: 0.1em; }
.foot-links a:hover { color: var(--gold-hover); }
.foot-card {
  font-size: 10px; font-weight: 500; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--gold-ui); padding: 6px 12px; border: 1px solid rgba(230, 188, 92, 0.3); border-radius: 999px;
  transition: color var(--dur-1), border-color var(--dur-1);
}
.foot-card:hover { color: var(--gold-hover); border-color: var(--gold-hover); }

/* ---------- responsive ---------- */

@media (max-width: 1180px) {
  .topbar-tagline { display: none; }
}

@media (max-width: 920px) {
  body { overflow-x: hidden; }
  #stage {
    flex-direction: column; align-items: center; gap: 26px;
    padding: 26px 22px 34px; text-align: left;
  }
  #tube { width: clamp(230px, 62vw, 330px); }
  #panel-slot { width: 100%; max-width: 560px; }
  #bandzone { height: 132px; }
  #meter { display: none; }
  #readout { flex: 0 0 128px; padding: 0 14px; }
  #presets { flex-direction: column; }
  #preset-questions {
    display: flex; overflow-x: auto; padding-bottom: 6px;
    scrollbar-width: none;
  }
  #preset-questions::-webkit-scrollbar { display: none; }
  #preset-questions .preset { flex: 0 0 auto; max-width: 240px; }
  .preset-special { flex-direction: row; }
  #foot { flex-direction: column; align-items: flex-start; gap: 10px; padding-top: 16px; padding-bottom: 18px; }
  .council-inner { padding: 76px 20px 60px; }
  .card-inner { padding: 46px 26px 34px; }
  .signon-actions { flex-direction: column; align-items: center; }
  .band-question { white-space: normal; text-align: center; width: min(86vw, 420px); }
}

@media (max-width: 560px) {
  .wordmark-sub { display: none; }
  #topbar {
    height: auto; min-height: 56px; flex-wrap: wrap;
    padding: 9px 14px; row-gap: 4px; column-gap: 10px;
  }
  .wordmark { font-size: 10px; letter-spacing: 0.22em; gap: 8px; white-space: nowrap; }
  .wordmark img { width: 20px; height: 20px; }
  .topbar-controls { gap: 2px; margin-left: auto; }
  .ctl { padding: 7px 5px; font-size: 9px; letter-spacing: 0.18em; white-space: nowrap; gap: 5px; }
  .btn-small { padding: 8px 11px; font-size: 11px; white-space: nowrap; }
  #readout { display: none; }
  #bandzone { height: 118px; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  #grain { animation: none; }
  #tube-status.live::before, .btn-receive[data-state="playing"] .rec-ring::after,
  .part-btn.playing .part-state::after { animation: none; }
  *, *::before, *::after { transition-duration: 0.15s !important; }
  #set, #signon, #council, #stationcard { transition-duration: 0.25s !important; }
}
