:root {
  color-scheme: dark;
  --bg: #12141a;
  --panel: #1b1e27;
  --border: #2b2f3a;
  --text: #e8eaf0;
  --text-dim: #9aa0b0;
  --accent: #5b8cff;
  --accent-hover: #7aa2ff;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

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

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 0.25rem;
}

h2 {
  font-size: 1.05rem;
  margin: 0 0 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
}

#status {
  color: var(--text-dim);
  margin: 0 0 1.5rem;
}

section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.1rem;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
}

button:disabled {
  background: #3a3f4d;
  cursor: default;
}

code {
  background: #10131a;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.15rem 0.4rem;
  word-break: break-all;
}

#room-code {
  font-size: 1.4rem;
  letter-spacing: 0.1em;
  color: var(--accent-hover);
}

#composite-canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  background: #000;
  display: block;
}

.hint {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

.audio-output {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

select {
  background: #10131a;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  flex: 1;
}

#ometv-preview {
  width: 100%;
  max-width: 320px;
  border-radius: 8px;
  margin-top: 0.75rem;
  background: #000;
}

/* Landing */
.landing {
  text-align: center;
  padding-top: 4rem;
}

.landing .button {
  display: inline-block;
  margin: 1.5rem 0;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
}

#join-form {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 2rem;
}

#room-input {
  background: #10131a;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  text-align: center;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  width: 8rem;
}

label {
  display: block;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

/* Buehnenmodus: alles ausblenden ausser dem fertigen Bild, damit die
   OBS-Fensteraufnahme nur das Video erwischt und nicht die Bedienoberflaeche.
   Das Seitenverhaeltnis wird ueber max-* statt ueber feste 100vw/100vh
   gehalten -- object-fit ist auf canvas nicht ueberall verlaesslich, und ein
   verzerrtes Gesicht auf ome.tv waere schlimmer als schwarze Raender. Wer die
   Raender nicht will, zieht das Browserfenster auf 16:9. */
#stage-exit {
  display: none;
}

body.stage-mode {
  background: #000;
  overflow: hidden;
}

body.stage-mode main {
  max-width: none;
  margin: 0;
  padding: 0;
}

body.stage-mode header,
body.stage-mode .room-info,
body.stage-mode .ometv-share,
body.stage-mode .composite h2,
body.stage-mode .composite .hint,
body.stage-mode .composite .audio-output,
body.stage-mode #stage-mode {
  display: none;
}

body.stage-mode .composite {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: #000;
}

body.stage-mode #composite-canvas {
  width: auto;
  height: auto;
  max-width: 100vw;
  max-height: 100vh;
  border-radius: 0;
}

body.stage-mode #stage-exit {
  display: block;
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 10;
  opacity: 0.05;
  transition: opacity 0.15s ease;
}

body.stage-mode #stage-exit:hover,
body.stage-mode #stage-exit:focus-visible {
  opacity: 1;
}

/* Gast-Ansicht: ome.tv gross, Host als Bild-im-Bild oben rechts */
.views {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.views video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#host-view {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 26%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  border: 2px solid #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.self-corner {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  width: 140px;
  border-radius: 8px;
  border: 2px solid var(--border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}
