/*
 * Publikumsanzeige: Grundaufbau für alle Designs (display-view.js baut die Elemente).
 * Gilt in anzeige.html und verkleinert im Panel „Anzeige-Vorschau“ des Hauptfensters.
 * Alle Maße in Container-Einheiten (cqh/cqw) der Bühne .stage: Die Anzeige wächst mit jedem
 * Beamer-Format, und die Vorschau sieht genauso aus, nur kleiner.
 * Alles hängt an .stage und an Klassen mit „ad-“, damit nichts ins Hauptfenster durchschlägt.
 * Die Designs (web/themes/<name>-anzeige.css) setzen Farben, Schriften und Schmuck
 * unter [data-dtheme="<name>"] .stage. Die Vorgaben hier ergeben „Studio Dunkel“.
 */
.stage {
  --bg: #14110f;
  --panel: #1d1916;
  --panel-2: #26201c;
  --line: #3a312a;
  --text: #f3e9dc;
  --muted: #a8998a;
  --accent: #e8a33d;
  --accent-ink: #1a1208;
  --ok: #7cc68a;
  --warn: #f0b35a;
  --bad: #e5776b;
  --bpm-color: var(--accent);
  --artist-color: var(--accent);
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-head: var(--font-ui);
  --font-num: var(--font-ui);
  --pad: 4cqmin;
  container-type: size;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  /* Nur kräftige Schnitte: dünne Schrift verschwindet bei schwachen Beamern. */
  font: 700 4cqh/1.15 var(--font-ui);
  color-scheme: dark;
}
.stage [hidden] { display: none !important; }
.stage .ad-view { position: absolute; inset: 0; padding: var(--pad); }
.stage .ad-deco { position: absolute; inset: 0; pointer-events: none; }

/* Leerlauf */
.stage .ad-idle { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 4cqh; }
.stage .ad-idle-party { margin: 0; font-family: var(--font-head); font-size: 16cqh; font-weight: 800; line-height: 1.05; color: var(--accent); max-width: 100%; overflow-wrap: anywhere; }
.stage .ad-idle-text { margin: 0; font-size: 7cqh; font-weight: 700; line-height: 1.2; max-width: 90%; overflow-wrap: anywhere; }
.stage .ad-idle-text:empty { display: none; }

/* Läuft gerade */
.stage .ad-now {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) 27cqh auto;
  grid-template-areas:
    "party party"
    "bpm   media"
    "text  text"
    "extra extra";
  column-gap: 4cqmin;
  row-gap: 1.5cqh;
  transition: opacity 0.35s ease;
}
/* Auch bei „Bewegung reduzieren“: Die Anzeige darf sich bewegen (Entscheidung des Nutzers). */
.stage .ad-now.fading { opacity: 0; }

.stage .ad-party-line { grid-area: party; font-size: 3.4cqh; color: var(--muted); padding-right: 14cqh; min-height: 4cqh; }
.stage .ad-party-line:empty { min-height: 0; }

.stage .ad-bpm-box { grid-area: bpm; min-height: 0; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.stage .ad-bpm {
  font-family: var(--font-num); font-size: min(44cqh, 27cqw); font-weight: 900; line-height: 0.85; white-space: nowrap;
  color: var(--bpm-color); font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.stage .ad-bpm-unit { font-size: 8cqh; font-weight: 800; letter-spacing: 0.12em; color: var(--text); margin-top: 2cqh; }

.stage .ad-media { grid-area: media; min-height: 0; position: relative; display: flex; justify-content: center; align-items: center; }
.stage .ad-cover, .stage .ad-photo { display: block; border-radius: 1.5cqh; object-fit: cover; background: var(--panel-2); }
.stage .ad-cover { height: 100%; max-width: 100%; aspect-ratio: 1; }
/* Mit Foto: Foto füllt den Platz, das Cover sitzt als kleines Bild in der Ecke. */
.stage .ad-photo { width: 100%; height: 100%; }
.stage .ad-media.has-photo .ad-cover {
  position: absolute; left: 1.5cqh; bottom: 1.5cqh; height: 40%; width: auto;
  border: 0.8cqh solid var(--bg); border-radius: 1.5cqh;
}
.stage[data-media="none"] .ad-now { grid-template-columns: minmax(0, 1fr); grid-template-areas: "party" "bpm" "text" "extra"; }
.stage[data-media="none"] .ad-bpm-box { align-items: center; }
.stage[data-media="none"] .ad-media { display: none; }

.stage .ad-text-box { grid-area: text; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 1cqh; }
.stage .ad-title { margin: 0; font-family: var(--font-head); font-size: 11cqh; font-weight: 800; line-height: 1.05; overflow-wrap: anywhere; }
.stage .ad-artist { margin: 0; font-size: 6cqh; font-weight: 700; color: var(--artist-color); line-height: 1.1; overflow-wrap: anywhere; }

.stage .ad-extra-box { grid-area: extra; display: flex; align-items: center; gap: 3cqmin; flex-wrap: wrap; }
.stage .ad-extra-box:empty, .stage[data-extra="none"] .ad-extra-box { display: none; }
.stage .ad-saying { margin: 0; flex: 1 1 40%; font-size: 4.4cqh; font-weight: 700; font-style: italic; line-height: 1.2; }

/* Fortschritt und Namensnennung: unauffällig am unteren Rand */
.stage .ad-progress-line { position: absolute; left: 0; right: 0; bottom: 0; height: 0.8cqh; background: var(--panel-2); }
.stage .ad-progress-fill { height: 100%; width: 0; background: var(--accent); opacity: 0.7; transition: width 0.25s linear; }
.stage .ad-credit {
  position: absolute; right: var(--pad); bottom: 1.4cqh; margin: 0; max-width: 60%;
  font-size: 1.7cqh; font-weight: 600; line-height: 1.2; color: var(--muted); text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Wettbewerbs-Timer */
.stage .ad-timer { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 3cqh; }
.stage .ad-timer-label { font-family: var(--font-head); font-size: 8cqh; font-weight: 800; max-width: 100%; overflow-wrap: anywhere; line-height: 1.05; }
.stage .ad-timer-label:empty { display: none; }
.stage .ad-timer-time { font-family: var(--font-num); font-size: 48cqh; font-weight: 900; line-height: 0.9; color: var(--accent); font-variant-numeric: tabular-nums; }
.stage .ad-timer.warn .ad-timer-time { color: var(--warn); }
.stage .ad-timer.end .ad-timer-time { color: var(--bad); }
.stage .ad-timer-track { width: 80%; height: 4cqh; background: var(--panel-2); border: 2px solid var(--line); border-radius: 3cqh; overflow: hidden; }
.stage .ad-timer-fill { height: 100%; width: 100%; background: var(--accent); border-radius: 3cqh; transition: width 0.25s linear; }
.stage .ad-timer.warn .ad-timer-fill { background: var(--warn); }
.stage .ad-timer.end .ad-timer-fill { background: var(--bad); }

/* Hochformat oder sehr schmal: untereinander statt nebeneinander */
@container (max-aspect-ratio: 1/1) {
  .stage .ad-now { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) 24cqh auto; grid-template-areas: "party" "bpm" "media" "text" "extra"; }
  .stage .ad-bpm { font-size: 26cqh; }
  .stage .ad-bpm-box { align-items: center; }
  .stage .ad-timer-time { font-size: 30cqw; }
}

/* Vorschau im Hauptfenster: am Pult bewegt sich nichts (Zierbewegungen nur auf der echten Anzeige). */
.stage.is-preview *, .stage.is-preview *::before, .stage.is-preview *::after,
.stage.is-preview::before, .stage.is-preview::after { animation: none !important; transition: none !important; }

/* ---------- Nur die eigene Seite anzeige.html ---------- */
html[data-surface="anzeige"], html[data-surface="anzeige"] body { height: 100%; margin: 0; background: #000; }
html[data-surface="anzeige"] body { overflow: hidden; }
.stage.is-page { position: fixed; inset: 0; }
.stage.hide-cursor, .stage.hide-cursor * { cursor: none; }
.stage .full-btn {
  position: absolute; top: 1.5cqmin; right: 1.5cqmin; z-index: 5;
  font: inherit; font-size: 2.4cqh; font-weight: 700;
  padding: 1cqh 2cqh; border-radius: 1cqh;
  background: var(--panel-2); color: var(--text); border: 2px solid var(--line);
  opacity: 0.9;
}
.stage .full-btn:hover { background: var(--line); }
.stage.hide-cursor .full-btn, .stage.is-full .full-btn { opacity: 0; pointer-events: none; }
