:root {
  --bg: #05060a;
  --panel: #0e1118;
  --line: #1e2330;
  --text: #e8eef7;
  --dim: #7c879b;
  --accent: #38bdf8;

  /* LED colours, driven by match state */
  --led: #23d160;          /* green — a record matches the expected value */
  --led-dim: #0b2f18;
  --led-glow: rgba(35, 209, 96, 0.55);
}

* {
  box-sizing: border-box;
}

/* Author display rules below (.setup/.display) would otherwise beat the UA
   [hidden] rule, so the panels never actually hide. Force it. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Config panel ───────────────────────────────────────────── */
.setup {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.logo {
  margin: 0 0 4px;
  font-size: 26px;
  letter-spacing: 3px;
}

.tagline {
  margin: 0 0 22px;
  color: var(--dim);
  font-size: 14px;
}

.field {
  display: block;
  margin-bottom: 18px;
}

.field > span,
.field > legend {
  display: block;
  font-size: 13px;
  color: var(--dim);
  margin-bottom: 8px;
  padding: 0;
}

.field em {
  font-style: normal;
  color: #55617a;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  background: #05070d;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: 16px;
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

fieldset.field {
  border: 0;
  padding: 0;
  margin-inline: 0;
}

.checks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #05070d;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: ui-monospace, monospace;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.checks input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.inline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.inline input {
  width: 110px;
}

.unit {
  color: var(--dim);
  font-size: 14px;
}

.go {
  width: 100%;
  margin-top: 6px;
  padding: 14px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #04121c;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
}

.go:hover {
  filter: brightness(1.08);
}

.hint {
  margin: 18px 0 0;
  color: #55617a;
  font-size: 12px;
  text-align: center;
}

/* ── Fullscreen LED display ─────────────────────────────────── */
.display {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #020304;
  overflow: hidden;
}

/* State drives the LED colour variables */
.display.match {
  --led: #23d160;
  --led-dim: #072813;
  --led-glow: rgba(35, 209, 96, 0.6);
}

.display.nomatch {
  --led: #ff2d2d;
  --led-dim: #2c0707;
  --led-glow: rgba(255, 45, 45, 0.6);
}

.display.pending {
  --led: #f5b301;
  --led-dim: #2a2202;
  --led-glow: rgba(245, 179, 1, 0.55);
}

/* Dot-matrix overlay: a grid of holes punched over everything,
   giving the panel that physical LED-board texture. */
.matrix {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background-image: radial-gradient(
    circle,
    transparent 40%,
    rgba(2, 3, 4, 0.92) 46%
  );
  background-size: 10px 10px;
  mix-blend-mode: multiply;
  opacity: 0.85;
}

/* Ambient wash so the whole board glows in the state colour */
.display::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(circle at 50% 45%, var(--led-glow), transparent 70%);
  opacity: 0.14;
  transition: background 0.4s ease;
}

.ticker {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  align-items: center;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.ticker-track {
  display: inline-flex;
  white-space: nowrap;
  will-change: transform;
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  font-weight: 700;
  font-size: clamp(64px, 20vh, 240px);
  line-height: 1;
  letter-spacing: 0.06em;
  color: var(--led);
  text-shadow:
    0 0 8px var(--led-glow),
    0 0 26px var(--led-glow);
  animation: scroll var(--scroll-dur, 18s) linear infinite;
}

/* Unlit-segment feel: dim ghost of the panel behind the lit text */
.ticker-track .sep {
  color: var(--led-dim);
  text-shadow: none;
  padding: 0 0.4em;
}

/* The track holds two identical copies of the message; sliding it by
   exactly half its width makes the loop seamless. */
@keyframes scroll {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-50%, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track {
    animation-duration: calc(var(--scroll-dur, 18s) * 2.5);
  }
}

.statusbar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  background: rgba(0, 0, 0, 0.55);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(4px);
  font-size: 13px;
  flex-wrap: wrap;
}

.mono {
  font-family: ui-monospace, monospace;
}

.dim {
  color: var(--dim);
}

.pill {
  font-family: ui-monospace, monospace;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 5px 12px;
  border-radius: 999px;
  color: #04121c;
  background: var(--led);
  box-shadow: 0 0 14px var(--led-glow);
}

.exit {
  margin-left: auto;
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: ui-monospace, monospace;
  font-size: 12px;
  cursor: pointer;
}

.exit:hover {
  background: rgba(255, 255, 255, 0.08);
}
