/* =========================================================
   "The Lamplighter" — number-station page
   Sits on top of embers.css (backdrop, spotlight, embers, staged
   reveal) and the brand tokens in brand.css. Only what is new lives
   here: the receiver, the ledger, the tower, the badges, the notices.

   Brightness is the first lock: .lit digits are message, .ash digits
   are nulls, .ind is the indicator group. Don't "fix" the ash contrast
   for accessibility without deciding that on purpose.
   ========================================================= */

.signal-page .city-backdrop {
  background-image: url("../img/the-last-ember/city2-darkness-comes.jpg");
}

/* No opening sequence on this page: the city and the content are simply
   there. (embers.css fades both in over ~8s for the book page.) The
   spotlight still breathes, from the start rather than after the reveal. */
.signal-page .city-backdrop {
  animation: none;
  opacity: 1;
  -webkit-mask-size: 170% 170%;
  mask-size: 170% 170%;
}

.signal-page .reveal {
  animation: none;
  opacity: 1;
  transform: none;
}

.signal-page .spotlight-glow,
.signal-page .spotlight-overlay {
  animation-delay: 0s;
}

.signal-content {
  width: 100%;
  max-width: 620px;
}

.signal-title {
  font-size: clamp(2.2rem, 7vw, 3.8rem);
}

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

/* ---------- Shared panel (same bracketed "registry notice" as signup) ---------- */

.panel {
  position: relative;
  margin: 0 auto 26px;
  padding: 26px 26px 22px;
  background: rgba(9, 12, 10, 0.86);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  border: 1px solid var(--facade-steel);
  text-align: left;
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 1px solid var(--facade-gold);
  pointer-events: none;
}

.panel::before { top: 7px; left: 7px; border-right: none; border-bottom: none; }
.panel::after { bottom: 7px; right: 7px; border-left: none; border-top: none; }

.panel-label {
  display: block;
  font-family: var(--f-clinical);
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--facade-steel);
  margin-bottom: 14px;
}

.btn-quiet {
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid rgba(139, 146, 144, 0.5);
}

.btn-quiet:hover {
  color: var(--facade-bone);
  border-color: var(--facade-steel);
}

.linklike {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--ink-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.linklike:hover {
  color: var(--facade-gold-bright);
}

/* ---------- Badge strip ---------- */

.badge-strip {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 26px;
  padding: 8px 14px;
  /* the city photo is bright behind this — give the medals a ground */
  background: rgba(9, 12, 10, 0.78);
  border: 1px solid rgba(139, 146, 144, 0.25);
  border-radius: 8px;
}

.badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 78px;
  padding: 8px 2px 6px;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink-dim);
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.badge:hover {
  color: var(--ink);
}

.badge:focus-visible {
  outline: none;
  border-color: var(--facade-gold);
  box-shadow: 0 0 0 3px rgba(201, 154, 68, 0.18);
}

.badge.is-tuned {
  border-color: rgba(201, 154, 68, 0.45);
  background: rgba(9, 12, 10, 0.6);
  color: var(--ink);
}

.badge svg {
  width: 46px;
  height: 46px;
  overflow: visible;
}

.badge .b-ring { fill: rgba(9, 12, 10, 0.7); stroke: var(--ink-dim); stroke-width: 1.2; }
.badge .b-gem { fill: none; stroke: var(--ink-dim); stroke-width: 1.2; }
.badge .b-dot { fill: var(--ink-dim); }

.badge.is-kindled .b-ring { stroke: var(--facade-ember); }
.badge.is-kindled .b-gem { stroke: var(--facade-ember); fill: rgba(181, 85, 31, 0.18); }
.badge.is-kindled .b-dot { fill: var(--facade-ember); }

.badge.is-lit .b-ring { stroke: var(--facade-gold-bright); fill: rgba(201, 154, 68, 0.14); }
.badge.is-lit .b-gem { stroke: var(--facade-gold-bright); fill: var(--facade-gold); }
.badge.is-lit .b-dot { fill: var(--world-bg); }
.badge.is-lit svg { filter: drop-shadow(0 0 8px rgba(201, 154, 68, 0.55)); }
.badge.is-lit { color: var(--facade-gold-bright); }

.badge-state {
  min-height: 1em;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- Receiver ---------- */

.rx-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--world-line);
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.rx-onair {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--facade-gold-bright);
}

.rx-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--facade-gold-bright);
  box-shadow: 0 0 8px 2px rgba(226, 186, 108, 0.7);
  animation: dot-blink 2.4s ease-in-out infinite;
}

@keyframes dot-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.rx-pass b {
  font-weight: 500;
  color: var(--facade-bone);
}

.rx-preamble {
  margin: 0 0 18px;
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-align: center;
}

.rx-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  margin-bottom: 20px;
}

/* The lamp. Between passes it speaks the keyword in Morse. */
.rx-lamp {
  position: relative;
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #2e2210 0%, #16120a 60%, #0b0d09 100%);
  border: 1px solid rgba(139, 146, 144, 0.4);
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.85);
}

.rx-lamp span {
  position: absolute;
  inset: 15px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--facade-gold-bright) 0%, var(--facade-ember) 75%);
  opacity: 0.16;
  transition: opacity 0.05s linear, box-shadow 0.05s linear;
}

.rx-lamp.idle span {
  animation: lamp-breathe 4.5s ease-in-out infinite;
}

@keyframes lamp-breathe {
  0%, 100% { opacity: 0.16; }
  50% { opacity: 0.4; }
}

.rx-lamp.on span {
  animation: none;
  opacity: 1;
  box-shadow: 0 0 24px 9px rgba(226, 186, 108, 0.65), 0 0 70px 20px rgba(201, 154, 68, 0.32);
}

.rx-readout {
  min-width: 7.2ch;
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: clamp(1.7rem, 7vw, 2.7rem);
  letter-spacing: 0.22em;
  text-align: center;
  white-space: nowrap;
}

.rx-readout.lit { color: var(--facade-bone); text-shadow: 0 0 18px rgba(201, 154, 68, 0.55); }
.rx-readout.ind { color: var(--facade-gold-bright); text-shadow: 0 0 20px rgba(226, 186, 108, 0.7); }
.rx-readout.ash { color: var(--truth-verdigris); opacity: 0.42; }
.rx-readout.rest { color: var(--ink-faint); text-shadow: none; }

/* The ledger: every group sent so far. */
.rx-ledger {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 4px 6px;
  padding-top: 16px;
  border-top: 1px solid var(--world-line);
}

.grp {
  padding: 4px 0;
  border-radius: 2px;
  font-family: var(--f-mono);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-align: center;
  transition: background 0.3s, box-shadow 0.3s;
}

.grp.pending { visibility: hidden; }
.grp.lit { color: var(--facade-bone); text-shadow: 0 0 10px rgba(201, 154, 68, 0.45); }
.grp.ind { color: var(--facade-gold-bright); text-shadow: 0 0 12px rgba(226, 186, 108, 0.6); box-shadow: inset 0 0 0 1px rgba(201, 154, 68, 0.45); }
.grp.ash { color: var(--truth-verdigris); opacity: 0.42; }
.grp.now { background: rgba(201, 154, 68, 0.16); box-shadow: 0 0 0 1px var(--facade-gold); }

.rx-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--world-line);
  font-family: var(--f-mono);
  font-size: 0.7rem;
  color: var(--ink-faint);
}

.rx-sound {
  padding: 5px 12px;
  background: none;
  border: 1px solid rgba(139, 146, 144, 0.4);
  border-radius: 2px;
  color: var(--ink-dim);
  font: inherit;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.rx-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.rx-sound:hover,
.rx-sound[aria-pressed="true"] {
  color: var(--facade-gold-bright);
  border-color: var(--facade-gold);
}

/* ---------- The Table (tower of windows) ---------- */

.table-panel {
  text-align: center;
}

.table-panel .panel-label {
  text-align: left;
}

.tower {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  margin: 0 auto 8px;
}

.tower .t-body { fill: rgba(18, 22, 15, 0.9); stroke: var(--facade-steel); stroke-width: 1; }
.tower .t-roof { fill: rgba(18, 22, 15, 0.9); stroke: var(--facade-gold); stroke-width: 1.1; }
.tower .t-win.lit { fill: var(--facade-gold); filter: drop-shadow(0 0 4px rgba(201, 154, 68, 0.7)); }
.tower .t-win.dark { fill: var(--world-bg); stroke: var(--ink-faint); stroke-width: 0.8; }
.tower .t-col { fill: var(--ink-faint); font-family: var(--f-mono); font-size: 9px; text-anchor: middle; }

.tower .t-win.lit {
  animation: win-flicker var(--fd, 7s) ease-in-out var(--fdelay, 0s) infinite;
}

@keyframes win-flicker {
  0%, 100% { opacity: 0.95; }
  50% { opacity: 0.6; }
}

.table-note {
  margin: 0;
  font-family: var(--f-literary);
  font-style: italic;
  font-size: 1.02rem;
  color: var(--ink-dim);
}

/* ---------- Operator's note, hints, claim link ---------- */

.operator-note {
  max-width: 500px;
  margin: 0 auto 30px;
  padding: 0 4px;
}

.operator-note > p:first-child {
  margin: 0 0 14px;
  font-family: var(--f-literary);
  font-style: italic;
  font-size: 1.08rem;
  line-height: 1.55;
  color: var(--ink);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.92);
}

.hints {
  margin: 0 0 22px;
  font-family: var(--f-clinical);
  font-size: 0.86rem;
  color: var(--ink-dim);
}

.hints summary {
  display: inline-block;
  cursor: pointer;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--ink);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.95), 0 0 2px rgba(0, 0, 0, 0.9);
}

.hints summary:hover { color: var(--facade-gold-bright); }

.hints ol {
  margin: 12px 0 0;
  padding: 12px 18px 12px 34px;
  text-align: left;
  background: rgba(10, 13, 11, 0.62);
  border: 1px solid rgba(139, 146, 144, 0.25);
  border-radius: 8px;
}

.hints li + li { margin-top: 6px; }

.signal-claim {
  margin: 0;
}

.signal-claim a {
  display: inline-block;
  padding: 10px 4px;
  font-family: var(--f-clinical);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--facade-gold-bright);
  text-decoration: none;
  border-bottom: 1px solid rgba(201, 154, 68, 0.5);
}

.signal-claim a:hover { color: var(--facade-bone); border-bottom-color: var(--facade-gold-bright); }

/* ---------- Reply panel ---------- */

.report-panel[hidden] { display: none; }

#guess {
  display: block;
  width: 100%;
  margin-bottom: 14px;
  padding: 13px 16px;
  border-radius: 2px;
  border: 1px solid var(--world-line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: 0.88rem;
  line-height: 1.5;
  resize: vertical;
}

#guess::placeholder { color: var(--ink-faint); }

#guess:focus-visible {
  outline: none;
  border-color: var(--facade-gold);
  box-shadow: 0 0 0 3px rgba(201, 154, 68, 0.18);
}

.report-result {
  margin-top: 18px;
}

.report-result:empty { display: none; }

.verdict {
  margin: 0 0 6px;
  font-family: var(--f-display);
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

.verdict.is-far { color: var(--ink-dim); }
.verdict.is-close { color: var(--facade-gold-bright); }
.verdict.is-exact { color: var(--truth-bloom); text-shadow: 0 0 18px rgba(126, 145, 99, 0.45); }

.verdict-sub {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--ink-dim);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 12px 14px;
  background: rgba(10, 13, 11, 0.62);
  border: 1px solid rgba(139, 146, 144, 0.2);
  border-radius: 6px;
  font-family: var(--f-mono);
  font-size: 0.84rem;
}

.chip.hit { color: var(--facade-gold-bright); text-shadow: 0 0 8px rgba(201, 154, 68, 0.4); }
.chip.miss { color: #a8574a; text-decoration: line-through; text-decoration-thickness: 1px; opacity: 0.85; }

.result-actions {
  margin-top: 14px;
  font-size: 0.86rem;
  color: var(--ink-dim);
}

.result-actions a { color: var(--facade-gold-bright); }

/* ---------- Text dialog ---------- */

.text-dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  margin: auto;
  color: var(--ink);
}

.text-dialog::backdrop {
  background: rgba(5, 7, 5, 0.82);
}

.td-text {
  margin: 0 0 14px;
  font-family: var(--f-literary);
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--facade-bone);
  white-space: pre-wrap;
}

.td-meta {
  margin: 0 0 18px;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}

.td-actions {
  display: flex;
  justify-content: flex-end;
}

/* ---------- Storage notice ---------- */

.consent {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  width: min(720px, calc(100vw - 32px));
  padding: 14px 18px;
  background: rgba(9, 12, 10, 0.95);
  border: 1px solid var(--facade-steel);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  font-family: var(--f-clinical);
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--ink);
}

.consent[hidden] { display: none; }

.consent p { margin: 0; flex: 1; }
.consent strong { color: var(--facade-gold-bright); font-weight: 600; }

.consent-actions {
  display: flex;
  gap: 8px;
  flex: none;
}

.consent .btn { padding: 9px 18px; }

@media (max-width: 560px) {
  .panel { padding: 22px 16px 18px; }
  .rx-main { gap: 16px; }
  .consent { flex-direction: column; align-items: stretch; gap: 12px; }
  .consent-actions { justify-content: flex-end; }
}
