:root {
  color-scheme: dark;
  --ink: #f3f1e9;
  --muted: #a6aaa2;
  --lime: #d9ff68;
  --lime-dark: #a5c53b;
  --coral: #ff7058;
  --panel: rgba(17, 20, 18, 0.86);
  --panel-solid: #111412;
  --line: rgba(243, 241, 233, 0.16);
  --black: #080a09;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100svh;
  overflow: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 100svh;
  overflow: hidden;
  background:
    linear-gradient(110deg, rgba(4, 7, 5, 0.96) 0%, rgba(8, 11, 9, 0.76) 48%, rgba(16, 22, 18, 0.2) 100%),
    radial-gradient(circle at 78% 30%, rgba(217, 255, 104, 0.1), transparent 34%),
    #0a0c0b;
}

.app-shell::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 100% 4px;
  content: "";
  mix-blend-mode: soft-light;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(22px, env(safe-area-inset-top)) clamp(22px, 4vw, 64px) 16px;
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 850;
  letter-spacing: 0.24em;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 18px;
  height: 18px;
  border: 2px solid var(--lime);
  border-radius: 50%;
}

.brand-mark::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 2px;
  background: var(--lime);
  content: "";
  transform: translate(-50%, -50%) rotate(-38deg);
}

.connection-badge,
.peer-label {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 10, 9, 0.56);
  color: #d0d4cc;
  font-size: 0.72rem;
  font-weight: 720;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  backdrop-filter: blur(14px);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 12px rgba(217, 255, 104, 0.72);
}

.stage {
  position: relative;
  z-index: 2;
  min-height: 0;
  margin: 0 clamp(12px, 2.3vw, 36px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: clamp(22px, 3vw, 42px);
  background:
    radial-gradient(circle at 76% 45%, rgba(217, 255, 104, 0.13), transparent 28%),
    linear-gradient(135deg, #171c18 0%, #0c0f0d 56%, #111713 100%);
  box-shadow: var(--shadow);
}

.remote-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 600ms ease;
}

[data-state="call"] .remote-video,
[data-state="connecting"] .remote-video {
  opacity: 1;
}

[data-state="call"] .stage::after,
[data-state="connecting"] .stage::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.32), transparent 28%, transparent 72%, rgba(0, 0, 0, 0.46));
  content: "";
}

.map-field {
  position: absolute;
  top: 50%;
  right: clamp(-90px, 3vw, 50px);
  width: min(56vw, 720px);
  aspect-ratio: 1;
  border: 1px solid rgba(217, 255, 104, 0.2);
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at center, transparent 0 49px, rgba(217, 255, 104, 0.08) 50px 51px),
    radial-gradient(circle at 48% 40%, rgba(217, 255, 104, 0.06), transparent 62%);
  opacity: 0.82;
  transform: translateY(-50%);
  transition: opacity 400ms ease;
}

[data-state="call"] .map-field,
[data-state="connecting"] .map-field {
  opacity: 0;
}

.orbit {
  position: absolute;
  border: 1px solid rgba(217, 255, 104, 0.19);
  border-radius: 50%;
  transform: rotate(-18deg);
}

.orbit-one {
  inset: 9% 32%;
}

.orbit-two {
  inset: 17% 17%;
}

.orbit-three {
  inset: 31% 5%;
}

.map-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 2px solid #111713;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 8px rgba(217, 255, 104, 0.08), 0 0 24px var(--lime);
}

.dot-one {
  top: 28%;
  left: 27%;
}

.dot-two {
  top: 62%;
  right: 23%;
}

.dot-three {
  right: 35%;
  bottom: 16%;
}

.route-line {
  position: absolute;
  top: 43%;
  left: 26%;
  width: 55%;
  height: 30%;
  border-top: 1px dashed rgba(217, 255, 104, 0.52);
  border-radius: 50%;
  transform: rotate(20deg);
}

.intro-card,
.state-card,
.error-card {
  position: absolute;
  bottom: clamp(30px, 6.5vh, 86px);
  left: clamp(24px, 5vw, 84px);
  z-index: 4;
  width: min(600px, calc(100% - 48px));
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--lime);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.2em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 680px;
  margin-bottom: 22px;
  font-size: clamp(3.8rem, 8vw, 8.2rem);
  font-weight: 710;
  letter-spacing: -0.075em;
  line-height: 0.78;
}

h1 em {
  color: var(--lime);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}

.lede {
  max-width: 500px;
  margin-bottom: 28px;
  color: #c2c6bf;
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.55;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  gap: 22px;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 11px 0 23px;
  border: 0;
  border-radius: 999px;
  background: var(--lime);
  color: #11150d;
  font-weight: 800;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}

.primary-action:hover,
.secondary-action:hover {
  background: #e5ff91;
  transform: translateY(-2px);
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.button-arrow {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: #11150d;
  color: var(--lime);
  font-size: 1.15rem;
}

.consent-copy {
  max-width: 520px;
  margin: 20px 0 0;
  color: #848a82;
  font-size: 0.76rem;
  line-height: 1.55;
}

.consent-copy a {
  color: #b9c49c;
}

.state-card,
.error-card {
  bottom: 50%;
  width: min(530px, calc(100% - 48px));
  padding: clamp(24px, 4vw, 44px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  transform: translateY(50%);
  backdrop-filter: blur(22px);
}

.state-card h2,
.error-card h2,
.report-dialog h2 {
  margin-bottom: 13px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.state-card > p:not(.eyebrow, .queue-note),
.error-card > p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.55;
}

.queue-note {
  margin: 24px 0 0;
  color: #d6dacd;
  font-size: 0.78rem;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.radar {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 46px;
  height: 46px;
  overflow: hidden;
  border: 1px solid rgba(217, 255, 104, 0.3);
  border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 7px, rgba(217, 255, 104, 0.15) 8px 9px);
}

.radar span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50%;
  height: 1px;
  background: linear-gradient(90deg, var(--lime), transparent);
  transform-origin: left;
  animation: scan 2s linear infinite;
}

@keyframes scan {
  to { transform: rotate(360deg); }
}

.secondary-action {
  min-height: 48px;
  margin-top: 8px;
  padding: 0 22px;
}

.peer-label {
  position: absolute;
  top: 22px;
  left: 22px;
  z-index: 5;
}

.local-card {
  position: absolute;
  right: clamp(14px, 2.5vw, 34px);
  bottom: clamp(14px, 2.5vw, 34px);
  z-index: 6;
  width: clamp(130px, 18vw, 260px);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  background: #181c19;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.42);
}

.local-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.local-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #151916;
  color: var(--muted);
  font-size: 0.78rem;
}

.local-label {
  position: absolute;
  bottom: 10px;
  left: 10px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.56);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.privacy-note {
  position: absolute;
  top: 50%;
  right: clamp(20px, 3vw, 46px);
  z-index: 4;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: min(260px, 25vw);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(8, 10, 9, 0.46);
  transform: translateY(-50%);
  backdrop-filter: blur(16px);
}

.privacy-icon {
  color: var(--lime);
  font-size: 0.7rem;
  text-shadow: 0 0 12px var(--lime);
}

.privacy-note p {
  margin: 0;
  color: #aeb3aa;
  font-size: 0.72rem;
  line-height: 1.45;
}

.privacy-note strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
}

[data-state="call"] .privacy-note,
[data-state="connecting"] .privacy-note {
  top: auto;
  right: auto;
  bottom: 20px;
  left: 20px;
  transform: none;
}

.controls {
  position: relative;
  z-index: 20;
  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  padding: 14px 18px max(14px, env(safe-area-inset-bottom));
}

.control-button {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #151815;
  color: #d6d9d2;
  font-size: 0.78rem;
  font-weight: 740;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.control-button:hover {
  border-color: rgba(255, 255, 255, 0.34);
  transform: translateY(-2px);
}

.control-button[aria-pressed="true"] {
  background: #343a32;
  color: #a6aaa2;
}

.control-primary {
  border-color: var(--lime);
  background: var(--lime);
  color: #11150d;
}

.control-danger:hover {
  border-color: var(--coral);
  color: #ff9a89;
}

.control-icon {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  font-size: 1rem;
  font-weight: 900;
}

.footer-note {
  position: absolute;
  right: clamp(22px, 4vw, 64px);
  bottom: 21px;
  z-index: 21;
  display: flex;
  gap: 7px;
  color: #6f756e;
  font-size: 0.66rem;
}

.controls:not([hidden]) ~ .footer-note {
  display: none;
}

.report-dialog {
  width: min(520px, calc(100% - 32px));
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 26px;
  background: #141714;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.report-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
}

.report-dialog form {
  padding: 28px;
}

.dialog-heading {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
}

.dialog-heading .eyebrow {
  margin-bottom: 12px;
}

.dialog-heading h2 {
  margin-bottom: 0;
}

.dialog-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 1.25rem;
  cursor: pointer;
}

.dialog-copy {
  color: var(--muted);
}

.report-options {
  display: grid;
  gap: 8px;
}

.report-options button {
  min-height: 50px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #1a1e1a;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.report-options button:hover {
  border-color: var(--coral);
  background: #241a17;
}

noscript {
  position: fixed;
  inset: 20px;
  z-index: 100;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: #111;
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .app-shell {
    min-height: 100svh;
  }

  .stage {
    min-height: 0;
  }

  .map-field {
    right: -32vw;
    width: 100vw;
    opacity: 0.5;
  }

  .privacy-note {
    top: 22px;
    right: 22px;
    width: min(245px, calc(100% - 44px));
    transform: none;
  }

  .intro-card {
    bottom: 28px;
  }

  h1 {
    font-size: clamp(3.5rem, 15vw, 6rem);
  }
}

@media (max-width: 640px) {
  .app-shell {
    grid-template-rows: auto minmax(560px, 1fr) auto;
  }

  .topbar {
    padding: max(17px, env(safe-area-inset-top)) 18px 12px;
  }

  .connection-badge {
    padding: 8px 10px;
    font-size: 0.61rem;
  }

  .stage {
    margin: 0 8px;
    border-radius: 24px;
  }

  .intro-card,
  .state-card,
  .error-card {
    left: 20px;
    width: calc(100% - 40px);
  }

  .intro-card {
    bottom: 22px;
  }

  .lede {
    margin-bottom: 20px;
    font-size: 0.96rem;
  }

  .consent-copy {
    font-size: 0.7rem;
  }

  .privacy-note {
    display: none;
  }

  .state-card,
  .error-card {
    padding: 26px 22px;
  }

  .local-card {
    width: 118px;
    border-radius: 15px;
  }

  .controls {
    gap: 6px;
    justify-content: space-between;
    padding-inline: 10px;
  }

  .control-button {
    flex: 1 1 0;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    min-height: 54px;
    padding: 5px 4px;
    border-radius: 14px;
    font-size: 0.61rem;
  }

  .footer-note {
    right: 18px;
    bottom: 16px;
  }
}

@media (max-height: 700px) and (min-width: 641px) {
  h1 {
    font-size: clamp(3.4rem, 10vh, 5.8rem);
  }

  .intro-card {
    bottom: 24px;
  }

  .consent-copy {
    max-width: 600px;
    margin-top: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
