:root {
  color-scheme: dark;
  --bg: #080a0d;
  --panel: #11151a;
  --panel-soft: #151a20;
  --line: #242a31;
  --text: #f4f7fa;
  --muted: #8b96a3;
  --accent: #67e8a5;
  --accent-deep: #17b26a;
  --blue: #74a7ff;
  --danger: #ff6f7d;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 75% -10%, rgba(39, 125, 88, 0.2), transparent 35rem),
    linear-gradient(180deg, #0b0e12 0%, var(--bg) 42rem);
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

.shell {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding-bottom: 72px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 82px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #34413b;
  border-radius: 11px;
  background: #121a17;
}

.brand-mark span {
  width: 17px;
  height: 12px;
  border: 2px solid var(--accent);
  border-radius: 3px;
  box-shadow: 0 0 18px rgba(103, 232, 165, 0.25);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  letter-spacing: 0.01em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.release {
  display: flex;
  gap: 8px;
  align-items: center;
  color: #a8b1bb;
  font: 500 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.release-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(103, 232, 165, 0.5);
}

.hero {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 64px;
  align-items: end;
  padding: 78px 0 56px;
}

.eyebrow,
.panel-kicker {
  margin: 0;
  color: var(--accent);
  font: 650 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.18em;
}

.hero h1 {
  margin: 13px 0 22px;
  font-size: clamp(44px, 6vw, 84px);
  font-weight: 650;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.hero h1 span {
  color: #78838f;
}

.lede {
  max-width: 690px;
  margin: 0;
  color: #9ca6b2;
  font-size: 16px;
  line-height: 1.8;
}

.pair-form {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(17, 21, 26, 0.84);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.22);
}

.pair-form label {
  display: grid;
  gap: 7px;
}

.pair-form label > span {
  color: var(--muted);
  font-size: 11px;
}

.pair-form input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid #303943;
  border-radius: 8px;
  outline: 0;
  color: var(--text);
  background: #0b0f13;
  font: 550 14px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.pair-form input:focus {
  border-color: rgba(103, 232, 165, 0.62);
  box-shadow: 0 0 0 3px rgba(103, 232, 165, 0.09);
}

.pair-form input:disabled {
  color: #7a8590;
  opacity: 0.7;
}

.hero-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.button {
  height: 49px;
  padding: 0 19px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

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

.button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.button-primary {
  color: #07110c;
  background: var(--accent);
}

.button-primary:not(:disabled):hover {
  background: #7cf0b5;
}

.button-secondary {
  border-color: var(--line);
  background: var(--panel);
}

.button-secondary:not(:disabled):hover {
  border-color: #39424d;
}

.button-icon {
  margin-right: 7px;
  font-size: 11px;
}

.compatibility {
  grid-column: 1 / -1;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.compatibility.ok {
  color: #90dcb5;
}

.compatibility.error {
  color: #ff9ba5;
}

.lan-share {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.lan-share a {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.lan-share button {
  margin-left: 0.45rem;
  border: 1px solid rgba(103, 232, 165, 0.35);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  color: var(--accent);
  background: rgba(103, 232, 165, 0.08);
  cursor: pointer;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.8fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

.screen-panel,
.telemetry-panel {
  min-width: 0;
}

.screen-panel {
  padding: 22px;
  border-right: 1px solid var(--line);
}

.telemetry-panel {
  padding: 22px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  margin-bottom: 18px;
}

.panel-header h2 {
  margin: 4px 0 0;
  font-size: 17px;
  letter-spacing: -0.02em;
}

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

.view-button {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #a8b1bb;
  background: #0e1115;
  cursor: pointer;
  font-size: 11px;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.view-button b {
  font: inherit;
  font-weight: 600;
}

.view-button:not(:disabled):hover,
.view-button[aria-pressed="true"] {
  color: var(--accent);
  border-color: rgba(103, 232, 165, 0.36);
  background: rgba(23, 178, 106, 0.09);
}

.view-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.connection-pill {
  display: flex;
  gap: 8px;
  align-items: center;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #0e1115;
  font-size: 11px;
}

.connection-pill > span:first-child {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #59616b;
}

.connection-pill.connected {
  color: #b4efcf;
  border-color: rgba(103, 232, 165, 0.28);
  background: rgba(23, 178, 106, 0.08);
}

.connection-pill.connected > span:first-child {
  background: var(--accent);
  box-shadow: 0 0 9px rgba(103, 232, 165, 0.55);
}

.video-stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid #2a323b;
  border-radius: 9px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    #090c10;
  background-size: 32px 32px;
  cursor: crosshair;
}

.video-stage:focus {
  outline: 2px solid rgba(103, 232, 165, 0.62);
  outline-offset: 3px;
}

.video-stage video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #090c10;
}

body.view-mode-active {
  overflow: hidden;
}

.screen-panel.is-maximized,
.screen-panel:fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  padding: 16px;
  border: 0;
  background: #080a0d;
}

.screen-panel:fullscreen {
  box-sizing: border-box;
}

.screen-panel::backdrop {
  background: #080a0d;
}

.screen-panel.is-maximized .panel-header,
.screen-panel:fullscreen .panel-header {
  flex: 0 0 auto;
  margin-bottom: 12px;
}

.screen-panel.is-maximized .video-stage,
.screen-panel:fullscreen .video-stage {
  min-height: 0;
  flex: 1 1 auto;
  aspect-ratio: auto;
  border-radius: 6px;
}

.screen-panel.is-maximized .channel-row,
.screen-panel:fullscreen .channel-row {
  flex: 0 0 auto;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  pointer-events: none;
}

.empty-state strong {
  margin-top: 17px;
  font-size: 14px;
}

.empty-state small {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.empty-orbit {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 1px solid #29313a;
  border-radius: 50%;
}

.empty-orbit span {
  width: 22px;
  height: 16px;
  border: 2px solid #5f6b77;
  border-radius: 4px;
}

.stage-badge {
  position: absolute;
  right: 10px;
  bottom: 9px;
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.65);
  background: rgba(5, 7, 9, 0.72);
  font: 500 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}

.channel-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.channel-row > div {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 52px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0e1216;
}

.channel-row small,
.channel-row strong {
  display: block;
}

.channel-row small {
  color: var(--muted);
  font-size: 10px;
}

.channel-row strong {
  margin-top: 3px;
  font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.channel-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  font-size: 13px;
}

.channel-fast {
  color: var(--blue);
  background: rgba(116, 167, 255, 0.1);
}

.channel-safe {
  color: var(--accent);
  background: rgba(103, 232, 165, 0.09);
}

.sample-count {
  color: var(--muted);
  font: 500 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric {
  min-height: 98px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0e1216;
}

.metric-featured {
  position: relative;
  grid-column: 1 / -1;
  min-height: 118px;
  overflow: hidden;
  border-color: rgba(103, 232, 165, 0.22);
  background:
    linear-gradient(135deg, rgba(103, 232, 165, 0.08), transparent 56%),
    #0e1216;
}

.metric > span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric strong {
  display: block;
  margin-top: 13px;
}

.metric b {
  font: 520 31px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

#resolution-value {
  font-size: 23px;
}

#transport-value {
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.25;
}

.metric small {
  margin-left: 6px;
  color: #68737f;
  font: 500 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.metric-featured b {
  color: var(--accent);
  font-size: 41px;
}

.sparkline {
  position: absolute;
  right: 14px;
  bottom: 15px;
  display: flex;
  gap: 3px;
  align-items: end;
  width: 38%;
  height: 38px;
}

.sparkline span {
  flex: 1;
  min-width: 2px;
  border-radius: 2px 2px 0 0;
  background: rgba(103, 232, 165, 0.46);
}

.event-log {
  margin-top: 17px;
  border-top: 1px solid var(--line);
}

.event-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 43px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.event-log-header button {
  padding: 0;
  border: 0;
  color: #75808b;
  background: none;
  cursor: pointer;
  font-size: 10px;
}

.event-log ol {
  overflow: auto;
  max-height: 183px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.event-log li {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 9px;
  padding: 9px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.045);
  color: #a8b1bb;
  font-size: 11px;
  line-height: 1.45;
}

.event-log time {
  color: #68737f;
  font: 500 9px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.facts article {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 13px;
  padding: 25px 24px 26px 0;
}

.facts article + article {
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.facts article > span {
  color: var(--accent);
  font: 600 10px/1.8 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.facts h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.facts p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 30px;
    padding-top: 56px;
  }

  .hero-actions {
    max-width: 540px;
  }

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

  .screen-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .facts article,
  .facts article + article {
    padding: 20px 0;
    border-left: 0;
  }

  .facts article + article {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 24px, 1440px);
  }

  .topbar {
    height: 68px;
  }

  .brand small {
    display: none;
  }

  .release {
    font-size: 10px;
  }

  .hero {
    padding: 44px 0 36px;
  }

  .hero h1 {
    font-size: 47px;
  }

  .hero-actions {
    grid-template-columns: 1fr;
  }

  .screen-panel,
  .telemetry-panel {
    padding: 15px;
  }

  .screen-panel.is-maximized,
  .screen-panel:fullscreen {
    padding: 10px;
  }

  .view-button b {
    display: none;
  }

  .channel-row {
    grid-template-columns: 1fr;
  }
}

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