:root {
  --bg: #080b12;
  --panel: #111722;
  --panel-strong: #151e2d;
  --border: #2a3a50;
  --accent: #e8c47c;
  --accent-blue: #8eb8ff;
  --text: #f3f6fb;
  --muted: #9aaabd;
  --success: #71e0a0;
  --danger: #ff8d88;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body { min-height: 100dvh; }

button { font: inherit; }

.booth-shell {
  width: min(1180px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(22px + var(--safe-top)) 18px calc(18px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.booth-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow, .connection-number {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 5px;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  letter-spacing: -.025em;
}

.subtitle, .card-copy, .small-note, .booth-footer {
  color: var(--muted);
  line-height: 1.45;
}

.subtitle { margin: 0; font-size: .87rem; }

.connection-badge, .state-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: .67rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.connection-badge.good, .state-pill.good {
  border-color: rgba(113, 224, 160, .5);
  color: var(--success);
}

.connection-badge.warn, .state-pill.warn {
  border-color: rgba(232, 196, 124, .5);
  color: var(--accent);
}

.connection-badge.bad, .state-pill.bad {
  border-color: rgba(255, 141, 136, .5);
  color: var(--danger);
}

.status-banner {
  min-height: 42px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(17, 23, 34, .82);
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.4;
}

.status-banner.good { border-color: rgba(113, 224, 160, .42); color: var(--success); }
.status-banner.warn { border-color: rgba(232, 196, 124, .42); color: var(--accent); }
.status-banner.bad { border-color: rgba(255, 141, 136, .42); color: var(--danger); }

.connection-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.connection-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(21, 30, 45, .98), rgba(13, 18, 28, .98));
  box-shadow: 0 18px 50px rgba(0, 0, 0, .2);
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-heading h2 {
  margin-bottom: 5px;
  font-size: 1.35rem;
  letter-spacing: .05em;
}

.card-copy { margin-bottom: 0; font-size: .78rem; }

.user-stage, .ai-stage {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid #30445f;
  border-radius: 12px;
  background: #05080d;
}

.user-stage video {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 300px;
  object-fit: contain;
  background: #02050a;
}

.stage-placeholder, .ai-stage {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 22px;
  text-align: center;
}

.stage-placeholder {
  position: absolute;
  inset: 0;
  color: var(--muted);
  font-size: .8rem;
}

.placeholder-mark, .ai-mark {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border: 1px solid rgba(232, 196, 124, .55);
  border-radius: 50%;
  color: var(--accent);
  font-size: .82rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.ai-mark {
  border-color: rgba(142, 184, 255, .62);
  color: var(--accent-blue);
}

.ai-stage h3 { margin: 0; font-size: 1.05rem; }
.ai-stage > p { max-width: 380px; margin-bottom: 0; color: var(--muted); font-size: .8rem; line-height: 1.55; }

.ai-output {
  width: 100%;
  max-height: 190px;
  overflow: auto;
  padding: 11px 12px;
  border: 1px solid #30445f;
  border-radius: 10px;
  background: #09101b;
  color: #eaf2ff;
  font-size: .78rem;
  line-height: 1.55;
  text-align: left;
  white-space: pre-wrap;
}

.progress-track {
  width: min(360px, 100%);
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #223047;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent));
  transition: width .2s ease;
}

.live-label {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 5px 8px;
  border: 1px solid rgba(113, 224, 160, .6);
  border-radius: 999px;
  background: rgba(4, 18, 12, .82);
  color: var(--success);
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .08em;
}

.action-row { display: flex; flex-wrap: wrap; gap: 8px; }

.button {
  min-height: 42px;
  flex: 1 1 130px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #111925;
  color: var(--text);
  cursor: pointer;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .05em;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.button:hover:not(:disabled) { border-color: var(--accent); background: #182437; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button.primary { border-color: var(--accent); background: var(--accent); color: #111; }
.button.primary:hover:not(:disabled) { background: #f0d18e; }
.button:disabled { cursor: not-allowed; opacity: .42; }
.button:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; }

.small-note { margin: 0; font-size: .7rem; }

.booth-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
  font-size: .7rem;
}

.hidden { display: none !important; }

@media (max-width: 780px) {
  .connection-grid { grid-template-columns: 1fr; }
  .user-stage, .ai-stage, .user-stage video { min-height: 250px; }
}

@media (max-width: 520px) {
  .booth-shell { padding-left: 12px; padding-right: 12px; }
  .booth-header { flex-direction: column; gap: 10px; }
  .connection-badge { align-self: flex-start; }
  .card-heading { flex-direction: column; }
  .state-pill { align-self: flex-start; }
  .booth-footer { flex-direction: column; }
}
