:root {
  --bg: #07090c;
  --bg-2: #10161d;
  --ink: #edf3f8;
  --muted: #93a2b4;
  --amber: #ffb000;
  --amber-2: #ffe1a3;
  --red: #ff3b30;
  --green: #3dff9a;
  --ice: #8ecbff;
  --line: rgba(255, 176, 0, 0.38);
  --metal: #9aa6b4;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
  color-scheme: dark;
  font-family: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

.lift { position: relative; z-index: 30; }

.strobe {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
}
.strobe.is-bad { background: #ff1c1c; animation: flash-bad 720ms linear; }
.strobe.is-good { background: #18f48a; animation: flash-good 860ms linear; }

@keyframes flash-bad {
  0% { opacity: 0; }
  12% { opacity: 0.78; }
  28% { opacity: 0.06; }
  46% { opacity: 0.84; }
  72% { opacity: 0.1; }
  100% { opacity: 0; }
}
@keyframes flash-good {
  0% { opacity: 0; }
  14% { opacity: 0.7; }
  32% { opacity: 0.12; }
  50% { opacity: 0.68; }
  100% { opacity: 0; }
}

.hazard {
  height: 10px;
  background: repeating-linear-gradient(-45deg, #ffb000 0 12px, #141414 12px 24px);
}

.shield {
  width: 46px;
  height: 46px;
  fill: none;
  stroke: var(--amber);
  stroke-width: 3;
  filter: drop-shadow(0 0 6px rgba(255, 176, 0, 0.65));
}
.shield circle { fill: var(--amber); stroke: none; }

.brand { display: flex; align-items: center; gap: 14px; }
.brand-kicker, .eyebrow, .rail-title, .portal-kicker {
  margin: 0;
  color: var(--amber);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.74rem;
}
.brand-name, .portal-head h1, .console-head h1 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.link-pill, .live-chip {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--amber-2);
}
.link-pill.is-lost, .is-lost { color: var(--red); border-color: rgba(255, 59, 48, 0.7); }

.time {
  margin: 0;
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  line-height: 0.95;
  color: var(--amber);
  text-shadow: 0 0 12px rgba(255, 176, 0, 0.8), 0 0 36px rgba(255, 176, 0, 0.28);
}
.colon { display: inline-block; width: 0.42em; text-align: center; }
body[data-status="running"] .colon { animation: colon-blink 1s steps(1, end) infinite; }
@keyframes colon-blink {
  0%, 42% { opacity: 1; }
  50%, 92% { opacity: 0.15; }
}

/* Home */
.view-home {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(255, 176, 0, 0.14), transparent 55%),
    linear-gradient(180deg, #101820, #07090c 42%);
}
.portal {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.portal-head, .console-head, .topbar, .pad-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.portal-lead {
  max-width: 40rem;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.5;
}
.portal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.portal-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
  padding: 22px;
  text-decoration: none;
  color: inherit;
  background:
    linear-gradient(180deg, rgba(255, 176, 0, 0.08), transparent 34%),
    #121920;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.portal-card:hover { border-color: var(--amber); transform: translateY(-2px); }
.portal-title {
  font-size: 1.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.portal-url { color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; }

/* Television */
.view-tv {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #020304;
  padding: 16px;
}
.view-tv::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 4px);
  opacity: 0.35;
}
.shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(1000px 500px at 70% 20%, rgba(255, 176, 0, 0.07), transparent 50%),
    #070b10;
  box-shadow: inset 0 0 0 1px rgba(255, 176, 0, 0.4), inset 0 0 0 10px #05070b, 0 0 40px rgba(0, 0, 0, 0.45);
}
.topbar, .statusline { padding: 16px 22px; }
.topbar { border-bottom: 1px solid rgba(255, 176, 0, 0.18); }
.top-meta { display: flex; gap: 16px; align-items: center; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.78rem; }
.tv-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  padding: 18px;
}
.rail, .well, .monitor, .panel-block {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 28%), #0d141b;
  border: 1px solid rgba(255, 176, 0, 0.24);
  border-radius: 18px;
}
.rail { padding: 18px 16px 12px; display: flex; flex-direction: column; }
.zone-list { list-style: none; margin: 14px 0 0; padding: 0; }
.zone-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.82rem;
}
.zone-list strong { color: var(--amber); font-weight: 700; }
body[data-status="paused"] .zone-list strong { color: var(--ice); }
body[data-status="deactivated"] .zone-list strong { color: var(--green); }
body[data-status="alarm"] .zone-list strong { color: var(--red); }
.stage { min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }
.well {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 36px 28px 28px;
  text-align: center;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.45);
}
.eyebrow { font-size: 1rem; margin-bottom: 10px; }
.verdict {
  margin: 0 0 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: clamp(2.6rem, 6vw, 6.4rem);
  line-height: 0.95;
}
body[data-status="deactivated"] .verdict { color: var(--green); text-shadow: 0 0 18px rgba(61, 255, 154, 0.75); }
body[data-status="alarm"] .verdict { color: var(--red); text-shadow: 0 0 18px rgba(255, 59, 48, 0.8); }
.view-tv .time { font-size: clamp(4.4rem, 11vw, 9.6rem); }
body[data-status="deactivated"] .time,
body[data-status="alarm"] .time { font-size: clamp(2rem, 5vw, 4.2rem); }
body[data-status="deactivated"] .time { color: var(--green); text-shadow: 0 0 16px rgba(61, 255, 154, 0.55); }
body[data-status="alarm"] .time,
.time.is-critical { color: #ff5d52; text-shadow: 0 0 16px rgba(255, 50, 40, 0.75); }
.meter {
  height: 8px;
  margin: 22px auto 0;
  width: min(640px, 86%);
  border-radius: 999px;
  background: #1b2430;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.meter span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #8a5a00, var(--amber)); box-shadow: 0 0 12px rgba(255, 176, 0, 0.7); }
body[data-status="deactivated"] .meter span { background: var(--green); }
body[data-status="alarm"] .meter span,
.is-critical .meter span { background: var(--red); }
.detail { margin: 16px 0 0; color: var(--muted); letter-spacing: 0.16em; text-transform: uppercase; font-size: 0.92rem; }
.bracket { position: absolute; width: 26px; height: 26px; border: 2px solid rgba(255, 176, 0, 0.75); }
.b-tl { top: 12px; left: 12px; border-right: 0; border-bottom: 0; }
.b-tr { top: 12px; right: 12px; border-left: 0; border-bottom: 0; }
.b-bl { bottom: 12px; left: 12px; border-right: 0; border-top: 0; }
.b-br { bottom: 12px; right: 12px; border-left: 0; border-top: 0; }
.toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  margin: 0;
  padding: 10px 18px;
  background: rgba(70, 0, 0, 0.9);
  border: 1px solid var(--red);
  color: #ffd0d0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.radar-wrap {
  position: relative;
  width: 150px;
  height: 150px;
  margin: auto auto 8px;
}
.radar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid rgba(255, 176, 0, 0.45);
  background:
    repeating-radial-gradient(circle, transparent 0 18px, rgba(255, 176, 0, 0.28) 19px 20px),
    conic-gradient(from 0deg, transparent 0 300deg, rgba(255, 176, 0, 0.7) 360deg);
  animation: spin 4.5s linear infinite;
}
.radar-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px var(--amber);
}
body[data-status="deactivated"] .radar {
  animation: none;
  border-color: rgba(61, 255, 154, 0.5);
  background:
    repeating-radial-gradient(circle, transparent 0 18px, rgba(61, 255, 154, 0.28) 19px 20px),
    conic-gradient(from 20deg, transparent 0 300deg, rgba(61, 255, 154, 0.65) 360deg);
}
body[data-status="deactivated"] .radar-core { background: var(--green); box-shadow: 0 0 10px var(--green); }
body[data-status="alarm"] .radar { animation-duration: 0.8s; filter: hue-rotate(-25deg) saturate(1.4); }
@keyframes spin { to { transform: rotate(360deg); } }
.statusline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-top: 1px solid rgba(255, 176, 0, 0.18);
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.75rem;
}
.statusline span { display: inline-flex; align-items: center; gap: 8px; }
.led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}
body[data-status="running"] .led { background: var(--amber); box-shadow: 0 0 8px var(--amber); animation: colon-blink 1.2s steps(1) infinite; }
body[data-status="alarm"] .led { background: var(--red); box-shadow: 0 0 8px var(--red); }
#expand {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--amber-2);
  border-radius: 999px;
  padding: 8px 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.72rem;
}
body[data-status="alarm"] .shell { animation: alarm-wash 1.3s ease-in-out infinite; }
body[data-status="deactivated"] .shell { box-shadow: inset 0 0 0 1px rgba(61, 255, 154, 0.55), inset 0 0 0 10px #05070b, inset 0 0 90px rgba(61, 255, 154, 0.16); }
@keyframes alarm-wash {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(255, 59, 48, 0.45), inset 0 0 0 10px #05070b, inset 0 0 50px rgba(255, 40, 40, 0.18); }
  50% { box-shadow: inset 0 0 0 1px rgba(255, 59, 48, 0.85), inset 0 0 0 10px #05070b, inset 0 0 140px rgba(255, 30, 30, 0.42); }
}

/* Keypad */
.view-keypad {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: #1a1e24;
  background-image: radial-gradient(rgba(255, 255, 255, 0.055) 0.7px, transparent 0.7px);
  background-size: 3px 3px;
}
.pad {
  position: relative;
  width: min(560px, 100%);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(16px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 12%),
    linear-gradient(180deg, #343c48, #1a2028 22%, #12171d);
  box-shadow: 0 0 0 1px #050608, 0 24px 70px rgba(0, 0, 0, 0.45), inset 0 0 0 2px rgba(255, 255, 255, 0.04);
}
.pad.shake { animation: shake 380ms linear; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(4px); }
}
.screw {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e7edf3, #7d8793 42%, #2b3138 72%);
  box-shadow: inset 0 0 0 1px #111, 0 1px 0 rgba(255, 255, 255, 0.35);
}
.screw::before {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 7px;
  height: 2px;
  background: #22282e;
  transform: rotate(28deg);
}
.screw-tl { top: 12px; left: 12px; }
.screw-tr { top: 12px; right: 12px; }
.screw-bl { bottom: 12px; left: 12px; }
.screw-br { bottom: 12px; right: 12px; }
.lamps { display: flex; gap: 12px; }
.lamp {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.68rem;
}
.lamp i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2a3138;
  box-shadow: inset 0 0 0 1px #000;
}
body[data-status="running"] .lamp-armed i,
body[data-status="paused"] .lamp-armed i,
body[data-status="alarm"] .lamp-armed i {
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
}
body[data-status="deactivated"] .lamp-ready i,
body[data-status="standby"] .lamp-ready i {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}
.lcd {
  margin-top: 8px;
  padding: 16px 16px 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, #082216, #04140c 70%);
  box-shadow: inset 0 0 0 2px #0c2c18, inset 0 10px 24px rgba(0, 0, 0, 0.55);
  text-align: center;
}
.lcd-kicker {
  margin: 0;
  color: rgba(141, 255, 176, 0.7);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.75rem;
}
.lcd-message {
  margin: 8px 0;
  min-height: 1.1em;
  color: #b9ffd4;
  text-shadow: 0 0 8px rgba(80, 255, 150, 0.65);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: clamp(1.7rem, 6vw, 2.7rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.lcd[data-tone="bad"] { background: linear-gradient(180deg, #2a090c, #140406 70%); box-shadow: inset 0 0 0 2px #4a1216, inset 0 10px 24px rgba(0, 0, 0, 0.55); }
.lcd[data-tone="bad"] .lcd-kicker { color: #ffb0b0; }
.lcd[data-tone="bad"] .lcd-message { color: #ffd0d0; text-shadow: 0 0 8px rgba(255, 60, 60, 0.7); }
.lcd-slots { margin: 0; letter-spacing: 0.35em; color: #8dffb0; font-size: 1.3rem; }
.slot { opacity: 0.35; }
.slot.is-filled { opacity: 1; text-shadow: 0 0 8px rgba(80, 255, 150, 0.8); }
.pad-top, .lcd, .pad-foot { flex-shrink: 0; }
.keys {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: 12px;
}
.keys button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid #0c1014;
  border-radius: 16px;
  color: #f4f7fb;
  background: linear-gradient(180deg, #4a5563 0%, #2c3541 46%, #232b34 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38), 0 6px 0 #0a0d11, 0 10px 16px rgba(0, 0, 0, 0.35);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  touch-action: manipulation;
}
.keys button strong { font-size: clamp(1.8rem, 5vw, 2.5rem); font-weight: 650; letter-spacing: 0.04em; }
.keys button span {
  display: block;
  min-height: 0.9em;
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
}
.keys button:active {
  transform: translateY(4px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 0 #0a0d11;
}
.key-side { color: var(--amber-2); }
.pad-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 2px 28px 6px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.72rem;
}
.grill {
  width: 74px;
  height: 14px;
  background: radial-gradient(circle, #0c0f13 1.1px, transparent 1.3px);
  background-size: 6px 6px;
  opacity: 0.8;
}

/* Admin */
.view-admin {
  background:
    radial-gradient(800px 300px at 10% 0%, rgba(255, 176, 0, 0.12), transparent 50%),
    #07090c;
}
.console { width: min(1180px, calc(100% - 28px)); margin: 0 auto; padding-bottom: 40px; }
.console-head { padding: 20px 0 8px; }
.console-head h1 { letter-spacing: 0.16em; text-transform: uppercase; font-size: clamp(1.6rem, 3vw, 2.3rem); }
.console-grid { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 18px; align-items: start; }
.monitor { padding: 22px; text-align: center; }
.monitor-status {
  margin: 12px 0 8px;
  color: var(--amber);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.view-admin .time { font-size: clamp(3rem, 6vw, 4.8rem); }
.view-admin[data-status="deactivated"] .time { color: var(--green); text-shadow: 0 0 16px rgba(61, 255, 154, 0.5); }
.view-admin[data-status="alarm"] .time { color: var(--red); text-shadow: 0 0 16px rgba(255, 59, 48, 0.55); }
.view-admin[data-status="paused"] .time { color: var(--ice); text-shadow: 0 0 16px rgba(142, 203, 255, 0.4); }
.reset-point { color: var(--muted); letter-spacing: 0.06em; }
.pin-plaque {
  margin-top: 18px;
  padding: 14px;
  border-radius: 12px;
  background: #07140e;
  box-shadow: inset 0 0 0 1px rgba(61, 255, 154, 0.25);
}
.pin-plaque span {
  display: block;
  color: var(--muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.75rem;
}
.pin-plaque strong {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 2.4rem;
  letter-spacing: 0.28em;
  color: var(--green);
}
.control-row, .preset-row, .time-fields, .pin-row { display: flex; flex-wrap: wrap; gap: 10px; }
.cmd, .preset-row button, .time-fields button, .pin-row button {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #18212b;
  border-radius: 12px;
  min-height: 52px;
  padding: 0 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.cmd { flex: 1; min-width: 140px; font-size: 0.95rem; }
.cmd-small { flex: 0 0 auto; align-self: end; min-width: 132px; }
.cmd-arm { background: linear-gradient(180deg, #8d2a12, #5a140c); border-color: rgba(255, 120, 60, 0.5); }
.cmd-pause { background: linear-gradient(180deg, #1d3f66, #12283f); border-color: rgba(142, 203, 255, 0.4); }
.cmd-reset { background: linear-gradient(180deg, #3a414b, #222830); }
.cmd:active, .preset-row button:active, .pin-row button:active { transform: translateY(1px); }
.note { min-height: 1.2em; margin: 10px 0; letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.8rem; }
.note[data-kind="good"] { color: var(--green); }
.note[data-kind="bad"] { color: #ff8d86; }
.panel-block { margin-top: 12px; padding: 16px; }
.panel-block h2 { margin: 0 0 4px; font-size: 1rem; letter-spacing: 0.12em; text-transform: uppercase; }
.hint { margin: 0 0 12px; color: var(--muted); }
.time-fields { align-items: end; }
.time-fields label, .pin-row { align-items: end; }
.time-fields label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.72rem; }
input {
  width: 100%;
  min-width: 0;
  background: #070b10;
  border: 1px solid rgba(255, 176, 0, 0.28);
  border-radius: 10px;
  padding: 12px 10px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 1.3rem;
}
input::placeholder { color: rgba(237, 243, 248, 0.28); }
.time-fields input { width: 88px; text-align: center; }
.pin-row input { flex: 1; letter-spacing: 0.2em; }
.preset-row button { min-height: 46px; }
.log { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow: auto; }
.log-row {
  display: grid;
  grid-template-columns: 90px 90px 100px 1fr;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #10161c;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.85rem;
}
.log-row.is-good { box-shadow: inset 3px 0 0 var(--green); }
.log-row.is-bad { box-shadow: inset 3px 0 0 var(--red); }
.log-code { letter-spacing: 0.12em; }
.empty-log { margin: 0; color: var(--muted); }

@media (max-height: 680px) {
  .view-keypad { height: auto; min-height: 100dvh; overflow: auto; }
  .pad { height: auto; min-height: 100dvh; }
  .keys { min-height: 320px; }
}

@media (max-width: 980px) {
  .portal-grid, .console-grid { grid-template-columns: 1fr; }
  .log-row { grid-template-columns: 1fr 1fr; }
}

/* TV browsers such as Silk often report about 960x540, so the TV keeps the
   side-by-side layout and fits the screen instead of using the narrow breakpoint. */
@media (max-width: 1100px), (max-height: 720px) {
  .view-tv { padding: 8px; }
  .topbar, .statusline { padding: 10px 16px; }
  .tv-grid { grid-template-columns: minmax(190px, 26%) 1fr; gap: 12px; padding: 12px; }
  .rail { padding: 12px 12px 8px; }
  .zone-list { margin-top: 8px; }
  .zone-list li { padding: 7px 2px; font-size: 0.74rem; }
  .well { padding: 24px 18px 18px; }
  .view-tv .time { font-size: min(11vw, 24vh); }
  .view-tv .verdict { font-size: min(7vw, 15vh); }
  body[data-status="deactivated"] .time,
  body[data-status="alarm"] .time { font-size: min(5vw, 11vh); }
  .top-meta span:not(.link-pill) { display: none; }
  .statusline { font-size: 0.68rem; }
}

@media (max-height: 600px) {
  .radar-wrap { display: none; }
  .brand-kicker { display: none; }
  .shield { width: 34px; height: 34px; }
  .brand-name { font-size: 1.2rem; }
}

@media (max-width: 760px) {
  .statusline span:nth-child(-n+4) { display: none; }
}

@media (max-width: 640px) and (orientation: portrait) {
  .view-tv { height: auto; min-height: 100vh; overflow: auto; }
  .shell { height: auto; min-height: calc(100vh - 16px); }
  .tv-grid { grid-template-columns: 1fr; }
  .stage { order: -1; min-height: 50vh; }
  .radar-wrap { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .radar, body[data-status="running"] .colon, body[data-status="running"] .led, body[data-status="alarm"] .shell { animation: none; }
  .strobe.is-bad, .strobe.is-good { animation-duration: 280ms; }
}
