:root {
  --ink: #182039;
  --muted: #687089;
  --brand: #4b2fff;
  --brand-dark: #3520c7;
  --surface: #ffffff;
  --line: #e5e7f0;
  --canvas: #f3f4f9;
  --danger: #cb3b4e;
  --radius: 18px;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

.app-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px clamp(20px, 3vw, 46px) 28px;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: .08em;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: clamp(126px, 14vw, 168px);
  height: auto;
  object-fit: contain;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 650;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8c94a8;
}

.connection-status.connected .status-dot { background: #1eae72; box-shadow: 0 0 0 4px #d9f4e8; }
.connection-status.waiting .status-dot { background: #f1a62f; box-shadow: 0 0 0 4px #fff0d5; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: clamp(18px, 2.2vw, 32px);
  align-items: start;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.video-card, .session-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(29, 35, 62, .06);
}

.video-card { padding: 12px; }
.video-card.video-hidden .video-frame { display: none; }
.video-card.video-hidden { align-self: start; }

.video-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 3px 11px;
  font-size: .9rem;
  font-weight: 750;
}

.media-state {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
}

.video-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: calc(100vh - 190px);
  border-radius: 12px;
  background: #202638;
}

video {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}

.video-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: #aeb5c8;
  text-align: center;
}

.video-empty span {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 1px solid #4b5368;
  border-radius: 50%;
  background: #30374b;
  color: white;
  font-size: 1.25rem;
  font-weight: 800;
}

.visibility-control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 3px 1px;
  color: var(--muted);
  font-size: .78rem;
  cursor: pointer;
}

.visibility-control input { accent-color: var(--brand); }

.session-panel {
  position: sticky;
  top: 20px;
  min-height: 430px;
  padding: 26px;
}

.eyebrow {
  color: #cfcaff;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .15em;
}

.eyebrow.dark { color: var(--brand); }
.session-panel h1 { margin: 7px 0 8px; font-size: clamp(1.55rem, 2.4vw, 2rem); }
.panel-copy { margin: 0 0 24px; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.session-actions { display: grid; gap: 10px; }
.session-actions label { margin-top: 2px; font-size: .78rem; font-weight: 750; }

.session-actions input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid #cdd1df;
  border-radius: 10px;
  outline: none;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-weight: 750;
}

.audio-processing {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid #dcd9ff;
  border-radius: 12px;
  background: #f8f7ff;
}

.audio-heading, .gain-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.audio-title-group {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.audio-skop-icon {
  display: block;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 9px;
  object-fit: contain;
}

.audio-heading h2 { margin: 4px 0 0; font-size: 1rem; }
.audio-processing label { color: var(--ink); font-size: .76rem; font-weight: 750; }
.audio-processing select {
  width: 100%;
  height: 42px;
  padding: 0 10px;
  border: 1px solid #cdd1df;
  border-radius: 9px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.audio-badge {
  flex: none;
  padding: 5px 8px;
  border-radius: 99px;
  background: #e8e5ff;
  color: var(--brand-dark);
  font-size: .65rem;
  font-weight: 750;
}

.gain-heading output { color: var(--brand-dark); font-size: .85rem; font-weight: 800; }
.gain-control { width: 100%; accent-color: var(--brand); }
.audio-note { margin: 0; color: var(--muted); font-size: .68rem; line-height: 1.45; }

.session-actions input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(75,47,255,.13); }

.button, .primary-link {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
  transition: transform .15s ease, background .15s ease;
}

.button:hover:not(:disabled), .primary-link:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .45; }
.button.primary, .primary-link { background: var(--brand); color: white; }
.button.primary:hover, .primary-link:hover { background: var(--brand-dark); }
.button.secondary { border: 1px solid #d6d3ff; background: #f0eeff; color: var(--brand-dark); }
.button.danger { margin-top: 8px; background: #fff0f2; color: var(--danger); }

.divider { display: flex; align-items: center; gap: 10px; color: #9aa0b1; font-size: .72rem; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }

.room-code, .message {
  margin-bottom: 18px;
  padding: 14px;
  border-radius: 10px;
}

.room-code { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; background: #f0eeff; }
.room-code span { color: var(--muted); font-size: .72rem; }
.room-code strong { grid-row: span 2; color: var(--brand-dark); font-size: 1.35rem; letter-spacing: .12em; }
.text-button { width: max-content; padding: 0; border: 0; background: none; color: var(--brand); font-size: .72rem; cursor: pointer; }
.message.error { background: #fff0f2; color: #a32235; font-size: .82rem; }

.landing-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 75% 20%, #7060ff 0, transparent 32%), var(--brand);
}

.landing-card { width: min(680px, 100%); color: white; }
.landing-logo {
  display: block;
  width: clamp(190px, 32vw, 270px);
  height: auto;
  margin-bottom: 24px;
  filter: drop-shadow(0 14px 24px rgba(26, 16, 111, .24));
}
.landing-card h1 { margin: 14px 0 18px; font-size: clamp(2.5rem, 7vw, 5.2rem); line-height: .98; letter-spacing: -.055em; }
.landing-card p { max-width: 490px; margin: 0 0 32px; color: #e4e1ff; font-size: clamp(1rem, 2vw, 1.18rem); line-height: 1.6; }
.landing-card .primary-link { width: max-content; padding: 0 22px; background: white; color: var(--brand-dark); gap: 18px; }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 1fr; }
  .session-panel { position: static; min-height: 0; }
  .video-frame { max-height: 45vh; }
}

@media (max-width: 660px) {
  .app-shell { padding: 12px; }
  .app-header { margin-bottom: 10px; }
  .connection-status span:last-child { display: none; }
  .video-grid { grid-template-columns: 1fr; }
  .video-frame { aspect-ratio: 16 / 9; max-height: none; }
  .session-panel { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
