:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
  background: #07111f;
  color: #f4f8fc;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #153b66 0, #07111f 42%);
}
main {
  width: min(820px, 100%);
  margin: auto;
  padding: calc(22px + env(safe-area-inset-top)) 15px calc(28px + env(safe-area-inset-bottom));
}
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 18px;
}
small { color: #8cb9e8; font-weight: 750; letter-spacing: .12em; }
h1 { margin: 5px 0 0; font-size: clamp(28px, 7vw, 45px); line-height: 1; letter-spacing: -.04em; }
h2 { margin: 0; font-size: 18px; }
.status { display: flex; align-items: center; gap: 8px; color: #b9c9da; white-space: nowrap; font-size: 14px; }
.status i { width: 10px; height: 10px; border-radius: 50%; background: #708094; }
.status.live i { background: #43d787; box-shadow: 0 0 0 7px rgba(67,215,135,.13); }
.status.error i { background: #ff6d6d; }
.buttons {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 9px;
  padding: 11px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 18px;
  background: rgba(14,31,51,.88);
}
button {
  appearance: none;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  padding: 13px;
  background: #172d47;
  color: white;
  font: inherit;
  cursor: pointer;
}
button.primary { background: #edf6ff; color: #07111f; font-weight: 800; border-color: transparent; }
button:disabled { opacity: .42; cursor: default; }
.panel {
  margin-top: 12px;
  min-height: 58vh;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 18px;
  background: rgba(14,31,51,.88);
  box-shadow: 0 18px 60px rgba(0,0,0,.24);
}
.panelHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.panelHead > div:last-child { display: flex; gap: 8px; }
.panelHead button { padding: 9px 12px; font-size: 13px; }
#timer { display: block; margin-top: 4px; color: #86a1bc; font-variant-numeric: tabular-nums; }
.line {
  padding: 13px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
  line-height: 1.48;
  opacity: 1;
  transform: translateY(0);
  transition: opacity .45s ease, transform .45s ease;
}
.line.fresh {
  opacity: 0;
  transform: translateY(8px);
}
.line.has-warning .text::before {
  content: "⚠";
  margin-right: 6px;
  color: #ffc447;
}
.text { overflow-wrap: anywhere; }
.placeholder { color: #71869c; font-style: italic; line-height: 1.5; }
#transcript {
  min-height: 220px;
}
.currentBox {
  position: sticky;
  bottom: 10px;
  margin-top: 18px;
  padding: 14px 15px 16px;
  border: 1px solid rgba(140,185,232,.28);
  border-radius: 15px;
  background: rgba(7,17,31,.96);
  box-shadow: 0 14px 40px rgba(0,0,0,.34);
  backdrop-filter: blur(10px);
}
.currentHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #8cb9e8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.currentHead small {
  color: #6f879f;
  font-size: 10px;
  letter-spacing: .08em;
}
#partial {
  min-height: 48px;
  color: #f4f8fc;
  font-size: 18px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
#partial.refresh {
  animation: currentPulse .35s ease;
}
.current-placeholder {
  color: #71869c;
  font-size: 15px;
  font-style: italic;
}
.current-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  margin: 5px 0;
}
.turn-live {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  color: #75e3a9;
  white-space: nowrap;
  padding-top: 3px;
}
.current-turn-text {
  line-height: 1.55;
  font-size: 18px;
}
@keyframes currentPulse {
  from { opacity: .45; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}
.note { text-align: center; color: #8296aa; font-size: 13px; }
@media (max-width: 560px) {
  .buttons { grid-template-columns: 1fr 1fr; }
  .buttons .primary { grid-column: 1 / -1; }
  .panelHead { align-items: flex-start; flex-direction: column; }
}

/* v8.4: non-blocking error banner, replaces alert() */
.errorBanner {
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 109, 109, 0.35);
  background: rgba(255, 109, 109, 0.12);
  color: #ffb3b3;
  font-size: 13px;
  line-height: 1.4;
  transition: opacity .3s ease;
}
.errorBanner[hidden] { display: none; }

/* v8.5: manual end-of-transmission control, replaces automatic silence detection */
.endTransmission {
  display: block;
  width: 100%;
  margin: -4px 0 16px;
  padding: 17px;
  border-radius: 14px;
  border: 1px solid rgba(255, 181, 71, 0.4);
  background: linear-gradient(135deg, rgba(255,181,71,.24), rgba(255,140,66,.15));
  color: #ffd18b;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: .02em;
  cursor: pointer;
}
.endTransmission:disabled {
  opacity: .35;
  cursor: default;
}
.endTransmission:not(:disabled):active {
  transform: translateY(1px);
}

/* v8.4: plausibility warnings on values outside expected ATC ranges */
mark.suspect {
  background: rgba(255, 196, 71, 0.28);
  color: #ffd889;
  border-bottom: 1px dashed #ffc447;
  border-radius: 3px;
  padding: 0 2px;
  cursor: help;
}
