:root {
  --bg: #f5f6f8; --panel: #ffffff; --text: #1b1f24; --muted: #6b7380; --line: #dfe3e8;
  --accent: #e5322d; --accent-text: #fff; --a: #1f9d55; --b: #d9480f; --range: rgba(229, 50, 45, .16);
  --btn: #eef0f3; --btn-hover: #e2e6ea;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317; --panel: #1a1d23; --text: #e8eaed; --muted: #9aa1ab; --line: #2c313a;
    --accent: #ff4d47; --a: #3ccf7a; --b: #ff8a3d; --range: rgba(255, 77, 71, .2);
    --btn: #252932; --btn-hover: #2f3440;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
button { font: inherit; color: var(--text); background: var(--btn); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
button:hover { background: var(--btn-hover); }
button.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
button.primary:hover { filter: brightness(1.08); }
input[type=text], input[type=number] { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; width: 100%; }
kbd { font: 12px ui-monospace, Menlo, monospace; background: var(--btn); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; }

.top { display: flex; gap: 16px; align-items: center; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; white-space: nowrap; }
.logo { color: var(--accent); }
.load { display: flex; gap: 8px; flex: 1; min-width: 260px; }

main { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; padding: 20px; max-width: 1400px; margin: 0 auto; }
@media (max-width: 900px) {
  /* eine Spalte: gespeicherte Loops ganz ans Ende (nach A/B und Einstellungen) */
  main { display: flex; flex-direction: column; gap: 0; padding: 12px 16px; }
  .left, .right { display: contents; }
  .points { margin-top: 16px; }
  .right > .panel, .savedPanel { margin-top: 14px; }
  .savedPanel { order: 10; }
}

.playerWrap { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; }
.playerWrap iframe, #player { position: absolute; inset: 0; width: 100%; height: 100%; }
.placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: #ddd; padding: 20px; }
.placeholder .muted { color: #999; }
.placeholder.hidden { display: none; }
.errorBox { background: rgba(0, 0, 0, .88); z-index: 3; gap: 4px; }
.errorBox .errTitle { font-size: 18px; font-weight: 700; color: #fff; margin: 0 0 4px; }
.errorBox .muted { max-width: 520px; margin: 0 0 14px; }
.errActions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.btnLink { display: inline-block; padding: 9px 14px; border-radius: 8px; text-decoration: none; color: #fff; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .25); }
.btnLink.primary { background: var(--accent); border-color: transparent; }
.hostBanner { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 10px 16px; background: #fff4d6; color: #5c4200; border-bottom: 1px solid #f0d78a; font-size: 14px; text-align: center; }
.hostBanner.hidden { display: none; }
@media (prefers-color-scheme: dark) { .hostBanner { background: #3a2f12; color: #f3dfa6; border-color: #5c4a1c; } }

.tlLabel { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin: 16px 2px 6px; }
.timeline { position: relative; height: 34px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; touch-action: none; user-select: none; }
.timeline.zoom { height: 56px; }
.timeline .range { position: absolute; top: 0; bottom: 0; background: var(--range); border-left: 2px solid var(--a); border-right: 2px solid var(--b); display: none; }
.timeline .playhead { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); pointer-events: none; }
.timeline .handle { position: absolute; top: 50%; width: 22px; height: 22px; margin-left: -11px; transform: translateY(-50%); border-radius: 50%; color: #fff; font: 700 11px/22px sans-serif; text-align: center; cursor: ew-resize; display: none; box-shadow: 0 1px 3px rgba(0,0,0,.3); z-index: 2; }
.timeline .handle.a { background: var(--a); }
.timeline .handle.b { background: var(--b); }
.timeline .handle.active { outline: 2px solid var(--text); outline-offset: 1px; }
.ticks { position: absolute; inset: 0; pointer-events: none; }
.ticks .t { position: absolute; bottom: 0; height: 8px; border-left: 1px solid var(--line); }
.ticks .t.major { height: 14px; border-color: var(--muted); }
.ticks .t span { position: absolute; top: -16px; left: 3px; font: 10px ui-monospace, Menlo, monospace; color: var(--muted); white-space: nowrap; }

.transport { display: flex; gap: 8px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.transport .big { min-width: 64px; font-size: 18px; }
.toggle { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; margin-left: 8px; }
.reps { margin-left: auto; color: var(--muted); }

.right { display: flex; flex-direction: column; gap: 14px; }
.points { display: flex; flex-direction: column; gap: 10px; }
.point { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.point.active { border-color: var(--text); }
/* Kopfzeile: [Start setzen] [Zeit] [▶ Anhören] [?] – alles in einer Zeile */
.pointHead { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.pointHead .set { flex: none; font-weight: 600; color: #fff; border: 0; padding: 7px 10px; white-space: nowrap; }
.pointHead .set.a { background: var(--a); } .pointHead .set.b { background: var(--b); }
.pointHead .set:hover { filter: brightness(1.1); }
.pointHead .time { flex: 1 1 0; min-width: 0; width: 0; font-size: 19px; padding: 5px 4px; }
.pointHead .preview { flex: none; width: auto; padding: 7px 9px; white-space: nowrap; }
.pointHead .helpBtn { flex: none; margin-left: 0; }
.tag { display: inline-block; width: 22px; height: 22px; border-radius: 50%; color: #fff; text-align: center; line-height: 22px; font-size: 12px; }
.tag.a { background: var(--a); } .tag.b { background: var(--b); }
.time { font-size: 24px; text-align: center; padding: 6px; }
.nudges { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin: 6px 0 0; }
.nudges button { padding: 5px 0; font-size: 12px; }
.loopLen { text-align: right; font-size: 13px; }

/* Loop löschen – deutlich sichtbar, links unter den Bedienknöpfen */
.clearBtn { display: block; width: 100%; margin-top: 14px; padding: 11px 14px; min-height: 46px; font-weight: 700; font-size: 15px;
  color: #fff; background: #c62828; border: 2px solid #8e1b1b; border-radius: 10px; }
.clearBtn:hover { background: #b71c1c; }
.clearBtn:disabled { background: var(--btn); color: var(--muted); border-color: var(--line); font-weight: 500; cursor: default; }
.savedPanel { margin-top: 14px; }

/* Suche */
.searchWrap { position: relative; flex: 1; min-width: 260px; }
.searchWrap .load { min-width: 0; }
.searchWrap .load button { white-space: nowrap; flex-shrink: 0; }
input[type=search] { -webkit-appearance: none; appearance: none; font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; width: 100%; }
.searchResults { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50; max-height: min(70vh, 640px); overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 6px; }
.searchResults.hidden { display: none; }
.searchResults .msg { padding: 14px; color: var(--muted); text-align: center; }
.result { display: grid; grid-template-columns: 128px 1fr; gap: 12px; align-items: center; padding: 6px; border-radius: 8px; cursor: pointer; }
.result:hover, .result.sel { background: var(--btn); }
.result .thumb { position: relative; width: 128px; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: #000; }
.result .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.result .thumb .len { position: absolute; right: 4px; bottom: 4px; background: rgba(0,0,0,.8); color: #fff; font: 600 11px/1 ui-monospace, Menlo, monospace; padding: 2px 4px; border-radius: 3px; }
.result .rTitle { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result .rMeta { font-size: 13px; color: var(--muted); margin-top: 2px; }
@media (max-width: 600px) { .result { grid-template-columns: 96px 1fr; } .result .thumb { width: 96px; } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.panel summary { font-weight: 600; cursor: pointer; padding: 2px 0; }
.panel[open] summary { margin-bottom: 8px; }
.row { margin: 8px 0; }
.row label { display: block; font-size: 13px; color: var(--muted); }
.row input[type=range] { width: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid2 input { margin-top: 3px; }
.presets { display: flex; gap: 6px; }
.presets button { flex: 1; }
.saveRow { display: flex; gap: 6px; }
.saved { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; }
.saved li { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-top: 1px solid var(--line); }
.saved li .info { flex: 1; min-width: 0; cursor: pointer; }
.saved li .info:hover .name { text-decoration: underline; }
.saved li .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved li .meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved li button { padding: 2px 8px; }
.saved .empty { color: var(--muted); font-size: 13px; border: 0; }
.keys { font-size: 13px; border-collapse: collapse; }
.keys td { padding: 3px 8px 3px 0; vertical-align: top; }

/* ---------- iPad / Touch ---------- */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); padding-bottom: env(safe-area-inset-bottom); }
button, .timeline, .toggle, summary { touch-action: manipulation; } /* kein Doppeltipp-Zoom bei schnellem Tippen */
.timeline { touch-action: none; }
input[type=text], input[type=number] { font-size: 16px; } /* < 16px → Safari zoomt beim Antippen hinein */
input.time { font-size: 24px; }
.pointHead input.time { font-size: 19px; }
.timeline .handle::before { content: ''; position: absolute; inset: -12px -8px; } /* größere Griff-Fläche */
.nudges button.repeating { background: var(--btn-hover); }

@media (pointer: coarse) {
  button { min-height: 40px; }
  .nudges button { min-height: 42px; font-size: 13px; }
  .timeline { height: 44px; }
  .timeline.zoom { height: 72px; }
  .timeline .handle { width: 30px; height: 30px; margin-left: -15px; line-height: 30px; font-size: 13px; }
  .timeline .handle::before { inset: -16px -12px; }
  .transport { gap: 10px; }
  .toggle input { width: 22px; height: 22px; }
  .saved li { padding: 10px 4px; }
  .saved li button { min-width: 40px; }
}
/* iPad hochkant: Seitenleiste unter das Video, Punkte A/B nebeneinander */
@media (min-width: 640px) and (max-width: 900px) {
  .points { display: grid; grid-template-columns: 1fr 1fr; }
  .loopLen { grid-column: 1 / -1; }
}
@media (display-mode: standalone) { .top { padding-top: max(12px, env(safe-area-inset-top)); } }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 8px; opacity: 0; transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------- Eigene Dateien ---------- */
.fileBtn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; padding: 7px 12px; border-radius: 8px;
  background: var(--btn); border: 1px solid var(--line); min-height: 38px; touch-action: manipulation; }
.fileBtn:hover { background: var(--btn-hover); }
#localMedia { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
#localMedia.hidden, .audioCover.hidden { display: none; }
.audioCover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: linear-gradient(135deg, #2b1d3a, #12324a); color: #fff; text-align: center; padding: 20px; pointer-events: none; }
.audioCover .note { font-size: 72px; line-height: 1; opacity: .85; }
.audioCover #audioTitle { font-size: 20px; font-weight: 600; max-width: 90%; overflow-wrap: anywhere; }
body.dragging .playerWrap { outline: 3px dashed var(--accent); outline-offset: 4px; }

/* ---------- Tonhöhe ---------- */
.pitchRow { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.pitchLabel { font-size: 13px; color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { min-width: 38px; padding: 5px 8px; }
.stepper output { min-width: 48px; text-align: center; font-size: 18px; font-weight: 700; }
#pitchPanel input[type=range] { width: 100%; margin: 6px 0 2px; }
.pitchFoot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
#pitchPanel.off .pitchRow, #pitchPanel.off input[type=range], #pitchPanel.off .pitchFoot { opacity: .4; pointer-events: none; }
#pitchPanel:not(.off) #pitchNote { display: none; }
#pitchPanel.shifted summary::after { content: ' ●'; color: var(--accent); }

/* ---------- Quelle wählen + Mac-Mediathek ---------- */
.sourceWrap { position: relative; }
.sourceMenu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; width: 300px; max-width: calc(100vw - 32px);
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 6px; }
.sourceMenu.hidden { display: none; }
.menuItem { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; padding: 10px; border-radius: 8px; border: 0;
  background: transparent; cursor: pointer; font-size: 15px; min-height: 48px; }
.menuItem:hover { background: var(--btn); }
.menuItem span { display: flex; flex-direction: column; font-weight: 600; }
.menuItem small { font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 2px; }

.libDlg { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 16px 16px; }
.libDlg.hidden { display: none; }
.libBox { width: 100%; max-width: 640px; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); display: flex; flex-direction: column; gap: 8px;
  background: var(--panel); border-radius: 14px; padding: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.libHead { display: flex; justify-content: space-between; align-items: center; font-size: 17px; }
.libHead button { min-width: 40px; }
.libList { list-style: none; margin: 0; padding: 0; overflow: auto; -webkit-overflow-scrolling: touch; flex: 1; min-height: 120px; }
.libList li { display: flex; gap: 10px; align-items: center; padding: 9px 8px; border-top: 1px solid var(--line); cursor: pointer; border-radius: 6px; }
.libList li:hover, .libList li.current { background: var(--btn); }
.libList .lt { flex: 1; min-width: 0; }
.libList .lt b, .libList .lt span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.libList .lt span { font-size: 13px; color: var(--muted); }
.libList .ext { font: 600 10px ui-monospace, Menlo, monospace; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; }
.libList .msg { color: var(--muted); justify-content: center; cursor: default; border: 0; }
.audioCover .audioSub { font-size: 14px; opacity: .75; }

/* ---------- Auto-Tune ---------- */
.autotune { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.refA { display: inline-flex; align-items: center; font-size: 13px; color: var(--muted); }
.refA input { width: 74px; padding: 5px 6px; }
#tuneInfo { margin-top: 6px; min-height: 1em; }
#tuneInfo b { color: var(--text); }

/* ---------- Takt & Beat ---------- */
.beatHead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.beatHead b { font-size: 20px; }
select { font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; width: 100%; margin-top: 3px; }
.btnRow { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; align-items: center; }
.btnRow button { flex: 1; white-space: nowrap; }
.fineRow .pitchLabel { flex: 2; }
.segRow { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; border-left: 1px solid var(--line); padding: 6px 10px; }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--accent); color: #fff; }
#beatPanel.nogrid .needGrid { opacity: .4; pointer-events: none; }
#btnTap.tapping { background: var(--accent); color: #fff; }

.beatNudges { display: grid; grid-template-columns: 1fr 1fr 1.3fr 1fr 1fr; gap: 4px; margin: 6px 0 0; align-items: center; }
.beatNudges button { padding: 5px 0; font-size: 12px; }
.beatNudges .beatPos { text-align: center; font-size: 12px; color: var(--muted); }
.beatNudges.hidden { display: none; }

.timeline .beats { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.beats .bt { position: absolute; top: 0; bottom: 0; border-left: 1px dashed rgba(127,127,127,.45); }
.beats .bt.bar { border-left: 2px solid rgba(127,127,127,.75); }
.beats .bt span { position: absolute; top: 2px; left: 3px; font: 600 10px ui-monospace, Menlo, monospace; color: var(--muted); }

/* ---------- Sprache ---------- */
.langWrap { display: inline-flex; align-items: center; gap: 4px; font-size: 18px; cursor: pointer; }
.langWrap select { width: auto; margin: 0; padding: 6px 8px; font-size: 15px; min-height: 38px; }
/* Schmalere Bildschirme (iPad hochkant, Handy): Suchfeld in eigener Zeile unter Logo, Datei-Knopf und Sprache */
@media (max-width: 900px) {
  .top { gap: 10px; }
  .brand { margin-right: auto; }
  .searchWrap { order: 10; flex-basis: 100%; }
}

/* ---------- Hilfe ---------- */
.helpBtn { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; min-height: 0 !important; padding: 0;
  margin-left: 8px; border-radius: 50%; font: 700 13px/1 -apple-system, sans-serif; color: var(--muted); background: var(--bg); vertical-align: middle; }
.helpBtn:hover { color: var(--text); }
@media (pointer: coarse) { .helpBtn { width: 28px; height: 28px; font-size: 15px; } }

.helpBox { max-width: 560px; }
.helpList { margin: 0; overflow: auto; -webkit-overflow-scrolling: touch; }
.helpList dt { font-weight: 700; margin-top: 12px; }
.helpList dt:first-child { margin-top: 4px; }
.helpList dd { margin: 3px 0 0; color: var(--muted); line-height: 1.45; }

/* ---------- Metronom-Lautstärke ---------- */
.volRow { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; }
.volRow input { flex: 1; }
.volRow output { min-width: 44px; text-align: right; font-size: 13px; }

/* ---------- Standalone: Einstellungen, Meine Songs ---------- */
.sourceMenu .menuItem.hidden { display: none; }
.iconBtn { font-size: 17px; padding: 6px 10px; }
.setScroll { overflow: auto; -webkit-overflow-scrolling: touch; }
.setScroll h4 { margin: 14px 0 6px; font-size: 14px; }
.setScroll h4:first-child { margin-top: 2px; }
#apiKeyInput { font-family: ui-monospace, Menlo, monospace; font-size: 14px; }
.apiHelp ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.5; }
.apiHelp a { color: var(--accent); }
.okText { color: #1f9d55; } .errText { color: var(--accent); }
.libList .libDel { padding: 2px 8px; min-width: 36px; }
.searchResults .msg button { margin-top: 10px; }

#libImport { align-self: flex-start; }
#libImport.hidden { display: none; }

/* ---------- Videogröße & Vollbild ---------- */
.tlRight { display: flex; align-items: center; gap: 12px; }
.viewCtl { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.viewCtl button { border: 0; border-radius: 0; background: var(--panel); color: var(--muted); padding: 2px 9px; font-size: 14px; line-height: 20px; min-width: 0; cursor: pointer; }
.viewCtl button + button { border-left: 1px solid var(--line); }
.viewCtl button.on { background: var(--accent); color: #fff; }
@media (pointer: coarse) { .viewCtl button { padding: 6px 13px; font-size: 16px; } }
.playerWrap.small { aspect-ratio: auto; height: max(200px, 36vh); width: min(100%, calc(max(200px, 36vh) * 16 / 9)); margin-inline: auto; }
/* eigene Audiodatei: kein Bild – dann nur ein schmaler Streifen mit dem Titel */
.playerWrap.small:has(#audioCover:not(.hidden)) { height: 64px; width: 100%; }
.playerWrap.small .audioCover { flex-direction: row; gap: 14px; padding: 8px 16px; }
.playerWrap.small .audioCover .note { font-size: 32px; }
.playerWrap.small .audioCover #audioTitle { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playerWrap.small .audioCover .audioSub { display: none; }
.playerWrap.small .placeholder p { margin: 4px 0; }
.playerWrap:fullscreen { width: 100%; height: 100%; max-width: none; aspect-ratio: auto; border-radius: 0; margin: 0; }
.playerWrap:-webkit-full-screen { width: 100%; height: 100%; max-width: none; aspect-ratio: auto; border-radius: 0; margin: 0; }

/* „Vollbild beenden“ – nur im Vollbild sichtbar (auf dem iPad gibt es sonst keinen sichtbaren Weg zurück) */
.fsExit { display: none; }
/* Klasse .isFs setzt app.js – ältere iPads kennen „:fullscreen“ nicht, und eine Selektorliste mit unbekanntem Teil wird komplett verworfen */
.playerWrap.isFs .fsExit {
  display: inline-flex; align-items: center; gap: 6px; position: absolute; z-index: 10;
  top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right));
  padding: 10px 16px; font-size: 16px; border-radius: 999px; border: 1px solid rgba(255,255,255,.35);
  background: rgba(0,0,0,.6); color: #fff; cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.playerWrap.isFs .fsExit:hover { background: rgba(0,0,0,.8); }
.playerWrap.isFs { width: 100% !important; height: 100% !important; max-width: none; aspect-ratio: auto; border-radius: 0; margin: 0; }
/* Ersatz-Vollbild (iPad): Player füllt das ganze Fenster */
.playerWrap.pseudoFs { position: fixed !important; inset: 0; z-index: 1000; width: 100vw !important; height: 100vh !important; height: 100dvh !important; max-width: none; margin: 0; border-radius: 0; }
html.noScroll, html.noScroll body { overflow: hidden; }
@media (max-width: 420px) { .pointHead input.time { font-size: 15px; } .pointHead .set, .pointHead .preview { padding: 7px 7px; } }

/* Takt & Beat: BPM in der Überschrift, Loop-Anfang/-Ende mit Icons */
.bpmHead { margin-left: 10px; font-size: 15px; font-weight: 700; }
.bpmHead:empty { display: none; }
#beatPanel .beatHead:has(#beatStatus:empty) { display: none; }
.adjHead { margin: 10px 0 2px; }
.loopAdj.adjRow { display: grid; grid-template-columns: 1fr 1fr 1.5fr 1fr 1fr; gap: 4px; margin: 6px 0; align-items: stretch; }
.loopAdj.adjRow button { min-width: 0; padding: 5px 4px; }
.adjMid { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 0; }
.adjName { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.adjMid .beatPos { font-size: 11px; color: var(--muted); white-space: nowrap; }
.adjMid .tag { width: 20px; height: 20px; line-height: 20px; font-size: 11px; }
.loopAdj button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 5px 10px; min-width: 58px; min-height: 34px; }
.ic { height: 20px; width: auto; fill: currentColor; flex: none; }
.ic.ar { height: 11px; opacity: .6; }
.ic.bar { height: 18px; }
.ticks .t.end span { left: auto; right: 3px; }
#beatPanel:not(.ytOff) #beatNote { display: none; }
#beatNote { margin: 0 0 8px; }
#btnDetect:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Akkordspur (Beta) ---------- */
.chordLane { position: relative; height: 26px; margin-top: 4px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.chordLane.hidden { display: none; }
.chordLane .ch { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); display: flex; align-items: center; overflow: hidden; }
.chordLane .ch span { padding: 0 5px; font: 600 13px/1 ui-monospace, Menlo, monospace; white-space: nowrap; }
.chordLane .ch.nc span { color: var(--muted); font-weight: 400; }
.chordLane .ch.cur { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.chordLane .ch.cur span { color: var(--accent); }
.chordLane .chMsg { display: block; padding: 5px 8px; font-size: 12px; color: var(--muted); }
.chordNow { margin-left: auto; margin-right: 12px; font: 700 14px ui-monospace, Menlo, monospace; color: var(--accent); white-space: pre; }
.chordNow.hidden { display: none; }
.beta { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-left: 4px; }

/* Start/Ende setzen auch in der Abspielzeile (bleibt beim Scrollen in Reichweite) */
.transport .qset { display: inline-flex; gap: 6px; }
.transport .qset .set { color: #fff; border: 0; font-weight: 600; padding: 9px 12px; white-space: nowrap; }
.transport .qset .set.a { background: var(--a); }
.transport .qset .set.b { background: var(--b); }
.transport .qset .set:hover { filter: brightness(1.08); }
.transport .qclr { display: inline-flex; gap: 6px; }
.transport .qclr .clr { white-space: nowrap; padding: 9px 10px; background: transparent; }
.transport .qclr .clr.a { color: var(--a); border-color: var(--a); }
.transport .qclr .clr.b { color: var(--b); border-color: var(--b); }
.transport .qclr .clr:disabled { opacity: .35; cursor: default; }

/* ---------- Ansicht Einfach / Profi ---------- */
.modeBar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.modeLabel { font-weight: 600; color: var(--muted); white-space: nowrap; }
.modeSeg { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; background: var(--bg); border-radius: 9px; }
.modeSeg button { border: 0; border-radius: 7px; padding: 8px 10px; font-size: 15px; font-weight: 600; background: transparent; color: var(--muted); }
.modeSeg button.on { background: var(--accent); color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.modeSeg .mi { font-size: 13px; opacity: .85; }
/* Desktop/iPad quer: Umschalter oben in der rechten Spalte, linke Spalte läuft daneben durch */
@media (min-width: 901px) {
  main { grid-template-rows: auto 1fr; }
  main > .left { grid-column: 1; grid-row: 1 / span 2; }
  main > .modeBar { grid-column: 2; grid-row: 1; margin-bottom: 0; align-self: start; }
  main > .right { grid-column: 2; grid-row: 2; align-self: start; }
}
@media (max-width: 900px) { .modeBar { margin: 0 0 12px; } }
/* Ein-/Ausblenden über die Ansichts-Konfiguration (viewcfg.js) statt fest per .pro */
.rgHide { display: none !important; }
.proHint { margin-top: 10px; padding: 8px 12px; border-radius: 8px; font-size: 14px; background: #fff6dc; color: #6b5310; border: 1px solid #f0dc9c; }
.proHint .linkBtn { border: 0; background: none; padding: 0; min-height: 0; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
@media (prefers-color-scheme: dark) { .proHint { background: #3a2f12; color: #f3dfa6; border-color: #5c4a1c; } }
.proHint.hidden { display: none; }
.viewLbl { color: var(--muted); font-size: 13px; margin-right: 6px; white-space: nowrap; }
@media (max-width: 430px) { .viewLbl { display: none; } }

/* ---------- Abschnitte (Leiste unter der Gesamt-Zeitleiste) ---------- */
.secLane { position: relative; height: 22px; margin-top: 4px; }
.secLane.hidden { display: none; }
.secLane .sec { position: absolute; top: 0; bottom: 0; padding: 0; border: 0; border-radius: 4px; margin: 0; background: color-mix(in srgb, var(--c) 28%, var(--panel)); border-left: 2px solid var(--c); overflow: hidden; cursor: pointer; display: flex; align-items: center; min-width: 0; }
.secLane .sec span { padding: 0 4px; font: 700 11px/1 ui-monospace, Menlo, monospace; color: var(--text); white-space: nowrap; }
.secLane .sec:hover { background: color-mix(in srgb, var(--c) 45%, var(--panel)); }
.secLane .sec.cur { box-shadow: inset 0 -3px 0 var(--c); }
.secLane .sec.inLoop { outline: 2px solid var(--text); outline-offset: -2px; }
/* ---------- Noten (Leiste unter der Akkordspur) ---------- */
.noteLane { position: relative; height: 72px; margin-top: 4px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.noteLane.hidden { display: none; }
.noteLane .nt { position: absolute; height: 22%; min-width: 3px; background: color-mix(in srgb, var(--accent) 22%, transparent); border-left: 2px solid var(--accent); border-radius: 3px; overflow: visible; display: flex; align-items: center; }
.noteLane .nt span { padding: 0 2px; font: 600 11px/1 ui-monospace, Menlo, monospace; white-space: nowrap; position: relative; z-index: 1; }
.noteLane .nt.cur { background: var(--accent); }
.noteLane .nt.cur span { color: #fff; }
.noteLane .chMsg { display: block; padding: 5px 8px; font-size: 12px; color: var(--muted); }
.noteNow { margin-left: auto; margin-right: 10px; font: 700 14px ui-monospace, Menlo, monospace; color: var(--b); white-space: pre; }
.noteNow.hidden { display: none; }
.noteNow:not(.hidden) + .chordNow { margin-left: 0; }
/* ---------- Klang ---------- */
.fxSeg { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 4px; margin: 8px 0; }
.fxSeg button { padding: 7px 6px; font-size: 13px; }
.fxSeg button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
#soundPanel:not(.ytOff) .fileOnlyNote { display: none; }
.notesToggle { margin: 8px 0 0; }
/* ---------- Aufnahme ---------- */
.recRow { flex-wrap: wrap; }
.recBtn.recording { background: #e5484d; color: #fff; border-color: #e5484d; }
.recDot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #e5484d; margin-left: 8px; animation: recBlink 1s infinite; }
.recDot.hidden { display: none; }
@keyframes recBlink { 50% { opacity: .25; } }
.recStatus { margin-top: 6px; }
/* ---------- Fußpedal (Einstellungen) ---------- */
.pedalToggle { margin: 4px 0 8px; }
.pedalRow { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px; align-items: center; margin: 6px 0; }
.pedalName { font-weight: 600; white-space: nowrap; }
.pedalKey.learning { background: var(--accent); color: #fff; animation: recBlink 1s infinite; }
@media (max-width: 480px) { .pedalRow { grid-template-columns: 1fr 1fr; } .pedalName { grid-column: 1 / -1; } }
.noteSeq { margin-top: 3px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); font: 600 13px/1.5 ui-monospace, Menlo, monospace; white-space: nowrap; overflow-x: auto; scrollbar-width: thin; }
.noteSeq.hidden { display: none; }
.noteSeq span { padding: 0 2px; border-radius: 3px; }
.noteSeq span.cur { background: var(--accent); color: #fff; }
/* aktuelle Note immer beschriften (auch wenn die Beschriftung sonst wegen Platzmangel fehlt) */
.noteLane .nt.cur:not(:has(span))::after { content: attr(title); position: relative; z-index: 2; padding: 1px 3px; margin-left: -2px; border-radius: 3px; background: var(--accent); color: #fff; font: 600 11px/1 ui-monospace, Menlo, monospace; white-space: nowrap; }
/* ---------- Tabulatur & Notensystem ---------- */
.notation { margin-top: 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); overflow: hidden; }
.notation.hidden { display: none; }
.notation svg { display: block; }
.notation line { stroke: var(--muted); stroke-width: 1; opacity: .7; }
.notation line.bar { stroke: var(--text); opacity: .45; }
.notation .clef { font: 34px/1 "Bravura", "Apple Symbols", "Segoe UI Symbol", "Noto Music", serif; fill: var(--text); }
.notation .clef.bassClef { font-size: 24px; }
.notation .clef8 { font: 600 8px sans-serif; fill: var(--muted); }
.notation .strName { font: 600 10px ui-monospace, Menlo, monospace; fill: var(--muted); }
.notation .n ellipse { fill: var(--text); }
.notation .n line.stem, .notation .n line.ledger { stroke: var(--text); opacity: 1; }
.notation .n .acc { font: 13px serif; fill: var(--text); }
.notation .tab .n rect { fill: var(--panel); }
.notation .tab .n text { font: 700 11px ui-monospace, Menlo, monospace; fill: var(--text); text-anchor: middle; }
.notation .n.cur ellipse, .notation .n.cur .acc { fill: var(--accent); }
.notation .n.cur line.stem, .notation .n.cur line.ledger { stroke: var(--accent); }
.notation .tab .n.cur rect { fill: var(--accent); }
.notation .tab .n.cur text { fill: #fff; }
/* Notenwerte */
.notation .n ellipse.hollow { fill: var(--panel); stroke: var(--text); stroke-width: 1.4; }
.notation .n.cur ellipse.hollow { fill: var(--panel); stroke: var(--accent); }
.notation .n circle { fill: var(--text); }
.notation .n path.flag, .notation path.tieArc { fill: none; stroke: var(--text); stroke-width: 1.3; }
.notation path.beam { stroke: var(--text); stroke-width: 3.2; fill: none; }
.notation .rest rect, .notation .rest circle { fill: var(--text); }
.notation .rest path { fill: none; stroke: var(--text); stroke-width: 1.6; stroke-linejoin: round; }
.notation .rest path.restQ { stroke-width: 2.2; }
.notation .n.cur path.flag { stroke: var(--accent); }
.notation .va { font: italic 700 11px serif; fill: var(--text); }
.notation line.vaLine { stroke-dasharray: 3 3; opacity: .6; }
#bassTunRow.hidden { display: none; }
#bassTun { max-width: 60%; }
.notation line.slide { stroke: var(--text); stroke-width: 1.6; opacity: 1; }
#bassLowRow.hidden { display: none; }
.bassLowRow { margin: 2px 0 6px; }
#bassSensRow.hidden, #bassSensRow.hidden + .sensHint { display: none; }
.sensHint { display: flex; justify-content: space-between; margin: -2px 0 6px; padding-left: 0; font-size: 11px; }

/* ---------- Klavier ---------- */
.pianoBox { position: relative; margin-top: 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); padding: 4px; }
.pianoBox.hidden { display: none; }
#piano { display: block; width: 100%; height: 74px; }
#piano .pk.w { fill: #fff; stroke: #9aa0a6; stroke-width: 0.6; }
#piano .pk.b { fill: #222; stroke: #000; stroke-width: 0.6; }
#piano .pk.on { fill: var(--accent); }
#piano .pk.b.on { fill: color-mix(in srgb, var(--accent) 80%, #000); }
#piano .pkC { font: 8px sans-serif; fill: #888; text-anchor: middle; }
#piano .pkN { font: 700 9px ui-monospace, Menlo, monospace; fill: #fff; text-anchor: middle; }
.pianoMsg { min-height: 18px; line-height: 18px; text-align: center; margin-bottom: 2px; }
#pianoSensRow.hidden { display: none; }
#piano .pk.mel { fill: #1e88e5; }
#piano .pk.b.mel { fill: #1565c0; }
.pianoLegend { display: flex; gap: 12px; justify-content: flex-end; font-size: 11px; margin-top: 2px; }
.pianoLegend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.pianoLegend .lgOn { background: var(--accent); }
.pianoLegend .lgMel { background: #1e88e5; }
.pianoLegend.hidden { display: none; }
#pianoModeRow.hidden { display: none; }
.pianoMsg.chordName { font: 700 15px ui-monospace, Menlo, monospace; color: var(--accent); opacity: 1; }

/* ---------- Ansicht anpassen ---------- */
.modeBar { position: relative; }
.viewCfgBtn { flex: none; width: 40px; height: 40px; padding: 0; font-size: 18px; border-radius: 9px; }
.cfgInst { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.cfgChip { margin: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 18px; background: var(--bg); }
.cfgChip.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg)); }
.cfgChip input { width: 16px; height: 16px; }
.cfgTable { width: 100%; border-collapse: collapse; margin: 4px 0 8px; font-size: 14px; }
.cfgTable th { font-size: 12px; color: var(--muted); font-weight: 600; text-align: center; padding: 4px; }
.cfgTable td { padding: 5px 4px; border-top: 1px solid var(--line); }
.cfgTable td:not(:first-child) { text-align: center; width: 70px; }
.cfgTable input { width: 20px; height: 20px; }
.cfgTable tr.cfgOff td:first-child { color: var(--muted); text-decoration: line-through; }
.subRegion { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 4px; }

/* ---------- Schlagzeug ---------- */
.drumBox.hidden { display: none; }
.drumBox .chMsg { display: block; padding: 5px 8px; font-size: 12px; color: var(--muted); }
.drumBox line.dRow { stroke: var(--line); opacity: 1; }
.drumBox line.dBeat { stroke: var(--line); stroke-dasharray: 2 3; opacity: 1; }
.drumBox .dLbl { font: 600 10px ui-monospace, Menlo, monospace; fill: var(--muted); }
.drumBox .dHit circle { fill: var(--text); }
.drumBox .dHit path { stroke: var(--text); stroke-width: 1.8; fill: none; }
.drumBox .dHit.cur circle, .drumBox .dHit.cur ellipse { fill: var(--accent); }
.drumBox .dHit.cur path, .drumBox .dHit.cur line { stroke: var(--accent); }
.drumBox .pClef { fill: var(--text); }
.drumBox .xHead { stroke: var(--text); stroke-width: 1.6; fill: none; }
#drumViewRow.hidden, #drumSensRow.hidden { display: none; }
.drumBox .tSig { font: 700 13px Georgia, serif; fill: var(--text); }
.drumBox .n ellipse { fill: var(--text); }
.drumBox .n line.stem { stroke: var(--text); opacity: 1; }
.drumBox .n .dot { fill: var(--text); }
.drumBox .flag, .drumBox .rstL { fill: none; stroke: var(--text); stroke-width: 1.4; }
.drumBox path.beam { stroke: var(--text); stroke-width: 3.2; fill: none; }
.drumBox .rst, .drumBox .rstD { fill: var(--text); }
.drumBox .rstQ { fill: none; stroke: var(--text); stroke-width: 2.1; stroke-linejoin: round; }
.cfgOrder { list-style: none; margin: 4px 0 10px; padding: 0; }
.cfgOrder li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin: 4px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.cfgOrder li.dragging { opacity: .6; border-color: var(--accent); box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.ordHandle { cursor: grab; touch-action: none; user-select: none; font-size: 18px; color: var(--muted); padding: 0 4px; }
.ordName { flex: 1; }
.ordBtn { padding: 3px 9px; font-size: 12px; }
/* Abspielzeile auf iPad/Laptop etwas kompakter, damit alles in eine Zeile passt („A – Start“ / „B – Ende“) */
@media (max-width: 1300px) and (min-width: 901px) {
  .transport, .transport .qset, .transport .qclr { gap: 5px !important; }
  .transport button { padding-left: 9px; padding-right: 9px; }
  .transport .big { min-width: 56px; }
}
