:root {
  color-scheme: dark;
  --bg: #090a0d;
  --surface: #111318;
  --surface-2: #17191f;
  --line: #282b32;
  --text: #f5f2ed;
  --muted: #96989f;
  --accent: #ff5a36;
  --accent-2: #ff794f;
  --green: #79e2aa;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 79% 15%, rgba(255, 90, 54, .09), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.noise {
  position: fixed;
  inset: 0;
  opacity: .045;
  pointer-events: none;
  z-index: 10;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

.topbar {
  height: 82px;
  padding: 0 clamp(24px, 5vw, 76px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font: 700 16px/1 "Inter", "Segoe UI", sans-serif;
  letter-spacing: .16em;
}
.brand > span:last-child > span { color: var(--accent); }
.brand-mark { display: flex; gap: 3px; height: 22px; align-items: center; }
.brand-mark i { width: 4px; border-radius: 3px; background: var(--accent); display: block; }
.brand-mark i:nth-child(1) { height: 11px; }
.brand-mark i:nth-child(2) { height: 22px; }
.brand-mark i:nth-child(3) { height: 15px; }

.network-pill {
  color: #b6b7bc;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .13em;
  border: 1px solid var(--line);
  padding: 9px 12px;
  border-radius: 999px;
}
.network-pill span { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }

main { max-width: 1360px; margin: 0 auto; padding: 0 clamp(24px, 5vw, 76px); }
.landing { min-height: calc(100vh - 82px); display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; gap: clamp(50px, 8vw, 130px); padding: 65px 0 90px; }
.hero-copy { max-width: 620px; }
.eyebrow { color: #a3a4aa; font-size: 11px; letter-spacing: .2em; font-weight: 600; margin-bottom: 25px; }
.eyebrow span { color: var(--accent); margin-right: 13px; }
h1, h2 { margin: 0; font-family: "Inter", "Segoe UI", sans-serif; letter-spacing: -.055em; line-height: .91; }
h1 { font-size: clamp(60px, 7.4vw, 110px); font-weight: 500; }
h1 em, h2 em { color: var(--accent); font-style: normal; }
.hero-copy > p { color: var(--muted); max-width: 470px; font-size: 16px; line-height: 1.65; margin: 34px 0 0; }

.start-card { border: 1px solid var(--line); background: rgba(17,19,24,.88); box-shadow: 0 40px 100px rgba(0,0,0,.32); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.tab { color: #777a82; background: transparent; border: 0; padding: 22px; font-weight: 600; position: relative; }
.tab.active { color: var(--text); }
.tab.active::after { content: ""; position: absolute; height: 2px; background: var(--accent); bottom: -1px; left: 18%; right: 18%; }
.tab-panel { display: none; padding: 34px; }
.tab-panel.active { display: block; }
.field-label, .section-kicker { display: block; color: #787b83; font-size: 10px; font-weight: 700; letter-spacing: .18em; margin-bottom: 10px; }
input, select {
  color: var(--text);
  background: #0c0e12;
  border: 1px solid #30333a;
  border-radius: 2px;
  outline: none;
}
input:focus, select:focus { border-color: #5b5e67; }
input[type="text"], input:not([type]), .room-input-wrap input, #joinRoom { width: 100%; height: 50px; padding: 0 15px; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.room-input-wrap { position: relative; }
.room-input-wrap input { padding-right: 48px; }
.icon-button { position: absolute; right: 6px; top: 6px; width: 38px; height: 38px; border: 0; color: #9b9da3; background: transparent; font-size: 20px; }
.setting-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 18px; margin: 28px 0; }
.setting-grid label > span { color: #a2a4aa; display: block; font-size: 12px; margin-bottom: 8px; }
select { width: 100%; height: 42px; padding: 0 11px; }
.range-inline { min-height: 42px; display: flex; align-items: center; gap: 10px; }
.range-inline input { flex: 1; }
.range-inline b { font-size: 11px; white-space: nowrap; min-width: 64px; text-align: right; }
input[type="range"] { accent-color: var(--accent); height: 3px; }

.primary-button, .secondary-button, .danger-button {
  min-height: 48px;
  border-radius: 2px;
  border: 1px solid transparent;
  font-weight: 700;
}
.primary-button { width: 100%; color: white; background: var(--accent); transition: .2s; }
.primary-button:hover { background: var(--accent-2); transform: translateY(-1px); }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.primary-button > span:last-child { float: right; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: white; margin-right: 8px; box-shadow: 0 0 0 5px rgba(255,255,255,.12); }
.hint { color: #6f727a; text-align: center; font-size: 11px; line-height: 1.5; margin: 16px 10px 0; }
#viewerPanel .primary-button { margin-top: 20px; }

.hidden { display: none !important; }
.studio { padding: 55px 0 80px; }
.studio-head { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 30px; }
.studio-head .eyebrow { margin-bottom: 14px; }
h2 { font-size: clamp(38px, 5vw, 68px); font-weight: 500; }
.head-actions { display: flex; gap: 10px; }
.secondary-button, .danger-button { color: #d5d5d7; background: transparent; border-color: #33363e; padding: 0 18px; }
.secondary-button:hover { background: #1a1c22; border-color: #4b4e56; }
.danger-button { color: #ff8c76; border-color: rgba(255,90,54,.36); }
.danger-button:hover { background: rgba(255,90,54,.08); }
.stage-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; border: 1px solid var(--line); }
.video-shell { position: relative; min-height: 520px; background: #020203; display: grid; place-items: center; overflow: hidden; }
.video-shell video { display: block; width: 100%; height: 100%; max-height: 75vh; object-fit: contain; background: #020203; }
.video-shell.fill video { object-fit: cover; }
.video-shell:fullscreen {
  width: 100vw;
  height: 100vh;
}
.video-shell:fullscreen video {
  width: 100vw;
  height: 100vh;
  max-height: none;
}
.video-overlay { position: absolute; left: 18px; top: 17px; right: 18px; display: flex; justify-content: space-between; pointer-events: none; font-size: 10px; letter-spacing: .12em; }
.video-overlay > span { color: #d7d7da; background: rgba(8,9,12,.78); padding: 7px 9px; backdrop-filter: blur(10px); }
.video-overlay .live-badge { color: #ff8169; }
.video-overlay-actions { display: flex; align-items: stretch; gap: 7px; pointer-events: auto; }
.video-overlay-actions > span, .overlay-button {
  color: #d7d7da;
  background: rgba(8,9,12,.78);
  border: 1px solid rgba(255,255,255,.08);
  padding: 7px 9px;
  backdrop-filter: blur(10px);
  font-size: 10px;
  letter-spacing: .08em;
}
.overlay-button:hover { color: #fff; border-color: rgba(255,255,255,.25); }
.enable-audio {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 25px;
  transform: translateX(-50%);
  min-height: 44px;
  padding: 0 19px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 2px;
  color: #fff;
  background: rgba(15,17,22,.9);
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.enable-audio:hover { background: var(--accent); border-color: var(--accent); }
.empty-stage { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; background: #08090c; }
.empty-stage strong { margin-top: 20px; font-size: 16px; }
.empty-stage span { color: var(--muted); margin-top: 7px; font-size: 12px; }
.loader-ring { width: 36px; height: 36px; border-radius: 50%; border: 2px solid #24262c; border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.control-panel { border-left: 1px solid var(--line); background: #101217; }
.panel-section { padding: 26px 24px; border-bottom: 1px solid var(--line); }
.stat-row, .section-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stat-row { color: #898b92; font-size: 12px; padding: 8px 0; }
.stat-row b { color: #d9dadd; font-size: 11px; }
.stat-row .status-good { color: var(--green); }
.section-heading .section-kicker { margin: 0; }
.section-heading b { font-size: 12px; }
.volume-range, #liveBitrate { width: 100%; margin: 25px 0 8px; }
.range-labels { display: flex; justify-content: space-between; color: #585b63; font-size: 9px; }
.full { width: 100%; margin-top: 20px; }
.audio-status { color: #757880; font-size: 10px; line-height: 1.45; margin: 12px 0 0; text-align: center; }
.audio-status.error { color: #ff8c76; }
.diagnostics-button { min-height: 38px; font-size: 10px; letter-spacing: .08em; }
.diagnostics-panel {
  margin-top: 22px;
  border: 1px solid var(--line);
  background: rgba(14, 16, 21, .94);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .2);
}
.diagnostics-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  padding: 24px 26px;
  border-bottom: 1px solid var(--line);
}
.diagnostics-head .section-kicker { margin-bottom: 8px; }
.diagnostics-head h3 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 500;
  letter-spacing: -.035em;
}
.diagnostics-actions { display: flex; gap: 9px; }
.diagnostics-actions button { min-height: 40px; font-size: 11px; }
.diagnostics-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}
.diagnostic-metric {
  min-width: 0;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
}
.diagnostic-metric:last-child { border-right: 0; }
.diagnostic-metric > span {
  display: block;
  color: #696c74;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.diagnostic-metric b {
  display: block;
  overflow: hidden;
  margin-top: 8px;
  color: #f0efeb;
  font-size: 16px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.diagnostic-metric small {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  color: #777a82;
  font-size: 9px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.diagnostic-health.good b { color: var(--green); }
.diagnostic-health.warn b { color: #ffcf66; }
.diagnostic-health.bad b { color: #ff826b; }
.diagnostics-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.diagnostic-chart-card {
  min-width: 0;
  margin: 0;
  padding: 20px 20px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.diagnostic-chart-card:nth-child(2n) { border-right: 0; }
.diagnostic-chart-card:nth-last-child(-n+2) { border-bottom: 0; }
.viewer-inbound-chart { border-right: 0; border-bottom: 1px solid var(--line); }
.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 24px;
}
.chart-head h4 { margin: 0; font-size: 12px; font-weight: 650; }
.chart-subtitle { display: block; margin-top: 5px; color: #6f727a; font-size: 9px; line-height: 1.35; }
.chart-legend { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px 12px; }
.chart-legend span { color: #7e8189; font-size: 9px; white-space: nowrap; }
.chart-legend span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 2px;
  margin: 0 5px 3px 0;
  background: var(--legend-color);
}
.diagnostic-chart-card canvas { display: block; width: 100%; height: 190px; margin-top: 8px; }
.inbound-bitrate-statistics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 12px;
  color: #6f727a;
  font-size: 9px;
  letter-spacing: .08em;
}
.inbound-bitrate-statistics b { margin-left: 4px; color: #e8e8e5; font-size: 11px; letter-spacing: 0; }
.diagnostics-note { margin: 0; padding: 13px 20px; border-top: 1px solid var(--line); color: #62656d; font-size: 9px; text-align: center; }
.privacy-note { display: flex; gap: 12px; padding: 24px; color: #777a82; font-size: 10px; line-height: 1.5; }
.privacy-note span { color: var(--green); }
.privacy-note p { margin: 0; }
.privacy-note b { color: #b9bbc0; }
.toast { position: fixed; left: 50%; bottom: 30px; z-index: 20; padding: 12px 18px; color: #fff; background: #252830; border: 1px solid #3b3e47; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; transition: .25s; font-size: 12px; box-shadow: 0 10px 40px #000; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255,90,54,.7); }

@media (max-width: 960px) {
  .landing { grid-template-columns: 1fr; padding-top: 70px; }
  .hero-copy { max-width: 700px; }
  .stage-grid { grid-template-columns: 1fr; }
  .control-panel { border-left: 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(2, 1fr); }
  .diagnostics-summary { grid-template-columns: repeat(3, 1fr); }
  .diagnostic-metric { border-bottom: 1px solid var(--line); }
  .diagnostic-metric:nth-child(3n) { border-right: 0; }
  .diagnostic-metric:nth-last-child(-n+3) { border-bottom: 0; }
  .privacy-note { display: none; }
  .video-shell { min-height: 430px; }
}

@media (max-width: 620px) {
  .topbar { height: 68px; padding: 0 18px; }
  .network-pill { font-size: 0; padding: 9px 5px 9px 11px; }
  main { padding: 0 16px; }
  .landing { min-height: calc(100vh - 68px); padding: 48px 0; gap: 45px; }
  h1 { font-size: 54px; }
  .tab-panel { padding: 25px 20px; }
  .setting-grid { grid-template-columns: 1fr; }
  .studio { padding-top: 35px; }
  .studio-head { align-items: start; flex-direction: column; }
  .head-actions { width: 100%; }
  .head-actions button { flex: 1; }
  .video-shell { min-height: 260px; }
  .overlay-button span { display: none; }
  .control-panel { grid-template-columns: 1fr; }
  .diagnostics-head { align-items: start; flex-direction: column; padding: 20px; }
  .diagnostics-actions { width: 100%; }
  .diagnostics-actions button { flex: 1; padding: 0 10px; }
  .diagnostics-summary { grid-template-columns: repeat(2, 1fr); }
  .diagnostic-metric:nth-child(3n) { border-right: 1px solid var(--line); }
  .diagnostic-metric:nth-child(2n) { border-right: 0; }
  .diagnostic-metric:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
  .diagnostic-metric:nth-last-child(-n+2) { border-bottom: 0; }
  .diagnostics-charts { grid-template-columns: 1fr; }
  .diagnostic-chart-card, .diagnostic-chart-card:nth-child(2n) { border-right: 0; border-bottom: 1px solid var(--line); }
  .diagnostic-chart-card:last-child { border-bottom: 0; }
  .chart-head { align-items: start; flex-direction: column; }
  .chart-legend { justify-content: start; }
}
