/*
 * Missileer Watch. The device's locked palette and nothing else.
 *
 * Text colours: valar-scopes src/eam/EamTheme.h PaletteGreen() (the device default).
 * Seven-segment colours: the Zulu clock's ClockLit / ClockGhost / ClockBloom, and the
 * bezel fill/edge from EamManager::DrawClock. Do not add colours here.
 */
:root {
  --fg: #00ff00;      /* color888(0,255,0)    primary text / lit */
  --dim: #00c800;     /* color888(0,200,0)    secondary text */
  --faint: #005a00;   /* color888(0,90,0)     labels / inactive / rules */
  --accent: #78ffb4;  /* color888(120,255,180) highlights */
  --warn: #ffb400;    /* color888(255,180,0)  elevated */
  --alert: #ff2800;   /* color888(255,40,0)   high / emergency */
  --bg: #000000;      /* true black */
  --seg-lit: #ef1409;    /* ClockLit */
  --seg-ghost: #0e0302;  /* ClockGhost */
  --seg-bloom: #5a0a06;  /* ClockBloom */
  --bezel: #120403;      /* DrawClock bezel fill, color888(18,4,3) */
  --bezel-edge: #3c0c08; /* DrawClock bezel edge, color888(60,12,8) */
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 var(--mono);
  overflow-x: hidden;
  text-align: center;
}
.wrap { max-width: 40rem; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
p { margin: 0; }
[hidden] { display: none !important; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---- seven-segment readouts (inline SVG built by assets/app.js) ---- */
.ss { display: inline-block; height: 1.6em; width: auto; vertical-align: middle; overflow: visible; }
.ss .g { fill: var(--seg-ghost); }
.ss .b { fill: var(--seg-bloom); }
.ss .l { fill: var(--seg-lit); }

/* ---- header: the round panel with the Zulu clock ---- */
.top { padding-top: 16px; }
.dial {
  width: min(100%, 21rem);
  aspect-ratio: 1;
  margin: 0 auto;
  border: 1px solid var(--faint);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
}
.brand { color: var(--dim); letter-spacing: .25em; font-size: 13px; }
.bezel {
  background: var(--bezel);
  border: 1px solid var(--bezel-edge);
  border-radius: 12px;
  padding: 10px 12px;
  max-width: 100%;
}
.clock { aspect-ratio: 409 / 100; width: min(15rem, 68vw); line-height: 0; }
.clock .ss { width: 100%; height: auto; }
.zulu { color: var(--faint); letter-spacing: .4em; font-size: 12px; }
.ambient { color: var(--faint); font-size: 13px; min-height: 1.5em; padding: 0 12px; }
.nav { display: flex; justify-content: center; gap: 22px; margin: 14px 0 4px; flex-wrap: wrap; }
.nav a { color: var(--dim); text-decoration: none; letter-spacing: .18em; font-size: 13px; padding: 6px 0; }
.nav a:hover { color: var(--fg); }

.sample {
  margin-top: 12px;
  color: var(--warn);
  font-size: 12px;
  letter-spacing: .12em;
  min-height: 1.5em;
}
/* visibility, not display: the line keeps its space either way, so nothing shifts. */
.sample.off { visibility: hidden; }

/* ---- sections ---- */
section { padding-top: 28px; }
h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 8px;
  color: var(--dim);
  font-size: 13px;
  font-weight: normal;
  letter-spacing: .25em;
}
h2::before, h2::after { content: ""; flex: 1; border-top: 1px solid var(--faint); }
.waiting { color: var(--dim); letter-spacing: .2em; font-size: 13px; padding: 24px 0; }
/* Hold the space the messages will take, so the sections below do not jump when they land (CLS). */
#latest-list.loading { min-height: 110vh; }
.unavail { color: var(--warn); padding: 20px 0; }
.unavail .why { color: var(--dim); font-size: 13px; margin-top: 6px; overflow-wrap: anywhere; }
.unavail .btn { margin-top: 12px; }
.note { color: var(--dim); font-size: 12px; margin-top: 8px; }
.note.warn { color: var(--warn); }

.btn {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--dim);
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  letter-spacing: .18em;
  padding: 0 1.1em;
  min-height: 40px;
  cursor: pointer;
}
.btn:hover { border-color: var(--fg); }
.btn:disabled { color: var(--faint); border-color: var(--faint); cursor: default; }
.more-row { padding: 16px 0 0; }

/* ---- a message ---- */
.msg { border-top: 1px solid var(--faint); padding: 22px 0; }
.msg:first-child { border-top: 0; }
.when { color: var(--dim); font-size: 13px; display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; }
.when .ss { height: 28px; }
.when .z { color: var(--dim); }
.head { color: var(--dim); font-size: 13px; margin-top: 8px; }
.preamble {
  font-size: clamp(34px, 11vw, 54px);
  line-height: 1.15;
  letter-spacing: .12em;
  margin: 10px 0 6px;
  color: var(--fg);
  overflow-wrap: anywhere;
}
.preamble.sky { color: var(--accent); }
.body {
  font-size: 17px;
  letter-spacing: .1em;
  line-height: 1.6;
  color: var(--fg);
  word-break: break-all;
}
.body .pre { color: var(--dim); }
.badges { margin-top: 10px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.badge {
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0 .7em;
}
.badge.accent { color: var(--accent); }
.badge.faint { color: var(--faint); }
.via { color: var(--dim); font-size: 12px; margin-top: 10px; overflow-wrap: anywhere; }

details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }

.corr { margin-top: 8px; font-size: 12px; color: var(--dim); }
.corr > summary { display: inline-block; letter-spacing: .12em; }
.corr > summary::after { content: " +"; }
.corr[open] > summary::after { content: " \2212"; }
.corr p { margin-top: 4px; word-break: break-all; }

.msg.collapsed > details > summary {
  color: var(--dim);
  font-size: 13px;
  letter-spacing: .1em;
  padding: 4px 0;
}
.msg.collapsed > details > summary .flag { color: var(--faint); display: block; font-size: 12px; }
.msg.collapsed > details > summary::after { content: "SHOW"; display: inline-block; margin-top: 6px; color: var(--accent); font-size: 12px; letter-spacing: .2em; }
.msg.collapsed > details[open] > summary::after { content: "HIDE"; }
.msg.collapsed > details[open] > .inner { margin-top: 12px; }

/* clip player */
.clip { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }
.clip input[type=range] { flex: 1; max-width: 13rem; min-width: 0; height: 24px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; }
.clip input[type=range]::-webkit-slider-runnable-track { height: 2px; background: var(--faint); }
.clip input[type=range]::-moz-range-track { height: 2px; background: var(--faint); }
.clip input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -6px; border-radius: 50%; background: var(--fg); border: 0; }
.clip input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--fg); border: 0; }
.clip input[type=range]:disabled::-webkit-slider-thumb { background: var(--dim); }
.clip input[type=range]:disabled::-moz-range-thumb { background: var(--dim); }
.clip .t { color: var(--dim); font-size: 13px; min-width: 4.5ch; text-align: left; }
.clip.err .t { color: var(--warn); min-width: 0; }
.noclip { color: var(--faint); font-size: 12px; margin-top: 12px; letter-spacing: .12em; }

/* ---- station status ---- */
.counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 16px 0 8px; }
.count .ss { height: 40px; }
.count p { color: var(--dim); font-size: 12px; letter-spacing: .12em; margin-top: 6px; }
.stns { list-style: none; margin: 8px 0 0; padding: 0; }
.stn { border-top: 1px solid var(--faint); padding: 16px 0; }
.stn .name { color: var(--fg); font-size: 15px; overflow-wrap: anywhere; }
.stn .state { font-size: 12px; letter-spacing: .15em; margin-top: 2px; }
.state.on { color: var(--fg); }
.state.quiet { color: var(--dim); }
.state.silent { color: var(--warn); }
.state.never { color: var(--faint); }
.stn .lh { margin-top: 8px; display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--dim); font-size: 13px; }
.stn .lh .ss { height: 24px; }
.stn .clips { color: var(--dim); font-size: 13px; margin-top: 6px; }
.stn .clips .ss { height: 20px; margin-right: 6px; }

/* ---- listen live (placeholder) ---- */
.listen {
  width: min(100%, 17rem);
  aspect-ratio: 1;
  margin: 12px auto 0;
  border: 1px solid var(--faint);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
}
.listen-seg .ss { height: 40px; }
.listen-title { color: var(--dim); letter-spacing: .2em; font-size: 13px; }
.listen-note { color: var(--dim); font-size: 12px; max-width: 13rem; }

.foot { color: var(--dim); font-size: 12px; padding-top: 40px; padding-bottom: 32px; display: grid; gap: 6px; }
