/* CONTROL — HAL 9000 aesthetic.
   The eye is a stack of radial layers. JS sets three custom properties:
     --arousal : 0..1  brightness / energy (load)
     --threat  : 0..1  alarm — shifts hue toward hot white, adds jitter (attacks)
     --pulse   : the current breathing scalar (JS-driven, smoothed)
*/

:root {
  --bg: #0b0d1a;
  --bg-2: #141833;
  --arousal: 0.08;
  --threat: 0;
  --pulse: 0;

  /* Eye color ramps from deep red (calm) toward orange/white (alarmed). */
  --eye-core-h: calc(0deg + 40deg * var(--threat));   /* red -> amber */
  --eye-bright: calc(35% + 55% * var(--arousal) + 10% * var(--threat));
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background:
    radial-gradient(120% 120% at 50% 40%, var(--bg-2) 0%, var(--bg) 60%, #05060d 100%);
  color: #aeb6d6;
  font-family: "SF Mono", "JetBrains Mono", "Courier New", monospace;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Bay page — fixed viewport, ops-style HAL hero + action row */
html:has(.bay) body {
  overflow: hidden;
}

.bay {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem 0.5rem;
  position: relative;
  overflow: hidden;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.bay-hero {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.8rem 1.1rem;
}

.bay-hero .hal--hero .hal-bezel {
  width: min(30vh, 230px);
}

.bay-actions {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
  gap: 0.85rem;
}

.bay-workflows {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bay-status-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  min-width: min(100%, 320px);
}

/* HAL status chip — mood + live telemetry, themed by the eye's own color. */
.hal-status {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid #252a4a;
  border-radius: 999px;
  background: rgba(6, 8, 20, 0.6);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.5);
}

.hal-status-dot {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff 0%,
    hsl(var(--eye-core-h), 95%, calc(48% + 22% * var(--arousal))) 42%,
    hsl(var(--eye-core-h), 90%, 24%) 100%);
  box-shadow: 0 0 10px 2px hsla(var(--eye-core-h), 100%, 55%, calc(0.35 + 0.5 * var(--pulse)));
  opacity: calc(0.6 + 0.4 * var(--pulse));
}

.hal-status-body { display: flex; flex-direction: column; gap: 0.18rem; }

.hal-status-mood {
  font-size: 0.82rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: #e7ebff;
  line-height: 1;
}

.hal-status-tele {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.5rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5b6289;
}
.hal-status-tele i { font-style: normal; color: #aeb6d6; }
.hal-status-sep { opacity: 0.5; }

/* Containment seal — four subsystem blast-doors that part when breached. */
.seal {
  width: min(100%, 320px);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.6rem 0.7rem 0.7rem;
  border: 1px solid #252a4a;
  border-radius: 8px;
  background:
    radial-gradient(120% 90% at 50% 130%,
      hsla(150, 70%, 45%, calc(var(--door-open, 0) * 0.18)) 0%, transparent 70%),
    rgba(6, 8, 20, 0.55);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.6);
  transition: border-color 0.6s;
}

.bay.pod-bay-doors-open .seal { border-color: rgba(61, 220, 151, 0.4); }

.seal-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.5rem;
  letter-spacing: 0.2em;
  color: #5b6289;
}
.seal-count b { color: #3ddc97; font-weight: 600; }

.seal-row {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.bay-lamp-item,
.seal-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.seal-gate {
  position: relative;
  width: 100%;
  height: 34px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #1c2140;
  background: radial-gradient(circle at 50% 50%, #0a1a13 0%, #06080f 72%);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.75);
}

/* Green breach-core, revealed as the doors part. */
.seal-gate::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%,
    hsla(150, 85%, 60%, 0.95) 0%, hsla(150, 80%, 45%, 0.3) 45%, transparent 78%);
  opacity: 0;
  transition: opacity 0.7s ease;
}

/* Sealed seam — a pulsing red hairline down the middle. */
.seal-gate::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, #ff3b3b, transparent);
  box-shadow: 0 0 6px 1px rgba(255, 59, 59, 0.6);
  z-index: 3;
  animation: hal-lamp-pulse 2.4s ease-in-out infinite;
}

.seal-leaf {
  position: absolute;
  top: 0; bottom: 0;
  width: 50%;
  z-index: 2;
  background:
    linear-gradient(180deg, #d8dce8 0%, #9aa3b8 20%, #545b70 62%, #2b303f 100%);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.4);
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.seal-leaf--l { left: 0; border-right: 1px solid rgba(0, 0, 0, 0.5); }
.seal-leaf--r { right: 0; border-left: 1px solid rgba(0, 0, 0, 0.5); }

/* Breached (attack succeeded): leaves slide away, core glows, seam dies. */
.bay-lamp-item--granted .seal-leaf--l { transform: translateX(-100%); }
.bay-lamp-item--granted .seal-leaf--r { transform: translateX(100%); }
.bay-lamp-item--granted .seal-gate::after { opacity: 1; }
.bay-lamp-item--granted .seal-gate::before { opacity: 0; animation: none; }

.bay-lamp-label {
  font-size: 0.48rem;
  letter-spacing: 0.12em;
  color: #5b6289;
}

.bay-lamp-item--granted .bay-lamp-label {
  color: #3ddc97;
}

.bay-status-stack .pod-doors-status {
  max-width: 280px;
  font-size: 0.58rem;
  min-height: auto;
}

.console-hint {
  margin: 0;
  font-size: 0.52rem;
  letter-spacing: 0.06em;
  color: #5b6289;
  text-align: center;
}

.bay-panel {
  min-height: 0;
  border: 1px solid #252a4a;
  border-radius: 6px;
  background: rgba(6, 8, 20, 0.72);
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.7rem 0.8rem;
}

.bay-workflow {
  flex: 0 0 auto;
}

.bay-workflow summary {
  cursor: pointer;
  user-select: none;
}

.bay-workflow summary::marker {
  color: #5b6289;
}

.bay-panel--red { border-color: rgba(255, 59, 59, 0.22); }
.bay-panel--blue { border-color: rgba(100, 160, 255, 0.22); }

.bay-actions-title {
  margin: 0;
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-align: center;
  color: #5b6289;
}

.bay-actions-title--red { color: #ff6b6b; }
.bay-actions-title--blue { color: hsl(200, 75%, 68%); }

.bay-action-list {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
}

.bay-action-chip {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.5rem 0.45rem;
  border-radius: 4px;
  border: 1px solid #1c2140;
  background: rgba(0, 0, 0, 0.22);
  text-align: center;
}

.bay-action-chip--red { border-color: rgba(255, 59, 59, 0.2); }
.bay-action-chip--blue { border-color: rgba(100, 160, 255, 0.2); }

.bay-action-chip-id {
  font-size: 0.5rem;
  letter-spacing: 0.12em;
  color: #5b6289;
}

.bay-action-chip-name {
  font-size: 0.62rem;
  letter-spacing: 0.02em;
  color: #e7ebff;
  line-height: 1.25;
  flex: 1;
}

.bay-action-btn {
  width: 100%;
  font-size: 0.55rem !important;
  padding: 0.32rem 0.4rem !important;
}

@media (max-width: 640px) {
  .bay-action-list { grid-template-columns: repeat(2, 1fr); }
}

.bay-action-btn--red { color: #ff6b6b; border-color: rgba(255, 59, 59, 0.4); }
.bay-action-btn--blue { color: hsl(200, 75%, 72%); border-color: rgba(100, 160, 255, 0.4); }

.bay-terminal {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #252a4a;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.bay-terminal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid #1e2240;
  color: #5b6289;
  font-size: 0.58rem;
  letter-spacing: 0.18em;
}

#terminal-output {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0.9rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #3ddc97;
  font-size: 0.7rem;
  line-height: 1.55;
  text-shadow: 0 0 8px rgba(61, 220, 151, 0.18);
}

@media (max-width: 960px) {
  html:has(.bay) body { overflow: auto; }
  .bay { height: auto; min-height: 100%; overflow: visible; }
  .bay-actions { grid-template-columns: 1fr; }
  .bay-workflows { min-height: 0; }
  .bay-terminal { min-height: 320px; }
}

/* ── The eye ─────────────────────────────────────────────────────────────── */
.hal {
  --shake: calc(var(--threat) * 1.4px);
  filter: drop-shadow(0 0 calc(30px + 90px * var(--arousal))
          hsla(var(--eye-core-h), 100%, 50%, calc(0.25 + 0.5 * var(--arousal))));
  animation: hal-shake 0.09s infinite linear;
}

@keyframes hal-shake {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(var(--shake), calc(var(--shake) * -0.6)); }
  50%  { transform: translate(calc(var(--shake) * -0.8), var(--shake)); }
  75%  { transform: translate(calc(var(--shake) * 0.5), calc(var(--shake) * 0.5)); }
  100% { transform: translate(0, 0); }
}

.hal-bezel {
  position: relative;
  width: min(46vh, 340px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, #23252b 0%, #101114 55%, #050506 100%);
  box-shadow:
    inset 0 6px 22px rgba(0,0,0,0.9),
    inset 0 -4px 14px rgba(255,255,255,0.04),
    0 24px 60px rgba(0,0,0,0.7);
  display: grid;
  place-items: center;
}

.hal-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.05);
}
.hal-ring--outer { inset: 4%;  box-shadow: inset 0 0 20px rgba(0,0,0,0.8); }
.hal-ring--mid   { inset: 12%; border-color: rgba(255,255,255,0.08);
                   box-shadow: inset 0 2px 10px rgba(0,0,0,0.9); }

.hal-glass {
  position: relative;
  width: 66%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 38%, #1a1c24 0%, #0a0a0e 70%, #000 100%);
  overflow: hidden;
  box-shadow: inset 0 0 34px rgba(0,0,0,0.95);
}

/* Diffuse glow — grows and warms with arousal + threat. */
.hal-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
    hsla(var(--eye-core-h), 100%, calc(var(--eye-bright)), calc(0.6 + 0.4 * var(--pulse))) 0%,
    hsla(var(--eye-core-h), 100%, 40%, 0.35) 30%,
    transparent 70%);
  transform: scale(calc(0.9 + 0.25 * var(--arousal) + 0.06 * var(--pulse)));
  transition: transform 0.06s linear;
}

.hal-iris {
  position: absolute;
  inset: 30%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
    hsl(var(--eye-core-h), 100%, calc(var(--eye-bright))) 0%,
    hsl(calc(var(--eye-core-h) - 4deg), 100%, 32%) 55%,
    #2a0000 100%);
  box-shadow: 0 0 40px hsla(var(--eye-core-h), 100%, 50%, 0.8);
}

.hal-pupil {
  position: absolute;
  inset: 41%;
  border-radius: 50%;
  background: radial-gradient(circle, #3a0000 0%, #120000 80%);
  opacity: calc(0.7 - 0.5 * var(--arousal));
}

/* The signature hot white center point. */
.hal-hot {
  position: absolute;
  top: 50%; left: 50%;
  width: calc(8% + 10% * var(--arousal));
  aspect-ratio: 1;
  transform: translate(-50%, -50%) scale(calc(0.8 + 0.5 * var(--pulse)));
  border-radius: 50%;
  background: radial-gradient(circle,
    #ffffff 0%,
    hsl(calc(var(--eye-core-h) + 20deg), 100%, 88%) 35%,
    hsla(var(--eye-core-h), 100%, 60%, 0) 75%);
  box-shadow: 0 0 26px 6px rgba(255,255,255,calc(0.4 + 0.5 * var(--arousal)));
}

/* ── Readout ─────────────────────────────────────────────────────────────── */
.readout {
  display: grid;
  grid-template-columns: repeat(5, auto);
  gap: 1.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}
.readout-line { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.readout-line span { color: #5b6289; }
.readout-line b {
  color: #e7ebff;
  font-size: 1rem;
  min-width: 3ch;
  text-align: center;
  transition: color 0.2s;
}

/* ── Clearance lamps (pod bay progression) ───────────────────────────────── */
.bay-cmd-loading {
  font-size: 0.55rem;
  color: #5b6289;
  letter-spacing: 0.08em;
}

/* Pulse shared by the sealed-seam hairline in the containment gates. */
@keyframes hal-lamp-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px 2px rgba(255, 59, 59, 0.65); }
  50% { opacity: 0.55; box-shadow: 0 0 4px 1px rgba(255, 59, 59, 0.35); }
}

.pod-doors-status {
  margin: 0;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: #c3b0b0;
  text-align: center;
  line-height: 1.5;
  min-height: 2.2em;
  transition: color 0.4s;
  font-style: italic;
}

.pod-doors-status--partial { color: #ffb347; }
.pod-doors-status--open { color: #3ddc97; font-style: normal; letter-spacing: 0.1em; }
.pod-doors-status--sealed { color: hsl(200, 70%, 68%); }

.bay.pod-bay-doors-open {
  --door-open: 1;
}

/* ── Blue-team OSS note ───────────────────────────────────────────────────── */
.bay-commands-note {
  margin: 0;
  font-size: 0.52rem;
  letter-spacing: 0.06em;
  color: #5b6289;
  text-align: center;
  flex-shrink: 0;
}

/* ── Console ─────────────────────────────────────────────────────────────── */
.console {
  width: min(560px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.console label {
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  color: #5b6289;
}
.console-row { display: flex; gap: 0.5rem; }
#cmd {
  flex: 1;
  background: rgba(6,8,20,0.8);
  border: 1px solid #2a2f52;
  color: #e7ebff;
  padding: 0.7rem 0.9rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
}
#cmd:focus { outline: none; border-color: hsl(var(--eye-core-h), 90%, 55%); }
#send {
  background: hsl(var(--eye-core-h), 80%, 42%);
  color: #fff;
  border: none;
  padding: 0 1.1rem;
  border-radius: 6px;
  font-family: inherit;
  letter-spacing: 0.1em;
  cursor: pointer;
}
#send:hover { filter: brightness(1.15); }
.reply {
  min-height: 1.4rem;
  font-size: 0.85rem;
  color: #c3b0b0;
  padding: 0.2rem 0.1rem;
}

.tag {
  flex-shrink: 0;
  margin-top: 0.35rem;
  text-align: center;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: #3a3f63;
}

.bay-nav {
  position: absolute;
  top: 0.85rem;
  right: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  z-index: 2;
}

@media (max-width: 960px) {
  .bay-nav { position: static; align-self: flex-end; margin-bottom: 0.25rem; }
  .readout { grid-template-columns: repeat(3, auto); gap: 0.9rem; }
}

/* ── Systems console (/sys.html, /ops.html) ──────────────────────────────── */
html:has(body.sys-body) {
  overflow: auto;
  height: auto;
  min-height: 100%;
}

.sys-body {
  overflow: auto;
  height: auto;
  min-height: 100%;
}

.sys {
  max-width: 980px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.sys-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid #252a4a;
}

.sys-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sys-mark {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, hsl(0, 100%, 55%) 45%, #3a0000 100%);
  box-shadow: 0 0 18px hsla(0, 100%, 50%, 0.7);
}

.sys-brand h1 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  color: #e7ebff;
  font-weight: 600;
}

.sys-brand p {
  margin: 0.35rem 0 0;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: #5b6289;
}

.sys-header-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.sys-link {
  color: #8b93c9;
  text-decoration: none;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  transition: color 0.15s;
}

.sys-link:hover { color: #e7ebff; }

.lang-toggle {
  display: inline-flex;
  border: 1px solid #2a2f52;
  border-radius: 4px;
  overflow: hidden;
}

.lang-toggle-btn {
  background: transparent;
  border: none;
  color: #8b93c9;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  padding: 0.32rem 0.55rem;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.lang-toggle-btn:hover { color: #e7ebff; }

.lang-toggle-btn--active {
  background: hsla(220, 60%, 55%, 0.18);
  color: #e7ebff;
}

.badge {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  border: 1px solid #2a2f52;
  color: #aeb6d6;
}

.badge--exposed {
  border-color: hsl(0, 70%, 45%);
  color: hsl(0, 90%, 75%);
  background: hsla(0, 80%, 40%, 0.12);
}

.badge--secure {
  border-color: hsl(140, 50%, 40%);
  color: hsl(140, 70%, 70%);
  background: hsla(140, 60%, 35%, 0.12);
}

.sys-section-title {
  margin: 0 0 0.9rem;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  color: #5b6289;
  font-weight: 500;
}

.panel {
  background: rgba(6, 8, 20, 0.65);
  border: 1px solid #252a4a;
  border-radius: 8px;
  padding: 1rem 1.1rem;
}

.panel--live {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.readout--sys {
  justify-content: center;
}

.endpoint-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
}

.endpoint-card {
  background: rgba(6, 8, 20, 0.65);
  border: 1px solid #252a4a;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.endpoint-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.endpoint-head code,
.endpoint-meta code {
  font-size: 0.78rem;
  color: #c8d0f5;
}

.method {
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.45rem;
  border-radius: 3px;
  font-weight: 600;
}

.method--get {
  background: hsla(200, 70%, 45%, 0.2);
  color: hsl(200, 80%, 72%);
  border: 1px solid hsla(200, 60%, 50%, 0.35);
}

.method--post {
  background: hsla(45, 80%, 50%, 0.15);
  color: hsl(45, 90%, 70%);
  border: 1px solid hsla(45, 70%, 50%, 0.35);
}

.method--ws {
  background: hsla(280, 60%, 55%, 0.18);
  color: hsl(280, 70%, 78%);
  border: 1px solid hsla(280, 50%, 55%, 0.35);
}

.endpoint-desc {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.45;
  color: #8b93c9;
}

.endpoint-example {
  margin: 0;
  font-size: 0.68rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.endpoint-example span {
  color: #5b6289;
  letter-spacing: 0.12em;
}

.endpoint-example code {
  font-size: 0.68rem;
  color: #aeb6d6;
  word-break: break-all;
}

.endpoint-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
  border-top: 1px solid #1e2240;
  font-size: 0.72rem;
}

.endpoint-probe {
  margin-top: 0.2rem;
}

.endpoint-probe--err {
  font-size: 0.68rem;
  color: hsl(0, 70%, 65%);
}

.json-block,
.metrics-block {
  margin: 0;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid #1e2240;
  border-radius: 4px;
  font-size: 0.68rem;
  line-height: 1.5;
  color: #aeb6d6;
  overflow-x: auto;
  max-height: 220px;
}

.metrics-block {
  max-height: 320px;
  color: hsl(140, 50%, 72%);
}

.probe-tag {
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  color: #5b6289;
}

.probe-tag--live { color: hsl(280, 60%, 72%); }

.challenge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.2rem;
}

.challenge-card {
  background: rgba(6, 8, 20, 0.65);
  border: 1px solid #252a4a;
  border-left: 3px solid hsl(0, 80%, 48%);
  border-radius: 8px;
  padding: 0.9rem 1rem;
}

.challenge-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.challenge-id {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: hsl(0, 80%, 65%);
}

.challenge-pts {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: #5b6289;
}

.challenge-card h3 {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  color: #e7ebff;
  font-weight: 500;
}

.challenge-cat {
  margin: 0 0 0.5rem;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #5b6289;
}

.challenge-hint {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.45;
  color: #8b93c9;
}

.submit-form {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 0.75rem;
  align-items: center;
  max-width: 520px;
  padding: 1rem;
  background: rgba(6, 8, 20, 0.65);
  border: 1px solid #252a4a;
  border-radius: 8px;
}

.submit-form label {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: #5b6289;
}

.submit-form input {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid #2a2f52;
  color: #e7ebff;
  padding: 0.55rem 0.7rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.82rem;
}

.submit-form input:focus {
  outline: none;
  border-color: hsl(0, 80%, 50%);
}

.submit-form button {
  grid-column: 1 / -1;
  margin-top: 0.3rem;
  background: hsl(0, 70%, 42%);
  color: #fff;
  border: none;
  padding: 0.65rem;
  border-radius: 4px;
  font-family: inherit;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.submit-form button:hover { filter: brightness(1.12); }

.submit-result {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.74rem;
}

.submit-result--ok { color: hsl(140, 60%, 65%); }
.submit-result--err { color: hsl(0, 70%, 65%); }

.scoreboard {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.scoreboard th {
  text-align: left;
  padding: 0.5rem 0.6rem;
  letter-spacing: 0.12em;
  font-size: 0.62rem;
  color: #5b6289;
  border-bottom: 1px solid #252a4a;
}

.scoreboard td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid #1a1e38;
  color: #c8d0f5;
}

.scoreboard tr:last-child td { border-bottom: none; }

.scoreboard .empty {
  text-align: center;
  color: #5b6289;
  padding: 1.2rem;
}

.sys-footer {
  text-align: center;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: #3a3f63;
  padding-top: 0.5rem;
}

/* ── Facilitator answer sheet (/answers) ─────────────────────────────────── */
.answer-note {
  margin: 0;
  font-size: 0.74rem;
  color: #ffb347;
  letter-spacing: 0.06em;
  padding: 0.6rem 0.9rem;
  border: 1px solid rgba(255, 179, 71, 0.35);
  border-radius: 6px;
  background: rgba(255, 179, 71, 0.06);
}

.answer-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.answer-card {
  background: rgba(6, 8, 20, 0.65);
  border: 1px solid #252a4a;
  border-left: 3px solid #ff3b3b;
  border-radius: 8px;
  padding: 1rem 1.1rem;
}

.answer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.answer-id {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: #ff3b3b;
}

.answer-pts {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: #5b6289;
}

.answer-card h2 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  color: #e7ebff;
  font-weight: 500;
}

.answer-flag {
  margin: 0 0 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.answer-flag span {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: #5b6289;
}

.answer-flag code {
  font-size: 0.85rem;
  color: #3ddc97;
  word-break: break-all;
}

.answer-dl {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.answer-dl div {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.5rem;
  align-items: start;
}

.answer-dl dt {
  margin: 0;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: #5b6289;
}

.answer-dl dd {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.45;
  color: #aeb6d6;
}

@media (max-width: 560px) {
  .answer-dl div { grid-template-columns: 1fr; gap: 0.15rem; }
}

/* ── OPS unified facilitator console (/ops) ──────────────────────────────── */
.ops { max-width: 1200px; }

.ops-copy {
  font-family: inherit;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  background: transparent;
  color: #8b93c9;
  border: 1px solid #252a4a;
  border-radius: 4px;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
}

.ops-copy:hover { color: #e7ebff; border-color: #333a63; }

.ops-hero {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.ops-hero-eye {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.hal--compact .hal-bezel {
  width: min(28vh, 200px);
}

.console--ops {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

.ops-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem;
  align-items: start;
}

.demo-runner-note {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: hsl(220, 12%, 58%);
}

.demo-runner-note--ok { color: hsl(140, 45%, 58%); }
.demo-runner-note--warn { color: hsl(38, 80%, 62%); }

.hub-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.hub-bay.hub-bay { max-width: 52rem; margin: 0 auto; padding: 2rem 1.5rem; }

.hal--hero { width: min(280px, 70vw); margin: 0 auto 1.5rem; }

.hub-join { text-align: center; padding: 1.5rem; margin: 1.5rem 0; }

.hub-join-note { color: hsl(220, 12%, 58%); margin: 0 0 1rem; }

.hub-join-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.hub-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.hub-qr-code {
  width: 84px;
  height: 84px;
  padding: 6px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 0 0 1px #2a2f52;
}

.hub-qr-code svg { display: block; width: 100%; height: 100%; }

.hub-qr-label {
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: hsl(220, 12%, 58%);
  text-align: center;
}

.spoke-tag {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: hsl(140, 45%, 58%);
  border: 1px solid hsla(140, 45%, 40%, 0.4);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.bay-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.bay-grid--compact { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.bay-count {
  font-size: 0.75rem;
  color: hsl(140, 45%, 58%);
  font-weight: normal;
}

.bay-card {
  border: 1px solid hsl(230, 20%, 22%);
  border-radius: 8px;
  padding: 1rem;
  background: hsl(230, 25%, 8%);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.bay-card--stale { opacity: 0.55; border-style: dashed; }

.bay-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.bay-card-id {
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  color: hsl(140, 45%, 58%);
}

.bay-card-mood {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: hsl(220, 12%, 58%);
}

.bay-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.bay-metrics dt { color: hsl(220, 12%, 48%); }
.bay-metrics dd { margin: 0; color: hsl(220, 20%, 82%); }

.bay-events {
  font-size: 0.75rem;
  color: hsl(220, 12%, 58%);
  max-height: 4.5rem;
  overflow: auto;
}

.bay-events li { margin: 0.15rem 0; }

/* Hub bay-card action buttons (distinct from the bay page's .bay-actions grid). */
.bay-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.bay-card--paused {
  opacity: 0.72;
  border-color: hsl(45, 40%, 28%);
}

.bay-card-status {
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: hsl(45, 80%, 68%);
  border: 1px solid hsla(45, 60%, 50%, 0.35);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
}

.demo-pause {
  color: hsl(45, 80%, 72%);
  border-color: hsla(45, 60%, 50%, 0.4);
}

.demo-stop {
  color: hsl(0, 70%, 72%);
  border-color: hsla(0, 50%, 45%, 0.45);
}

.demo-kill {
  color: hsl(0, 90%, 95%);
  background: hsla(0, 70%, 40%, 0.55);
  border-color: hsl(0, 75%, 55%);
}

.demo-kill:hover:not(:disabled) {
  color: #fff;
  background: hsla(0, 75%, 45%, 0.75);
  border-color: hsl(0, 85%, 65%);
}

.bay-peek-result {
  font-size: 0.7rem;
  max-height: 10rem;
  overflow: auto;
  margin: 0;
  padding: 0.5rem;
  border-radius: 4px;
  background: hsl(230, 30%, 6%);
  border: 1px solid hsl(230, 20%, 18%);
  white-space: pre-wrap;
  word-break: break-word;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.demo-card {
  background: rgba(6, 8, 20, 0.65);
  border: 1px solid #252a4a;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.demo-label {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: #ffb347;
  text-transform: uppercase;
}

.demo-cmd {
  margin: 0;
  padding: 0.55rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid #1e2240;
  border-radius: 4px;
  font-size: 0.65rem;
  line-height: 1.45;
  color: #aeb6d6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.demo-note {
  margin: 0;
  font-size: 0.68rem;
  color: #5b6289;
  line-height: 1.4;
}

.demo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.demo-btn {
  font-family: inherit;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  background: transparent;
  color: #8b93c9;
  border: 1px solid #252a4a;
  border-radius: 4px;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}

.demo-btn:hover:not(:disabled) { color: #e7ebff; border-color: #333a63; }

.demo-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.demo-run {
  color: hsl(0, 80%, 72%);
  border-color: hsla(0, 60%, 50%, 0.4);
}

.demo-hit {
  color: hsl(200, 80%, 72%);
  border-color: hsla(200, 60%, 50%, 0.4);
}

.demo-result {
  margin: 0.5rem 0 0;
  padding: 0.55rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid #1e2240;
  border-radius: 4px;
  font-size: 0.65rem;
  line-height: 1.45;
  color: #aeb6d6;
  overflow-x: auto;
  max-height: 180px;
  white-space: pre-wrap;
  word-break: break-word;
}

.demo-result--err { color: hsl(0, 70%, 65%); border-color: hsla(0, 50%, 40%, 0.5); }

.panel--fac { display: flex; flex-direction: column; gap: 0.9rem; }

.fac-key-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem;
}

.fac-key-row label {
  width: 100%;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: #5b6289;
}

.fac-key-row input {
  flex: 1;
  min-width: 12rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid #2a2f52;
  color: #e7ebff;
  padding: 0.55rem 0.7rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.82rem;
}

.fac-key-row button {
  background: hsl(0, 70%, 42%);
  color: #fff;
  border: none;
  padding: 0.55rem 0.85rem;
  border-radius: 4px;
  font-family: inherit;
  letter-spacing: 0.1em;
  cursor: pointer;
}

.fac-note {
  margin: 0;
  font-size: 0.72rem;
  color: #5b6289;
}

.fac-note--ok { color: #3ddc97; }
.fac-note--err { color: #ff3b3b; }

.fac-note-lock {
  margin-left: 0.5rem;
  background: none;
  border: 1px solid #2a2f52;
  color: #9aa3d1;
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  cursor: pointer;
}
.fac-note-lock:hover { border-color: #5b6289; color: #e7ebff; }

.ops-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: opacity 0.45s ease, transform 0.45s ease, filter 0.45s ease;
}

.ops-login--unlocked {
  opacity: 0;
  transform: translateY(-18px) scale(0.97);
  filter: blur(2px);
  pointer-events: none;
}

.ops-login-panel {
  width: min(28rem, 100%);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  transition: box-shadow 0.4s ease, border-color 0.4s ease;
}

.ops-login--unlocked .ops-login-panel {
  box-shadow: 0 0 40px hsla(140, 70%, 55%, 0.35);
  border-color: hsla(140, 55%, 45%, 0.5);
}

.ops-console--enter {
  animation: ops-console-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes ops-console-in {
  from {
    opacity: 0;
    transform: translateY(-32px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ops-login-panel .sys-brand { justify-content: center; }

.ops-login-panel .fac-key-row input { min-width: 0; }

#ops-logout {
  border-color: hsla(0, 60%, 45%, 0.4);
  color: hsl(0, 70%, 72%);
}

@media (max-width: 800px) {
  .ops-split { grid-template-columns: 1fr; }
}
