@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;700&display=swap");

:root {
  --control-min-height: 32px;
  --control-padding-y: 7px;
  --control-padding-x: 10px;
  --control-font-size: 11px;
  --nav-tab-width: 112px;
  --nav-tab-height: 34px;
  --bg: #11151c;
  --fg: #ececec;
  --dim: #c7c7c7;
  --muted: #8f8f8f;
  --line: rgba(255, 255, 255, 0.12);
  --panel: rgba(255, 255, 255, 0.04);
  --accent: #ff6e98;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background-color: #000;
  background-image: radial-gradient(1200px 800px at 50% 18%, #151515 0%, #080808 42%, #000 100%);
  color: var(--fg);
  font-family: "IBM Plex Mono", monospace;
  font-size: clamp(12px, 1.8vw, 14px);
  line-height: 1.35;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 1.6vw, 24px);
}

body.terminal-bg-only {
  padding: 0;
}

body.terminal-bg-only .wrap {
  padding: 0;
  gap: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body.terminal-bg-only .topbar,
body.terminal-bg-only .metaStrip,
body.terminal-bg-only .tabs {
  display: none !important;
}

body.terminal-bg-only .screen {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.14;
  background:
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 0, rgba(255, 255, 255, 0.05) 1px, transparent 3px, transparent 5px),
    repeating-linear-gradient(to right, rgba(255, 0, 0, 0.03) 0, rgba(255, 0, 0, 0.03) 1px, transparent 2px, transparent 4px);
  animation: pageScan 9s linear infinite;
}

@keyframes pageScan {
  0% { transform: translateY(-3px); }
  50% { transform: translateY(3px); }
  100% { transform: translateY(-3px); }
}

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.985);
  box-shadow: 0 26px 72px rgba(0, 0, 0, 0.66);
}

.topbar {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  backdrop-filter: blur(4px);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  user-select: none;
}

.toplinks {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.topnavToggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: var(--nav-tab-height);
  padding: 0 14px;
  border: 1px solid rgba(255, 111, 121, 0.45);
  background: #5f0d14;
  color: var(--fg);
  font: inherit;
  font-size: var(--control-font-size);
  letter-spacing: 0.9px;
  text-transform: uppercase;
  cursor: pointer;
}

.topnavToggle:hover {
  border-color: rgba(255, 132, 141, 0.55);
  background: #7a111b;
}

.toplinks a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 var(--nav-tab-width);
  inline-size: var(--nav-tab-width);
  height: var(--nav-tab-height);
  block-size: var(--nav-tab-height);
  min-height: 0;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg);
  border: 1px solid rgba(255, 111, 121, 0.35);
  padding: 0 var(--control-padding-x);
  font-size: var(--control-font-size);
  font-weight: 500;
  background: #5f0d14;
  text-decoration: none;
  transition: transform 0.16s ease, border-color 0.2s ease, background 0.2s ease;
}

.toplinks a:hover {
  border-color: rgba(255, 132, 141, 0.55);
}

.toplinks a.active {
  background: #8f1520;
  border-color: rgba(255, 111, 121, 0.62);
}

.toplinks a::before {
  content: "";
  position: absolute;
  inset: -16%;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  mix-blend-mode: screen;
  background:
    linear-gradient(90deg, rgba(255, 35, 85, 0.45), rgba(255, 255, 255, 0) 45%, rgba(0, 210, 255, 0.42)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.16) 0, rgba(255, 255, 255, 0.16) 1px, transparent 2px, transparent 4px);
}

.toplinks a,
.pill {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.toplinks a::after,
.pill::after {
  content: "";
  position: absolute;
  inset: -22%;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  mix-blend-mode: screen;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.2) 0,
      rgba(255, 255, 255, 0.2) 1px,
      transparent 2px,
      transparent 4px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255, 0, 0, 0.14) 0,
      rgba(255, 0, 0, 0.14) 1px,
      transparent 2px,
      transparent 3px
    );
  transform: translate3d(0, 0, 0);
}

.toplinks a:hover::after,
.toplinks a:focus-visible::after,
.pill:hover::after,
.pill:focus-visible::after {
  opacity: 0.42;
  animation: btnNoise 90ms steps(2, end) infinite, btnGlitch 180ms steps(2, end) infinite;
}

.toplinks a:hover,
.toplinks a:focus-visible {
  border-color: rgba(255, 154, 165, 0.78);
  box-shadow: inset 0 0 0 1px rgba(255, 180, 186, 0.28), 0 0 16px rgba(181, 19, 29, 0.42);
  text-shadow: -1px 0 rgba(255, 30, 80, 0.5), 1px 0 rgba(0, 200, 255, 0.5), 0 0 7px rgba(255, 255, 255, 0.35);
  filter: contrast(1.2) saturate(1.22);
}

.toplinks a:hover::before,
.toplinks a:focus-visible::before {
  opacity: 0.86;
  animation: navBtnRgbSplit 85ms steps(2, end) infinite;
}

.toplinks a:hover::after,
.toplinks a:focus-visible::after {
  opacity: 0.72;
  animation: btnNoise 55ms steps(2, end) infinite, btnGlitch 120ms steps(2, end) infinite;
}

@keyframes btnNoise {
  0% { transform: translate3d(-1px, 0, 0) scale(1); }
  50% { transform: translate3d(1px, 1px, 0) scale(1.03); }
  100% { transform: translate3d(0, -1px, 0) scale(1.01); }
}

@keyframes btnGlitch {
  0% { clip-path: inset(0 0 78% 0); }
  25% { clip-path: inset(34% 0 44% 0); }
  50% { clip-path: inset(58% 0 18% 0); }
  75% { clip-path: inset(18% 0 64% 0); }
  100% { clip-path: inset(0 0 78% 0); }
}

@keyframes navBtnRgbSplit {
  0% { transform: translate3d(-2px, 0, 0) skewX(0deg); }
  50% { transform: translate3d(2px, -1px, 0) skewX(-2deg); }
  100% { transform: translate3d(-1px, 1px, 0) skewX(2deg); }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: 1px;
  font-size: 12px;
  color: rgba(236, 230, 220, 0.84);
}

.dots {
  display: flex;
  gap: 7px;
}

.dots span {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: linear-gradient(145deg, #8f0d1c 0%, #1d0205 100%);
  box-shadow: inset 0 0 0 1px rgba(35, 0, 0, 0.24);
}

.dots span:nth-child(2) {
  background: linear-gradient(145deg, #780914 0%, #140103 100%);
}

.dots span:nth-child(3) {
  background: linear-gradient(145deg, #5b060f 0%, #0b0001 100%);
}

.title {
  font-size: 12px;
}

.meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.42);
  min-width: 0;
}

.metaStrip {
  display: flex;
  justify-content: flex-end;
}

.pill {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  padding: var(--control-padding-y) var(--control-padding-x);
  min-height: var(--control-min-height);
  line-height: 1;
  font-size: var(--control-font-size);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 2px 0;
}

.tab {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.82);
  border-radius: 12px;
  padding: 8px 11px;
  font-size: 12px;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.2s ease, border-color 0.2s ease;
}

.tab:hover {
  transform: translateY(-1px);
}

.tab.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.24);
  color: var(--fg);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

.tab.plus {
  border-style: dashed;
}

.screen {
  position: relative;
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(1000px 620px at 20% 12%, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.025) 45%, rgba(0, 0, 0, 0.65)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.014));
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.52);
  filter: contrast(1.12) saturate(0.82) brightness(0.98) sepia(0.02) blur(0.24px);
  transition: opacity 0.2s ease, filter 0.2s ease, transform 0.2s ease;
}

.crt {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.22) 0,
      rgba(255, 255, 255, 0.22) 1px,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0) 3px
    ),
    repeating-linear-gradient(
      to right,
      rgba(255, 0, 0, 0.06) 0,
      rgba(255, 0, 0, 0.06) 1px,
      rgba(0, 255, 255, 0) 2px,
      rgba(0, 255, 255, 0) 4px
    );
  opacity: 0.3;
  mix-blend-mode: overlay;
  animation: scanDrift 0.11s steps(2, end) infinite, noisePulse 0.16s steps(2, end) infinite;
}

.screen.line-rush .crt {
  animation-duration: 0.05s, 0.08s;
  opacity: 0.42;
}

.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.08) 46%,
      rgba(255, 255, 255, 0.13) 50%,
      rgba(255, 255, 255, 0.08) 54%,
      rgba(255, 255, 255, 0) 100%
    ),
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.02) 0,
      rgba(255, 255, 255, 0.02) 1px,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0) 3px
    );
  background-size: 100% 260px, 100% 100%;
  mix-blend-mode: soft-light;
  opacity: 0.2;
  animation: verticalRoll 4s linear infinite, noisePulse 0.16s steps(2, end) infinite;
}

.screen.line-rush::before {
  animation-duration: 0.72s, 0.08s;
  opacity: 0.32;
}

.screen::after {
  content: "";
  position: absolute;
  inset: -50px;
  pointer-events: none;
  background: radial-gradient(900px 600px at 50% 35%, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.4) 52%, rgba(0, 0, 0, 0.72));
  opacity: 0.44;
  animation: tubeWarp 3.4s steps(2, end) infinite;
}

.chroma {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  mix-blend-mode: screen;
  background:
    radial-gradient(620px 420px at 72% 22%, rgba(255, 0, 0, 0.58), rgba(0, 0, 0, 0) 60%),
    radial-gradient(540px 420px at 28% 72%, rgba(0, 160, 255, 0.56), rgba(0, 0, 0, 0) 60%);
  filter: blur(0.45px);
  animation: chromaDrift 0.95s steps(3, end) infinite;
}

.screen.line-rush .chroma {
  animation-duration: 0.28s;
  opacity: 0.42;
}

#glitch {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0)),
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.08) 0, rgba(255, 255, 255, 0.08) 1px, rgba(0, 0, 0, 0) 2px, rgba(0, 0, 0, 0) 6px),
    linear-gradient(90deg, rgba(255, 20, 60, 0.24), rgba(0, 200, 255, 0.2));
}

#glitch.on {
  opacity: 0.34;
  animation: shake 0.18s linear 1, glitchSlice 0.18s steps(2, end) 1, glitchFlash 0.18s linear 1;
}

@keyframes shake {
  0% { transform: translate(0, 0); }
  25% { transform: translate(2px, -1px); }
  50% { transform: translate(-3px, 1px); }
  75% { transform: translate(1px, 2px); }
  100% { transform: translate(0, 0); }
}

.flicker {
  animation: flicker 1.3s steps(20, end) infinite;
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  5% { opacity: 0.96; }
  6% { opacity: 0.92; }
  7% { opacity: 0.98; }
  33% { opacity: 0.95; }
  34% { opacity: 0.9; }
  35% { opacity: 0.99; }
  61% { opacity: 0.94; }
  62% { opacity: 0.91; }
  63% { opacity: 1; }
  81% { opacity: 0.95; }
  82% { opacity: 0.92; }
  83% { opacity: 1; }
  92% { opacity: 0.93; }
  93% { opacity: 0.9; }
  94% { opacity: 0.99; }
}

@keyframes scanDrift {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-1px, 1px); }
  40% { transform: translate(1px, 2px); }
  60% { transform: translate(-2px, 3px); }
  80% { transform: translate(2px, 4px); }
  100% { transform: translate(0, 5px); }
}

@keyframes chromaDrift {
  0% { transform: translate(-3px, 0); }
  25% { transform: translate(3px, -2px); }
  50% { transform: translate(-2px, 2px); }
  75% { transform: translate(2px, 1px); }
  100% { transform: translate(-3px, 0); }
}

@keyframes verticalRoll {
  0% { background-position: 0 -260px, 0 0; }
  100% { background-position: 0 100%, 0 0; }
}

@keyframes noisePulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.4; }
}

@keyframes glitchSlice {
  0% { clip-path: inset(0 0 72% 0); }
  25% { clip-path: inset(32% 0 44% 0); }
  50% { clip-path: inset(56% 0 16% 0); }
  75% { clip-path: inset(18% 0 62% 0); }
  100% { clip-path: inset(0 0 72% 0); }
}

@keyframes glitchFlash {
  0% { filter: brightness(1.45) contrast(1.2); }
  100% { filter: brightness(1) contrast(1); }
}

@keyframes tubeWarp {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.012, 0.994); }
}

.inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 16px 10px;
}

.out {
  flex: 1;
  overflow: auto;
  padding-right: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.08);
}

.out::-webkit-scrollbar {
  width: 8px;
}

.out::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
}

.line-dim { color: var(--dim); }
.line-muted { color: var(--muted); }
.line-warn { color: #ff4d57; }
.line-fatal { color: #fff; }
.line-load {
  color: #fff;
  letter-spacing: 0.2px;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}
.line-echo { color: #f1f1f1; }

.line-ascii {
  white-space: pre;
  word-break: normal;
  font-family: "Consolas", "Lucida Console", "Courier New", monospace;
  font-variant-ligatures: none;
  line-height: 1.05;
  text-shadow: none;
  letter-spacing: 0;
}

.line-logo {
  color: #ff4d57;
}

.promptTitle {
  margin: 2px 0 4px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 170, 186, 0.75);
}

.inputbar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  padding-top: 8px;
}

.promptLabel {
  color: var(--accent);
  text-shadow: 0 0 10px rgba(255, 110, 152, 0.3);
  font-size: 14px;
  min-width: 46px;
}

.cmdWrap {
  position: relative;
  flex: 1;
}

#cmd {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--fg);
  font: inherit;
  padding: 5px 0;
  caret-color: #f2f2f2;
}

.pixel-caret {
  position: absolute;
  top: 50%;
  left: 0;
  width: 8px;
  height: 8px;
  border-radius: 0;
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
  transform: translateY(-50%);
  pointer-events: none;
  animation: pixelBlink 0.92s steps(1, end) infinite;
}

.pixel-caret.hidden {
  display: none;
}

@keyframes pixelBlink {
  0%, 48% { opacity: 1; }
  49%, 100% { opacity: 0; }
}

.camView {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: #000;
  overflow: hidden;
  isolation: isolate;
}

.camView[hidden] {
  display: none !important;
}

.camNvr {
  position: relative;
  z-index: 5;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-width: none;
  max-height: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0;
  padding: 10px;
  background: rgba(0, 0, 0, 0.92);
  box-shadow: 0 20px 64px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.camNvrHud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 0 2px;
  flex-wrap: wrap;
}

.camBanner {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  padding: 6px 10px;
  color: rgba(255, 255, 255, 0.94);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.camStamp {
  font-size: 14px;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.9);
}

.camGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  aspect-ratio: 2 / 1;
  gap: 8px;
  flex: 1;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
  min-height: 0;
  align-content: stretch;
  overflow: hidden;
}

.camTile {
  position: relative;
  display: flex;
  flex-direction: column;
  aspect-ratio: 4 / 3;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
  overflow: hidden;
  background: #050608;
  cursor: pointer;
  transition: opacity 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.camTile.is-dimmed {
  opacity: 0.4;
  filter: saturate(0.75);
}

.camTile.is-focused {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(74vw, 1100px, calc((100dvh - 120px) * 4 / 3), calc(100dvw - 24px));
  aspect-ratio: 4 / 3;
  max-width: calc(100dvw - 24px);
  max-height: calc(100dvh - 24px);
  transform: translate(-50%, -50%);
  z-index: 40;
  box-shadow:
    0 0 0 100vmax rgba(0, 0, 0, 0.52),
    0 26px 80px rgba(0, 0, 0, 0.72);
}

.camTile.is-focused .camTileBody {
  aspect-ratio: 4 / 3;
  height: auto;
}

.camTileTop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.66), rgba(0, 0, 0, 0.26));
}

.camTileHead {
  display: flex;
  align-items: center;
  gap: 8px;
}

.camRec {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border: 1px solid rgba(255, 90, 90, 0.45);
  border-radius: 999px;
  background: rgba(255, 0, 0, 0.08);
  color: rgba(255, 220, 220, 0.95);
  font-size: 9px;
  letter-spacing: 1px;
  font-weight: 700;
}

.recDot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #ff4b4b;
  box-shadow: 0 0 10px rgba(255, 70, 70, 0.6);
  animation: recBlink 1s steps(1, end) infinite;
}

@keyframes recBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.25; }
}

.camTileId {
  font-size: clamp(9px, 1.2vw, 11px);
  letter-spacing: 0.8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.camToggle {
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-size: clamp(9px, 1.1vw, 10px);
  letter-spacing: 0.8px;
  padding: 4px 8px;
  cursor: pointer;
  text-transform: uppercase;
}

.camToggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.camTileBody {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 1 1 auto;
  aspect-ratio: 4 / 3;
  min-height: 0;
  background: #000;
  overflow: hidden;
}

.camVideo {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  box-shadow: none;
  background: #000;
  object-fit: contain;
  filter: grayscale(1) contrast(1.2) brightness(0.82) saturate(0);
}

iframe.camVideo {
  border: 0;
  outline: 0;
  box-shadow: none;
  pointer-events: none;
}

.camTile--zoom .camVideo {
  transform: scale(1.75);
  transform-origin: 50% 62%;
}

.camTile--cam02-crop .camVideo {
  object-fit: cover;
  object-position: 46% 50%;
  transform: scale(1.08);
  transform-origin: center;
}

.camTile--cam06-crop .camVideo {
  object-fit: cover;
  object-position: 50% 48%;
  transform: scale(1.1);
  transform-origin: center;
}

.camTile--cam05-embed .camVideo {
  transform: scale(1.16);
  transform-origin: 50% 50%;
}

.camTile--cam05-embed.cam05-jitter .camVideo {
  animation: cam05-jitter 96ms steps(2, end) infinite;
}

.camTile--cam05-embed.cam05-desync .camVideo {
  filter: grayscale(1) contrast(1.45) brightness(0.68) saturate(0);
}

.camTile--cam05-embed.cam05-desync .camFx {
  opacity: 1;
  background:
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.08) 0, rgba(255, 255, 255, 0.08) 1px, rgba(0, 0, 0, 0) 2px, rgba(0, 0, 0, 0) 6px),
    radial-gradient(560px 360px at 50% 40%, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0) 62%);
}

@keyframes cam05-jitter {
  0% { transform: scale(1.16) translate(0, 0); }
  20% { transform: scale(1.17) translate(-2px, 1px); }
  40% { transform: scale(1.15) translate(2px, -1px); }
  60% { transform: scale(1.16) translate(-1px, -1px); }
  80% { transform: scale(1.18) translate(2px, 1px); }
  100% { transform: scale(1.16) translate(0, 0); }
}

.camFx,
.noSignal {
  position: absolute;
  inset: 0;
}

.camFx {
  z-index: 2;
  pointer-events: none;
  opacity: 0.86;
  mix-blend-mode: overlay;
  background:
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.045) 0, rgba(255, 255, 255, 0.045) 1px, rgba(0, 0, 0, 0) 3px, rgba(0, 0, 0, 0) 8px),
    radial-gradient(600px 420px at 50% 40%, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0) 60%);
}

.camTileFooter {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  font-size: clamp(9px, 1.1vw, 10px);
  letter-spacing: 0.8px;
  color: rgba(255, 255, 255, 0.75);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.68), rgba(0, 0, 0, 0.25));
}

.camTileState {
  font-size: 10px;
  letter-spacing: 0.8px;
}

.camTileState.live {
  color: rgba(255, 130, 130, 0.95);
  font-weight: 700;
}

.noSignal {
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
}

.noSignal.on,
.camTile.off .noSignal {
  display: flex;
}

.noSignalBox {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  padding: 10px 12px;
  width: min(92%, 320px);
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

.noSignalTitle {
  font-size: 12px;
  letter-spacing: 1.4px;
}

.noSignalSub {
  margin-top: 4px;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.58);
  letter-spacing: 0.8px;
}

.camTile.off .camVideo {
  opacity: 0.08;
}

.camTile.off .camToggle {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.72);
}

.camTile.off .camTileState {
  color: rgba(255, 255, 255, 0.52);
}

.camTile.unavailable .camTileState {
  color: #f2d3d3;
}

body.cam-active #termView,
body.cam-active .inputbar,
body.cam-active .promptLabel {
  display: none !important;
}

body.cam-active #cmd {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

body.monitor-off .screen {
  opacity: 0;
  filter: brightness(0) contrast(1);
  transform: scaleY(0.98);
}

body.monitor-on-pulse .screen {
  animation: monitorPowerOn 0.35s ease-out 1;
}

@keyframes monitorPowerOn {
  0% { opacity: 0.08; filter: brightness(2.2) blur(1px); transform: scaleY(1.03); }
  100% { opacity: 1; filter: contrast(1.08) saturate(0.9); transform: scaleY(1); }
}

.loreOverlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background: transparent;
  z-index: 8;
}

.loreOverlay[hidden] {
  display: none !important;
}

.loreOverlay::before,
.loreOverlay::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
}

.loreShell {
  position: relative;
  z-index: 2;
  width: min(820px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loreQuestion {
  font-size: clamp(20px, 3.3vw, 34px);
  line-height: 1.25;
  text-align: center;
  letter-spacing: 0.4px;
  color: rgba(255, 255, 255, 0.95);
}

#loreInput {
  width: min(560px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  font: inherit;
  text-align: center;
  padding: 11px 12px;
  outline: none;
}

#loreInput:focus {
  border-color: rgba(255, 255, 255, 0.42);
}

#loreSubmit {
  min-width: 110px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: inherit;
  padding: 9px 16px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

#loreSubmit:hover {
  background: rgba(255, 255, 255, 0.2);
}

#loreSubmit:disabled,
#loreInput:disabled {
  opacity: 0.58;
  cursor: default;
}

@media (max-width: 640px) {
  body {
    display: block;
    padding: 0;
  }

  .wrap {
    width: 100%;
    height: 100%;
    padding: 12px;
    gap: 8px;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }

  .brand {
    width: auto;
    justify-content: flex-start;
    gap: 10px;
  }

  .meta {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    align-items: stretch;
  }

  #metaNode,
  #metaSession {
    max-width: 100%;
  }

  .tabs {
    overflow-x: auto;
    padding-bottom: 6px;
    flex-wrap: nowrap;
  }

  .tab {
    white-space: nowrap;
  }

  .screen {
    border-radius: 14px;
  }

  .inner {
    padding: 12px 12px 8px;
  }

  .camView {
    padding: 12px;
  }

  .camNvr {
    width: 100%;
    border-radius: 0;
    max-height: 100%;
  }

  .camNvrHud {
    flex-direction: column;
    align-items: flex-start;
  }

  .camGrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .topnavToggle { display: inline-flex; }

  .toplinks {
    display: none;
    grid-column: 1 / -1;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 0;
  }

  .topbar.nav-open .toplinks { display: flex; }

  .toplinks a {
    flex: 1 1 calc(50% - 6px);
    inline-size: auto;
    width: auto;
  }
}

@media (max-height: 900px) {
  .camView {
    align-items: flex-start;
  }
}

@media (max-height: 760px) {
  .camGrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }
}
