:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --bg-2: #12161c;
  --panel: #181d25;
  --line: #2a3340;
  --text: #f3f5f7;
  --muted: #9aa6b2;
  --fr: #e8b86d;
  --en: #7ec8c3;
  --live: #14b8a6;
  --talk: #f59e0b;
  --off: #5b6570;
  --danger: #ef4444;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  font-family: "Segoe UI", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body.booth {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.92em;
}

.home {
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(232, 184, 109, 0.12), transparent 50%),
    radial-gradient(800px 480px at 110% 10%, rgba(126, 200, 195, 0.1), transparent 46%),
    var(--bg);
}

.home-wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 10vh 24px 48px;
}

.eyebrow {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0 0 12px;
}

.home h1,
.identity-text h1 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.home h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
}

.lede,
.home-note,
.identity-text p,
.booth-session p {
  color: var(--muted);
}

.lede {
  max-width: 42rem;
  font-size: 1.05rem;
  line-height: 1.5;
}

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

.booth-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 28px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.booth-card:hover,
.booth-card:focus-visible {
  transform: translateY(-2px);
  border-color: #4b5a6c;
}

.booth-card.fr {
  border-top: 3px solid var(--fr);
}

.booth-card.en {
  border-top: 3px solid var(--en);
}

.booth-id {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.booth-meta,
.home-note {
  font-size: 0.95rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: rgba(11, 13, 16, 0.92);
  border-bottom: 1px solid var(--line);
}

.identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.role-badge {
  min-width: 76px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #2a2114;
  color: var(--fr);
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.role-badge.en {
  background: #122424;
  color: var(--en);
}

.identity-text h1 {
  font-size: 1.15rem;
}

.identity-text p {
  margin: 2px 0 0;
  font-size: 0.86rem;
}

.pills {
  display: flex;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  font-size: 0.86rem;
}

.pill i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--off);
}

.pill[data-state="on"] i {
  background: var(--live);
  box-shadow: 0 0 10px var(--live);
}

.pill[data-state="talk"] i {
  background: var(--talk);
  box-shadow: 0 0 10px var(--talk);
}

.stage {
  position: relative;
  min-height: 0;
  background: #050607;
}

.floor-frame,
.booth-frame {
  border: 0;
  width: 100%;
  height: 100%;
  background: #000;
}

.booth-session {
  position: fixed;
  left: -200vw;
  top: 0;
  width: 480px;
  height: 320px;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.booth-session p {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.console {
  display: grid;
  grid-template-columns: 1fr auto minmax(220px, 280px);
  gap: 18px;
  align-items: center;
  padding: 16px 18px 18px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.faders {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.fader,
.device {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.fader {
  display: grid;
  grid-template-columns: auto 1fr 36px;
  align-items: center;
  gap: 10px;
}

input[type="range"] {
  width: 100%;
  accent-color: #d7b57a;
}

.fader output {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.actions {
  display: flex;
  gap: 10px;
}

.btn {
  min-width: 110px;
  min-height: 56px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.btn.mute {
  background: #2a3340;
  color: var(--text);
}

.btn.mute[aria-pressed="true"] {
  background: var(--danger);
  color: white;
}

.btn.reload {
  min-width: auto;
  padding: 0 12px;
  background: #3f1d1d;
  color: #fecaca;
}

.btn.reload:disabled {
  opacity: 0.6;
}

.btn.cough {
  background: #3a2d16;
  color: #f3d19a;
}

.btn.cough:active,
.btn.cough.is-held {
  background: var(--talk);
  color: #1a1206;
}

.device select,
.device input,
.join-card input {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  padding: 0 10px;
  font: inherit;
}

.join-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(11, 13, 16, 0.94);
}

.join-gate[hidden] {
  display: none;
}

.join-card {
  width: min(420px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 32px 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.join-card h1 {
  margin: 0;
}

.join-card .btn {
  width: 100%;
}

.error-banner {
  padding: 12px 18px;
  background: #3f1d1d;
  color: #fecaca;
}

.error-banner[hidden] {
  display: none;
}

.error-inline {
  margin: 0;
  font-size: 0.95rem;
  color: #fca5a5;
}

.error-inline[hidden] {
  display: none;
}

.inline-link {
  color: var(--fr);
}

body.operator {
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

body.operator .topbar {
  padding: 8px 12px;
  gap: 10px;
}

body.operator .role-badge {
  min-width: 48px;
  padding: 6px 8px;
}

body.operator .btn {
  min-width: 52px;
  min-height: 34px;
  border-radius: 8px;
  font-size: 0.72rem;
}

.onair {
  min-width: 160px;
  padding: 10px 16px;
  border-radius: 12px;
  background: #1c222b;
  border: 1px solid var(--line);
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.onair[data-live="true"] {
  background: var(--danger);
  border-color: transparent;
  color: white;
}

.op-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(0, 1fr) minmax(280px, 1.05fr);
  min-height: 0;
  gap: 8px;
  padding: 8px 10px 0;
}

.monitor,
.input-tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  min-height: 0;
}

.monitor.preview {
  grid-column: 1;
  grid-row: 1;
}

.monitor.program {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.monitor.preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.input-bus {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
  min-height: 0;
}

.input-bar {
  display: flex;
  gap: 8px;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  min-height: 0;
}

.monitor-head,
.guest-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px 0;
  flex-shrink: 0;
}

.group-talk,
.talk-pair,
.guest-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-talk {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.monitor-head h2,
.input-tile strong {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.guest-name {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 0.86rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 650;
}

.oton-video {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  margin: 8px 10px 10px;
  background: #050607;
  border-radius: 8px;
  overflow: hidden;
}

.oton-frame {
  border: 0;
  background: #050607;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  max-height: 100%;
}

.oton-video:not(:empty) .oton-frame {
  width: min(100%, calc(100cqh * 16 / 9));
  height: min(100%, calc(100cqw * 9 / 16));
}

.oton-video {
  container-type: size;
}

.preview-stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  padding: 8px 10px 10px;
}

.preview-hero,
.tile-hero {
  display: grid;
  place-items: center;
  min-height: 0;
  border-radius: 10px;
  background: #0a0c10;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.preview-hero {
  flex: 1;
  min-height: 0;
  font-size: clamp(2rem, 6vw, 4.5rem);
}

.tile-hero {
  display: grid;
  place-items: center;
  margin: 8px 10px 0;
  min-height: 2rem;
  flex: 1 1 auto;
  padding: 4px 8px;
  font-size: clamp(1rem, 1.8vw, 1.45rem);
  font-weight: 750;
  letter-spacing: 0;
  text-transform: none;
  text-align: center;
  line-height: 1.15;
}

.preview-hero.fr,
.input-tile.fr .tile-hero {
  color: var(--fr);
}

.preview-hero.en,
.input-tile.en .tile-hero {
  color: var(--en);
}

.input-tile {
  display: flex;
  flex-direction: column;
  min-height: 0;
  cursor: pointer;
}

.input-tile.fr {
  border-top: 3px solid var(--fr);
}

.input-tile.en {
  border-top: 3px solid var(--en);
}

.input-tile.is-preview {
  border-color: #e8b86d;
  box-shadow: inset 0 0 0 1px #e8b86d;
}

.input-tile.is-assigned .tile-hero {
  color: inherit;
}

.level-track {
  position: relative;
  margin: 8px 10px 0;
  height: 14px;
  border-radius: 4px;
  background:
    linear-gradient(
      90deg,
      rgba(20, 184, 166, 0.18) 0%,
      rgba(132, 204, 22, 0.18) 55%,
      rgba(245, 158, 11, 0.2) 78%,
      rgba(239, 68, 68, 0.22) 100%
    ),
    #0a0c10;
  overflow: hidden;
  flex-shrink: 0;
}

.level-track.tall {
  height: 18px;
}

.level-track i {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    #14b8a6 0%,
    #84cc16 55%,
    #f59e0b 78%,
    #ef4444 100%
  );
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

.level-track b {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #f8fafc;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.7);
  left: 0;
  transform: translateX(-1px);
}

.guest-actions {
  padding: 8px 10px 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
  margin-top: auto;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 6px 10px 0;
  padding: 6px 8px;
  flex-shrink: 0;
  background: #0a0c10;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stats.compact {
  grid-template-columns: 1fr 1fr 1fr;
}

.stats div {
  margin: 0;
}

.stats dt {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stats dd {
  margin: 2px 0 0;
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
  font-weight: 700;
  color: #e8eef4;
}

.stats dd.is-warn {
  color: #fbbf24;
}

.stats dd.is-bad {
  color: #f87171;
}

.input-tile .stats,
#preview-stats {
  grid-template-columns: 1fr 1fr 1fr;
}

.vmix-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-width: 88px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.vmix-copy:hover,
.vmix-copy:focus-visible {
  border-color: #4b5a6c;
}

.vmix-copy.is-copied {
  background: #14302c;
  border-color: var(--live);
  color: #b7f3ea;
}

.talk-pair.wide .btn.ptt {
  min-width: 96px;
}

.btn.ptt {
  background: #2a3340;
  color: var(--text);
}

.btn.lock {
  min-width: 72px;
  background: #231c12;
  color: #f3d19a;
}

.talk-pair[data-live="true"] .btn.ptt {
  background: var(--danger);
  color: white;
}

.btn.lock[aria-pressed="true"] {
  background: var(--talk);
  color: #1a1206;
}

.op-console {
  grid-template-columns: 1fr 1fr minmax(180px, 240px);
  padding: 8px 12px;
}

.mix-pair {
  display: flex;
  gap: 6px;
}

.btn.mix {
  min-width: 64px;
  min-height: 40px;
  background: #2a3340;
  color: var(--text);
}

.btn.mix[aria-pressed="true"] {
  background: #3f1d1d;
  color: #fecaca;
}

.btn.cut {
  min-width: 56px;
  min-height: 40px;
  background: #2a3340;
  color: var(--text);
}

.btn.cut[aria-pressed="true"] {
  background: var(--danger);
  border-color: transparent;
  color: #fff;
}

.btn.mix.solo[aria-pressed="true"] {
  background: #3a2d16;
  color: #f3d19a;
}

body.oton {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.oton-stage {
  position: relative;
  min-height: 0;
  margin: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #050607;
  overflow: hidden;
}

.oton-steps {
  height: 100%;
  overflow: auto;
  padding: 18px 22px;
}

.oton-steps[hidden] {
  display: none;
}

.oton-steps h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.oton-steps ol {
  margin: 0 0 12px;
  padding-left: 20px;
  line-height: 1.6;
}

.oton-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.oton-console {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
}

.oton-console .home-note {
  margin: 0;
}

.hear-cue {
  position: fixed;
  z-index: 20;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid #e8b86d;
  border-radius: 10px;
  background: #3a2d16;
  color: #f3d19a;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.hear-cue[hidden] {
  display: none;
}

.view-dock {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 8px;
  height: 8px;
  overflow: hidden;
  opacity: 0.02;
  pointer-events: none;
}

.view-dock iframe {
  width: 280px;
  height: 160px;
  border: 0;
}

.talk-dock {
  position: fixed;
  left: -200vw;
  top: 0;
  width: 480px;
  height: 320px;
  overflow: hidden;
}

.talk-dock iframe {
  width: 480px;
  height: 320px;
  border: 0;
}

@media (max-width: 900px) {
  .booth-grid,
  .console,
  .fader,
  .op-main,
  .input-grid,
  .op-console {
    grid-template-columns: 1fr;
  }

  .op-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .monitor.preview,
  .monitor.program,
  .input-bus {
    grid-column: auto;
    grid-row: auto;
  }

  body.operator {
    height: auto;
    overflow: auto;
  }

  .console {
    gap: 14px;
  }

  .booth-session {
    width: 320px;
    height: 220px;
  }
}
