:root {
  color-scheme: dark;
  --bg: #070a11;
  --bg-raised: #0c111c;
  --panel: rgba(15, 22, 36, 0.78);
  --panel-solid: #101827;
  --panel-soft: rgba(255, 255, 255, 0.028);
  --line: rgba(152, 173, 204, 0.15);
  --line-strong: rgba(152, 173, 204, 0.26);
  --text: #edf3fb;
  --muted: #8e9eb6;
  --faint: #637189;
  --accent: #5eead4;
  --accent-strong: #2dd4bf;
  --accent-ink: #04231f;
  --indigo: #8b95ff;
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.12);
  --warn: #fbbf24;
  --ok: #34d399;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --shadow-lg: 0 28px 80px rgba(0, 0, 0, 0.42);
  --shadow-md: 0 14px 38px rgba(0, 0, 0, 0.28);
  --font: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  background:
    radial-gradient(circle at 12% -8%, rgba(45, 212, 191, 0.12), transparent 32rem),
    radial-gradient(circle at 92% 8%, rgba(99, 102, 241, 0.13), transparent 30rem),
    linear-gradient(180deg, #080c14 0%, #070a11 48%, #080b12 100%);
  background-attachment: fixed;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.026) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
  content: "";
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

svg {
  display: block;
}

::selection {
  color: #fff;
  background: rgba(45, 212, 191, 0.32);
}

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

.hidden {
  display: none !important;
}

.mono {
  font-family: var(--mono);
}

.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;
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgba(152, 173, 204, 0.1);
  background: rgba(7, 10, 17, 0.74);
  backdrop-filter: blur(18px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1240px, calc(100% - 40px));
  min-height: 72px;
  margin: 0 auto;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(94, 234, 212, 0.28);
  border-radius: 12px;
  color: var(--accent);
  background:
    linear-gradient(145deg, rgba(94, 234, 212, 0.18), rgba(99, 102, 241, 0.12)),
    #0b1320;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 22px rgba(0, 0, 0, 0.3);
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-sub {
  margin-top: 4px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #c9d6e8;
  background: rgba(255, 255, 255, 0.035);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.role-badge::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--indigo);
  box-shadow: 0 0 10px rgba(139, 149, 255, 0.7);
  content: "";
}

.role-badge.is-capture::before {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(94, 234, 212, 0.75);
}

.room-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.18);
  font-size: 11px;
  white-space: nowrap;
}

.room-chip strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.09em;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.btn svg {
  width: 17px;
  height: 17px;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  color: var(--accent-ink);
  background: linear-gradient(135deg, #76f5df, #2dd4bf 72%);
  box-shadow: 0 10px 26px rgba(45, 212, 191, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 13px 32px rgba(45, 212, 191, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.btn-ghost {
  border-color: var(--line);
  color: #d8e3f2;
  background: rgba(255, 255, 255, 0.035);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.065);
}

.btn-danger {
  border-color: rgba(251, 113, 133, 0.24);
  color: #ffd9df;
  background: var(--danger-soft);
}

.btn-danger:hover:not(:disabled) {
  border-color: rgba(251, 113, 133, 0.48);
  background: rgba(251, 113, 133, 0.19);
}

.btn-wide {
  width: 100%;
}

.btn-lg {
  min-height: 50px;
  padding: 0 24px;
  border-radius: 13px;
  font-size: 14.5px;
}

.icon-btn {
  display: inline-grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.icon-btn:hover {
  border-color: var(--line-strong);
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

/* ---------- home ---------- */

.shell {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 58px 0 64px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(380px, 0.82fr);
  align-items: center;
  gap: clamp(36px, 6vw, 88px);
  min-height: 490px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 18px;
  height: 1px;
  background: currentColor;
  content: "";
}

.home-title {
  margin: 22px 0 20px;
  font-size: clamp(48px, 6.2vw, 78px);
  font-weight: 720;
  line-height: 1.04;
  letter-spacing: -0.055em;
}

.gradient-text {
  color: transparent;
  background: linear-gradient(100deg, #f0fdfa 8%, #5eead4 46%, #8b95ff 100%);
  background-clip: text;
  -webkit-background-clip: text;
}

.home-lead {
  max-width: 540px;
  margin: 0;
  color: #9eafc6;
  font-size: 16.5px;
  line-height: 1.8;
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  margin: 32px 0 0;
  padding: 0;
  gap: 10px 22px;
  list-style: none;
}

.hero-points li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #b4c3d6;
  font-size: 12.5px;
}

.hero-points svg {
  width: 15px;
  height: 15px;
  color: var(--accent);
}

.lobby-card {
  position: relative;
  padding: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 35%),
    var(--panel);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

.lobby-card::before {
  position: absolute;
  top: 0;
  right: 24px;
  left: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(94, 234, 212, 0.75), transparent);
  content: "";
}

.card-kicker {
  margin: 0 0 9px;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.lobby-title {
  margin: 0;
  font-size: 22px;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.lobby-desc {
  margin: 7px 0 22px;
  color: var(--muted);
  font-size: 12.5px;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.text-action {
  padding: 0;
  border: 0;
  color: var(--accent);
  background: none;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
}

.text-action:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.room-input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  color: var(--text);
  background: rgba(4, 8, 14, 0.56);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 650;
  letter-spacing: 0.22em;
  text-align: center;
  text-transform: uppercase;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.room-input:focus {
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.08);
}

.room-input.is-invalid {
  border-color: rgba(251, 113, 133, 0.55);
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.08);
}

.field-hint {
  min-height: 18px;
  margin: 7px 0 16px;
  color: var(--faint);
  font-size: 11px;
}

.lobby-actions {
  display: grid;
  gap: 9px;
}

.role-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 16px;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.026);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.role-link:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(2px);
}

.role-link.is-primary {
  border-color: rgba(94, 234, 212, 0.3);
  background: linear-gradient(110deg, rgba(94, 234, 212, 0.12), rgba(94, 234, 212, 0.035));
}

.role-link.is-primary:hover {
  border-color: rgba(94, 234, 212, 0.5);
}

.role-link[aria-disabled="true"] {
  opacity: 0.4;
  pointer-events: none;
}

.role-link-copy {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.role-icon {
  display: grid;
  flex: 0 0 auto;
  width: 33px;
  height: 33px;
  place-items: center;
  border: 1px solid rgba(94, 234, 212, 0.2);
  border-radius: 9px;
  color: var(--accent);
  background: rgba(94, 234, 212, 0.08);
}

.role-icon.is-receiver {
  border-color: rgba(139, 149, 255, 0.24);
  color: #aeb5ff;
  background: rgba(139, 149, 255, 0.09);
}

.role-icon svg {
  width: 17px;
  height: 17px;
}

.role-link strong {
  display: block;
  font-size: 13px;
  font-weight: 650;
}

.role-link small {
  display: block;
  margin-top: 1px;
  color: var(--faint);
  font-size: 10.5px;
}

.role-link-arrow {
  color: var(--faint);
  font-size: 17px;
  transition: color 160ms ease, transform 160ms ease;
}

.role-link:hover .role-link-arrow {
  color: var(--accent);
  transform: translateX(2px);
}

.lobby-foot {
  display: flex;
  align-items: center;
  margin-top: 18px;
  padding-top: 16px;
  gap: 8px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10.5px;
}

.lobby-foot svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  color: var(--warn);
}

.flow-section {
  margin-top: 30px;
  padding-top: 38px;
  border-top: 1px solid rgba(152, 173, 204, 0.1);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 20px;
}

.section-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 660;
  letter-spacing: -0.02em;
}

.section-head p {
  margin: 0;
  color: var(--faint);
  font-size: 11.5px;
}

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

.flow-card {
  position: relative;
  min-height: 148px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
}

.flow-card::after {
  position: absolute;
  top: 50%;
  right: -18px;
  z-index: 2;
  width: 24px;
  height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
  content: "";
}

.flow-card:last-child::after {
  display: none;
}

.flow-number {
  display: inline-grid;
  width: 25px;
  height: 25px;
  margin-bottom: 14px;
  place-items: center;
  border: 1px solid rgba(94, 234, 212, 0.22);
  border-radius: 7px;
  color: var(--accent);
  background: rgba(94, 234, 212, 0.07);
  font-family: var(--mono);
  font-size: 10.5px;
}

.flow-card h3 {
  margin: 0 0 6px;
  font-size: 13.5px;
  font-weight: 650;
}

.flow-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.flow-card code {
  padding: 1px 4px;
  border: 1px solid rgba(152, 173, 204, 0.12);
  border-radius: 4px;
  color: #b9c7da;
  background: rgba(255, 255, 255, 0.04);
  font-family: var(--mono);
  font-size: 10px;
}

/* ---------- shared page layout ---------- */

.page-shell {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 52px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 20px;
}

.page-heading h1 {
  margin: 6px 0 0;
  font-size: 27px;
  font-weight: 690;
  letter-spacing: -0.035em;
}

.page-heading p {
  max-width: 580px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.capture-layout,
.receiver-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(310px, 0.72fr);
  align-items: start;
  gap: 20px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px);
}

.preview-card {
  overflow: hidden;
}

.video-shell,
.video-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, rgba(94, 234, 212, 0.05), transparent 55%),
    #04070c;
}

.video-shell::before,
.video-stage::before {
  position: absolute;
  z-index: 1;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.035);
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.video-shell video,
.video-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-shell video {
  transform: scaleX(-1);
}

.video-shell.is-empty video,
.video-stage.is-empty video {
  visibility: hidden;
}

.video-placeholder {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.video-shell.has-video .video-placeholder,
.video-stage.has-video .video-placeholder {
  opacity: 0;
  visibility: hidden;
}

.placeholder-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 14px;
  place-items: center;
  border: 1px solid rgba(94, 234, 212, 0.17);
  border-radius: 17px;
  color: var(--accent);
  background: rgba(94, 234, 212, 0.055);
  box-shadow: 0 0 48px rgba(45, 212, 191, 0.09);
}

.placeholder-icon svg {
  width: 26px;
  height: 26px;
}

.video-placeholder h2,
.video-placeholder h3 {
  margin: 0 0 5px;
  font-size: 15px;
  font-weight: 640;
}

.video-placeholder p {
  max-width: 360px;
  margin: 0;
  color: var(--faint);
  font-size: 11.5px;
}

.video-overlay-top {
  position: absolute;
  z-index: 4;
  top: 14px;
  right: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  color: #e8f0fb;
  background: rgba(4, 8, 14, 0.56);
  backdrop-filter: blur(10px);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
}

.live-badge::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  content: "";
}

.live-badge[data-tone="ok"]::before {
  background: var(--ok);
  box-shadow: 0 0 9px rgba(52, 211, 153, 0.9);
}

.live-badge[data-tone="live"] {
  border-color: rgba(251, 113, 133, 0.3);
  color: #ffe4e8;
}

.live-badge[data-tone="live"]::before {
  background: var(--danger);
  box-shadow: 0 0 9px rgba(251, 113, 133, 0.9);
  animation: blink 1.6s ease-in-out infinite;
}

.live-badge[data-tone="warn"]::before {
  background: var(--warn);
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  color: #c8d5e6;
  background: rgba(4, 8, 14, 0.52);
  backdrop-filter: blur(10px);
  font-family: var(--mono);
  font-size: 10px;
}

.preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  gap: 18px;
  border-top: 1px solid var(--line);
}

.state-copy {
  min-width: 0;
}

.state-copy h2 {
  margin: 4px 0 3px;
  font-size: 18px;
  font-weight: 660;
  letter-spacing: -0.025em;
}

.state-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
}

.side-stack {
  display: grid;
  gap: 14px;
}

.panel {
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
  gap: 12px;
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
  color: #b8c6d9;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.panel-note {
  color: var(--faint);
  font-size: 10px;
}

.remote-callout {
  padding: 23px 15px 20px;
  border: 1px solid rgba(94, 234, 212, 0.13);
  border-radius: 13px;
  background:
    radial-gradient(circle at 50% 0%, rgba(94, 234, 212, 0.11), transparent 70%),
    rgba(4, 8, 14, 0.28);
  text-align: center;
  transition: border-color 250ms ease, background 250ms ease;
}

.remote-callout[data-tone="live"] {
  border-color: rgba(52, 211, 153, 0.28);
  background:
    radial-gradient(circle at 50% 0%, rgba(52, 211, 153, 0.16), transparent 70%),
    rgba(4, 8, 14, 0.28);
}

.remote-callout[data-tone="warn"] {
  border-color: rgba(251, 191, 36, 0.24);
  background:
    radial-gradient(circle at 50% 0%, rgba(251, 191, 36, 0.12), transparent 70%),
    rgba(4, 8, 14, 0.28);
}

.remote-callout[data-tone="error"] {
  border-color: rgba(251, 113, 133, 0.3);
  background:
    radial-gradient(circle at 50% 0%, rgba(251, 113, 133, 0.13), transparent 70%),
    rgba(4, 8, 14, 0.28);
}

.remote-icon {
  display: grid;
  width: 46px;
  height: 46px;
  margin: 0 auto 13px;
  place-items: center;
  border: 1px solid rgba(94, 234, 212, 0.2);
  border-radius: 50%;
  color: var(--accent);
  background: rgba(94, 234, 212, 0.07);
}

.remote-callout[data-tone="live"] .remote-icon {
  color: var(--ok);
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.1);
}

.remote-callout[data-tone="error"] .remote-icon {
  color: var(--danger);
  border-color: rgba(251, 113, 133, 0.3);
  background: rgba(251, 113, 133, 0.1);
}

.remote-icon svg {
  width: 21px;
  height: 21px;
}

.remote-callout h3 {
  margin: 0 0 4px;
  font-size: 14.5px;
  font-weight: 650;
}

.remote-callout p {
  min-height: 34px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.steps-list {
  display: grid;
  margin: 17px 0 0;
  padding: 0;
  gap: 8px;
  list-style: none;
}

.steps-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--faint);
  font-size: 11px;
  transition: color 200ms ease;
}

.step-dot {
  display: grid;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 8px;
}

.steps-list li.is-done {
  color: #c4d2e3;
}

.steps-list li.is-done .step-dot {
  border-color: rgba(52, 211, 153, 0.32);
  color: var(--ok);
  background: rgba(52, 211, 153, 0.1);
}

.steps-list li.is-active {
  color: var(--accent);
}

.steps-list li.is-active .step-dot {
  border-color: rgba(94, 234, 212, 0.45);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.07);
}

.kv-list {
  display: grid;
  margin: 0;
  gap: 11px;
}

.kv-list-spaced {
  margin-top: 16px;
}

.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.kv-row dt {
  color: var(--faint);
  font-size: 10.5px;
}

.kv-row dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #c7d4e5;
  font-size: 11px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.status::before {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  content: "";
}

.status[data-tone="ok"] {
  color: var(--accent);
}

.status[data-tone="ok"]::before {
  background: var(--ok);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.8);
}

.status[data-tone="warn"] {
  color: var(--warn);
}

.status[data-tone="warn"]::before {
  background: var(--warn);
}

.status[data-tone="error"] {
  color: var(--danger);
}

.status[data-tone="error"]::before {
  background: var(--danger);
}

.share-row {
  display: flex;
  align-items: center;
  margin-top: 13px;
  padding-top: 13px;
  gap: 8px;
  border-top: 1px solid var(--line);
}

.share-url {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-row .icon-btn {
  flex: 0 0 auto;
}

.log-panel {
  margin-top: 18px;
  padding: 16px 19px;
}

.log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.log-head h2 {
  margin: 0;
  color: #b8c6d9;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.log-list {
  max-height: 152px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-color: rgba(148, 163, 184, 0.24) transparent;
  scrollbar-width: thin;
}

.log-entry {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  padding: 5px 0;
  gap: 8px;
  border-bottom: 1px solid rgba(152, 173, 204, 0.06);
  color: #9cacc1;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.5;
}

.log-entry:last-child {
  border-bottom: 0;
}

.log-entry time {
  color: #54647a;
}

.log-ok span {
  color: #8ce8cf;
}

.log-warn span {
  color: #f5cf7d;
}

.log-error span {
  color: #ff9eab;
}

/* ---------- receiver ---------- */

.receiver-stage {
  overflow: hidden;
}

.video-stage {
  aspect-ratio: 16 / 9;
  min-height: 260px;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.5);
}

.video-stage .video-placeholder {
  z-index: 3;
  background: linear-gradient(180deg, rgba(7, 10, 17, 0.2), rgba(7, 10, 17, 0.58));
}

.receiver-stage .video-overlay-top {
  align-items: flex-start;
}

.stage-actions {
  display: flex;
  gap: 7px;
  pointer-events: auto;
}

.stage-actions .icon-btn {
  border-color: rgba(255, 255, 255, 0.14);
  color: #d8e2f0;
  background: rgba(4, 8, 14, 0.46);
  backdrop-filter: blur(8px);
}

.stage-stats {
  position: absolute;
  z-index: 4;
  right: 14px;
  bottom: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.stage-stats[data-visible="false"] {
  opacity: 0;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  color: #d7e2f0;
  background: rgba(4, 8, 14, 0.6);
  backdrop-filter: blur(9px);
  font-family: var(--mono);
  font-size: 9.5px;
}

.stat-chip b {
  color: #fff;
  font-weight: 650;
}

.receiver-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  gap: 20px;
  border-top: 1px solid var(--line);
}

.receiver-controls h2 {
  margin: 3px 0 2px;
  font-size: 18px;
  font-weight: 660;
  letter-spacing: -0.025em;
}

.receiver-controls p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
}

.control-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.side-panel .panel + .panel {
  margin-top: 14px;
}

.capture-presence {
  display: flex;
  align-items: center;
  padding: 12px;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(4, 8, 14, 0.24);
}

.presence-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 35px;
  height: 35px;
  place-items: center;
  border: 1px solid rgba(94, 234, 212, 0.18);
  border-radius: 10px;
  color: var(--accent);
  background: rgba(94, 234, 212, 0.07);
}

.presence-avatar svg {
  width: 17px;
  height: 17px;
}

.presence-copy {
  flex: 1;
  min-width: 0;
}

.presence-copy strong {
  display: block;
  font-size: 12.5px;
  font-weight: 650;
}

.presence-copy small {
  display: block;
  color: var(--faint);
  font-size: 10px;
}

.session-empty {
  padding: 18px 12px;
  border: 1px dashed rgba(152, 173, 204, 0.18);
  border-radius: 11px;
  color: var(--faint);
  font-size: 11px;
  text-align: center;
}

.session-active {
  display: grid;
  gap: 9px;
}

.session-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--faint);
  font-size: 10.5px;
}

.session-line strong {
  color: #cbd8e9;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
}

.side-panel .log-list {
  max-height: 190px;
}

/* ---------- join gate ---------- */

.gate {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgba(4, 7, 12, 0.72);
  backdrop-filter: blur(14px);
}

.gate[hidden] {
  display: none;
}

.gate-card {
  width: min(420px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 42%),
    #0d1421;
  box-shadow: var(--shadow-lg);
}

.gate-card h1 {
  margin: 12px 0 6px;
  font-size: 26px;
  font-weight: 690;
  letter-spacing: -0.03em;
}

.gate-card p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 12px;
}

.gate-card .field-hint {
  margin-bottom: 14px;
}

/* ---------- generic bits ---------- */

.empty-inline {
  color: var(--faint);
  font-size: 10.5px;
}

.toast-host {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  display: grid;
  width: min(340px, calc(100% - 44px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: #e2ebf7;
  background: rgba(16, 24, 39, 0.96);
  box-shadow: var(--shadow-md);
  font-size: 12px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-error {
  border-color: rgba(251, 113, 133, 0.38);
}

.toast-ok {
  border-color: rgba(94, 234, 212, 0.32);
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@media (max-width: 1020px) {
  .home-hero {
    grid-template-columns: 1fr;
    min-height: 0;
    gap: 38px;
  }

  .home-title {
    max-width: 760px;
  }

  .lobby-card {
    max-width: 560px;
  }

  .capture-layout,
  .receiver-layout {
    grid-template-columns: 1fr;
  }

  .side-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .side-stack > .panel:last-child {
    grid-column: 1 / -1;
  }

  .side-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 14px;
  }

  .side-panel .panel + .panel {
    margin-top: 0;
  }
}

@media (max-width: 720px) {
  .topbar-inner,
  .shell,
  .page-shell {
    width: min(100% - 28px, 1240px);
  }

  .topbar-inner {
    min-height: 64px;
    gap: 10px;
  }

  .brand-sub,
  .room-chip span,
  .top-actions .role-badge {
    display: none;
  }

  .shell {
    padding-top: 36px;
  }

  .home-title {
    font-size: clamp(42px, 13vw, 60px);
  }

  .home-lead {
    font-size: 15px;
  }

  .lobby-card {
    padding: 22px;
  }

  .flow-grid {
    grid-template-columns: 1fr;
  }

  .flow-card {
    min-height: 0;
  }

  .flow-card::after {
    display: none;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .preview-footer,
  .receiver-controls {
    align-items: flex-start;
    flex-direction: column;
    padding: 17px;
  }

  .receiver-controls .control-actions {
    width: 100%;
  }

  .receiver-controls .btn {
    flex: 1;
  }

  .side-stack,
  .side-panel {
    grid-template-columns: 1fr;
  }

  .side-stack > .panel:last-child {
    grid-column: auto;
  }

  .video-stage {
    min-height: 0;
  }

  .stat-chip.is-optional {
    display: none;
  }

  .stage-stats {
    justify-content: flex-start;
  }

  .log-entry {
    grid-template-columns: 56px minmax(0, 1fr);
    font-size: 9.5px;
  }

  .gate-card {
    padding: 24px;
  }
}

@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;
  }
}
