:root {
  --ink: #12102a;
  --ink-2: #1a1740;
  --card: rgba(245, 243, 255, 0.045);
  --line: rgba(245, 243, 255, 0.1);
  --paper: #f5f3ff;
  --muted: #b9b4d9;
  --faint: #7d78a8;
  --amber: #ffb020;
  --mint: #7df0c6;
  --rose: #fb7185;
  --display: "Space Grotesk", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --r: 18px;
}

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body);
  background: var(--ink);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ambient atmosphere: two slow-drifting color fields */
body::before,
body::after {
  content: "";
  position: fixed;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(110px);
  z-index: 0;
  pointer-events: none;
}
body::before {
  top: -22vmax;
  right: -18vmax;
  background: radial-gradient(circle, rgba(255, 176, 32, 0.16), transparent 65%);
  animation: drift 26s ease-in-out infinite alternate;
}
body::after {
  bottom: -25vmax;
  left: -20vmax;
  background: radial-gradient(circle, rgba(125, 240, 198, 0.12), transparent 65%);
  animation: drift 32s ease-in-out infinite alternate-reverse;
}
@keyframes drift {
  to { transform: translate(-6vmax, 5vmax) scale(1.12); }
}

#orb {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.9;
  pointer-events: none;
}

.topbar,
main,
footer {
  position: relative;
  z-index: 1;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 28px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(140deg, #241f56, #17143a);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}
.brand-mark span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(255, 176, 32, 0.18), 0 0 14px rgba(255, 176, 32, 0.8);
}
.brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.01em;
}
.status-pill {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 10px var(--mint);
  animation: blink 2.2s ease-in-out infinite;
}
body[data-state="incall"] .live-dot { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
@keyframes blink {
  50% { opacity: 0.35; }
}

/* Lobby */
main { max-width: 1120px; margin: 0 auto; padding: 20px 28px 40px; }

.eyebrow,
.topbar + main h1,
.lede,
.lobby-grid > * {
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: var(--d, 0s);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
}

.eyebrow {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 34px 0 0;
}
h1 {
  font-family: var(--display);
  font-size: clamp(46px, 7.5vw, 92px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin: 14px 0 0;
}
h1::after {
  content: "";
  display: block;
  width: 72px;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--amber), var(--mint));
  margin-top: 20px;
}
.lede {
  font-size: 17px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 560px;
  margin: 20px 0 0;
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 22px;
  margin-top: 38px;
  align-items: start;
}

/* Preview monitor */
.monitor {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  backdrop-filter: blur(8px);
}
.monitor-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.monitor-bar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(245, 243, 255, 0.16);
}
.monitor-bar span:first-child { background: rgba(251, 113, 133, 0.7); }
.monitor-bar em {
  margin-left: auto;
  font-family: var(--mono);
  font-style: normal;
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}
.monitor-screen {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #0b0a1e;
}
.monitor-screen video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.monitor-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
}
.monitor-screen video[srcobject] + .monitor-empty,
.monitor-screen.has-video .monitor-empty { display: none; }
.monitor-controls {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
}
.chip {
  flex: 1;
  font-family: var(--body);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--paper);
  background: rgba(245, 243, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s;
}
.chip:hover { background: rgba(245, 243, 255, 0.13); transform: translateY(-1px); }
.chip[aria-pressed="true"] { border-color: rgba(125, 240, 198, 0.45); color: var(--mint); }

/* Steps */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.steps li {
  display: flex;
  gap: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px;
  backdrop-filter: blur(8px);
  transition: border-color 0.2s, transform 0.2s;
}
.steps li:hover { border-color: rgba(255, 176, 32, 0.35); transform: translateY(-2px); }
.step-n {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--amber);
  border: 1px solid rgba(255, 176, 32, 0.4);
  border-radius: 9px;
  height: fit-content;
  padding: 5px 9px;
  flex: none;
}
.steps h2 {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.steps p { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 6px 0 0; }
.id-row, .dial-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
code {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--mint);
  background: rgba(125, 240, 198, 0.07);
  border: 1px dashed rgba(125, 240, 198, 0.35);
  border-radius: 12px;
  padding: 11px 14px;
  flex: 1;
  min-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  align-self: center;
}
input {
  flex: 1;
  min-width: 160px;
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--paper);
  background: rgba(11, 10, 30, 0.7);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
input::placeholder { color: var(--faint); }
input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.18); }

/* Buttons */
.btn {
  font-family: var(--body);
  font-size: 14px;
  font-weight: 600;
  border: 0;
  border-radius: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: transform 0.16s, box-shadow 0.16s, opacity 0.16s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn.primary { background: var(--amber); color: #241300; box-shadow: 0 6px 24px rgba(255, 176, 32, 0.28); }
.btn.primary:hover:not(:disabled) { box-shadow: 0 10px 30px rgba(255, 176, 32, 0.4); }
.btn.call { background: var(--mint); color: #06281c; box-shadow: 0 6px 24px rgba(125, 240, 198, 0.25); }
.btn.call:hover:not(:disabled) { box-shadow: 0 10px 30px rgba(125, 240, 198, 0.38); }

:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

/* In-call stage */
[hidden] { display: none !important; }
body[data-state="incall"] #lobby { display: none; }

.stage-top { text-align: center; margin: 26px 0 20px; }
.onair {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
  background: rgba(255, 176, 32, 0.08);
  border: 1px solid rgba(255, 176, 32, 0.35);
  border-radius: 999px;
  padding: 9px 20px;
  margin: 0;
}
.stage-peer { color: var(--muted); font-size: 14px; margin: 12px 0 0; }
.stage-peer code { border: 0; background: none; padding: 0; }

.stage-videos {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0b0a1e;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
#remoteVideo {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 62vh;
  object-fit: cover;
  background: #0b0a1e;
}
.pip {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: clamp(120px, 20%, 220px);
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(245, 243, 255, 0.25);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  background: #0b0a1e;
}
.pip video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }

.dock {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 24px;
}
.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 92px;
  font-family: var(--body);
  font-size: 12px;
  font-weight: 600;
  color: var(--paper);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 18px 11px;
  cursor: pointer;
  transition: transform 0.16s, background 0.16s, border-color 0.16s;
  backdrop-filter: blur(8px);
}
.dock-btn:hover:not(:disabled) { transform: translateY(-2px); background: rgba(245, 243, 255, 0.09); }
.dock-btn:disabled { opacity: 0.35; cursor: default; }
.dock-btn[aria-pressed="false"].muted-off { border-color: rgba(251, 113, 133, 0.55); color: var(--rose); }
.dock-btn.hangup { background: var(--rose); border-color: var(--rose); color: #3d0713; }
.dock-btn.hangup:hover:not(:disabled) { background: #fc8ba0; }

footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px 34px;
}
footer p {
  margin: 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--faint);
}

@media (max-width: 880px) {
  .lobby-grid { grid-template-columns: 1fr; }
  .status-pill { max-width: 100%; }
  .topbar { flex-wrap: wrap; }
  #remoteVideo { aspect-ratio: 4 / 3; }
}

@media (prefers-reduced-motion: reduce) {
  body::before, body::after { animation: none; }
  .eyebrow, .topbar + main h1, .lede, .lobby-grid > * { animation: none; }
  .live-dot { animation: none; }
  .btn:hover:not(:disabled), .dock-btn:hover:not(:disabled),
  .chip:hover, .steps li:hover { transform: none; }
}
