/*
 * Decks: Wellenform, Restzeit, Ausblenden, Wettbewerbs- und Unterrichts-Modus.
 * Farben aus styles.css (:root). Eigene Datei, damit die Decks unabhängig von
 * der übrigen Oberfläche gestaltet werden können.
 */

:root {
  --contest: #c455e0; /* Wettbewerb: kräftiges Violett, nicht zu verwechseln mit LIVE (rot) */
  --teach: #3fbf9f; /* Unterricht: Türkis wie die Schleife in der Wellenform */
}

/*
 * Mittlerer Bereich: links BPM, Countdown und Zeiten in einer Zeile, darunter die
 * Wellenform; rechts EQ und Pegel. Das ersetzt die frühere Zeile mit dem Balken,
 * das Deck wird dadurch nicht höher.
 */
.deck-mid { align-items: stretch; }
.deck-main { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 4px; }
.deck-line { display: flex; align-items: center; gap: 10px; min-width: 0; height: 44px; }
.deck-line .deck-bpm { flex: 1 1 auto; flex-direction: row; align-items: baseline; gap: 8px; min-width: 98px; overflow: hidden; }
.deck-line .bpm-big { flex: none; }
.deck-line .bpm-sub { white-space: pre-line; line-height: 1.15; font-size: 11px; overflow: hidden; align-self: center; }
.deck-wave {
  position: relative; flex: 1; min-height: 12px; max-height: 40px; min-width: 0;
  display: flex; align-items: center; cursor: pointer; touch-action: none;
}
.deck-wave.has-wave { background: var(--bg); border-radius: 5px; overflow: hidden; }
.deck-wave .bar { flex: 1; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.deck-wave.has-wave .bar { display: none; }
.deck-wave .fill { height: 100%; width: 0; background: var(--accent); }
.wave-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.deck-times { display: flex; flex-direction: column; align-items: flex-end; flex: none; line-height: 1.1; }
.deck-times .t-rem { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.deck-times .t-el { color: var(--muted); }
.deck.ending .t-rem { color: #ff6b57; }
.deck.is-empty .deck-wave { opacity: 0.35; }

/* Modus-Umschalter in der Kopfzeile: klein, im aktiven Zustand kräftig farbig */
.deck-modes { display: flex; gap: 4px; flex: none; }
.deck-modes button { padding: 2px 7px; font-size: 11px; line-height: 1.3; color: var(--muted); }

/* Ausblenden-Knopf */
.d-fade[aria-pressed="true"] { background: #b9473a; border-color: #b9473a; color: #fff; font-weight: 700; }

/* Modus-Leiste: deutlich, damit kein Modus versehentlich an bleibt */
.deck-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 28px; }
.d-contest[aria-pressed="true"] { background: var(--contest); border-color: var(--contest); color: #fff; font-weight: 800; }
.d-teach[aria-pressed="true"] { background: var(--teach); border-color: var(--teach); color: #0d1f1a; font-weight: 800; }
.contest-opts, .teach-opts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.contest-opts label, .teach-opts label { display: flex; align-items: center; gap: 4px; color: var(--muted); white-space: nowrap; }
.contest-opts select { padding: 2px 4px; }
.deck .contest-opts input.c-free { width: 62px; padding: 3px 6px; }
.deck .contest-opts input.c-gap { width: 52px; padding: 3px 6px; }
.teach-opts button { padding: 4px 8px; font-size: 12px; }
.l-toggle[aria-pressed="true"] { background: var(--teach); border-color: var(--teach); color: #0d1f1a; font-weight: 700; }
.l-info { white-space: nowrap; }

.deck-mode {
  margin: -10px -12px 0; padding: 4px 12px;
  font-size: 12px; font-weight: 800; letter-spacing: 0.08em; white-space: pre-wrap;
  color: #fff; background: var(--contest);
}
.panel-body > .deck .deck-mode { margin-top: -10px; }
.deck.mode-teach:not(.mode-contest) .deck-mode { background: var(--teach); color: #0d1f1a; }
.deck.mode-contest.mode-teach .deck-mode { background: linear-gradient(90deg, var(--contest), var(--teach)); }
.deck.mode-contest { box-shadow: inset 0 0 0 2px var(--contest); }
.deck.mode-teach:not(.mode-contest) { box-shadow: inset 0 0 0 2px var(--teach); }
.panel-body > .deck.mode-contest { box-shadow: inset 0 0 0 2px var(--contest); }
.panel-body > .deck.mode-teach:not(.mode-contest) { box-shadow: inset 0 0 0 2px var(--teach); }

/* Wettbewerbs-Countdown, so groß wie die BPM */
.deck-clock { display: flex; flex-direction: row; align-items: center; gap: 6px; flex: none; min-width: 0; overflow: hidden; padding: 1px 8px; border-radius: 8px; background: color-mix(in srgb, var(--contest) 16%, var(--bg)); border: 1px solid color-mix(in srgb, var(--contest) 55%, var(--line)); }
.clock-big { font-size: 34px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text); }
.clock-big.urgent { color: #ff6b57; }
.clock-sub { color: var(--muted); white-space: nowrap; }
.deck-clock .clock-sub { white-space: nowrap; line-height: 1.1; font-size: 11px; }

/*
 * Wettbewerb: Countdown neben BPM und Restzeit, ohne dass etwas abgeschnitten wird.
 * Die Beschriftung („bereit“, „bis Ende“) steht klein unter der Zeit, das Deck wird nicht höher.
 */
.deck-clock { flex-direction: column; justify-content: center; gap: 0; padding: 0 8px; height: 44px; }
.deck-clock .clock-big { font-size: 28px; line-height: 1; }
.deck-clock .clock-sub { font-size: 10px; line-height: 1.1; }
.deck.mode-contest .deck-line { gap: 8px; }
.deck.mode-contest .deck-line .deck-bpm { gap: 6px; }
/* Im Wettbewerb zählt der Countdown (er endet spätestens mit dem Stück); die Restzeit des
   Stücks weicht ihm, damit „ungeprüft“ neben der BPM ganz lesbar bleibt. */
.deck.mode-contest .deck-times { display: none; }
