/**
 * Präsentationsansicht (#/stage/:code): große Schrift für 2–3 m Lesbarkeit,
 * hoher Kontrast (WCAG 2.1 AA), viel Weißraum, kein Blinken.
 * App-Chrome blendet body.stage-mode aus.
 */

body.stage-mode {
  grid-template-rows: 1fr;
  background: #ffffff;
  color: #111111;
}

body.stage-mode .skip-link,
body.stage-mode #legal-hash-link,
body.stage-mode #app-footer,
body.stage-mode #consent-dialog {
  display: none !important;
}

body.stage-mode .app {
  height: 100dvh;
  height: 100vh;
  min-height: 0;
}

.view-stage {
  position: relative;
  display: grid;
  /* Bühne füllt den Viewport; Steuerleiste nur unten — keine impliziten Auto-Zeilen. */
  grid-template-rows: 1fr auto;
  grid-template-columns: 1fr;
  padding: 0;
  height: 100dvh;
  height: 100vh;
  overflow: hidden;
  background: #ffffff;
  color: #111111;
  /* ~40 % Weißraum über große Außenabstände */
  --stage-pad-y: 8vh;
  --stage-pad-x: 8vw;
}

/* Folieninhalt in der Hauptzeile — volle verfügbare Höhe für Ergebnisflächen. */
.view-stage > #stage-frame {
  grid-row: 1;
  grid-column: 1;
  min-height: 0;
  overflow: hidden;
}

/* Über der Bühne schwebende Layer — kein zusätzlicher Grid-Platz. */
.view-stage > #stage-conn,
.view-stage > #stage-reaction-layer,
.view-stage > #stage-logo-wrap,
.view-stage > #stage-footer,
.view-stage > #stage-pause,
.view-stage > #stage-event-countdown,
.view-stage > .stage-kbd-toast,
.view-stage > .stage-kbd-hint,
.view-stage > .stage-kbd-help-chip {
  grid-row: 1;
  grid-column: 1;
}

.view-stage > .stage-display-controls {
  grid-row: 2;
  grid-column: 1;
}

.view-stage[hidden] {
  display: none !important;
}

.stage-reaction-layer {
  z-index: 6;
}

.stage-conn {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  margin: 0;
  padding: 10px 18px;
  border-radius: 999px;
  background: #111111;
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
}

.stage-conn[hidden] {
  display: none !important;
}

.stage-logo-wrap {
  display: flex;
  justify-content: center;
  padding: 16px var(--stage-pad-x) 0;
}

.stage-logo-wrap[hidden] {
  display: none !important;
}

.stage-logo-wrap img {
  max-height: 48px;
  max-width: 220px;
  object-fit: contain;
}

.stage-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4vh;
  padding: var(--stage-pad-y) var(--stage-pad-x);
  min-height: 0;
  overflow: hidden;
}

.stage-frame.is-fading {
  animation: stageFade 480ms ease;
}

@keyframes stageFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage-frame.is-fading {
    animation: none;
  }
}

.stage-question {
  margin: 0;
  max-width: 18em;
  text-align: center;
  font-size: clamp(48px, 6.2vw, 96px);
  font-weight: 800;
  line-height: 1.12;
  color: #111111;
}

.stage-subtitle {
  margin: 0.65em 0 0;
  max-width: 22em;
  text-align: center;
  font-size: clamp(22px, 2.2vw, 34px);
  font-weight: 600;
  line-height: 1.35;
  color: #444444;
}

.stage-prompt {
  margin: 0.65em 0 0;
  max-width: 22em;
  text-align: center;
  font-size: clamp(32px, 3.4vw, 48px);
  font-weight: 700;
  line-height: 1.25;
  color: #111111;
}

.stage-subtitle + .stage-prompt {
  margin-top: 0.45em;
}

/* Schätzfrage: kleinere Frage, engerer Kopf (Frage → subtitle/prompt → Ergebnis/Teaser). */
.stage-frame--estimation {
  gap: 0.75vh;
  justify-content: flex-start;
  padding-top: max(2vh, 12px);
}

.stage-frame--estimation .stage-interaction-hint {
  margin: 0 0 0.25rem;
}

.stage-frame--estimation .stage-question {
  font-size: clamp(34px, 4.2vw, 58px);
  line-height: 1.08;
}

.stage-frame--estimation .stage-subtitle {
  margin-top: 0.12em;
  font-size: clamp(18px, 1.9vw, 28px);
  line-height: 1.2;
}

.stage-frame--estimation .stage-prompt {
  margin-top: 0.1em;
  font-size: clamp(22px, 2.3vw, 34px);
  line-height: 1.15;
}

.stage-frame--estimation .stage-subtitle + .stage-prompt {
  margin-top: 0.08em;
}

.stage-frame--estimation .stage-results {
  gap: 0.35vh;
  margin-top: 0;
  /* Restliche Viewport-Höhe für das Histogramm nutzen */
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.stage-frame--estimation .stage-results.stage-estimation {
  width: min(1100px, 100%);
}

.stage-frame--estimation .stage-teaser {
  margin: 0;
}

/* Multiple Choice: Grid — Kopf (Frage/Teilnahme) und Ergebnisbereich mit reserviertem Chrome. */
.stage-frame--choice {
  gap: 0.75vh;
  justify-content: flex-start;
  padding-top: max(2vh, 12px);
}

.stage-frame--choice .stage-choice-layout {
  display: grid;
  /* minmax(min-content): Kopfzeile darf bei wenig Höhe nicht unter Frage+Teilnahme kollabieren. */
  grid-template-rows: minmax(min-content, auto) minmax(0, 1fr);
  /* Volle Inhaltsbreite: die frühere Deckelung auf 1100px verschenkte auf 1920er
     Bühnen rund 400px, obwohl die Inhaltsfläche 1516px breit ist. Die QR-Reserve
     steckt bereits im padding-inline-end des Frames. */
  width: 100%;
  max-width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  height: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.stage-frame--choice .stage-choice-head {
  grid-row: 1;
  /* min-content: Grid-Zeile darf nicht unter Frage+Teilnahme schrumpfen (sonst Überlappung mit Balken). */
  min-block-size: min-content;
  min-inline-size: 0;
  width: 100%;
  box-sizing: border-box;
}

.stage-frame--choice .stage-choice-head .stage-question {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stage-frame--choice .stage-choice-body {
  grid-row: 2;
  min-block-size: 0;
  min-inline-size: 0;
  display: flex;
  flex-direction: column;
  /* Oben ausrichten: overflow:hidden + center schneidet erste/letzte Balken ab. */
  justify-content: flex-start;
  overflow-x: hidden;
  /* Standard: kein Scroll — Größe passt sich via --mc-* dynamisch an (JS). */
  overflow-y: hidden;
  width: 100%;
}

/* Notfall: nur wenn Inhalt trotz Mindestgrößen nicht passt (extrem kleines Viewport). */
.stage-frame--choice .stage-choice-body.stage-choice-body--scroll {
  overflow-y: auto;
}

.stage-frame--choice .stage-interaction-hint {
  margin: 0 0 0.25rem;
}

.stage-frame--choice .stage-question {
  font-size: clamp(34px, 4.2vw, 58px);
  line-height: 1.08;
}

@media (max-height: 520px) {
  .stage-frame--choice .stage-question {
    font-size: clamp(22px, 4vw, 32px);
    line-height: 1.06;
  }

  .stage-frame--choice .stage-vote-count {
    font-size: clamp(16px, 2vw, 22px);
  }
}

.stage-frame--choice .stage-choice-options-wrap {
  width: min(920px, 100%);
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage-frame--choice .stage-choice-options {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.6vh, 18px);
}

.stage-frame--choice .stage-choice-option {
  margin: 0;
  padding: clamp(14px, 1.8vh, 22px) clamp(18px, 2.4vw, 28px);
  border-radius: 14px;
  background: #f4f4f4;
  border: 2px solid #e0e0e0;
  font-size: clamp(24px, 2.6vw, 38px);
  font-weight: 700;
  line-height: 1.25;
  color: #111111;
  text-align: left;
}

.stage-frame--choice .stage-choice-option[data-color="0"] { border-left: 8px solid var(--c1, #b42318); }
.stage-frame--choice .stage-choice-option[data-color="1"] { border-left: 8px solid var(--c2, #175cd3); }
.stage-frame--choice .stage-choice-option[data-color="2"] { border-left: 8px solid var(--c3, #027a48); }
.stage-frame--choice .stage-choice-option[data-color="3"] { border-left: 8px solid var(--c4, #93370d); }
.stage-frame--choice .stage-choice-option[data-color="4"] { border-left: 8px solid var(--c5, #6941c6); }
.stage-frame--choice .stage-choice-option[data-color="5"] { border-left: 8px solid var(--c6, #155eef); }

.stage-frame--choice .stage-results.stage-choice-results {
  flex: 0 1 auto;
  min-height: min-content;
  min-width: 0;
  /* Oben ausrichten: margin-block:auto zentriert die Liste und schneidet bei
     overflow:hidden am Layout den ersten Balken oben / letzten unten ab. */
  justify-content: flex-start;
  align-self: flex-start;
  overflow: visible;
  margin-block: 0;
  width: 100%;
  /* .stage-results deckelt sonst auf min(1100px, 100%) — auf der Bühne soll die
     Balkenliste die gesamte Inhaltsbreite nutzen. */
  max-width: none;
}

/*
 * Wenige Optionen: Balkenblock vertikal zentrieren.
 *
 * Bei zwei bis drei Optionen sind alle Wachstumsdeckel erreicht, bevor die
 * Body-Höhe gefüllt ist — oben ausgerichtet bliebe die untere Bühnenhälfte leer.
 * Nur im Fit-Modus, in dem der Inhalt nachweislich in den Body passt: bei
 * Scrollbedarf würde `margin-block: auto` den ersten und letzten Balken
 * abschneiden (deshalb steht oben `justify-content: flex-start`).
 */
.stage-frame--choice
  .stage-choice-layout[data-mc-layout="fit"]
  .stage-results.stage-choice-results {
  margin-block: auto;
}

/*
 * Beschriftungsspalte: breiter und mehrzeilig.
 *
 * components.css setzt auf .poll-label `white-space: nowrap` mit
 * `text-overflow: ellipsis`. Auf der Bühne war die Spalte nur rund 230 px breit,
 * dadurch wurden bei der Messung ALLE sechs Optionen abgeschnitten
 * („Digitalisier…“). Zwei Zeilen in einer 30-%-Spalte fassen die üblichen
 * Optionstexte vollständig; die Höhenschätzung in stageMetrics.js rechnet
 * ohnehin mit mehrzeiligen Beschriftungen.
 */
.stage-frame--choice .stage-results .poll-row {
  grid-template-columns: minmax(0, var(--mc-label-col, 34%)) minmax(0, 1fr) auto;
}

.stage-frame--choice .stage-results .poll-label {
  white-space: normal;
  /* break-word statt anywhere: nur wirklich zu lange Wörter werden getrennt,
     „Personalgewinnung“ bleibt in einer Zeile. */
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--mc-label-lines, 2);
  line-clamp: var(--mc-label-lines, 2);
  overflow: hidden;
}

/*
 * MC-Ergebnisbalken: dynamische Tokens (--mc-*) aus stageChoiceLayoutMetrics.js.
 * Fallback clamp() für ersten Paint vor JS-Messung.
 */
.stage-frame--choice .stage-results {
  gap: var(--mc-row-gap, clamp(6px, 1.2vh, 2.4vh));
}

.stage-frame--choice .stage-results .poll-row {
  gap: clamp(0.4rem, 0.8vw, 1.2rem) clamp(0.6rem, 1vw, 1.6rem);
}

.stage-frame--choice .stage-results .poll-track {
  height: var(--mc-bar-height, 2.4rem);
}

.stage-frame--choice .stage-results .poll-label {
  font-size: var(--mc-label-size, clamp(28px, 2.8vw, 40px));
  line-height: 1.12;
}

.stage-frame--choice .stage-results .poll-count {
  font-size: var(--mc-count-size, clamp(18px, 2vw, 28px));
}

.stage-frame--choice .stage-results .poll-pct {
  font-size: var(--mc-pct-size, clamp(22px, 2.6vw, 40px));
  line-height: 1.05;
}

.stage-frame--choice .stage-teaser {
  margin: 0;
}

/* Stimmenzähler unter der Frage — live während der Abstimmung */
.stage-frame--choice .stage-vote-count {
  margin: 0.35em 0 0;
  font-size: clamp(22px, 2.4vw, 36px);
  font-weight: 700;
  text-align: center;
  color: #444444;
  font-variant-numeric: tabular-nums;
}

/* QR/Timer-Reserve erfolgt zentral über --stage-chrome-right auf .stage-choice-layout */

.stage-wait {
  font-size: clamp(40px, 5vw, 72px);
  font-weight: 800;
  text-align: center;
}

.stage-results {
  width: min(1100px, 100%);
  display: flex;
  flex-direction: column;
  gap: 2.4vh;
}

.stage-results .poll-row {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) minmax(12rem, 2.2fr) auto;
  gap: 1.2rem 1.6rem;
  align-items: center;
}

.stage-results .poll-label {
  font-size: clamp(28px, 2.8vw, 40px);
  font-weight: 700;
  color: #111111;
}

.stage-results .poll-track {
  position: relative;
  height: 2.4rem;
  background: #e8e8e8;
  border-radius: 999px;
  overflow: hidden;
}

.stage-results .poll-fill {
  /* Explizit im Track verankern — verhindert Höhen-Drift durch line-height/Text. */
  position: absolute;
  inset: 0 auto 0 0;
  height: auto;
  width: var(--bar-width, 0%);
  border-radius: inherit;
  line-height: 1;
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: width;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-inline: 12px;
  box-sizing: border-box;
}

/* Unterschiedliche Balkenfarben — Theme-Tokens wie Presenter/Join */
.stage-results .poll-fill[data-color="0"] { background: var(--c1, #b42318); color: var(--c1-ink, #fff); }
.stage-results .poll-fill[data-color="1"] { background: var(--c2, #175cd3); color: var(--c2-ink, #fff); }
.stage-results .poll-fill[data-color="2"] { background: var(--c3, #027a48); color: var(--c3-ink, #fff); }
.stage-results .poll-fill[data-color="3"] { background: var(--c4, #93370d); color: var(--c4-ink, #fff); }
.stage-results .poll-fill[data-color="4"] { background: var(--c5, #6941c6); color: var(--c5-ink, #fff); }
.stage-results .poll-fill[data-color="5"] { background: var(--c6, #155eef); color: var(--c6-ink, #fff); }

.stage-results .poll-fill--custom {
  background: var(--bar-bg);
  color: var(--bar-ink);
}

.stage-choice-option.choice-color--custom {
  border-left-width: 6px;
  border-left-style: solid;
  border-left-color: var(--choice-accent, var(--bar-bg));
}

/* Reguläre Folien: Chrome-Reserve (Timer oben, QR unten) — dynamisch via JS */
.stage-frame--regular {
  gap: 0.75vh;
  justify-content: flex-start;
  padding-top: max(2vh, var(--stage-chrome-top, 12px));
  padding-bottom: max(1vh, var(--stage-chrome-bottom, 12px));
  /* Rechts Platz für QR/Timer — verhindert Überlappung bei zentriertem MC-Grid. */
  padding-inline-end: calc(var(--stage-pad-x) + var(--stage-chrome-right, 0px));
  box-sizing: border-box;
}

.stage-frame--regular:has(.stage-slide-qr-overlay) .stage-results,
.stage-frame--regular:has(.stage-slide-qr-overlay) .stage-cloud,
.stage-frame--regular:has(.stage-slide-qr-overlay) .stage-choice-options-wrap {
  max-width: calc(100% - min(13rem, 28vw));
}

/*
 * Multiple Choice und Stimmungsbarometer: Bühnenfläche statt dreifacher QR-Reserve.
 *
 * Gemessen bei 1920×1080 (scripts/diagnose-stage-space-headless.js): Die QR-Karte
 * ist 216×273 px groß und sitzt in der rechten unteren Ecke (x 1682–1898,
 * y 785–1058). Die pauschale Reserve von .stage-frame--regular hält dafür aber
 * gleich dreifach Platz frei:
 *
 *   1. --stage-chrome-right (250 px) wird ZUSÄTZLICH zu --stage-pad-x (154 px)
 *      addiert. Die Variable misst den Abstand vom Bühnenrand zur QR-Karte, der
 *      Bühnenrand selbst ist darin also bereits enthalten — 404 px statt 250 px.
 *   2. --stage-chrome-bottom (303 px) sperrt ein volles unteres Band über die
 *      ganze Bühnenbreite, obwohl die Karte nur die rechte Ecke belegt.
 *   3. Der max-width-Abzug oben nimmt nochmals min(13rem, 28vw) = 208 px weg.
 *
 * Übrig blieben 1363×755 px, also 49,6 % der Bühne; die MC-Balken nutzten davon
 * nur 892 px Breite (46 % der Bühnenbreite), der Rest blieb leer.
 *
 * Beide Folientypen zeigen Balken bzw. Säulen, die nur bei gleicher Spurbreite
 * vergleichbar sind. Die Ecke wird deshalb nicht wie beim Picker umflossen,
 * sondern ehrlich als rechte Spalte reserviert: max() statt Addition. Das untere
 * Band und der max-width-Abzug entfallen — die QR-Karte liegt horizontal
 * vollständig rechts der neuen Inhaltskante.
 */
.stage-frame--choice.stage-frame--regular,
.stage-frame--mood-meter.stage-frame--regular {
  padding-inline-end: max(var(--stage-pad-x), var(--stage-chrome-right, 0px));
  padding-bottom: max(1vh, 12px);
}

/* Reihenfolge der beiden Klassen bewusst so herum: test-stage-layout-bounds.js
   verbietet per Zeichenkettensuche den Selektor, der mit der Folientyp-Klasse
   beginnt und direkt darauf die :has-Prüfung setzt — dort stand früher ein
   fragiles padding-right-Patch auf der Ergebnisliste. */
.stage-frame--choice.stage-frame--regular:has(.stage-slide-qr-overlay) .stage-results,
.stage-frame--choice.stage-frame--regular:has(.stage-slide-qr-overlay) .stage-choice-options-wrap,
.stage-frame--mood-meter.stage-frame--regular:has(.stage-slide-qr-overlay) .stage-results {
  max-width: none;
}

.stage-clock[data-reduced-motion="true"][data-urgency="critical"] strong {
  animation: none;
}

.stage-results .poll-count {
  font-size: clamp(18px, 2vw, 28px);
  font-weight: 800;
  color: inherit;
}

.stage-results .poll-pct {
  min-width: 5.5ch;
  font-size: clamp(36px, 4.2vw, 64px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #111111;
  text-align: right;
}

.stage-teaser {
  font-size: clamp(32px, 3.5vw, 52px);
  font-weight: 700;
  text-align: center;
  color: #111111;
}

.stage-avg {
  margin: 0;
  font-size: clamp(72px, 11vw, 160px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: center;
  color: #111111;
}

.stage-avg-scale {
  display: block;
  margin-top: 0.2em;
  font-size: 0.28em;
  font-weight: 700;
  color: #333333;
}

/* Picker: kompakte Frage, maximaler Platz für Bubble-Ergebnisse und Legende. */
.stage-frame--picker {
  gap: 0.55vh;
  justify-content: flex-start;
  /* Volle Breite nutzen — kein horizontales Zentrieren der Ergebnisfläche. */
  align-items: stretch;
  padding-top: max(1.5vh, 10px);
}

/* Das QR-Badge belegt nur die rechte untere Ecke. Die pauschale Reserve von
   .stage-frame--regular hält dafür eine volle Spalte und ein volles Band frei —
   zusammen rund die Hälfte der Bühne. Die Kacheln umfließen die Ecke selbst
   (siehe measurePickerChromeReserve), daher hier nur der normale Bühnenrand. */
.stage-frame--picker.stage-frame--regular {
  padding-inline-end: var(--stage-pad-x);
  padding-bottom: max(1vh, 12px);
}

.stage-frame--regular.stage-frame--picker:has(.stage-slide-qr-overlay) .stage-results {
  max-width: none;
}

.stage-frame--picker .stage-interaction-hint {
  margin: 0 0 0.2rem;
}

.stage-frame--picker .stage-question {
  font-size: clamp(24px, 2.8vw, 40px);
  line-height: 1.1;
  max-width: 24em;
}

.stage-frame--picker .stage-results {
  flex: 1 1 auto;
  min-height: 0;
  width: min(100%, 1880px);
  gap: 0.25vh;
  margin-top: 0;
  /* Minimales Innenpadding — Bubbles starten links im nutzbaren Bereich. */
  padding-inline: clamp(0, 0.25vw, 0.35rem);
  align-self: stretch;
  display: flex;
  flex-direction: column;
}

.stage-frame--picker .stage-results .picker-results--bubbles {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Ergebnisfläche oben, Legende als Fußzeile darunter. */
.stage-frame--picker .picker-bubble-grid {
  flex: 1 1 auto;
  /* Flex-Kind darf schrumpfen; Mindesthöhe nur als Fallback vor erstem Layout-Pass. */
  min-height: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.stage-frame--picker .picker-bubble-grid > .picker-bubble-canvas {
  flex: 1 1 auto;
  min-height: 0;
}

/* Kacheln tragen die Chrome-Reserve schon in ihren Koordinaten — Canvas bleibt voll breit. */
.stage-frame--picker .picker-bubble-canvas--tiles {
  width: 100%;
  max-width: none;
  margin: 0;
}

/* Listen-Fallback: volle Breite — Legende liegt als Overlay oben rechts. */
.stage-frame--picker .picker-bubble-canvas--list {
  width: 100%;
  max-width: none;
  margin: 0;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stage-frame--picker .picker-bubble-canvas--list .picker-results-list {
  width: 100%;
  max-width: none;
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  /* Rechts Platz für Legende und QR-Overlay — vom Renderer gemessen. */
  padding-inline-end: var(--picker-legend-reserve, 0px);
  box-sizing: border-box;
}

.stage-frame--picker .picker-bubble-canvas--list .picker-results-list__item {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  max-width: 100%;
}

.stage-frame--picker .picker-bubble-canvas--list .picker-results-list__label {
  flex: 0 1 auto;
  font-weight: 650;
  line-height: 1.12;
  font-size: max(var(--picker-bubble-label-size, 16px), 16px);
}

.stage-frame--picker .picker-bubble-canvas--list .picker-results-list__votes {
  flex: 0 0 auto;
  margin-left: 0.15rem;
  font-size: max(var(--picker-bubble-count-size, 14px), 14px);
  font-weight: 600;
  opacity: 0.9;
}

.stage-frame--picker .picker-bubble-canvas--tiles {
  flex: 1 1 auto;
  min-height: 0;
}

/* Legende oben rechts unter Timer/QR-Chrome — Swatch rechts neben Text. */
/* Legende als schmale Fußzeile unter den Kacheln — als Overlay oben rechts würde sie
   mitten in der Ergebnisfläche liegen und dort eine Leerfläche erzwingen. */
.stage-frame--picker .picker-results-legend {
  position: static;
  width: 100%;
  max-width: none;
  flex: 0 0 auto;
  margin-top: 0.35rem;
}

.stage-frame--picker .picker-results-legend .picker-category-legend {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.2rem 1.1rem;
  text-align: center;
}

.stage-frame--picker .picker-results-legend .picker-category-legend__item {
  justify-content: flex-start;
}

/* Wortwolke: Frage oben, Wolke auf voller Ergebnisfläche — QR nur als echte Ecken-Überdeckung. */
.stage-frame--wordcloud {
  gap: 0.55vh;
  justify-content: flex-start;
  align-items: stretch;
  padding-top: max(1.5vh, 10px);
}

/*
 * Wie Picker: die pauschale Reserve von .stage-frame--regular (volle rechte Spalte
 * + unteres Band) entfällt. Der Packer spart nur die gemessene QR-Ecke aus.
 */
.stage-frame--wordcloud.stage-frame--regular {
  padding-inline-end: var(--stage-pad-x);
  padding-bottom: max(1vh, 12px);
}

.stage-frame--regular.stage-frame--wordcloud:has(.stage-slide-qr-overlay) .stage-cloud {
  max-width: none;
}

.stage-frame--wordcloud .stage-question {
  font-size: clamp(32px, 3.8vw, 56px);
  line-height: 1.12;
  max-width: 22em;
}

.stage-frame--wordcloud .stage-subtitle {
  margin-top: 0.25em;
}

.stage-frame--wordcloud .stage-wordcloud-count {
  margin: 0.35em 0 0;
  font-size: clamp(22px, 2.4vw, 36px);
  font-weight: 700;
  text-align: center;
  color: #444444;
  font-variant-numeric: tabular-nums;
}

/* Kein zweiter Beitragszähler in der Canvas-Hülle (Stage hat #stage-wordcloud-count). */
.stage-frame--wordcloud .wordcloud-contribution-count,
.stage-frame--wordcloud .wordcloud-live {
  display: none !important;
}

.stage-frame--wordcloud .stage-cloud {
  /* 0%-Basis: Rest der Leinwand füllen, unabhängig von der Canvas-Pixelhöhe. */
  flex: 1 1 0%;
  min-height: 0;
  width: min(100%, 1880px);
  align-self: stretch;
}

.stage-frame--wordcloud .wordcloud-surface {
  min-height: 0;
  height: 100%;
}

.stage-cloud {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1;
}

.stage-cloud canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.stage-qa {
  width: min(1000px, 100%);
  max-height: 100%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.stage-qa-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.2rem;
  align-items: start;
  padding-bottom: 1.2rem;
  border-bottom: 2px solid #e4e4e4;
}

.stage-qa-rank {
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 800;
  color: #007cc1;
}

.stage-qa-text {
  margin: 0;
  font-size: clamp(28px, 2.6vw, 40px);
  font-weight: 700;
  line-height: 1.25;
  color: #111111;
}

.stage-qa-votes {
  font-size: clamp(32px, 3.4vw, 48px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #111111;
}

.stage-quiz-options {
  width: min(960px, 100%);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.stage-quiz-opt {
  padding: 0.6em 0.8em;
  font-size: clamp(28px, 2.6vw, 40px);
  font-weight: 700;
  border-radius: 12px;
  background: #f4f4f4;
  color: #111111;
}

.stage-quiz-opt.is-correct {
  background: #1b7a3a;
  color: #ffffff;
}

.stage-board {
  width: min(720px, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.stage-board-row {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  font-size: clamp(26px, 2.4vw, 36px);
  font-weight: 700;
}

.stage-open-list {
  width: min(900px, 100%);
  max-height: 100%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stage-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  width: min(1100px, 100%);
}

.stage-images img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 12px;
}

.stage-images p {
  margin: 0.4rem 0 0;
  font-size: clamp(22px, 2vw, 32px);
  font-weight: 700;
  text-align: center;
}

.stage-footer-copy {
  margin: 0;
  padding: 12px var(--stage-pad-x) 16px;
  text-align: center;
  font-size: 16px;
  color: #333333;
}

.stage-footer-copy[hidden] {
  display: none !important;
}

/* Auto-ausblendbare Stage-Steuerungsleiste (stageDisplayControls.js) */
.stage-display-controls {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(17, 17, 17, 0.12);
  box-shadow: 0 8px 28px rgba(17, 17, 17, 0.12);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.stage-display-controls.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.view-stage[data-stage-mode="share"] .stage-display-controls {
  display: none !important;
}

.stage-onscreen-context {
  margin: 0;
  min-width: 7rem;
  flex: 0 1 auto;
  font-size: clamp(14px, 1.4vw, 18px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #333333;
  white-space: nowrap;
}

.stage-onscreen-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1 1 auto;
}

.stage-onscreen-secondary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 7rem;
}

.stage-onscreen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 14px;
  border: 2px solid #111111;
  border-radius: 999px;
  background: #ffffff;
  color: #111111;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.1;
}

.stage-onscreen-btn--core {
  min-width: 7.5rem;
  padding: 12px 18px;
  font-size: 16px;
}

.stage-onscreen-btn--jump {
  padding: 10px 12px;
  font-size: 14px;
}

.stage-onscreen-btn:disabled,
.stage-onscreen-btn[aria-disabled="true"] {
  opacity: 0.38;
  cursor: not-allowed;
  color: #555555;
  border-color: #888888;
}

.stage-onscreen-btn:focus-visible,
.stage-fs:focus-visible {
  outline: 3px solid #007cc1;
  outline-offset: 3px;
}

.stage-onscreen-btn__icon {
  font-size: 1.05em;
}

.stage-fs {
  padding: 10px 16px;
  border: 2px solid #111111;
  border-radius: 999px;
  background: #ffffff;
  color: #111111;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}

/* Schmale Stage: Sprung-Buttons ausblenden, Kernnav behalten (Spec §5.2). */
@media (max-width: 720px) {
  .stage-onscreen-btn--jump {
    display: none;
  }

  .stage-onscreen-btn__label {
    /* Platz: nur Icons, aria-label/title bleiben. */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .stage-onscreen-btn--core {
    min-width: 44px;
    position: relative;
  }

  .stage-onscreen-context {
    min-width: 0;
    font-size: 13px;
  }

  .stage-onscreen-secondary {
    min-width: 0;
  }
}

.stage-pause {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  background: rgba(17, 17, 17, 0.92);
  color: #ffffff;
}

.stage-pause[hidden] {
  display: none !important;
}

.stage-pause p {
  margin: 0;
  font-size: clamp(40px, 6vw, 80px);
  font-weight: 800;
  text-align: center;
}

.stage-clock {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}

.stage-clock[hidden] {
  display: none !important;
}

.stage-clock-ring {
  width: 56px;
  height: 56px;
}

.stage-clock strong {
  font-size: 28px;
  font-weight: 800;
}

.stage-clock[data-urgency="ok"] strong {
  color: #1b7a3a;
}

.stage-clock[data-urgency="warn"] strong {
  color: #8a6a00;
}

.stage-clock[data-urgency="critical"] strong {
  color: var(--timer-critical, var(--danger, #b91c1c));
}

@media (max-width: 900px) {
  .stage-question {
    font-size: 48px;
  }

  .stage-prompt {
    font-size: 32px;
  }

  .view-stage {
    --stage-pad-y: 5vh;
    --stage-pad-x: 5vw;
  }
}

/* Screen-Sharing-Modus (?share=1): größere Typo, ruhigere Animationen */
.view-stage[data-stage-mode="share"] {
  --stage-pad-y: 8vh;
  --stage-pad-x: 10vw;
}

#stage-event-countdown .event-countdown-title {
  font-size: clamp(2rem, 6.5vw, 4.25rem);
}

.view-stage[data-stage-mode="share"] .event-countdown-title {
  font-size: clamp(2rem, 5vw, 3.75rem);
}

.view-stage[data-stage-mode="share"] .event-countdown-num {
  font-size: clamp(4rem, 14vw, 9rem);
}

.view-stage[data-stage-mode="share"] .event-countdown-datetime {
  font-size: clamp(1.35rem, 3.5vw, 2.5rem);
}

.view-stage[data-stage-mode="share"] .event-countdown-qr-card {
  max-width: min(24rem, 92vw);
  padding: 1.25rem 1.5rem;
}

.view-stage[data-stage-mode="share"] .event-countdown-qr-canvas {
  width: min(240px, 44vw);
  height: auto;
  aspect-ratio: 1 / 1;
}

.view-stage[data-stage-mode="share"] .event-countdown-bg {
  animation: none;
}

/* QR auf der Stage leicht vergrößert (Folien-Badge + Countdown, nicht Presenter-Vorschau) */
.view-stage .stage-slide-qr-overlay .stage-slide-qr-card {
  max-width: min(15rem, 34vw);
  padding: 0.75rem 1rem;
}

.view-stage .stage-slide-qr-overlay .event-countdown-qr-canvas {
  width: min(200px, 28vw);
}

.view-stage:not([data-stage-mode="share"]) .event-countdown-host .event-countdown-qr-canvas {
  width: min(228px, 40vw);
}

/* Stage-Tastatursteuerung: dezente Toasts und Hilfe (keine Toolbar) */
.stage-kbd-toast,
.stage-kbd-hint {
  position: absolute;
  right: max(16px, var(--stage-pad-x));
  bottom: max(16px, var(--stage-pad-y));
  z-index: 8;
  max-width: min(420px, 90vw);
  padding: 10px 16px;
  border-radius: 8px;
  background: rgba(17, 17, 17, 0.92);
  color: #ffffff;
  font-size: clamp(14px, 1.6vw, 18px);
  font-weight: 600;
  line-height: 1.35;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
}

.stage-kbd-toast[hidden],
.stage-kbd-hint[hidden] {
  display: none !important;
}

.stage-kbd-hint {
  opacity: 0.88;
  font-weight: 500;
}

/*
 * Persistenter „?“-Chip: Hilfe nach dem ausblendenden Banner erneut öffnen.
 * Oben rechts — kollidiert nicht mit Toast/Hinweis unten rechts.
 */
.stage-kbd-help-chip {
  position: absolute;
  top: max(12px, var(--stage-pad-y, 12px));
  right: max(12px, var(--stage-pad-x, 12px));
  z-index: 8;
  box-sizing: border-box;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: rgba(17, 17, 17, 0.55);
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}

.stage-kbd-help-chip[hidden] {
  display: none !important;
}

.stage-kbd-help-chip:hover {
  background: rgba(17, 17, 17, 0.75);
}

.stage-kbd-help-chip:focus-visible {
  outline: 2px solid var(--focus, #0071e3);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .stage-kbd-toast:not([hidden]),
  .stage-kbd-hint:not([hidden]) {
    animation: stage-kbd-fade-in 0.2s ease-out;
  }
}

@keyframes stage-kbd-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stage-kbd-help-dialog {
  max-width: 36rem;
  width: min(36rem, 92vw);
}

.stage-kbd-help-dialog h2 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
}

.stage-kbd-help-section h3 {
  margin: 1rem 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.stage-kbd-help-list {
  margin: 0;
  display: grid;
  gap: 0.35rem;
}

.stage-kbd-help-list div {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.5rem;
  align-items: baseline;
}

.stage-kbd-help-list dt {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
}

.stage-kbd-help-list dd {
  margin: 0;
}

.stage-kbd-help-note {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  color: var(--muted, #555);
}

.stage-kbd-help-muted {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted, #555);
}

.stage-kbd-help-actions {
  margin-top: 1.25rem;
  display: flex;
  justify-content: flex-end;
}
