:root {
  color-scheme: light;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --canvas: #f7f8fc;
  --surface: #fff;
  --ink: #171b30;
  --muted: #565e75;
  --subtle: #667089;
  --border: #e2e5ef;
  --accent: #503ddb;
  --accent-hover: #4331be;
  --accent-soft: #eeebff;
  --shadow: 0 2px 3px #1c24500a, 0 10px 24px #1c245008;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .7; }
:focus-visible { outline: 3px solid #8271ff; outline-offset: 3px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.page-width { width: min(1320px, calc(100% - 88px)); margin-inline: auto; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { height: 73px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; gap: 10px; align-items: center; font-weight: 720; font-size: 24px; letter-spacing: -.055em; text-decoration: none; }
.brand img { flex: none; }
.nav-link { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-weight: 620; font-size: 14px; text-decoration: none; white-space: nowrap; }
.nav-link:hover { color: var(--accent); }
.nav-link svg { width: 16px; height: 16px; }

.hero { min-height: min(680px, calc(100vh - 74px)); display: grid; grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr); align-items: center; gap: clamp(24px, 5vw, 82px); padding: 66px 0 78px; }
.hero-copy { padding-left: 8px; }
.hero h1 { margin: 0; max-width: 15ch; font-size: clamp(3rem, 5.1vw, 4.75rem); line-height: 1.01; letter-spacing: -.065em; font-weight: 690; text-wrap: balance; }
.hero h1 span { color: var(--accent); white-space: nowrap; }
.hero-tagline { margin: 18px 0 0; font-size: clamp(1.2rem, 2vw, 1.65rem); font-weight: 600; line-height: 1.3; letter-spacing: -.025em; }
.hero-description { max-width: 34ch; font-size: clamp(16px, 1.5vw, 20px); margin: 18px 0 29px; line-height: 1.55; color: var(--muted); }
.hero-visual { display: grid; place-items: center; }
.hero-visual img { display: block; width: 95%; height: auto; max-height: 440px; object-fit: contain; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; border: 1px solid transparent; border-radius: 8px; padding: 8px 13px; font-size: 14px; font-weight: 650; line-height: 1.2; text-decoration: none; white-space: nowrap; }
.primary { background: var(--accent); color: #fff; box-shadow: 0 3px 8px #503ddb2b; }
.primary:hover { background: var(--accent-hover); }
.hero-button { min-height: 56px; padding: 12px 21px; border-radius: 11px; font-size: 16px; }
.secondary { background: var(--surface); border-color: var(--border); color: var(--ink); }
.secondary:hover { border-color: #b7afd9; background: #f8f6ff; }
.secondary[aria-pressed="true"] { color: #402fb8; border-color: #d3cbff; background: var(--accent-soft); }
.danger { background: #fff0ef; border-color: #f5d6d3; color: #aa272f; }
.danger:hover { background: #ffe3e0; }
.button svg { width: 17px; height: 17px; }
.hero-button svg { width: 21px; height: 21px; }
.message { padding: 11px 13px; margin: 14px 0 0; border-radius: 8px; border: 1px solid #dbdff2; background: #f0f2ff; color: #3b4264; line-height: 1.45; font-size: 14px; }
.message[data-error="true"] { border-color: #f5d6d3; background: #fff1f0; color: #902a32; }
.presenter-toast {
  position: fixed; z-index: 20; inset-inline: 0; top: max(12px, env(safe-area-inset-top, 0px));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: min(480px, calc(100% - 32px)); margin: 0 auto; padding: 8px 8px 8px 14px;
  box-shadow: 0 8px 24px #1c245024;
}
.toast-dismiss { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border: 0; border-radius: 6px; background: transparent; color: inherit; }
.toast-dismiss:hover { background: #171b3010; }
.toast-dismiss svg { width: 16px; height: 16px; }

.workspace, .viewer-workspace { padding: 40px 0 76px; }
.session-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.session-state { display: flex; align-items: center; gap: 8px; color: #5746ac; font-size: 13px; margin-bottom: 12px; }
.session-state span { width: 8px; height: 8px; border-radius: 50%; background: #806cf2; box-shadow: 0 0 0 3px #e9e3ff; }
.session-state[data-live="true"] { color: #167052; }
.session-state[data-live="true"] span { background: #16a475; box-shadow: 0 0 0 3px #def4e9; }
.session-heading h1 { font-size: clamp(32px, 4vw, 54px); line-height: 1.05; letter-spacing: -.058em; font-weight: 700; margin: 0; }
.session-heading p { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 9px 0 0; }
.metric { display: inline-flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--border); padding: 8px 11px; border-radius: 8px; white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--muted); }
.metric[data-viewers-present="true"] { background: #e6f7ee; border-color: #9bd6c0; color: #15583f; box-shadow: 0 0 0 3px #def4e98c; }
.metric svg, .toolbar-label svg { width: 16px; height: 16px; }
.session-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(282px, 328px); gap: 22px; align-items: start; }
.sidebar { display: grid; gap: 15px; }
.card { border: 1px solid var(--border); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); }
.capture-card { overflow: hidden; }
.card-toolbar { min-height: 47px; display: flex; padding: 10px 14px; align-items: center; justify-content: space-between; gap: 10px; }
.toolbar-label { display: inline-flex; gap: 8px; align-items: center; color: var(--ink); font-weight: 650; font-size: 14px; margin: 0; }
.toolbar-label svg, .source-format, .tile-status { color: var(--subtle); }
.source-format, .tile-status { font-variant-numeric: tabular-nums; font-size: 12px; text-align: right; }
.monitor { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #101323; }
.monitor video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.capture-controls { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; padding: 13px 14px; gap: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.destination { padding: 19px; }
.destination h2, .empty-viewer h2 { font-size: 17px; letter-spacing: -.024em; margin: 0; font-weight: 700; }
.destination-row { display: grid; grid-template-columns: 35px minmax(0, 1fr); align-items: start; gap: 10px; margin-top: 16px; }
.destination-icon { width: 35px; height: 35px; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent); border-radius: 8px; }
.destination-icon.neutral { background: #f0f2f7; color: var(--subtle); }
.destination-icon svg { width: 18px; height: 18px; }
.destination h3 { font-size: 14px; margin: 1px 0 4px; font-weight: 660; }
.destination p, .empty-viewer p { font-size: 13px; color: var(--muted); line-height: 1.45; margin: 0; }
.tv-row { border-top: 1px solid var(--border); padding-top: 15px; }
.link-tools { display: flex; margin-top: 12px; gap: 6px; align-items: stretch; }
.link-tools .button { min-height: 37px; padding-inline: 8px; }
.link-tools .button svg { width: 15px; height: 15px; }
.text-field { min-width: 0; border: 1px solid var(--border); border-radius: 8px; padding: 8px 9px; color: var(--ink); background: #f9faff; font-size: 13px; }
.link-tools input { flex: 1; text-overflow: ellipsis; }
.copy-message { padding-top: 8px; }
.viewers-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.count-pill { font-size: 12px; font-weight: 650; color: #4b536b; background: #f0f2f7; border-radius: 999px; padding: 4px 8px; white-space: nowrap; }
.destination label, .auth-card label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 670; }
.destination > .text-field { width: 100%; }
.viewer-workspace .message { margin-bottom: 14px; }
.auth-card { max-width: 480px; padding: 18px; }
.auth-card .text-field { flex: 1; min-height: 40px; }
.empty-viewer { padding: clamp(30px, 6vw, 72px) 18px; text-align: center; }
.empty-viewer h2 { margin: 12px 0 6px; }
.streams { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 18px; }
.streams[data-admin="true"]:not([data-focused="true"]) { grid-template-columns: repeat(auto-fill, minmax(min(100%, 285px), 1fr)); }
.streams[data-focused="true"], .streams[data-invited="true"] { grid-template-columns: 1fr; }
.streams[data-focused="true"] .monitor, .streams[data-invited="true"] .monitor { max-height: 70vh; }
.tile-zoom { margin-left: auto; }
.tile-status[data-live="true"] { color: #167052; }
.tile-status[data-waiting="true"] { padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: #4331be; }
.tile-waiting {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at 63% 47%, #403876, #1a1e3d); color: #eeebff;
  font-size: .9375rem; line-height: 1.4; text-align: center;
}

.viewer-workspace:has(.waiting-viewer:not([hidden])) { max-width: 880px; padding-top: clamp(20px, 3vw, 32px); }
.viewer-workspace:has(.waiting-viewer:not([hidden])) .session-heading { margin-bottom: 16px; }
.waiting-viewer { overflow: hidden; }
.waiting-viewer .card-toolbar { min-height: 40px; }
.no-signal {
  position: relative; display: grid; place-items: center; isolation: isolate;
  width: 100%; aspect-ratio: 5 / 2; min-height: 184px; overflow: hidden;
  background: radial-gradient(ellipse at 63% 47%, #403876 0%, #27284f 58%, #1a1e3d 100%);
}
.tv-static { position: absolute; z-index: -1; inset: -5%; width: 110%; height: 110%; opacity: .22; animation: static-shift 1.8s steps(5) infinite; }
.no-signal::before {
  content: ""; position: absolute; z-index: -1; inset: 0;
  background: repeating-linear-gradient(0deg, #13163146 0 1px, transparent 1px 4px);
}
.no-signal-label {
  display: grid; gap: 5px; margin: 12px; padding: 12px 16px; background: var(--accent-soft); color: var(--ink);
  border: 1px solid #d5ccff; border-radius: 9px; text-align: center;
}
.no-signal-label strong { font-family: ui-monospace, Menlo, monospace; font-size: clamp(16px, 3vw, 21px); text-transform: uppercase; letter-spacing: .08em; color: #4331be; }
.no-signal-label span { font-size: 14px; line-height: 1.4; color: #4b476d; }
@keyframes static-shift {
  0%, 100% { transform: translate(-1%, .5%); }
  25% { transform: translate(.75%, -.75%); }
  50% { transform: translate(0, 1%); }
  75% { transform: translate(-.5%, -.75%); }
}
@media (prefers-reduced-motion: reduce) { .tv-static { animation: none; } }


@media (max-width: 900px) {
  .page-width { width: calc(100% - 48px); }
  .hero { gap: 18px; min-height: 580px; }
  .hero-copy { padding-left: 0; }
  .hero h1 { font-size: clamp(2.6rem, 6vw, 3.5rem); }
  .session-grid { grid-template-columns: minmax(0, 1fr) minmax(245px, 275px); gap: 14px; }
  .destination { padding: 14px; }
}
@media (max-width: 690px) {
  .page-width { width: calc(100% - 32px); }
  .topbar-inner { height: 62px; }
  .brand { font-size: 22px; }
  .brand img { width: 32px; height: 32px; }
  .hero { grid-template-columns: 1fr; min-height: auto; padding: 48px 0 28px; gap: 35px; }
  .hero h1 { font-size: clamp(2.4rem, 9.5vw, 4rem); }
  .hero-description { margin-top: 16px; margin-bottom: 20px; }
  .hero-visual img { max-height: 285px; }
  .workspace, .viewer-workspace { padding-top: 25px; }
  .session-grid { grid-template-columns: minmax(0, 1fr); }
  .session-heading { align-items: start; margin-bottom: 18px; }
}
