:root {
  color-scheme: dark;
  --ink: #f6f8f2;
  --muted: #929c99;
  --panel: #111617;
  --panel-2: #171d1e;
  --line: rgba(255, 255, 255, 0.11);
  --green: #a1f219;
  --green-soft: rgba(161, 242, 25, 0.14);
  --red: #ff4d55;
  --amber: #ffbd59;
  --cyan: #64d8e8;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #080b0c; color: var(--ink); }
body { min-height: 100vh; min-height: 100dvh; overflow-x: hidden; }
button, input, select { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 15% 5%, rgba(161, 242, 25, 0.06), transparent 29rem),
    linear-gradient(145deg, #0b0f10, #07090a 68%);
}

.topbar {
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: max(14px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) 14px max(22px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: rgba(7, 10, 11, 0.86);
  backdrop-filter: blur(24px);
  position: relative;
  z-index: 5;
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand strong { display: block; font-size: 19px; letter-spacing: -0.03em; }
.brand small { display: block; color: var(--muted); font-size: 10px; letter-spacing: 0.11em; text-transform: uppercase; margin-top: 2px; }
.brand-mark { width: 33px; height: 33px; border: 1px solid rgba(161, 242, 25, 0.52); border-radius: 9px; display: grid; place-content: center; gap: 3px; transform: rotate(-2deg); }
.brand-mark i { width: 17px; height: 2px; background: var(--green); display: block; border-radius: 2px; }
.brand-mark i:nth-child(2) { width: 12px; }
.brand-mark i:nth-child(3) { width: 7px; }

.top-status { display: flex; gap: 8px; align-items: center; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: rgba(255,255,255,.04); font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px rgba(146,156,153,.1); }
.status-pill.live i { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.status-pill.recording { border-color: rgba(255,77,85,.35); }
.status-pill.recording i { background: var(--red); box-shadow: 0 0 0 4px rgba(255,77,85,.12); animation: pulse 1.2s infinite; }

.landing { min-height: calc(100dvh - 74px); display: grid; align-content: center; justify-items: start; max-width: 960px; margin: 0 auto; padding: 10vw 30px; }
.landing h1, .join-copy h1 { font-size: clamp(44px, 7vw, 90px); line-height: .96; letter-spacing: -.065em; margin: 16px 0 24px; max-width: 950px; }
.landing h1 em { color: var(--green); font-style: normal; }
.landing > p { color: #b4bcba; font-size: clamp(17px, 2vw, 23px); max-width: 650px; line-height: 1.55; }
.landing-note { margin-top: 36px; border-left: 2px solid var(--green); padding: 9px 14px; color: var(--muted); }
.eyebrow { font-size: 10px; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; color: var(--green); }
.error-text { color: var(--red); }

.join-layout { min-height: calc(100dvh - 74px); display: grid; grid-template-columns: minmax(300px, .9fr) minmax(400px, 620px); align-items: center; gap: clamp(40px, 8vw, 120px); max-width: 1280px; margin: auto; padding: 48px 40px; }
.join-copy h1 { font-size: clamp(42px, 5vw, 72px); }
.join-copy > p { color: #adb5b3; font-size: 17px; line-height: 1.65; max-width: 600px; }
.privacy-note { display: flex; align-items: flex-start; gap: 12px; margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.55; }
.privacy-note span { color: var(--green); }
.privacy-note p { margin: 0; }
.privacy-note strong { color: #dce2df; }

.join-card { border: 1px solid var(--line); border-radius: 24px; background: rgba(18,23,24,.86); padding: 18px; box-shadow: 0 30px 100px rgba(0,0,0,.44); }
.preview-wrap { aspect-ratio: 16/9; border-radius: 16px; overflow: hidden; background: #050707; position: relative; margin-bottom: 18px; }
.preview-wrap video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.preview-placeholder, .monitor-placeholder { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: #727b79; }
.preview-wrap:not(.waiting) .preview-placeholder { display: none; }
.preview-label { position: absolute; left: 12px; bottom: 12px; padding: 5px 8px; background: rgba(0,0,0,.65); border-radius: 6px; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.field { display: grid; gap: 6px; margin: 12px 0; }
.field > span { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.field input, .field select { width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 10px; background: #0b0f10; color: white; padding: 0 13px; outline: none; }
.field input:focus, .field select:focus { border-color: rgba(161,242,25,.6); box-shadow: 0 0 0 3px rgba(161,242,25,.08); }
.device-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.primary-button { width: 100%; min-height: 50px; margin-top: 12px; border: 0; border-radius: 12px; background: var(--green); color: #111700; font-weight: 850; cursor: pointer; }
.primary-button:hover { filter: brightness(1.06); }
.primary-button:disabled { opacity: .5; cursor: wait; }
.inline-error { color: #ff979c; font-size: 13px; line-height: 1.45; margin: 12px 4px 0; }

.studio { height: calc(100dvh - 74px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(290px, 350px); overflow: hidden; }
.stage-column { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) 102px; }
.program-monitor { position: relative; min-height: 0; background: #010202; overflow: hidden; }
.program-monitor > video { width: 100%; height: 100%; object-fit: contain; background: #020303; }
.monitor-placeholder { background: radial-gradient(circle at center, #172021, #050707 60%); gap: 8px; }
.monitor-placeholder strong { color: #c3cbc8; font-size: 15px; }
.monitor-placeholder small { color: #6f7976; }
.signal-rings { width: 42px; height: 42px; border: 1px solid rgba(161,242,25,.55); border-radius: 50%; margin: 0 auto 10px; box-shadow: 0 0 0 9px rgba(161,242,25,.06), 0 0 0 18px rgba(161,242,25,.025); animation: breathe 2s infinite ease-in-out; }
.monitor-topline { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; justify-content: space-between; pointer-events: none; }
.monitor-topline span { background: rgba(3,5,5,.68); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.08); border-radius: 6px; padding: 5px 8px; font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.audio-meter { position: absolute; left: 13px; bottom: 13px; width: 4px; height: 86px; border-radius: 4px; overflow: hidden; background: rgba(255,255,255,.15); display: flex; align-items: flex-end; }
.audio-meter i { display: block; width: 100%; height: 2%; background: linear-gradient(to top, var(--green), var(--amber) 76%, var(--red)); transition: height .07s linear; }

.control-bar { display: flex; align-items: center; justify-content: center; gap: 13px; border-top: 1px solid var(--line); background: #0d1112; padding: 12px 18px; }
.self-view { width: 120px; height: 74px; border-radius: 10px; overflow: hidden; position: absolute; left: 18px; border: 1px solid var(--line); background: #030505; }
.self-view video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.self-view span { position: absolute; left: 6px; bottom: 5px; font-size: 8px; font-weight: 850; letter-spacing: .13em; padding: 3px 5px; background: rgba(0,0,0,.65); border-radius: 4px; }
.round-control { width: 62px; height: 66px; border-radius: 13px; border: 1px solid var(--line); background: #171d1e; display: grid; place-content: center; gap: 4px; cursor: pointer; }
.round-control span { font-size: 18px; }
.round-control small { font-size: 9px; color: var(--muted); font-weight: 700; }
.round-control.off { background: rgba(255,77,85,.15); border-color: rgba(255,77,85,.32); }
.record-control { height: 58px; min-width: 170px; border-radius: 14px; border: 1px solid rgba(255,255,255,.14); background: #1a2021; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; }
.record-control span { width: 14px; height: 14px; border: 2px solid var(--red); border-radius: 50%; }
.record-control strong { font-size: 12px; }
.record-control.active { background: rgba(255,77,85,.14); border-color: rgba(255,77,85,.4); }
.record-control.active span { border-radius: 3px; background: var(--red); }
.record-control:disabled { opacity: .42; cursor: not-allowed; }
.leave-control { height: 45px; padding: 0 18px; border-radius: 10px; border: 1px solid rgba(255,77,85,.3); background: rgba(255,77,85,.1); cursor: pointer; font-size: 11px; font-weight: 750; }

.production-panel { border-left: 1px solid var(--line); background: #0d1112; padding: 22px; overflow: auto; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 20px; }
.panel-heading h2 { margin: 5px 0 0; font-size: 22px; letter-spacing: -.04em; }
.session-code { font: 750 11px ui-monospace, monospace; letter-spacing: .12em; color: var(--green); padding: 7px 9px; background: var(--green-soft); border-radius: 7px; }
.status-section { border-top: 1px solid var(--line); padding: 14px 0; }
.status-row { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; color: var(--muted); font-size: 12px; }
.status-row strong { color: #e8ecea; font-size: 11px; text-align: right; }
.status-row strong[data-tone="good"] { color: var(--green); }
.status-row strong[data-tone="warn"] { color: var(--amber); }
.status-row strong[data-tone="bad"] { color: #ff7e84; }
.technical { margin-top: 4px; }
.transfer-card, .invite-card { margin: 12px 0; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #131819; }
.transfer-head, .transfer-detail { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; }
.transfer-head strong { color: var(--green); }
.progress-track { height: 5px; background: rgba(255,255,255,.1); overflow: hidden; border-radius: 9px; margin: 12px 0 10px; }
.progress-track i { display: block; width: 100%; height: 100%; background: var(--green); transition: width .25s ease; }
.transfer-detail { color: var(--muted); font-size: 9px; }
.invite-card p { font: 10px/1.4 ui-monospace, monospace; color: #c7cecc; overflow-wrap: anywhere; }
.invite-card button { width: 100%; height: 38px; border: 1px solid rgba(161,242,25,.32); background: var(--green-soft); color: var(--green); border-radius: 9px; cursor: pointer; font-size: 11px; font-weight: 800; }
.reconnect-message { padding: 12px; border-radius: 9px; background: rgba(255,189,89,.1); border: 1px solid rgba(255,189,89,.24); color: #ffd596; font-size: 11px; line-height: 1.5; }

@keyframes pulse { 50% { opacity: .45; } }
@keyframes breathe { 50% { transform: scale(.92); opacity: .6; } }

@media (max-width: 900px) {
  .join-layout { grid-template-columns: 1fr; max-width: 660px; gap: 30px; padding: 34px 20px; }
  .join-copy h1 { font-size: clamp(38px, 11vw, 60px); }
  .studio { height: auto; min-height: calc(100dvh - 74px); grid-template-columns: 1fr; overflow: visible; }
  .stage-column { height: min(72dvh, 720px); grid-template-rows: minmax(0, 1fr) 96px; }
  .production-panel { border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 620px) {
  .topbar { height: 66px; padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .brand small { display: none; }
  .status-pill { padding: 0 9px; }
  .join-layout { padding: 26px 14px; }
  .join-copy h1 { margin-top: 12px; }
  .device-fields { grid-template-columns: 1fr; }
  .join-card { padding: 12px; border-radius: 18px; }
  .stage-column { height: 64dvh; min-height: 430px; }
  .control-bar { justify-content: flex-end; gap: 7px; padding: 10px; }
  .self-view { width: 86px; height: 62px; left: 8px; }
  .round-control { width: 49px; height: 57px; }
  .record-control { min-width: 56px; width: 56px; }
  .record-control strong { display: none; }
  .leave-control { padding: 0 10px; }
  .production-panel { padding: 18px 15px calc(24px + env(safe-area-inset-bottom)); }
}
