#monitor-root {
  --bg: #0a0b0d;
  --bg2: #12151c;
  --panel: rgba(18, 21, 28, 0.86);
  --line: rgba(30, 35, 48, 0.95);
  --text: #fff;
  --muted: #8a919e;
  --cb-blue: #0052ff;
  --cb-blue-2: #2667ff;
  --green: #0fae6e;
  --display: 'Sora', system-ui, sans-serif;
  --body: 'Inter', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  line-height: 1.5;
}

#monitor-root * {
  box-sizing: border-box;
}

#monitor-root a {
  color: var(--cb-blue-2);
  text-decoration: none;
}

#monitor-root a:hover {
  text-decoration: underline;
}

#monitor-root .mon-shell {
  width: min(1180px, 94vw);
  margin: 0 auto;
  padding: 28px 0 64px;
}

#monitor-root .mon-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

#monitor-root .mon-kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cb-blue-2);
  margin-bottom: 8px;
}

#monitor-root .mon-am-link {
  font-family: var(--mono);
  font-size: 12px;
  margin: 6px 0 0;
}

#monitor-root .mon-am-link a {
  color: #5fd0ff;
  text-decoration: none;
  text-shadow: 0 0 10px rgba(95, 208, 255, 0.45);
}

#monitor-root .mon-am-link a:hover {
  color: #dff8ff;
  text-decoration: underline;
}

#monitor-root h1 {
  font-family: var(--display);
  font-size: clamp(26px, 5vw, 36px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

#monitor-root .mon-lede {
  color: var(--muted);
  max-width: 58ch;
  margin-top: 10px;
  font-size: 15px;
}

#monitor-root .mon-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

#monitor-root .mon-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg2);
}

#monitor-root .mon-toggle button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--body);
  font-size: 13px;
  padding: 8px 14px;
  cursor: pointer;
}

#monitor-root .mon-toggle button.is-active {
  background: var(--panel);
  color: var(--text);
}

#monitor-root .mon-live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3ddc84;
  margin-right: 7px;
  vertical-align: middle;
  box-shadow: 0 0 8px rgba(61, 220, 132, 0.85);
  animation: mon-live-pulse 1.8s ease-in-out infinite;
}

#monitor-root .mon-toggle button[data-mode="live"].is-active .mon-live-dot {
  animation: mon-live-pulse-active 1.5s ease-in-out infinite;
}

@keyframes mon-live-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1); box-shadow: 0 0 10px rgba(61, 220, 132, 0.9); }
}

@keyframes mon-live-pulse-active {
  0%, 100% { opacity: 0.8; transform: scale(0.95); box-shadow: 0 0 10px rgba(61, 220, 132, 0.95); }
  50% { opacity: 1; transform: scale(1.1); box-shadow: 0 0 16px rgba(61, 220, 132, 1), 0 0 28px rgba(61, 220, 132, 0.65); }
}

#monitor-root .mon-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

#monitor-root .mon-truth {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 4px;
  padding: 12px 14px;
  margin-bottom: 22px;
  font-size: 14px;
}

#monitor-root .mon-truth strong {
  font-family: var(--mono);
  font-weight: 500;
}

#monitor-root .mon-truth.is-external strong {
  color: var(--green);
}

#monitor-root .mon-durable {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

#monitor-root .mon-families {
  display: grid;
  gap: 18px;
}

#monitor-root .mon-family {
  border: 1px solid var(--line);
  background: rgba(18, 21, 28, 0.55);
  border-radius: 4px;
  padding: 14px;
}

#monitor-root .mon-family h2 {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
  font-weight: 500;
}

#monitor-root .mon-fam-count {
  color: var(--text);
  opacity: 0.55;
}

#monitor-root .mon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 6px;
}

#monitor-root .mon-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 4px;
  border: 1px solid rgba(95, 208, 255, 0.45);
  background: rgba(18, 21, 28, 0.45);
  cursor: default;
  padding: 0;
  min-height: 56px;
  overflow: hidden;
  box-shadow: 0 0 14px rgba(95, 208, 255, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

#monitor-root .mon-cell:hover {
  transform: translateY(-1px);
}

#monitor-root .mon-cell-lbl {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 4px;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: #5fd0ff;
  text-align: center;
  pointer-events: none;
  z-index: 2;
  word-break: break-all;
  font-weight: 600;
  opacity: 1;
  text-shadow:
    0 0 6px rgba(95, 208, 255, 1),
    0 0 14px rgba(95, 208, 255, 0.85),
    0 0 24px rgba(95, 208, 255, 0.5);
}

#monitor-root .mon-cell[data-state="dormant"] .mon-cell-in,
#monitor-root .mon-cell[data-state="probed"] .mon-cell-in {
  background: rgba(18, 21, 28, 0.55);
  opacity: 1;
}

#monitor-root .mon-cell[data-state="probed"] .mon-cell-lbl {
  color: #5fd0ff;
  text-shadow:
    0 0 6px rgba(95, 208, 255, 1),
    0 0 14px rgba(95, 208, 255, 0.85),
    0 0 24px rgba(95, 208, 255, 0.5);
}

#monitor-root .mon-cell[data-state="settled"] .mon-cell-lbl,
#monitor-root .mon-cell[data-state="external"] .mon-cell-lbl,
#monitor-root .mon-cell[data-state="verify"] .mon-cell-lbl {
  color: #3ddc84;
  text-shadow:
    0 0 8px rgba(61, 220, 132, 1),
    0 0 18px rgba(61, 220, 132, 0.9),
    0 0 30px rgba(61, 220, 132, 0.55);
}

#monitor-root .mon-cell[data-state="settled"],
#monitor-root .mon-cell[data-state="external"],
#monitor-root .mon-cell[data-state="verify"] {
  border-color: rgba(61, 220, 132, 0.55);
  box-shadow: 0 0 16px rgba(61, 220, 132, 0.28);
}

#monitor-root .mon-cell .mon-cell-in {
  position: absolute;
  inset: 0;
  border-radius: 3px;
  transform: scale(1);
  will-change: transform, opacity;
}

#monitor-root .mon-cell[data-state="probed"] .mon-cell-in {
  background: rgba(0, 82, 255, 0.12);
  opacity: 1;
}

#monitor-root .mon-cell[data-state="settled"] .mon-cell-in {
  background: rgba(61, 220, 132, 0.22);
  opacity: 1;
}

#monitor-root .mon-cell[data-state="external"] .mon-cell-in {
  background: rgba(61, 220, 132, 0.32);
  opacity: 1;
  box-shadow: 0 0 0 2px rgba(61, 220, 132, 0.55), 0 0 14px rgba(61, 220, 132, 0.35);
}

#monitor-root .mon-cell[data-state="verify"] .mon-cell-in {
  background: rgba(61, 220, 132, 0.16);
  opacity: 1;
}

#monitor-root .mon-cell.is-flash .mon-cell-in {
  outline: 2px solid var(--text);
  outline-offset: -2px;
}

#monitor-root .mon-cell:focus-visible {
  outline: 2px solid var(--cb-blue-2);
  outline-offset: 2px;
}

#monitor-root .mon-tip {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  display: none;
  max-width: 280px;
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: rgba(10, 11, 13, 0.96);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.55;
  color: var(--text);
}

#monitor-root .mon-tip b {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
  color: var(--text);
}

#monitor-root .mon-tape-wrap {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

#monitor-root .mon-tape-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

#monitor-root .mon-tape-head h3 {
  font-family: var(--display);
  font-size: 16px;
  margin: 0;
  font-weight: 700;
}

#monitor-root .mon-scrub {
  width: 100%;
  margin: 8px 0 14px;
  accent-color: var(--cb-blue);
}

#monitor-root .mon-tape {
  font-family: var(--mono);
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

#monitor-root .mon-tape-row {
  display: grid;
  grid-template-columns: 88px 1.2fr 64px 88px 120px 72px;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(30, 35, 48, 0.7);
  color: var(--muted);
}

#monitor-root .mon-tape-row:last-child {
  border-bottom: 0;
}

#monitor-root .mon-tape-row.is-new {
  color: var(--text);
  background: rgba(0, 82, 255, 0.08);
}

#monitor-root .mon-tape-row .src-internal {
  color: var(--muted);
}

#monitor-root .mon-tape-row .src-external {
  color: var(--green);
}

#monitor-root .mon-err {
  border: 1px solid rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.08);
  border-radius: 4px;
  padding: 14px 16px;
  color: #ffb4b4;
  font-size: 14px;
}

#monitor-root .mon-foot {
  margin-top: 28px;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 720px) {
  #monitor-root .mon-tape-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #monitor-root .mon-live-dot {
    animation: none;
    opacity: 1;
  }

  #monitor-root .mon-cell {
    transition: none;
  }

  #monitor-root .mon-cell:hover {
    transform: none;
  }
}
