/* Cue-Board – Layout und Komponenten. Werte nach docs/mockup (Live-Ansicht). */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 14px;
  line-height: 1.4;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.num { font-variant-numeric: tabular-nums; }
.spacer { flex-grow: 1; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------- Grundgerüst ---------- */

.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.app__main { flex-grow: 1; display: flex; flex-direction: column; min-width: 0; }

.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px;
  padding: 14px 24px; background: var(--bg-bar);
}
.bar:empty { display: none; }
.bar--top {
  border-bottom: 1px solid var(--border);
  padding-top: max(14px, env(safe-area-inset-top));
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}
.bar--bottom {
  position: sticky; bottom: 0; z-index: 5;
  gap: 10px 12px; padding: 12px 24px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
  border-top: 1px solid var(--border);
}

.bar__group { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; min-width: 0; }
.bar__group--end { margin-left: auto; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--accent); }
.brand__name {
  font: 700 20px/1 var(--font-display); letter-spacing: -0.01em; color: var(--text);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 14px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--surface-2-border); border-radius: var(--r-btn);
  font-size: 14px; font-weight: 600; line-height: 1; text-decoration: none; white-space: nowrap;
  cursor: pointer; user-select: none; -webkit-user-select: none;
}
.btn:disabled { opacity: 0.45; cursor: default; }
.btn--lg { height: 44px; padding: 0 18px; }
.btn--bar { height: 48px; padding: 0 18px; border-radius: var(--r-bar-btn); font-size: 15px; }
.btn--icon { width: 44px; height: 44px; padding: 0; }
.btn--accent { background: var(--accent); color: var(--on-color); border-color: var(--accent); font-weight: 700; }
.btn--light { background: var(--text); color: var(--on-color); border-color: var(--text); font-weight: 700; }
.btn--danger { background: var(--danger); color: #FFFFFF; border-color: var(--danger); font-weight: 700; padding: 0 22px; }
.btn--ghost { background: transparent; }
.btn[aria-pressed='true'] {
  background: var(--accent-soft-bg); color: var(--accent-soft-fg); border-color: var(--accent-soft-border);
}
.btn.is-held { background: var(--accent); color: var(--on-color); border-color: var(--accent); }

@media (hover: hover) {
  .btn:not(:disabled):hover { border-color: #3A4150; }
  .btn--accent:not(:disabled):hover { background: var(--accent-hover); border-color: var(--accent-hover); }
  .btn--danger:not(:disabled):hover { background: #DC3B40; border-color: #DC3B40; }
}

/* Live-Sperre: Entsperren durch 1 s Halten, Fortschritt als Füllung. */
.btn--lock { position: relative; overflow: hidden; }
.btn--lock > * { position: relative; }
.btn--lock::before {
  content: ''; position: absolute; inset: 0; background: var(--accent); opacity: 0.35;
  transform: scaleX(0); transform-origin: left;
}
.btn--lock.is-holding::before { transform: scaleX(1); transition: transform 1s linear; }

/* ---------- Kopfzeile ---------- */

.select {
  height: 40px; max-width: 240px; padding: 0 36px 0 14px;
  background-color: var(--surface-2); color: var(--text);
  border: 1px solid var(--surface-2-border); border-radius: var(--r-btn);
  font-size: 14px; font-weight: 600; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23E8EAED' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  text-overflow: ellipsis;
}
.select:disabled { opacity: 0.6; cursor: default; }

.bank-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.bank-tab { padding: 0 12px; color: var(--text-soft); }
.bank-tab[aria-pressed='true'] {
  background: var(--accent); color: var(--on-color); border-color: var(--accent); font-weight: 700;
}

.master { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 13px; color: var(--text-muted); }
.master__range { width: 100px; accent-color: var(--accent); }
.master__value { min-width: 52px; text-align: right; }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px; border: 0; border-radius: 16px;
  background: var(--surface-2); color: var(--text-muted);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip__dot { width: 8px; height: 8px; border-radius: 4px; background: currentColor; }
.chip--ok { background: var(--ok-bg); color: var(--ok); }
.chip--ok .chip__dot { background: var(--ok-dot); }
.chip--accent { background: var(--accent-soft-bg); color: var(--accent-soft-fg); }
.chip--danger { background: var(--danger-soft-bg); color: var(--danger-soft-fg); }
button.chip { cursor: pointer; }

.tag {
  display: inline-flex; align-items: center; padding: 4px 8px; border-radius: var(--r-chip);
  font-size: 12px; font-weight: 600; line-height: 1.2; white-space: nowrap;
}
.tag--cat { background: var(--cat, var(--accent)); color: var(--on-color); }
.tag--accent { background: var(--accent-soft-bg); color: var(--accent-soft-fg); }

.cat-tor { --cat: var(--cat-tor); }
.cat-spiel { --cat: var(--cat-spiel); }
.cat-hymne { --cat: var(--cat-hymne); }
.cat-effekt { --cat: var(--cat-effekt); }
.cat-pause { --cat: var(--cat-pause); }

/* ---------- Live-Ansicht ---------- */

.live {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px;
  padding: 20px 24px; flex-grow: 1;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}
.pads-section { flex: 999 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.pads-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.pads-title { font: 700 22px/1.2 var(--font-display); overflow-wrap: anywhere; }
.pads-hint { font-size: 13px; color: var(--text-muted); }
.pads-head:has(+ .pads.is-edit) .pads-hint { color: var(--accent-soft-fg); }
.pads { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }

.pad {
  position: relative; min-width: 0; min-height: var(--pad-min-h);
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
  padding: 12px 14px 22px; border: 0; border-radius: var(--r-pad);
  background: var(--cat, var(--surface-2)); color: var(--on-color);
  text-align: left; cursor: pointer;
  outline: 0 solid transparent; outline-offset: 3px;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.pad:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.pad.is-pressed { filter: brightness(0.9); }
.pad.is-playing, .pad.is-fading { outline: 3px solid #FFFFFF; outline-offset: 3px; }
.pad.is-drop { outline: 3px dashed var(--accent); outline-offset: 3px; }

.pad__top { display: flex; justify-content: space-between; align-items: center; gap: 6px; min-height: 22px; }
.pad__key {
  font-size: 12px; font-weight: 700; line-height: 1; padding: 5px 7px;
  border-radius: var(--r-chip); background: rgba(14, 16, 20, 0.16);
}
.pad__flags { display: flex; align-items: center; gap: 6px; }
.pad__state { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.pad__label { font: 700 17px/1.2 var(--font-display); overflow-wrap: anywhere; }
.pad__meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 600; }
.pad__bar {
  position: absolute; left: 14px; right: 14px; bottom: 9px; height: 5px;
  border-radius: 3px; background: rgba(14, 16, 20, 0.22); overflow: hidden;
}
.pad__bar-fill {
  display: block; width: 100%; height: 100%; background: var(--on-color);
  transform: scaleX(0); transform-origin: left;
}
.pad.is-fading .pad__bar-fill { animation: pad-pulse 0.35s ease-in-out infinite alternate; }
@keyframes pad-pulse { from { opacity: 1; } to { opacity: 0.35; } }

.pad.is-loading { cursor: progress; }
.pad.is-loading > :not(.pad__top) { opacity: 0.55; }
.pad__spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(14, 16, 20, 0.25); border-top-color: var(--on-color);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pad__warn {
  display: inline-flex; padding: 3px; border-radius: var(--r-chip);
  background: var(--on-color); color: #FF8A8E;
}

.pad--empty {
  align-items: center; justify-content: center; padding: 12px;
  background: transparent; color: var(--text-muted);
  border: 2px dashed var(--surface-2-border); text-align: center;
}
.pad--empty .pad__top { position: absolute; top: 10px; left: 12px; right: 12px; }
.pad--empty .pad__key { background: var(--surface-2); color: var(--text-label); }
.pad--empty .pad__label { font: 600 14px/1.3 var(--font-text); }
.pad--empty .pad__meta, .pad--empty .pad__bar { display: none; }
.pad--empty .pad__spinner { border-color: rgba(232, 234, 237, 0.2); border-top-color: var(--text); }
.pad:disabled { cursor: default; }

.pads.is-edit .pad:not(.pad--empty) { outline: 2px dashed var(--text); outline-offset: 2px; }

/* ---------- Seitenleiste ---------- */

.side { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
.card__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 24px; }
.label-caps {
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-label);
}

.now { display: flex; flex-direction: column; gap: 12px; }
.now__title { font: 700 24px/1.2 var(--font-display); overflow-wrap: anywhere; }
.now__sub { margin-top: 4px; font-size: 13px; color: var(--text-muted); overflow-wrap: anywhere; }
.now__rem { font-size: 46px; font-weight: 600; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.now__actions { display: flex; gap: 8px; }
.now__actions .btn { flex: 1 1 0; height: 44px; min-width: 0; padding: 0 8px; }
.now__empty { padding: 18px 0; font-size: 15px; color: var(--text-muted); }
.now__more { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.now__row {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 2px;
  border-top: 1px solid var(--border); font-size: 14px;
}
.now__row-name { flex-grow: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now__row-rem { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.progress { position: relative; height: 10px; }
.progress__track { height: 100%; border-radius: 5px; background: var(--border); overflow: hidden; }
.progress__fill {
  width: 100%; height: 100%; background: var(--accent);
  transform: scaleX(0); transform-origin: left;
}
.progress__mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text-muted); }

.empty-note { font-size: 14px; color: var(--text-muted); }

/* ---------- Playlist ---------- */

.pl { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pl__head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.select--sm { height: 32px; max-width: 180px; padding: 0 30px 0 10px; background-position: right 8px center; font-size: 13px; }
.card.is-drop { outline: 3px dashed var(--accent); outline-offset: 3px; }
.pl__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 340px; overflow-y: auto; }
.pl__row {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px;
  background: transparent; color: var(--text); border: 0; border-radius: var(--r-input);
  font-size: 14px; text-align: left; cursor: pointer;
}
.pl__row.is-current { background: var(--surface-hover); }
.pl__row.is-current .pl__title { font-weight: 700; }
.pl__row.is-played { color: var(--text-label); }
.pl__n { flex: none; width: 18px; font-size: 12px; color: var(--text-label); }
.pl__title { flex-grow: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl__time { flex: none; font-size: 13px; }
.pl__transport { display: flex; align-items: center; gap: 8px; }
.pl__play { width: 56px; height: 44px; padding: 0; }
.pl__clock { font-size: 13px; color: var(--text-muted); }
.pl__toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { height: 34px; padding: 0 12px; border-radius: 17px; font-size: 13px; color: var(--text-soft); }
.pl__manage { display: flex; flex-wrap: wrap; gap: 8px; }

.dialog { overflow-y: auto; }
.dialog.dialog--wide { width: min(560px, calc(100vw - 32px)); }
.dialog__actions.dialog__actions--split { justify-content: space-between; }
.btn--ghost-danger { background: transparent; color: var(--danger-soft-fg); border-color: var(--danger); }
.pl-edit__fields { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 12px; }
.pl-edit__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.pl-edit__row { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; }

@media (pointer: coarse) {
  .pill { height: 44px; border-radius: 22px; }
  .pl__row { min-height: 44px; }
  .select--sm { height: 44px; }
}

/* ---------- Bibliothek ---------- */

.lib {
  display: flex; flex-direction: column; gap: 16px; padding: 20px 24px;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}
.lib__toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.lib__summary { font-size: 13px; color: var(--text-muted); }
.lib__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.lib__list--scroll { max-height: min(50vh, 420px); overflow-y: auto; }
.lib__group { padding: 12px 0 4px; }
.lib__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.lib__row:first-child, .lib__group + .lib__row { border-top: 0; }
.lib__main { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lib__name { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.lib__meta { font-size: 13px; color: var(--text-muted); overflow-wrap: anywhere; }
.lib__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.lib__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.lib__swatch { flex: none; align-self: stretch; width: 6px; min-height: 36px; border-radius: 3px; background: var(--cat, var(--surface-2-border)); }
.tag--muted { background: var(--surface-2); color: var(--text-muted); }
.search { width: min(280px, 100%); height: 40px; }
.pl-edit__row[draggable='true'] { cursor: grab; }
.pl-edit__row.is-over { box-shadow: 0 -2px 0 var(--accent); }

/* ---------- Einstellungen ---------- */

.settings {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; gap: 16px;
  padding: 20px 24px;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; gap: 12px; }
.set-stack { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.set-note { font-size: 13px; color: var(--text-muted); overflow-wrap: anywhere; }
.set-block { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.set-block + .set-block { padding-top: 12px; border-top: 1px solid var(--border); }
.set-progress { font-size: 13px; color: var(--accent-soft-fg); }
.set-value { font-size: 14px; overflow-wrap: anywhere; }
.switch { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 44px; cursor: pointer; }
.switch__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch__label { font-size: 14px; font-weight: 600; }
.switch__hint { font-size: 13px; color: var(--text-muted); }
.switch__input {
  flex: none; position: relative; width: 46px; height: 28px; margin: 0; border-radius: 14px;
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--surface-2-border);
}
.switch__input::before {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--text-muted); transition: transform 0.12s ease;
}
.switch__input:checked { background: var(--accent); border-color: var(--accent); }
.switch__input:checked::before { background: var(--on-color); transform: translateX(18px); }
.diag { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; margin: 0; font-size: 14px; }
.diag dt { color: var(--text-muted); }
.diag dd { margin: 0; text-align: right; overflow-wrap: anywhere; }

/* ---------- Fußzeile ---------- */

.storage-info { font-size: 13px; color: var(--text-muted); }
.storage-info.is-warn { color: var(--accent-soft-fg); }

/* ---------- Overlays, Dialoge, Meldungen ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(14, 16, 20, 0.94);
}
.overlay__btn {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  min-width: min(360px, 100%); padding: 36px 28px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-card);
  cursor: pointer; text-align: center;
}
.overlay__stack { display: flex; flex-direction: column; align-items: center; gap: 16px; max-width: 420px; }
.overlay__hint { font-size: 13px; color: var(--text-muted); text-align: center; }
.overlay__icon { color: var(--accent); }
.overlay__title { font: 700 24px/1.2 var(--font-display); }
.overlay__text { font-size: 14px; color: var(--text-muted); max-width: 34ch; }

.dialog {
  width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  padding: 20px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-card);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.dialog__form { display: flex; flex-direction: column; gap: 16px; }
.dialog__title { font: 700 20px/1.2 var(--font-display); overflow-wrap: anywhere; }
.dialog__text { font-size: 14px; color: var(--text-muted); overflow-wrap: anywhere; }
.dialog__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.dialog__menu { display: flex; flex-direction: column; gap: 8px; }
.dialog__menu .btn { height: 48px; justify-content: flex-start; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-muted); }
.input {
  height: 44px; padding: 0 12px; background: var(--surface-inset); color: var(--text);
  border: 1px solid var(--surface-2-border); border-radius: var(--r-input);
  font-size: 16px; /* ≥ 16 px: iOS zoomt sonst beim Fokussieren */
}

.toasts {
  position: fixed; left: 50%; bottom: 96px; z-index: 60; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: max-content; max-width: calc(100vw - 32px); pointer-events: none;
}
.toast {
  padding: 10px 14px; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--surface-2-border); border-radius: var(--r-btn);
  font-size: 14px; overflow-wrap: anywhere; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}
.toast--error { border-color: var(--danger); }

.page { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.page__title { font: 700 22px/1.2 var(--font-display); }

.log-overlay {
  position: fixed; left: 8px; bottom: 8px; z-index: 100; max-width: 70vw; padding: 6px 8px;
  background: rgba(0, 0, 0, 0.82); color: var(--ok);
  font: 11px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap; overflow-wrap: anywhere; pointer-events: none;
}

/* ---------- Clip-Editor (Werte nach docs/mockup/editor.dc.html) ---------- */

.editor {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; padding: 20px 24px;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}
.editor__side { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.editor__main { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.card--tight { padding: 16px; }
.editor__heading { min-width: 0; }
.editor__title { font: 700 20px/1.2 var(--font-display); overflow-wrap: anywhere; }
.editor__sub { font-size: 13px; color: var(--text-muted); }
.editor__file { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.editor__meta { font-size: 13px; line-height: 1.5; color: var(--text-muted); }

.editor__sections { display: flex; flex-direction: column; gap: 8px; }
.editor__section {
  display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-height: 44px; padding: 10px 12px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--surface-2-border);
  border-radius: var(--r-btn); text-align: left; cursor: pointer;
}
.editor__section[aria-current='true'] { background: var(--accent-soft-bg); border-color: var(--accent); cursor: default; }
.editor__section-head { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 700; }
.editor__section-name { min-width: 0; overflow-wrap: anywhere; }
.editor__section-pad { font-size: 12px; font-weight: 600; color: var(--text-soft); white-space: nowrap; }
.editor__section-range { font-size: 13px; color: var(--text-muted); }

.btn--dashed { background: transparent; color: var(--accent); border: 1px dashed var(--accent-soft-border); }
.btn--sm { height: 36px; padding: 0 12px; border-radius: var(--r-input); font-size: 13px; }
.btn--square { width: 36px; padding: 0; font-size: 18px; }

.editor__toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.editor__zoom { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.editor__range { font-size: 13px; color: var(--text-muted); }
.editor__loading { font-size: 12px; color: var(--text-muted); }
.editor__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.editor__fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.editor__length { height: 44px; display: flex; align-items: center; font-size: 20px; font-weight: 600; color: var(--text); }
.editor__gain { width: 100%; height: 44px; accent-color: var(--accent); }
.editor__hotkey { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.editor__key {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--on-color); border-radius: var(--r-input); font-size: 16px; font-weight: 700;
}
.editor__key.is-empty { background: var(--surface-2); color: var(--text-muted); }
.editor__key-note { font-size: 12px; color: var(--accent-soft-fg); }
.editor__key-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.editor__key-grid .seg { padding: 0; }
.input[aria-invalid='true'] { border-color: var(--danger); }

.editor__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.editor__row + .editor__row { margin-top: 2px; }
.editor__row-label { width: 190px; font-size: 13px; color: var(--text-muted); }
.editor__options { display: flex; flex-wrap: wrap; gap: 6px; }
.seg { height: 38px; padding: 0 14px; border-radius: var(--r-input); color: var(--text-soft); }
.seg[aria-pressed='true'] { background: var(--accent-soft-bg); color: var(--accent-soft-fg); border-color: var(--accent); }
.seg--cat { padding: 0 12px; border-width: 2px; font-size: 13px; color: var(--text); }
.seg--cat[aria-pressed='true'] { background: var(--surface-2); color: var(--text); border-color: var(--accent); }
.seg__swatch { width: 16px; height: 16px; border-radius: 4px; background: var(--cat); }

@media (pointer: coarse) {
  .btn--sm, .seg { height: 44px; }
  .btn--square { width: 44px; }
}

/* Wellenform */
.wave { display: flex; flex-direction: column; gap: 12px; }
.wave__canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.wave__overview {
  position: relative; height: 34px; background: var(--surface-inset); border-radius: 6px;
  overflow: hidden; cursor: pointer; touch-action: none;
}
.wave__ov-clip {
  position: absolute; top: 0; bottom: 0; min-width: 4px; pointer-events: none;
  background: rgba(245, 165, 36, 0.28);
  border-left: 2px solid var(--in-marker); border-right: 2px solid var(--accent);
}
.wave__ov-view {
  position: absolute; top: 0; bottom: 0; min-width: 6px; pointer-events: none;
  background: rgba(232, 234, 237, 0.06); border: 1px solid rgba(232, 234, 237, 0.55); border-radius: 4px;
}
.wave__detail {
  position: relative; height: 190px; background: var(--surface-inset); border-radius: var(--r-input);
  overflow: hidden; cursor: crosshair; touch-action: pan-y;
  user-select: none; -webkit-user-select: none;
}
.wave__marker {
  position: absolute; top: 0; bottom: 0; z-index: 2; width: 28px; margin-left: -14px; padding: 0;
  background: transparent; border: 0; cursor: ew-resize; touch-action: none;
}
.wave__marker::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; margin-left: -1.5px;
  background: var(--in-marker);
}
.wave__marker--out::before { background: var(--accent); }
.wave__marker.is-selected::before { width: 5px; margin-left: -2.5px; }
.wave__marker:focus-visible { outline: none; }
.wave__marker:focus-visible .wave__flag { outline: 2px solid var(--text); outline-offset: 1px; }
.wave__flag {
  position: absolute; top: 8px; left: calc(50% + 6px); padding: 3px 6px; border-radius: 4px;
  background: var(--in-marker); color: var(--on-color);
  font-size: 12px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.wave__marker--out .wave__flag { left: auto; right: calc(50% + 6px); background: var(--accent); }
.wave__marker--in.is-flip .wave__flag { left: auto; right: calc(50% + 6px); }
.wave__marker--out.is-flip .wave__flag { right: auto; left: calc(50% + 6px); }
.wave__playhead {
  position: absolute; top: 0; bottom: 0; z-index: 1; width: 2px; margin-left: -1px;
  background: #FFFFFF; pointer-events: none;
}
.wave__fade-label { position: absolute; bottom: 8px; font-size: 11px; font-weight: 600; color: var(--text-soft); pointer-events: none; }
.wave__axis { position: relative; height: 16px; overflow: hidden; font-size: 12px; color: var(--text-label); }
.wave__tick { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }

/* ---------- Schmale Bildschirme ---------- */

@media (max-width: 720px) {
  .bar { padding: 10px 12px; gap: 8px 10px; }
  .bar__group { gap: 8px 10px; }
  .bar__group--end { margin-left: 0; }
  .bar--top { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .bar--bottom { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); gap: 8px; }
  .live { padding: 12px; gap: 16px; }
  .pads { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pads-hint, .kbd-hint { display: none; }
  .bar--bottom .btn--bar { flex: 1 1 auto; padding: 0 12px; }
  .bar--bottom .spacer { display: none; }
  .storage-info { flex-basis: 100%; font-size: 12px; }
  .select { max-width: 100%; }
  .page { padding: 12px; }
  .lib, .settings { padding: 12px; }
  .search { width: 100%; }
  .bar__group--end:has(.search) { flex-basis: 100%; }
  .editor { padding: 12px; gap: 16px; }
  .editor__row-label { width: 100%; }
  .editor__actions .btn { flex: 1 1 auto; }
  .card { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .pad__spinner, .pad.is-fading .pad__bar-fill { animation-duration: 2s; }
}
