/* Farbwelt Hannover 96: Grün · Schwarz · Weiß */
:root {
  --bg: #0b0c0c;
  --surface: #161918;
  --surface2: #202523;
  --line: #2c3330;
  --text: #f3f5f4;
  --muted: #95a09b;
  --accent: #00a651;      /* 96-Grün (Ansehen) */
  --accent-ink: #ffffff;
  --edit: #ffffff;        /* Weiß (Admin-Bereich, Eingabefelder) */
  --edit-ink: #000000;
  --danger: #ff5a52;
  --ok: #2fd27a;
  --d: #ff7eb3;           /* Damen */
  --h: #62b3ff;           /* Herren */
  --g: var(--d);
  --f-dev: #ff8c2e;       /* Abweichung im Video */
  --f-rev: #b57bff;       /* Definition überarbeiten */
  --f-cmt: var(--accent); /* Kommentar (Zeile mit ?; Kommentare zum Trainingsvideo) – 96-Grün, klar anders als Herren-Blau */
  --draw: #ff3b30;        /* Zeichnung auf dem Trainingsvideo */
  --cw: 44px;
  --r: 14px;
  color-scheme: dark;
}
:root[data-gender="h"] { --g: var(--h); }

* { box-sizing: border-box; }
/* kein Zoomen durch schnelles Doppeltippen (stört z. B. bei Pfeiltasten); Zoomen mit zwei Fingern bleibt.
   Bewusst nicht für alle Elemente (*): Der Browser führt für jedes Element mit eigenem touch-action eine
   Touch-Zone nach – bei den tausenden Zellen der Taktleiste ruckelte dadurch jede Bewegung. Die Taktleiste
   selbst (pan-x) zoomt ohnehin nicht per Doppeltipp. */
html, body, button, a, input, select, label, textarea, .stage, .notes, .ctrl-row, .overview, .panel { touch-action: manipulation; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
body { overscroll-behavior: none; }
a { color: var(--accent); }
body.mode-edit a { color: #fff; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Consolas, monospace; }

#app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
}

/* ---------- Kopfzeile ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  border-bottom: 3px solid var(--accent);
  background: #000;
  transition: border-color .2s;
}
body.mode-edit .topbar { border-bottom-color: var(--edit); }
.brand-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.brand { font-weight: 800; white-space: nowrap; letter-spacing: .2px; }
.brand span { color: var(--accent); }
.choreo-btn {
  display: flex; align-items: center; gap: 4px; max-width: 100%; border: 0; background: none; padding: 0;
  color: var(--muted); font-size: 12.5px; cursor: pointer; text-align: left;
}
.choreo-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choreo-btn i { font-style: normal; font-size: 10px; opacity: .7; }
.choreo-btn:hover { color: var(--text); }

.seg { display: inline-flex; background: var(--surface); border-radius: 999px; padding: 3px; gap: 2px; flex-shrink: 0; }
.seg a, .seg button {
  border: 0; background: none; color: var(--muted);
  padding: 7px 13px; border-radius: 999px; font-weight: 650; text-decoration: none; cursor: pointer;
  transition: background .15s, color .15s;
}
@media (max-width: 400px) { .seg a, .seg button { padding: 7px 10px; } }
.seg .on { background: var(--surface2); color: var(--text); }
.gender .on[data-g="d"] { background: var(--d); color: #2b0015; }
.gender .on[data-g="h"] { background: var(--h); color: #001a33; }
/* Feld unter dem Video beim Trainingsvideo: Definition oder Kommentar – Wechsel wie Damen/Herren, aber ohne
   Farbe (gewählt = hell hinterlegt). Am Handy nur die Symbole (sonst passt die Zeile nicht), dafür steht am Feld
   mit demselben Symbol „Definition“ bzw. „Kommentar“; mit mehr Platz der Name des gewählten bzw. beider Felder.
   Die Symbole sind farbig (wie Emoji); das nicht gewählte ist blasser, das gewählte hüpft kurz */
.note-mode button { display: inline-flex; align-items: center; gap: 5px; }
.i-nm { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-cl { width: 20px; height: 20px; flex-shrink: 0; transition: opacity .15s, filter .15s; }
.note-mode button:not(.on) .i-cl { opacity: .7; filter: saturate(.7); }
.note-mode .on .i-cl { animation: nm-pop .28s ease-out; }
@keyframes nm-pop { 45% { transform: scale(1.2); } }
@media (prefers-reduced-motion: reduce) { .note-mode .on .i-cl { animation: none; } }
.note-mode .on { background: var(--surface2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.note-mode span { display: none; }
@media (min-width: 460px) { .note-mode .on span { display: inline; } }
@media (min-width: 560px) { .note-mode span { display: inline; } }
/* Kopf des Notizfelds: was hineingehört (Definition bzw. Kommentar) */
.g-tag .i-cl { width: 14px; height: 14px; vertical-align: -3px; margin-right: 3px; }

/* Knopf oben rechts: Admin-Bereich (Aufbau, Videos) bzw. zurück zum Plan */
.admin-btn {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; padding: 7px 13px; border-radius: 999px;
  background: var(--surface); color: var(--muted) !important; font-weight: 650; text-decoration: none; transition: background .15s, color .15s;
}
.admin-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.admin-btn:hover { color: var(--text) !important; }
.admin-btn.pw-locked::after { content: "🔒"; font-size: 10px; }
.admin-btn.on { background: var(--edit); color: var(--edit-ink) !important; }

main { min-height: 0; overflow: auto; position: relative; -webkit-overflow-scrolling: touch; }
main.fill { overflow: hidden; }

/* Choreo-Auswahl (Menü) */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 45; background: rgba(0,0,0,.6); display: flex; align-items: flex-start; justify-content: center;
  padding: calc(56px + env(safe-area-inset-top)) 12px 12px;
}
.sheet {
  width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
.sheet-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; }
.sheet-item {
  text-align: left; border: 1px solid var(--line); background: var(--surface2); border-radius: 12px; padding: 10px 12px; cursor: pointer;
}
.sheet-item b, .sheet-item small { display: block; }
.sheet-item small { color: var(--muted); font-size: 12.5px; }
.sheet-item.on { border-color: var(--accent); }

/* ---------- Tab-Leiste (nur im Admin-Bereich) ---------- */
.tabbar { display: none; }
body.mode-edit .tabbar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 0 6px; color: var(--muted) !important; text-decoration: none; font-size: 11.5px; font-weight: 600;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--edit) !important; }

/* ---------- Buttons & Formulare ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface2); color: var(--text) !important;
  padding: 10px 16px; border-radius: 12px; font-weight: 650; text-decoration: none; cursor: pointer;
  min-height: 44px;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink) !important; }
body.mode-edit .btn.primary { background: var(--edit); color: var(--edit-ink) !important; }
.btn.danger { color: var(--danger) !important; }
.btn.ghost { background: transparent; }
.btn.block { display: flex; width: 100%; }
.btn.big { min-height: 52px; font-size: 16px; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface2); font-size: 18px; cursor: pointer; display: inline-grid; place-items: center; flex-shrink: 0;
}
.icon-btn.sm { width: 36px; height: 36px; font-size: 15px; border-radius: 10px; }
.icon-btn.danger { color: var(--danger); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.linkish { border: 0; background: none; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0 4px; }
body.mode-edit .linkish { color: #fff; }
.input {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 16px;
}
.input.big { font-size: 18px; font-weight: 700; }
.input.sm { width: 76px; padding: 7px 8px; font-size: 16px; }
.input:focus, textarea:focus, select:focus { outline: 2px solid var(--edit); outline-offset: 0; }
.lbl { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: .5px; }
.card > .lbl:first-child { margin-top: 0; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.hint { color: var(--muted); font-size: 13.5px; margin: 6px 0; }
.warn { color: #ff8a7a; }
.ok { color: var(--ok); }
.check { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.check.sm { padding: 0; font-size: 14px; }
.check.sm input { width: 18px; height: 18px; }
.chip {
  border: 1px solid var(--line); background: var(--surface2); border-radius: 99px; padding: 6px 12px;
  font-size: 13px; cursor: pointer; font-variant-numeric: tabular-nums;
}
.chip b { color: var(--accent); margin-right: 4px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.progress { position: relative; height: 26px; border-radius: 8px; background: var(--bg); overflow: hidden; margin-top: 10px; }
.progress i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); transition: width .2s; }
.progress span { position: relative; display: block; line-height: 26px; padding: 0 10px; font-size: 12.5px; font-weight: 600; }

/* ---------- Seiten ---------- */
.page { padding: 14px 14px 28px; display: flex; flex-direction: column; gap: 12px; }
.page-head { display: flex; align-items: center; gap: 10px; }
.page-head h2 { margin: 0; font-size: 19px; }
.page-head .input.title { font-size: 18px; font-weight: 700; padding: 8px 10px; }
.back { color: var(--muted) !important; text-decoration: none; white-space: nowrap; font-weight: 600; padding: 8px 2px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
details.card > summary { cursor: pointer; font-weight: 650; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: "▸ "; color: var(--muted); }
details.card[open] > summary::before { content: "▾ "; }
details.card[open] > summary { margin-bottom: 10px; }
details.help ol { padding-left: 20px; margin: 6px 0; }
details.help li { margin: 4px 0; }
details.help p { color: var(--muted); font-size: 13.5px; margin: 8px 0 0; }
.sec { margin: 8px 2px 0; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.sec small { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 6px; }
.step { font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.step span {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 13px;
}
.empty { padding: 48px 24px; text-align: center; max-width: 420px; margin: 0 auto; }
.empty-icon { font-size: 44px; color: var(--accent); }
.empty h2 { margin: 8px 0; font-size: 20px; }
.empty p { color: var(--muted); margin-bottom: 20px; }
.num {
  width: 28px; height: 28px; border-radius: 8px; background: var(--surface2); display: grid; place-items: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}

.file-btn {
  display: flex; align-items: center; justify-content: center; min-height: 64px;
  border: 2px dashed var(--line); border-radius: 12px; color: var(--edit); font-weight: 650; cursor: pointer; text-align: center; padding: 10px;
}
.file-info:not(:empty) { margin-top: 10px; }
.preview { display: flex; gap: 12px; align-items: flex-start; }
.preview video { width: 96px; height: 170px; object-fit: cover; border-radius: 10px; background: #000; flex-shrink: 0; }
.preview b { display: block; word-break: break-all; }
.preview small { display: block; color: var(--muted); margin-top: 4px; }

/* Zählweise */
.struct-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.struct-grp { display: inline-flex; align-items: center; gap: 6px; }
.struct-row input, .struct-row select {
  width: 60px; background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px; font: inherit; font-size: 16px; text-align: center;
}
.struct-row .icon-btn { margin-left: auto; }
.struct-sum { color: var(--muted); font-size: 13px; }
.struct-preview {
  font-size: 12px; color: var(--muted); background: var(--bg); border-radius: 8px; padding: 6px 8px;
  margin: 2px 0 8px; overflow-wrap: anywhere;
}

/* ---------- Aufbau ---------- */
.music-head { display: flex; align-items: center; gap: 10px; }
.music-play { background: var(--accent); border-color: transparent; color: #fff; }
.music-name { min-width: 0; }
.music-name b, .music-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-name small { color: var(--muted); font-size: 12.5px; }
.music-wave { position: relative; margin-top: 10px; }
.music-wave canvas { display: block; width: 100%; height: 64px; background: var(--bg); border-radius: 8px; cursor: pointer; }
.mw-head { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; pointer-events: none; }
.parts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.part { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.part.open { border-color: var(--edit); }
.part-head { display: flex; align-items: center; gap: 10px; padding: 10px; cursor: pointer; }
.part-main { flex: 1; min-width: 0; }
.part-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-main small { display: block; color: var(--muted); font-size: 12.5px; }
.part-video { opacity: .25; filter: grayscale(1); font-size: 16px; }
.part-video.has { opacity: 1; filter: none; }
.chev { color: var(--muted); width: 16px; text-align: center; }
.part-body { padding: 0 12px 12px; border-top: 1px solid var(--line); }
.part-actions { margin-top: 14px; }

/* Passwortschutz */
.lock-screen {
  position: fixed; inset: 0; z-index: 60; background: #000; display: flex; align-items: center; justify-content: center;
  padding: 20px; border-top: 3px solid var(--accent);
}
.pw-form { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 10px; text-align: center; }
.pw-form h2 { margin: 0; font-size: 20px; }
.pw-form .hint { margin: 0; }
.pw-icon { font-size: 40px; }
.pw-page { align-items: center; padding-top: 48px; }
.pw-sheet { max-height: calc(100vh - 80px); overflow: auto; }
.pw-block { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.pw-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pw-head span { font-size: 12.5px; }
.sheet-foot { border-top: 1px solid var(--line); padding-top: 10px; }
.span-row { margin-top: 10px; }

/* Sperre & Sicherungen */
.lock-card { border-color: var(--line); }
.lock-card.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.lock-head { display: flex; align-items: center; gap: 10px; }
.lock-icon { font-size: 22px; }
.lock-text { flex: 1; min-width: 0; }
.lock-text b, .lock-text small { display: block; }
.lock-text small { color: var(--muted); font-size: 12.5px; }
.backups { margin-top: 10px; }
.backups summary { cursor: pointer; font-weight: 650; font-size: 14px; }
.backup-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.backup-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--bg); border-radius: 10px; }
.backup-list li > div { flex: 1; min-width: 0; }
.backup-list b, .backup-list small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backup-list small { color: var(--muted); font-size: 12px; }
.build.locked .part-head { cursor: pointer; }
.music-stats { margin: 8px 0 0; }
.split-ctl { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.split-ctl select.input.sm { width: 64px; }

/* Schlagraster-Editor */
.beated { display: flex; flex-direction: column; gap: 8px; }
.be-top { display: flex; align-items: center; gap: 10px; }
.be-view canvas { display: block; width: 100%; height: 110px; background: var(--bg); border-radius: 8px; touch-action: none; cursor: grab; }
.be-nav { display: flex; align-items: center; gap: 8px; }
.be-nav .range { margin: 0; }
.be-sel { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 36px; }
.be-selinfo { color: var(--muted); font-size: 13px; }
.be-selbtns { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.be-bpc button { font-size: 12.5px; padding: 6px 10px; }
.be-bpc button.on { background: var(--edit); color: var(--edit-ink); }
.be-tools { border-top: 1px solid var(--line); padding-top: 8px; }
.be-tools summary { cursor: pointer; font-weight: 650; font-size: 14px; margin-bottom: 6px; }
.be-tools .al-line { margin-top: 6px; }
.be-tap-pad .btn { width: 100%; min-height: 80px; font-size: 20px; }
.be-info { margin: 0; }
.be-mode { border: 2px solid var(--f-dev); border-radius: 12px; padding: 8px 10px; background: color-mix(in srgb, var(--f-dev) 8%, var(--surface)); }
.beated.mode-iv .be-mode { border-color: var(--h); background: color-mix(in srgb, var(--h) 8%, var(--surface)); }
.be-mode p { margin: 0 0 6px; font-size: 13.5px; }
.be-mode .al-line + .al-line { margin-top: 6px; }
.beated.mode-end .be-view canvas, .beated.mode-iv .be-view canvas { cursor: crosshair; }
.be-block { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; }
.be-block .al-lbl { width: 64px; }
.be-sel .hint { margin: 0; font-size: 12.5px; }
.vclip { display: block; font-size: 12.5px; color: var(--muted) !important; text-decoration: none; padding: 2px 0; }

/* Musik-Abgleich (Wiedergabe-Zähler) */
.al-top { display: flex; align-items: center; gap: 10px; }
.al-count { flex: 1; display: flex; align-items: baseline; gap: 8px; }
.al-count b {
  min-width: 52px; text-align: center; font-size: 28px; font-weight: 850; line-height: 1.1; border-radius: 10px; padding: 2px 6px;
  transition: background .06s;
}
.al-count b.flash { background: rgba(255,255,255,.25); }
.al-count b.one { background: var(--accent); }
.al-count small { color: var(--muted); font-variant-numeric: tabular-nums; }
.al-wave { position: relative; }
.al-wave span { position: absolute; left: 6px; bottom: 3px; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; pointer-events: none; }
.al-wave canvas { display: block; width: 100%; height: 76px; background: var(--bg); border-radius: 8px; }
.al-head { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #ffcf40; pointer-events: none; }
.al-ctrl { display: flex; flex-direction: column; gap: 8px; }
.al-line { display: flex; align-items: center; gap: 6px; }
.al-line.wrap { flex-wrap: wrap; }
.al-lbl { width: 54px; color: var(--muted); font-size: 13px; }
.al-line .input.sm { width: 88px; text-align: center; }

/* ---------- Videos ---------- */
.vlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.vrow {
  display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); flex-wrap: wrap;
}
.vmain { flex: 1; min-width: 110px; }
.vmain b, .vmain small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vmain small { color: var(--muted); font-size: 12.5px; }
.vrow select.input.sm { width: auto; max-width: 140px; font-size: 14px; }
.pick-parts { display: flex; flex-direction: column; gap: 6px; }
.pick-part { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface2); cursor: pointer; }
.pick-part input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }
.pick-part b, .pick-part small { display: block; }
.pick-part small { color: var(--muted); font-size: 12.5px; }
.assign-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.assign-row .lbl { margin: 0; }
.assign-row select.input.sm { width: auto; max-width: 60%; font-size: 14px; }

/* ---------- Taktleiste ---------- */
.beatbar { position: relative; height: 74px; background: var(--surface); border-block: 1px solid var(--line); user-select: none; -webkit-user-select: none; }
.bb-scroll {
  height: 100%; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
  scrollbar-width: none; overscroll-behavior-x: contain; touch-action: pan-x;
}
.bb-scroll::-webkit-scrollbar { display: none; }
.bb-track { display: flex; height: 100%; width: max-content; position: relative; }
.bb-sp { flex: 0 0 auto; }
/* unsichtbare Einrast-Punkte (je Zählzeit einer); sichtbar sind nur die Zellen in .bb-cells */
.bb-slot { flex: 0 0 var(--cw); scroll-snap-align: center; }
.bb-cells { position: absolute; top: 0; bottom: 0; left: 0; }
.bb-cell {
  position: absolute; top: 0; bottom: 0; width: var(--cw);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 20px;
  cursor: pointer; border-left: 1px solid transparent;
}
.bb-cell.main { border-left-color: rgba(255,255,255,.06); }
.bb-cell.barstart { border-left: 1px solid rgba(255,255,255,.3); }
.bb-cell.groupstart { border-left: 3px solid var(--accent); }
.bb-cell.dim { background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(255,255,255,.035) 6px 12px); }
.bb-cell.dim .bb-lbl { opacity: .35; }
.bb-cell.inrange { background-color: rgba(0,166,81,.12); }
.bb-lbl { font-weight: 800; font-size: 20px; line-height: 1; transition: color .1s, transform .1s; }
.bb-cell.half .bb-lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.bb-cell.active .bb-lbl { color: var(--accent); transform: scale(1.15); }
.bb-group {
  position: absolute; top: 4px; left: 5px; font-size: 11px; font-weight: 700; color: var(--accent);
  white-space: nowrap; pointer-events: none;
}
.bb-bar { position: absolute; top: 19px; left: 5px; font-size: 10.5px; color: var(--muted); pointer-events: none; }
.bb-dot { display: none; position: absolute; bottom: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--g); }
.bb-cell.marked .bb-dot { display: block; }
.calib .bb-dot { background: var(--edit); border-radius: 2px; transform: rotate(45deg); }
.bb-flags { position: absolute; left: 3px; right: 3px; bottom: 0; height: 4px; display: none; border-radius: 2px 2px 0 0; }
.bb-cell.f-dev .bb-flags, .bb-cell.f-rev .bb-flags { display: block; }
.bb-cell.f-dev .bb-flags { background: var(--f-dev); }
.bb-cell.f-rev .bb-flags { background: var(--f-rev); }
.bb-cell.f-dev.f-rev .bb-flags { background: linear-gradient(90deg, var(--f-dev) 50%, var(--f-rev) 50%); }
/* Kommentar zum Trainingsvideo an dieser Zählzeit */
.bb-q { display: none; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--f-cmt); }
.bb-cell.commented .bb-q { display: block; }
.bb-pic { display: none; position: absolute; bottom: 7px; right: 4px; width: 9px; height: 9px; border: 2px solid #fff; border-radius: 2px; }
.bb-cell.pictured .bb-pic { display: block; }
.bb-needle {
  position: absolute; top: 3px; bottom: 3px; left: 50%; width: var(--cw); transform: translateX(-50%);
  border: 2px solid var(--accent); border-radius: 12px; pointer-events: none;
}
body.mode-edit .bb-needle { border-color: var(--edit); }
.beatbar::before, .beatbar::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40px; z-index: 1; pointer-events: none;
}
.beatbar::before { left: 0; background: linear-gradient(90deg, var(--surface), transparent); }
.beatbar::after { right: 0; background: linear-gradient(-90deg, var(--surface), transparent); }

/* ---------- Player ---------- */
.player { display: flex; flex-direction: column; height: 100%; }
.stage { position: relative; flex: 1; min-height: 160px; background: #000; overflow: hidden; }
.stage video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; visibility: hidden; background: #000;
}
.stage video.on { visibility: visible; }
.blackout {
  position: absolute; inset: 0; background: #000; display: none; align-items: center; justify-content: center;
  color: #4a4d55; font-size: 12px;
}
.blackout.on { display: flex; }
.blackout.hint { color: #b4b8c1; font-size: 13px; padding: 0 24px; text-align: center; }
.hud { position: absolute; left: 12px; top: 10px; pointer-events: none; text-shadow: 0 1px 6px rgba(0,0,0,.8); z-index: 2; max-width: 60%; }
.hud-dance {
  display: inline-block; font-size: 12px; font-weight: 700; background: rgba(0,0,0,.5); padding: 3px 9px; border-radius: 99px;
  margin-bottom: 4px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  pointer-events: auto; border: 0; color: #fff; cursor: pointer;
}
.hud-dance:hover { background: rgba(0,0,0,.7); }
.hud-count { font-size: 46px; font-weight: 850; line-height: 1; color: #fff; }
.hud-bar { font-size: 13px; color: #ddd; font-weight: 600; }
/* Markierungen im Video: dezent am unteren Rand und zugleich die Schalter dafür – links unten (auf schmalen
   Geräten in Kurzform, damit sie die Abspielknöpfe nicht berühren): aus = blasser Ring, an = Farbe und eine
   farbige Linie über die ganze Breite. Beim Abspielen nur die gesetzten. */
.vflags { position: absolute; left: 0; right: 0; bottom: 0; height: 0; z-index: 3; pointer-events: none; }
.vflags::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--vf, transparent); opacity: .9; }
.vflags.f-dev { --vf: var(--f-dev); }
.vflags.f-rev { --vf: var(--f-rev); }
.vflags.f-dev.f-rev { --vf: linear-gradient(90deg, var(--f-dev) 50%, var(--f-rev) 50%); }
.vf-tags { position: absolute; left: 8px; bottom: 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.vflag {
  pointer-events: auto; border: 0; font: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px 4px 7px; border-radius: 8px;
  background: rgba(0,0,0,.42); font-size: 11.5px; line-height: 16px; color: rgba(255,255,255,.66); white-space: nowrap;
  transition: background .15s, color .15s;
}
.vflag b { font-weight: 650; }
.vflag i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--fc); flex-shrink: 0; }
.vflag:hover { color: #fff; }
.vflag.on { background: rgba(0,0,0,.66); color: #fff; }
.vflag.on b { font-weight: 750; }
.vflag.on i { background: var(--fc); }
.vflag.f-dev { --fc: var(--f-dev); }
.vflag.f-rev { --fc: var(--f-rev); }
.vflag .vf-long { display: none; }
@media (min-width: 600px) { .vflag .vf-long { display: inline; } .vflag .vf-short { display: none; } }
.player.playing .vflag:not(.on) { display: none; }

.stage-tools { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; z-index: 3; }
.tool {
  border: 0; background: rgba(0,0,0,.55); color: #fff; border-radius: 99px; padding: 6px 11px; font-weight: 700;
  font-size: 13px; cursor: pointer; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.tool.pic-open { background: rgba(255,255,255,.92); color: #000; display: flex; flex-direction: column; align-items: center; gap: 4px; }
/* Miniatur der Bilderplan-Seite (nur die Mitte, Ausschnitt per JS: THUMB_CROP) */
.pic-open:has(.pic-thumb:not([hidden])) { border-radius: 12px; padding: 5px 5px 4px; }
.pic-thumb { display: block; position: relative; width: 64px; aspect-ratio: 1; overflow: hidden; border-radius: 7px; background: #fff; }
.pic-thumb img { position: absolute; max-width: none; height: auto; display: block; }
@media (min-width: 700px) { .pic-thumb { width: 94px; } }
.tool.pic-open.fresh { background: var(--accent); color: #fff; }
/* was auf der markierten Stelle steht (ohne Seitenzahl) */
.pic-ref { display: block; max-width: 100px; font-size: 11px; font-weight: 750; line-height: 1.2; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* noch kein Bild: „🖼 +“ zum Zuordnen (dezent, beim Abspielen ausgeblendet) */
.tool.pic-open.none { background: rgba(0,0,0,.55); color: #fff; opacity: .85; }
.player.playing .pic-open.none { display: none; }

.transport {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 14px; align-items: center; z-index: 3;
}
.tp {
  width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; cursor: pointer;
  display: grid; place-items: center; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.tp svg { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.tp.play { width: 58px; height: 58px; background: var(--accent); }
.tp.play svg { width: 26px; height: 26px; }
.tp .i-pause, .playing .tp .i-play { display: none; }
.playing .tp .i-pause { display: block; }
.playing .transport { opacity: .55; }
.playing .transport:hover { opacity: 1; }

.panel {
  position: absolute; z-index: 5; left: 10px; right: 10px; top: 10px; max-height: calc(100% - 20px); overflow: auto;
  background: rgba(22,25,24,.97); border: 1px solid var(--line); border-radius: 16px; padding: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.dance-jumps { display: flex; flex-direction: column; gap: 6px; }
.dj {
  display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--line); background: var(--surface2);
  border-radius: 12px; padding: 10px; cursor: pointer; font-weight: 600;
}
.dj span {
  width: 26px; height: 26px; border-radius: 8px; background: var(--bg); display: grid; place-items: center; font-size: 13px; flex-shrink: 0;
}
.dj.on { border-color: var(--accent); }
.dj.on span { background: var(--accent); color: #fff; }
.play-mode { display: flex; width: 100%; margin-bottom: 10px; }
.play-mode button { flex: 1; }
.play-mode button.on { background: var(--accent); color: #fff; }
.tempo-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tempo-row div { text-align: center; }
.big-val { display: block; font-size: 32px; font-weight: 850; line-height: 1; font-variant-numeric: tabular-nums; }
.tempo-row small { color: var(--muted); font-size: 12px; }
.range { width: 100%; margin: 12px 0 6px; accent-color: var(--accent); }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.loop-box { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.loop-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.loop-row span { width: 28px; color: var(--muted); }
.loop-row b { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loop-row b small { color: var(--muted); font-weight: 400; }
.lead-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.lead-row span { color: var(--muted); }
.lead-row .range { flex: 1; margin: 0; }
.lead-row b { min-width: 96px; text-align: right; font-weight: 600; }

.ctrl-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; padding: 8px 12px; }
@media (max-width: 400px) { .ctrl-row { gap: 6px 8px; padding-inline: 10px; } .mchip { padding-inline: 7px; } }
.mark-chips { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; margin-left: auto; }
.mchip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 8px; font-size: 12.5px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; color: var(--text);
}
.mchip::before { content: ""; width: 9px; height: 9px; border-radius: 50%; }
.mchip.k-comment::before { background: var(--f-cmt); }
.mchip.k-dev::before { background: var(--f-dev); }
.mchip.k-rev::before { background: var(--f-rev); }

/* reicht am iPhone bis knapp über die Home-Leiste (sonst bliebe dort ein schwarzer Rand) */
.notes {
  --nb: max(8px, calc(env(safe-area-inset-bottom, 0px) - 16px));
  display: grid; grid-template-columns: 46px 1fr 46px; gap: 8px; padding: 8px 10px var(--nb);
  height: calc(182px + var(--nb)); touch-action: pan-y; flex-shrink: 0;
}
.nav {
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 4px 2px;
}
.nav span { font-size: 26px; line-height: 1; color: var(--g); }
.nav small { font-size: 10px; color: var(--muted); text-align: center; line-height: 1.2; }
.nav:disabled { opacity: .3; cursor: default; }
.note-card {
  background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--line);
  border-radius: 14px; padding: 8px 12px; display: flex; flex-direction: column; gap: 5px; min-width: 0; overflow: hidden;
  transition: border-color .2s, background .2s; position: relative;
}
.note-card.filled { border-top-color: var(--g); background: color-mix(in srgb, var(--g) 9%, var(--surface)); }
.note-card.f-dev { box-shadow: inset 4px 0 0 var(--f-dev); }
.note-card.f-rev { box-shadow: inset 4px 0 0 var(--f-rev); }
.note-card.f-dev.f-rev { box-shadow: inset 4px 0 0 var(--f-dev), inset 8px 0 0 var(--f-rev); }
/* Kommentar zum Trainingsvideo (gemeinsam für Damen und Herren) */
.note-card.cmt { border-top-color: var(--f-cmt); background: color-mix(in srgb, var(--f-cmt) 6%, var(--surface)); }
.g-tag.c-tag { color: var(--f-cmt); }
.cmt-wrap textarea {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; border: 1px solid color-mix(in srgb, var(--f-cmt) 45%, var(--line));
  border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 16px; line-height: 1.4; background: var(--bg); color: var(--text); resize: none;
}
.cmt-wrap textarea:disabled { opacity: .55; }
.note-card.pop { animation: pop .32s ease-out; }
@keyframes pop {
  from { transform: translateY(10px) scale(.97); opacity: .4; }
  to { transform: none; opacity: 1; }
}
.note-head { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.note-head b { color: var(--text); font-size: 17px; }
.note-head span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-tag { font-style: normal; font-weight: 700; color: var(--g); font-size: 11.5px; }
.note-tools { display: flex; gap: 6px; min-width: 0; }
.note-body { flex: 1; min-height: 0; overflow: auto; }
/* Textfeld mit hervorgehobenen Kommentar-Zeilen (Spiegel-Ebene hinter dem Text) */
.ta-wrap { position: relative; height: 100%; min-height: 60px; }
.ta-wrap textarea, .ta-mirror {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 16px; line-height: 1.4;
  white-space: pre-wrap; overflow-wrap: break-word; overflow: auto; letter-spacing: normal;
}
.ta-mirror { color: transparent; background: var(--bg); pointer-events: none; }
.ta-mirror mark { color: transparent; background: color-mix(in srgb, var(--f-cmt) 26%, transparent); border-radius: 3px; }
.ta-wrap textarea { background: transparent; color: var(--text); resize: none; caret-color: var(--text); cursor: text; }
.note-card.filled .ta-wrap textarea { border-color: color-mix(in srgb, var(--g) 50%, var(--line)); }
.ta-wrap textarea::placeholder { color: var(--muted); opacity: .75; }

/* ---------- Übersichtsleiste der Tänze ---------- */
.overview {
  position: relative; height: 30px; margin: 0 10px 8px; border-radius: 8px; overflow: hidden;
  background: var(--surface); cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none;
}
/* Streifen mit gleich breiten Reitern, läuft unter der festen Mittellinie (.ov-pos) durch */
.ov-strip { position: absolute; top: 0; bottom: 0; left: 0; will-change: transform; }
.ov-segs { display: flex; height: 100%; }
.ov-seg {
  flex: 0 0 var(--tw, 110px); background: var(--surface2); display: flex; align-items: center; gap: 6px;
  padding: 0 8px; overflow: hidden; border-right: 2px solid var(--surface); transition: background .25s;
}
.ov-seg:nth-child(odd) { background: #26302b; }
.ov-seg b { font-size: 10.5px; color: var(--muted); font-weight: 700; flex-shrink: 0; }
.ov-seg span { font-size: 12px; font-weight: 650; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-seg.cur { background: color-mix(in srgb, var(--accent) 30%, var(--surface2)); }
.ov-seg.cur b { color: #fff; background: var(--accent); border-radius: 5px; padding: 0 5px; }
.ov-seg.cur span { color: var(--text); font-weight: 700; }
body.mode-edit .ov-seg.cur { background: color-mix(in srgb, #fff 16%, var(--surface2)); }
body.mode-edit .ov-seg.cur b { background: #fff; color: #000; }
.ov-loop { position: absolute; top: 0; bottom: 0; background: rgba(0,166,81,.28); border-inline: 2px solid var(--accent); pointer-events: none; }
.ov-pos {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; margin-left: -1.5px; background: var(--accent); border-radius: 2px;
  box-shadow: 0 0 0 2px rgba(0,0,0,.5); pointer-events: none;
}
body.mode-edit .ov-pos { background: var(--edit); }

/* ---------- Kalibrierung ---------- */
.calib { display: flex; flex-direction: column; gap: 10px; margin: 0 -14px; }
.calib-stage { flex: none; height: 48vh; height: 48dvh; min-height: 260px; }
.calib-stage video { visibility: visible; }
.anchor-badge {
  position: absolute; right: 12px; top: 12px; background: var(--accent); color: #fff; font-weight: 700;
  font-size: 12px; padding: 4px 10px; border-radius: 99px; z-index: 2;
}
/* visuelles Metronom */
.vm {
  position: absolute; left: 50%; bottom: 8px; width: 110px; margin-left: -55px; z-index: 2; pointer-events: none;
  filter: drop-shadow(0 0 2px rgba(0,0,0,.9));
}
.vm svg { display: block; width: 100%; height: auto; overflow: visible; }
.vm-arc { fill: none; stroke: rgba(255,255,255,.35); stroke-width: 1.2; }
.vm-mark { stroke: rgba(255,255,255,.6); stroke-width: 2; stroke-linecap: round; transition: stroke .08s; }
.vm-mark.hit { stroke: #fff; }
.vm-mark.one { stroke: var(--accent); stroke-width: 3; }
.vm-needle line { stroke: rgba(255,255,255,.85); stroke-width: 1.6; stroke-linecap: round; }
.vm-needle circle { fill: #fff; }
.vm-pivot { fill: rgba(255,255,255,.7); }
.time-row { display: flex; align-items: center; gap: 6px; padding: 0 14px; }
.time-row .play { background: var(--accent); color: #fff; border-color: transparent; }
.time-row .sound.off { opacity: .55; }
.time-row .time { margin-left: auto; font-size: 16px; font-weight: 600; }
@media (max-width: 400px) { .time-row .icon-btn { width: 40px; } .time-row .time { font-size: 14px; } }
.scrub { margin: 0 14px; accent-color: var(--accent); height: 28px; }
.bb-label { padding: 0 14px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: -6px; }
.anchor-row { display: flex; gap: 8px; padding: 0 14px; }
.anchor-row .set { flex: 1; min-height: 50px; }
.calib-status { padding: 0 14px; color: var(--muted); font-size: 13.5px; }
.calib-status b { color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px; }
.chips:empty { display: none; }

/* ---------- Bildbetrachter & Seitenauswahl ---------- */
.pic-overlay {
  position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.96); display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
}
.pic-head { display: flex; align-items: center; gap: 8px; padding: 10px; border-bottom: 3px solid var(--accent); }
.pic-title { flex: 1; min-width: 0; }
.pic-title b { display: block; font-size: 17px; }
.pic-title small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pic-scroll { flex: 1; overflow: auto; display: grid; place-items: center; padding: 10px; touch-action: pan-x pan-y pinch-zoom; }
.pic-scroll img { max-width: 100%; max-height: 100%; background: #fff; border-radius: 4px; cursor: zoom-in; }
.pic-overlay.zoom .pic-scroll { place-items: start; }
.pic-overlay.zoom .pic-scroll img { max-width: none; max-height: none; width: 220%; cursor: zoom-out; }
.pic-msg { color: var(--muted); text-align: center; padding: 20px; }
.pic-msg:empty { display: none; }
.pic-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; }
/* Blättern über eine verschobene Spur (JS), Wischen ohne Browser-Gesten */
.pp-carousel { flex: 1; min-height: 0; overflow: hidden; position: relative; touch-action: none; user-select: none; -webkit-user-select: none; }
.pp-track { display: flex; height: 100%; will-change: transform; }
.pp-slide {
  flex: 0 0 100%; min-width: 0; height: 100%; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; padding: 12px 16px; cursor: pointer;
}
/* Seite passt in Breite und Höhe (früher richtete sie sich nur nach der Höhe und war im Hochformat breiter
   als der Bildschirm: sie stand schief, die Nachbarseite schaute herein) */
.pp-sheet { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.pp-sheet img {
  display: block; max-width: 100%; max-height: 100%; width: auto; height: auto;
  background: #fff; border-radius: 6px; border: 3px solid transparent; -webkit-user-drag: none;
}
.pp-sheet img:not([src]) { height: 100%; aspect-ratio: 1 / 1.414; } /* Platzhalter, bis die Seite geladen ist */
.pp-sheet.on img { border-color: var(--accent); }
.pp-used {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: 90%; border: 0; font: inherit;
  background: rgba(0,0,0,.8); color: #fff; font-size: 12px; padding: 4px 10px; border-radius: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pp-used:not(:disabled) { cursor: pointer; text-decoration: underline; }
.pp-sheet { cursor: zoom-in; }
/* Bilderplan-Fenster: was hier gilt, „Was stellt?“, ob spätere Bilder mitrücken, Aktionen */
.pp-foot { display: flex; flex-direction: column; gap: 8px; padding: 8px 12px 12px; border-top: 1px solid var(--line); }
.pp-status { margin: 0; font-size: 14.5px; }
.pp-status small { color: var(--muted); }
.pp-ref { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pp-ref > span { color: var(--muted); font-size: 13px; margin-right: 2px; }
.pp-follow { font-size: 13.5px; align-items: flex-start; }
.pp-follow small { color: var(--muted); white-space: nowrap; }
.pp-foot .pp-hint { margin: 0; }
.pp-foot .pic-foot { padding: 0; }
.pp-acts { display: flex; gap: 8px; margin-left: auto; }
.pp-edit .i-nm { width: 16px; height: 16px; margin-right: 6px; }
/* Bearbeiten: Kopf weiß wie im Admin-Bereich */
.plan-overlay.editing .pic-head { border-bottom-color: var(--edit); }
/* Seite groß: antippen schließt */
.pp-zoom { position: absolute; inset: 0; z-index: 3; overflow: auto; background: rgba(0,0,0,.97); cursor: zoom-out; touch-action: pan-x pan-y pinch-zoom; }
.pp-zoom img { display: block; width: min(220vw, 1800px); max-width: none; background: #fff; }
.pp-bar { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 4px 10px; }
.pp-ind { font-weight: 700; min-width: 120px; text-align: center; }
.pp-hint { text-align: center; margin: 0; padding: 0 12px; }
.pp-body { flex: 1; overflow: auto; padding: 12px; }
.pp-num { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pp-num span { color: var(--muted); }
.pp-num .input.sm { width: 76px; text-align: center; }

/* ---------- Bilderplan (Aufbau-Seite) ---------- */
.plan { display: flex; flex-direction: column; gap: 8px; }
.plan-file { display: flex; align-items: center; gap: 12px; }
.plan-file b, .plan-file small { display: block; }
.plan-file small { color: var(--muted); }
.plan-icon {
  width: 42px; height: 50px; border-radius: 6px; background: #fff; color: #000; font-weight: 900; font-size: 12px;
  display: grid; place-items: end center; padding-bottom: 8px; border-bottom: 6px solid var(--accent); flex-shrink: 0;
}
.plan .file-btn { min-height: 52px; }
.pic-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.pic-list li {
  display: flex; gap: 12px; align-items: center; padding: 6px 10px;
  background: var(--bg); border-radius: 10px; font-size: 14px; border: 1px solid transparent;
}
.pic-list li.has-issue { border-color: #ff8a7a55; }
.pl-page { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; flex-shrink: 0; }
.pl-page .input.sm { width: 64px; text-align: center; }
.pl-where { min-width: 0; }
.pl-where b, .pl-where small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-where small { color: var(--muted); font-size: 12.5px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: #2a2e38; color: var(--text); padding: 10px 16px; border-radius: 12px; font-size: 14px;
  box-shadow: 0 6px 24px rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: calc(100vw - 32px); z-index: 50; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: #4a1f22; }

@media (min-width: 721px) {
  #app { border-inline: 1px solid var(--line); }
}
@media (max-height: 640px) {
  .notes { height: calc(156px + var(--nb)); }
  .hud-count { font-size: 36px; }
}

/* ---------- Team-Betrieb ---------- */
.brand .sync-state {
  display: inline-block; margin-left: 8px; vertical-align: 2px; font-size: 11px; font-weight: 600; letter-spacing: 0;
  color: var(--muted); line-height: 1;
}
.brand .sync-state:empty { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); opacity: .8; }
.brand .sync-state[data-state="busy"] { color: var(--f-dev); }
.brand .sync-state[data-state="off"] { color: var(--danger); }
.update-banner {
  position: fixed; left: 50%; top: calc(8px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 90;
  display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 14px; border-radius: 12px;
  background: var(--surface2); border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(0,0,0,.5); font-size: 14px;
}
.conflict-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 8px; padding: 8px 10px;
  border-radius: 10px; background: rgba(255, 140, 46, .14); border: 1px solid var(--f-dev); font-size: 13px;
}
.conflict-bar span { flex: 1 1 100%; }
.import-box .progress { margin-top: 10px; }
/* Während der Wiedergabe kein Weichzeichner hinter den Knöpfen: er müsste mit jedem Videobild neu berechnet werden */
.player.playing .tool, .player.playing .tp { backdrop-filter: none; -webkit-backdrop-filter: none; }
/* Leistung (v. a. Safari): Bereiche unabhängig voneinander berechnen – ändert sich der Text im
   Definitionsfeld oder in der Anzeige, muss die Taktleiste nicht neu berechnet werden. */
.beatbar { contain: strict; }
.bb-cell { contain: layout style; }
.hud, .notes, .overview, .ctrl-row { contain: layout style; }

/* Ladebildschirm: Medien werden aufs Gerät geladen */
.loading-screen .progress { margin: 18px 0 8px; background: var(--surface2); }
.loading-screen .ls-detail { min-height: 1.4em; }
.ls-actions { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }


/* Musik läuft gerade an (Sprung an die Startstelle): Play-Knopf pulsiert, Leiste wartet */
.player.wait .tp.play { animation: wait-pulse .8s ease-in-out infinite alternate; }
@keyframes wait-pulse { from { opacity: 1; } to { opacity: .45; } }

/* ---------- Trainingsvideos ---------- */
.tool.train-open { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool.train-open.on { background: #ffcf40; color: #000; }
.hud-train { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 800; color: #ffcf40; }
.hud-train.gap { color: #bbb; }
.dj small { color: var(--muted); font-weight: 500; }
.pm-train .check { margin-top: 4px; }
/* im Trainingsvideo enthaltene Bereiche und Tempo je Tanz in der Übersicht */
.ov-cov { position: absolute; bottom: 0; height: 4px; background: #ffcf40; border-radius: 2px; pointer-events: none; }
.ov-seg em { margin-left: auto; font-style: normal; font-size: 10.5px; font-weight: 800; color: #ffcf40; flex-shrink: 0; }
.tr-row { color: inherit; text-decoration: none; }
.tr-days { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.tr-video video { display: block; width: 100%; max-height: 46vh; background: #000; border-radius: 12px; }
.tr-nav { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.tr-time { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
.tr-timeline { position: relative; height: 34px; background: var(--surface2); border-radius: 8px; overflow: hidden; cursor: pointer; }
.tr-seg {
  position: absolute; top: 3px; bottom: 3px; background: hsl(var(--h) 55% 42%); border-radius: 4px;
  border-right: 1px solid rgba(0,0,0,.4); overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.tr-seg.out { background-color: #5b625f; } /* Musik außerhalb der Tänze (Vorspiel, Nachspiel) */
.tr-auto .progress { background: var(--surface2); }
.tr-seg.manual { background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(255,255,255,.12) 6px 9px); }
.tr-seg span { font-size: 11px; font-weight: 800; color: #fff; }
.tr-pt { position: absolute; top: 3px; bottom: 3px; width: 3px; margin-left: -1px; background: #ffcf40; }
.tr-head { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5); pointer-events: none; }
.tr-legend { display: flex; flex-direction: column; gap: 4px; }
.tr-li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.tr-li > i { width: 12px; height: 12px; border-radius: 3px; background: hsl(var(--h) 55% 42%); flex-shrink: 0; }
.tr-li span { flex: 1; min-width: 0; }
.tr-go { border: 0; background: none; color: var(--text); font: inherit; font-variant-numeric: tabular-nums; text-decoration: underline; cursor: pointer; padding: 2px; }
.tr-points details { margin-top: 10px; }
.tr-pgroup { margin-top: 8px; }
.tr-prow { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.tr-prow span { flex: 1; min-width: 0; color: var(--muted); }
.training-page .assign-row select.input.sm { max-width: 46%; }
.tr-video { position: relative; }
.tr-live {
  position: absolute; left: 8px; top: 8px; max-width: calc(100% - 16px); padding: 3px 9px; border-radius: 8px;
  background: rgba(0,0,0,.6); color: #ffcf40; font-size: 13px; font-weight: 800; pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tr-tag { font-style: normal; font-size: 12px; color: var(--muted); margin-left: 4px; white-space: nowrap; }
.tr-tag.warn { color: #ffcf40; font-weight: 700; }
.tr-seg.uncertain { outline: 2px solid #ffcf40; outline-offset: -2px; }
.tr-li.uncertain > i { box-shadow: 0 0 0 2px #ffcf40; }
.tr-li .icon-btn.on { background: var(--surface2); }
.tr-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 0 8px 20px; font-size: 13px; color: var(--muted); }

/* ---------- Kommentare zum Trainingsvideo: Zeichnung ---------- */
/* liegt genau über dem Bild des Videos (Lage per JS); rote Linien in Tausendsteln der Bildgröße */
.tn-layer { position: absolute; z-index: 1; pointer-events: none; }
.tn-layer svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tn-layer polyline {
  fill: none; stroke: var(--draw); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round;
  vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 1px rgba(0,0,0,.7));
}
/* Werkzeuge des Kommentars dezent rechts unten im Video (über dem Vollbild-Knopf): Hinweis, ↶, löschen;
   beim Abspielen und im Vollbild (dort ✎/↶ oben rechts) ausgeblendet */
.tn-tools { position: absolute; right: 10px; bottom: 56px; z-index: 3; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.tn-hint {
  padding: 3px 9px; border-radius: 99px; background: rgba(0,0,0,.5); color: rgba(255,255,255,.85); font-size: 11.5px;
  font-weight: 650; white-space: nowrap; pointer-events: none;
}
.tn-tools .tool { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 10px; font-size: 18px; }
.tn-tools .tn-del svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.player.playing .tn-tools, .player.fs .tn-tools { display: none; }
/* Kommentar-Modus: mit Finger/Maus zeichnen (zwei Finger zoomen weiterhin, wo der Browser das kann) – auch im Vollbild */
.tn-layer.draw { pointer-events: auto; cursor: crosshair; touch-action: none; touch-action: pinch-zoom; box-shadow: inset 0 0 0 1.5px rgba(255,59,48,.45); }

/* ---------- Vollbild (Querformat) ---------- */
.tool.fs-open {
  position: absolute; right: 10px; bottom: 12px; z-index: 3; width: 36px; height: 36px; padding: 0;
  display: grid; place-items: center; border-radius: 10px;
}
.tool.fs-open svg, .tool.fs-exit svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fs-tools, .fs-bar { display: none; }
.player.fs { --fsl: env(safe-area-inset-left, 0px); --fsr: env(safe-area-inset-right, 0px); --fst: env(safe-area-inset-top, 0px); --fsb: env(safe-area-inset-bottom, 0px); }
/* Gerät hochkant: Bild um 90° gedreht (Handy nach links quer halten); Ränder entsprechend vertauscht */
.player.fs.fs-rot { --fsl: env(safe-area-inset-top, 0px); --fsr: env(safe-area-inset-bottom, 0px); --fst: env(safe-area-inset-right, 0px); --fsb: env(safe-area-inset-left, 0px); }
.player.fs .stage { position: fixed; inset: 0; z-index: 48; min-height: 0; width: 100%; height: 100%; }
.player.fs.fs-rot .stage {
  inset: auto; left: 0; top: 0; width: 100vh; height: 100vw; width: 100dvh; height: 100dvw;
  transform-origin: 0 0; transform: rotate(90deg) translateY(-100%);
}
.player.fs .hud { left: calc(14px + var(--fsl)); top: calc(10px + var(--fst)); }
.player.fs .hud-dance, .player.fs .hud-bar, .player.fs .hud-train,
.player.fs .stage-tools, .player.fs .transport, .player.fs .fs-open, .player.fs .panel { display: none !important; }
.player.fs .hud-count { font-size: 40px; }
.player.fs .fs-tools {
  display: flex; gap: 8px; position: absolute; z-index: 3; right: calc(10px + var(--fsr)); top: calc(10px + var(--fst));
}
.fs-tools .tool { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 12px; font-size: 18px; }
.fs-tools .fs-pen.on { background: var(--draw); color: #fff; }
.player.fs .vf-tags { left: calc(10px + var(--fsl)); bottom: calc(50px + var(--fsb)); }
.player.fs .fs-bar {
  display: flex; align-items: center; gap: 8px; position: absolute; z-index: 3; left: calc(8px + var(--fsl)); right: calc(8px + var(--fsr));
  bottom: calc(6px + var(--fsb)); height: 36px;
}
.fs-play {
  width: 36px; height: 36px; flex-shrink: 0; border: 0; border-radius: 50%; background: var(--accent); color: #fff; cursor: pointer;
  display: grid; place-items: center;
}
.fs-play svg { width: 18px; height: 18px; fill: currentColor; }
.fs-play .i-pause, .playing .fs-play .i-play { display: none; }
.playing .fs-play .i-pause { display: block; }
/* Mini-Taktleiste: ziehen = spulen, tippen = zu dieser Zählzeit */
.fs-mini {
  position: relative; flex: 1; height: 100%; overflow: hidden; border-radius: 8px; background: rgba(0,0,0,.55);
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab;
}
.fs-strip { position: absolute; top: 0; bottom: 0; left: 0; will-change: transform; }
.fm {
  position: absolute; top: 0; bottom: 0; width: 30px; display: grid; place-items: center; font-style: normal;
  font-size: 13px; font-weight: 800; color: #fff; border-left: 1px solid transparent;
}
.fm.half { color: transparent; }
.fm.half::after { content: ""; width: 3px; height: 3px; border-radius: 50%; background: rgba(255,255,255,.35); }
.fm.bar { border-left-color: rgba(255,255,255,.28); }
.fm.dance { border-left: 2px solid var(--accent); }
.fm.dim { opacity: .3; }
.fm.marked { box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--g) 80%, transparent); }
.fm.f-rev { box-shadow: inset 0 -3px 0 var(--f-rev); }
.fm.cmt::before { content: ""; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--f-cmt); }
.fs-needle {
  position: absolute; top: 2px; bottom: 2px; left: 50%; width: 30px; margin-left: -15px; border: 2px solid var(--accent);
  border-radius: 8px; pointer-events: none;
}

/* Wiedergabe-Menü: Stand von Video/Musik und Neu laden */
.reset-box { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.ph-acts { display: flex; align-items: center; gap: 8px; }
.media-state { color: var(--muted); font-size: 12px; line-height: 1.35; }
