:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: #0f1d31;
  --panel-2: #132742;
  --text: #eef5ff;
  --muted: #aebbd0;
  --primary: #38bdf8;
  --success: #10b981;
  --danger: #ef4444;
  --border: rgba(255,255,255,.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #133054, var(--bg));
  color: var(--text);
}

main { min-height: 100vh; }

.landing,
.app-shell {
  width: min(1400px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.presenter-shell,
.viewer-shell {
  display: grid;
  gap: 20px;
}

.presenter-shell {
  grid-template-columns: 420px 1fr;
}

.viewer-shell {
  grid-template-columns: 1fr;
}

.card {
  background: rgba(15, 29, 49, 0.92);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 12px 36px rgba(0,0,0,.28);
  backdrop-filter: blur(12px);
}

.hero {
  max-width: 760px;
  margin: 5vh auto 0;
  text-align: center;
}

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

label {
  display: block;
  margin-bottom: 14px;
  font-size: 0.95rem;
  color: var(--muted);
}

input {
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}

.button {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
  background: #233a5d;
  color: var(--text);
  transition: transform .18s ease, opacity .18s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button.primary { background: var(--primary); color: #062033; }
.button.success { background: var(--success); color: #042116; }
.button.danger { background: var(--danger); color: #280606; }

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.meta-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.meta-label,
.muted,
.hint {
  color: var(--muted);
  font-size: .9rem;
}

.copy-row,
.join-row,
.toolbar {
  display: flex;
  gap: 12px;
  align-items: end;
}

.copy-row input { flex: 1; }

.qr-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 12px 0 8px;
}

#qrCanvas {
  width: 220px;
  height: 220px;
  background: white;
  border-radius: 12px;
  padding: 12px;
}

.preview-panel video,
.video-stage video {
  width: 100%;
  background: black;
  border-radius: 16px;
  object-fit: contain;
}

.preview-panel video {
  min-height: 420px;
  max-height: 72vh;
}

.viewer-panel-large { min-height: calc(100vh - 48px); }
.video-stage {
  position: relative;
  min-height: 68vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-stage video {
  min-height: 68vh;
  max-height: 78vh;
}
.placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 1.1rem;
  border: 1px dashed rgba(255,255,255,.2);
  border-radius: 16px;
}

@media (max-width: 980px) {
  .presenter-shell {
    grid-template-columns: 1fr;
  }

  .vertical-mobile,
  .join-row,
  .toolbar,
  .copy-row {
    flex-direction: column;
    align-items: stretch;
  }

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