:root {
  color-scheme: dark;
  --ink: #070806;
  --panel: #0c0e0b;
  --panel-2: #11140e;
  --line: rgba(231, 255, 194, 0.14);
  --muted: #87907e;
  --text: #f0f5e9;
  --acid: #c8ff3d;
  --acid-soft: rgba(200, 255, 61, 0.14);
  --danger: #ff755f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--ink);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  height: 66px;
  padding: 0 max(22px, env(safe-area-inset-right)) 0 max(22px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: rgba(7, 8, 6, 0.92);
  position: relative;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.brand-mark {
  width: 10px;
  height: 10px;
  background: var(--acid);
  box-shadow: 0 0 18px rgba(200, 255, 61, 0.55);
}

.mode {
  font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.close {
  justify-self: end;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  min-height: 36px;
  padding: 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  font-weight: 760;
}

.close:hover,
.close:focus-visible {
  border-color: var(--acid);
  color: var(--acid);
}

main {
  min-height: calc(100dvh - 66px);
}

.gate {
  min-height: calc(100dvh - 66px);
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(340px, 0.7fr);
  align-items: stretch;
  background:
    radial-gradient(circle at 18% 65%, rgba(200, 255, 61, 0.1), transparent 27%),
    linear-gradient(135deg, transparent 0 64%, rgba(200, 255, 61, 0.035) 64% 64.2%, transparent 64.2%);
}

.gate-copy {
  align-self: end;
  padding: clamp(44px, 7vw, 110px);
}

.eyebrow {
  color: var(--acid);
  font: 750 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.22em;
  margin-bottom: 24px;
}

h1 {
  margin: 0;
  font-size: clamp(62px, 10vw, 148px);
  line-height: 0.83;
  letter-spacing: -0.075em;
  font-weight: 760;
}

.gate-copy p {
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.access-form {
  border-left: 1px solid var(--line);
  background: rgba(12, 14, 11, 0.88);
  padding: clamp(28px, 5vw, 72px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.access-row {
  display: grid;
  grid-template-columns: 1fr auto;
  border: 1px solid var(--line);
  background: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.access-row:focus-within {
  border-color: var(--acid);
  box-shadow: 0 0 0 3px var(--acid-soft);
}

.access-row input {
  min-width: 0;
  min-height: 58px;
  border: 0;
  outline: 0;
  padding: 0 18px;
  background: transparent;
  color: var(--text);
  font-size: 16px;
}

.access-row input::placeholder {
  color: #60675a;
}

.access-row button {
  min-height: 58px;
  min-width: 104px;
  border: 0;
  background: var(--acid);
  color: #101405;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.access-row button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.form-state {
  min-height: 21px;
  margin-top: 12px;
  color: var(--danger);
  font: 650 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.viewer {
  height: calc(100dvh - 66px);
  min-height: 420px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 52px;
  background: #000;
}

.stage {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #000;
}

.video-frame {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #000;
}

.video-frame video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #000;
}

.stage:fullscreen,
.stage:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  background: #000;
}

.fullscreen {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 4;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(200, 255, 61, 0.38);
  background: rgba(5, 6, 4, 0.76);
  color: var(--acid);
  font-size: 22px;
  line-height: 1;
  backdrop-filter: blur(10px);
}

.fullscreen:hover,
.fullscreen:focus-visible {
  border-color: var(--acid);
  background: rgba(17, 20, 14, 0.94);
}

.offline {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: radial-gradient(circle, rgba(200, 255, 61, 0.055), transparent 34%);
  text-align: center;
}

.offline strong {
  margin-top: 12px;
  font-size: clamp(20px, 3vw, 34px);
  letter-spacing: -0.035em;
}

.offline span {
  color: var(--muted);
  font-size: 13px;
}

.signal {
  height: 35px;
  display: flex;
  gap: 5px;
  align-items: end;
}

.signal i {
  display: block;
  width: 5px;
  background: var(--acid);
  animation: signal 1.05s ease-in-out infinite alternate;
}

.signal i:nth-child(1) { height: 12px; }
.signal i:nth-child(2) { height: 23px; animation-delay: 180ms; }
.signal i:nth-child(3) { height: 35px; animation-delay: 360ms; }

@keyframes signal {
  to { opacity: 0.22; transform: scaleY(0.62); transform-origin: bottom; }
}

.live {
  position: absolute;
  top: 18px;
  left: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(5, 6, 4, 0.76);
  border: 1px solid rgba(200, 255, 61, 0.38);
  color: var(--acid);
  font: 800 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.16em;
  backdrop-filter: blur(10px);
}

.live span,
.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--acid);
  box-shadow: 0 0 12px rgba(200, 255, 61, 0.7);
}

.viewer-bar {
  border-top: 1px solid var(--line);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.connection {
  display: flex;
  align-items: center;
  gap: 9px;
}

.connection-dot {
  background: #5f6659;
  box-shadow: none;
}

.connection-dot.active {
  background: var(--acid);
  box-shadow: 0 0 12px rgba(200, 255, 61, 0.7);
}

.source span {
  margin: 0 6px;
  color: var(--acid);
}

@media (max-width: 760px) {
  .topbar {
    height: 58px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .mode {
    display: none;
  }

  .topbar {
    grid-template-columns: 1fr auto;
  }

  main,
  .gate {
    min-height: calc(100dvh - 58px);
  }

  .gate {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .gate-copy {
    align-self: end;
    padding: 42px 20px 34px;
  }

  .eyebrow {
    margin-bottom: 18px;
  }

  h1 {
    font-size: clamp(58px, 19vw, 88px);
  }

  .gate-copy p {
    margin-top: 22px;
  }

  .access-form {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 20px 16px max(16px, env(safe-area-inset-bottom));
  }

  .access-row input,
  .access-row button {
    min-height: 54px;
  }

  .access-row button {
    min-width: 90px;
  }

  .viewer {
    height: calc(100dvh - 58px);
    min-height: 360px;
    grid-template-rows: minmax(0, 1fr) calc(48px + env(safe-area-inset-bottom));
  }

  .viewer-bar {
    padding: 0 14px env(safe-area-inset-bottom);
  }

  .live {
    top: 12px;
    left: 12px;
  }

  .fullscreen {
    top: 12px;
    right: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .signal i {
    animation: none;
  }
}
