/* Interaktives Songbook – Player-Kern (für alle Instrumente gleich)
   Aufbau: Leiste senkrecht links, rechts Titel, Instrument-Grafik, Fortschritt und eine Notenzeile (AlphaTab, horizontal).
   Mit artBelow (z. B. Ukulele): Titel, Fortschritt, Notenzeile und darunter die Grafik.
   Grundfarben stehen hier oben. Die Einstellungsseiten (Allgemein und je Instrument) überschreiben sie direkt am Player.
   Instrument-eigene Farben (z. B. Fingerfarben) stehen im Stil des Instrument-Plugins. */
.ias {
  /* ===== Konfiguration: Grundfarben ===== */
  --accent: #fb8700;        /* Hauptfarbe (Orange) */
  --accent-ink: #9a4f00;    /* Orange als Text auf hellem Grund */
  --on-accent: #1f1305;     /* Symbol auf orangem Knopf */
  --bg: #f6f4f1;
  --surface: #ffffff;
  --fg: #2b2520;
  --muted: #6e645b;
  --line: #e5ded6;
  --bar-bg: #33363b;        /* Steuerleiste: Anthrazit */
  --bar-fg: #f3f4f5;
  --bar-hover: #464a50;
  --bar-line: #4f535a;
  --loop-bar: color-mix(in srgb, var(--accent) 45%, transparent);
  --shadow: 0 10px 30px rgba(43, 37, 32, .18);
  --dot-ring: rgba(42, 26, 18, .45);
  /* Zeichnung des Instruments */
  --art-ink: #2b2520;
  --art-paper: #fffaf3;
  /* Größe des Players auf der Seite */
  --rail-w: 84px;
  height: var(--ias-height, calc(100vh - 140px));
  min-height: var(--ias-min-height, 460px);

  position: relative;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  border-radius: 12px;
  overflow: hidden;
  text-align: left;
  /* Abstand zum Inhalt darunter (WordPress entfernt leere Absätze, darum hier fest) */
  margin: 0 0 var(--ias-gap, 1.5em);
}
/* !important: mit automatischer Höhe steht die Höhe direkt am Player (style), im Vollbild gilt trotzdem der ganze Bildschirm */
.ias:fullscreen { height: 100vh !important; border-radius: 0; margin: 0; }
.ias *, .ias *::before, .ias *::after { box-sizing: border-box; }
.ias [hidden] { display: none !important; }
.ias button, .ias select { font-family: inherit; margin: 0; }
.ias .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===== Leiste links ===== */
.ias-rail {
  background: var(--bar-bg); color: var(--bar-fg);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 6px; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin;
}
.ias-rail hr { width: 56px; border: 0; border-top: 1px solid var(--bar-line); margin: 4px 0; flex: none; }
.ias .cap { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .65; margin-top: 2px; }
.ias .ib { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; padding: 0; position: relative; box-shadow: none; text-decoration: none; }
.ias .ib svg { width: 20px; height: 20px; }
.ias-rail .ib:hover { background: var(--bar-hover); }
.ias-rail .ib[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.ias-rail .ib:disabled { opacity: .4; cursor: default; }
.ias .ib.play { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: var(--on-accent); }
.ias-rail .ib.play:hover { background: var(--accent); filter: brightness(1.08); }
.ias .ib:focus-visible, .ias select:focus-visible, .ias .prog:focus-visible, .ias .pseg button:focus-visible,
.ias .switch:focus-visible, .ias .step button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ias .rtempo { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ias .ib.tstep { height: 34px; font-size: 22px; font-weight: 700; line-height: 1; background: var(--bar-hover); }
.ias-rail .ib.tstep:hover { background: var(--bar-line); }
.ias .ib.tstep:disabled { opacity: .35; cursor: default; }
.ias .tval { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; line-height: 1.6; }
.ias .rsel { flex: none; display: flex; align-items: center; justify-content: center; width: 72px; height: 36px; border-radius: 8px; cursor: pointer; }
.ias .rsel:hover { background: var(--bar-hover); }
.ias-rail select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: inherit; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; padding: 4px 1px; cursor: pointer; text-align: center; min-height: 0; height: auto; box-shadow: none; width: auto; max-width: 100%; }
.ias-rail option { background: var(--bar-bg); color: var(--bar-fg); }
.ias .loopsel { flex: none; display: flex; align-items: center; justify-content: center; width: 72px; height: 32px; border-radius: 8px; background: var(--bar-hover); font-weight: 700; font-size: 13px; }
.ias .loopsel span { opacity: .7; }
/* Loop notengenau (mit der Maus in den Noten gewählt): Takte mit Rahmen in der Hauptfarbe */
.ias .loopsel.exact { box-shadow: inset 0 0 0 2px var(--accent); }
/* Einzähler: Anzahl der Takte (erscheint unter dem Knopf, wenn der Einzähler an ist) */
.ias .cibars { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 60px; }
.ias .cibars button { height: 26px; min-height: 0; padding: 0; border: 0; border-radius: 6px; background: var(--bar-hover); color: inherit; font-weight: 700; font-size: 13px; line-height: 1; cursor: pointer; box-shadow: none; }
.ias .cibars button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.ias .cibars button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ias .ib.help { font-size: 22px; font-weight: 800; line-height: 1; }
.ias .spacer { flex: 1 0 4px; }
/* Knopfleiste in Stufen (player.js, fitHeight): Die Stufe richtet sich nach der Höhe des Players.
   Gerechnet wird so, als wären Hilfe- und PDF-Knopf da und Einzähler-Takte und Loop-Auswahl offen.
   rail-c = kompakt, rail-e = eng. Reicht auch „eng“ nicht, lässt sich die Leiste scrollen. */
.ias.rail-c .ib, .ias.rail-e .ib { width: 36px; height: 36px; }
.ias.rail-c .ib.play, .ias.rail-e .ib.play { width: 42px; height: 42px; }
.ias.rail-c .ias-rail, .ias.rail-e .ias-rail { gap: 2px; }
.ias.rail-c .ias-rail hr, .ias.rail-e .ias-rail hr { margin: 2px 0; }
.ias.rail-c .rsel, .ias.rail-e .rsel { height: 32px; }
.ias.rail-e .ias-rail { gap: 1px; padding: 6px 6px; }
.ias.rail-e .ib { width: 32px; height: 32px; }
.ias.rail-e .ib.play { width: 38px; height: 38px; }
.ias.rail-e .ib.tstep { height: 28px; }
.ias.rail-e .ias-rail hr { margin: 1px 0; }
.ias.rail-e .tval { line-height: 1.3; }
.ias.rail-e .cap { margin-top: 0; }
.ias.rail-e .loopsel { height: 28px; }
.ias.rail-e .cibars button { height: 22px; }

/* ===== Hauptbereich ===== */
.ias-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px 16px 10px 12px; }
.ias-songbar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; min-height: 38px; }
.ias .song-title { margin: 0; font-size: 20px; font-weight: 800; line-height: 38px; color: var(--fg); }
/* Komponist neben dem Titel: in Klammern, nicht fett, 80 % der Titelgröße, etwa drei Leerzeichen Abstand */
.ias .song-title .composer { margin-left: .75em; font-size: 80%; font-weight: 400; }
.ias .status { font-size: 13px; color: var(--muted); }
.ias .status.err { color: #b3261e; font-weight: 600; }

.ias .card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.ias-inst { position: relative; flex: 1 1 0; min-height: 110px; min-width: 0; overflow: hidden; }
.ias-inst > svg { position: absolute; inset: 6px 10px; width: calc(100% - 20px); height: calc(100% - 12px); display: block; }
.ias .chord-now { position: absolute; top: 8px; left: 14px; font-size: 20px; font-weight: 800; color: var(--accent-ink); }

.ias-progrow { position: relative; flex: none; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* Hinweis „Zum Aktivieren in den Player klicken“: schwebt mittig über dem Fortschrittsbalken, verschiebt nichts.
   Farben wie der Play-Knopf (Hauptfarbe / Symbol auf Hauptfarbe). Verschwindet nach dem Aktivieren. */
.ias .ias-hint { position: absolute; z-index: 5; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: max-content; max-width: calc(100% - 16px); padding: 7px 22px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font-size: 20px; font-weight: 600; line-height: 1.3;
  text-align: center; box-shadow: 0 4px 14px rgba(43, 37, 32, .18); cursor: pointer; }
.ias-progrow .t { color: var(--fg); font-weight: 700; white-space: nowrap; }
.ias-progrow .sub { white-space: nowrap; }
.ias .prog { position: relative; flex: 1; height: 6px; border-radius: 3px; background: var(--line); cursor: pointer; touch-action: none; }
.ias .prog::before { content: ""; position: absolute; inset: -12px 0; }
.ias .prog-loop { position: absolute; top: -3px; bottom: -3px; border-radius: 3px; background: var(--loop-bar); }
.ias .prog-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--accent); }
.ias .prog-knob { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 3px var(--accent); }

/* Einzähler in der Fortschrittszeile: ersetzt Zeit und Balken, solange er läuft. Ein Feld je Schlag, nichts wird verdeckt. */
.ias-progrow.counting > :not(.countrow) { display: none; }
.ias .countrow { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; }
.ias .countrow b { color: var(--fg); font-weight: 700; white-space: nowrap; }
.ias .cboxes { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ias .cbar { display: flex; gap: 4px; }
.ias .cbar i { flex: none; width: 14px; height: 14px; border-radius: 3px; background: var(--line); }
.ias .cbar i.on { background: var(--muted); }
.ias .cbar.last i.on { background: var(--accent); }

/* Notenzeile: AlphaTab zeichnet hinein, scrollt waagrecht mit */
/* isolation: AlphaTab-Cursor und Markierungen bleiben in dieser Ebene und liegen nie über den Panels */
.ias-score { flex: none; position: relative; z-index: 0; isolation: isolate; min-width: 0; overflow-x: auto; overflow-y: hidden; padding: 4px 0 0; }
/* Der Scrollbalken wird nicht gebraucht (dafür ist der Balken darüber da). Wischen und Mausrad gehen weiter. Zwei Regeln für alle Browser. */
.ias:not(.no-inst) .ias-score { scrollbar-width: none; }
.ias:not(.no-inst) .ias-score::-webkit-scrollbar { display: none; }
.ias-score .at-surface { background: transparent; }
.ias .at-cursor-bar { background: rgba(251, 135, 0, .10); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.ias .at-cursor-beat { background: var(--accent); width: 3px; }
.ias .at-selection div { background: rgba(251, 135, 0, .16); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.ias .at-highlight * { fill: var(--accent); stroke: var(--accent); }

/* ===== Schwebende Fenster ===== */
.ias .pop { position: absolute; z-index: 2000; left: calc(var(--rail-w) + 8px); bottom: 12px; background: var(--surface); color: var(--fg);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px 14px 8px; }
.ias .pop h3 { margin: 4px 0 2px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ias .mixer { width: min(600px, calc(100% - var(--rail-w) - 24px)); }
.ias .mrow { display: grid; grid-template-columns: minmax(80px, 120px) repeat(2, 40px) minmax(80px, 1fr) 44px; align-items: center; gap: 4px; padding: 2px 0; border-top: 1px solid var(--line); }
.ias .mrow:first-of-type { border-top: 0; }
.ias .mrow.dim .mname, .ias .mrow.dim input { opacity: .45; }
.ias .mname { font-weight: 700; font-size: 14px; }
.ias .mrow output { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.ias .mrow input[type=range] { width: 100%; accent-color: var(--accent); }
.ias .mixer .ib { color: var(--muted); }
.ias .mixer .ib:hover { background: var(--bg); color: var(--fg); }
.ias .mixer .ib[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.ias .viewp { width: min(420px, calc(100% - var(--rail-w) - 24px)); max-height: calc(100% - 24px); overflow-y: auto; }
.ias .prow.lang { margin-top: 12px; border-top-width: 2px; }
.ias .pop h4 { margin: 10px 0 0; font-size: 12px; font-weight: 700; color: var(--muted); }
.ias .prow { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; border-top: 1px solid var(--line); }
.ias .prow:first-of-type { border-top: 0; }
.ias .prow > span { font-weight: 700; font-size: 14px; }
.ias .pseg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.ias .pseg button { height: 36px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 700; font-size: 13px; cursor: pointer; }
.ias .pseg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
/* Schalter: Manche Themes (z. B. Storefront) blenden bei Knöpfen ::after aus oder ändern Größe und Rand – darum alles ausdrücklich */
.ias .switch { position: relative; display: inline-block; width: 52px; height: 30px; min-height: 0; flex: none; border: 0; border-radius: 15px; background: var(--line); cursor: pointer; padding: 0; margin: 0; box-shadow: none; line-height: 0; appearance: none; -webkit-appearance: none; }
.ias .switch:hover, .ias .switch:focus { background: var(--line); }
.ias .switch[aria-pressed="true"]:hover, .ias .switch[aria-pressed="true"]:focus { background: var(--accent); }
.ias .switch::before { display: none; }
.ias .switch::after { content: ""; display: block; margin: 0; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: left .15s; }
.ias .switch[aria-pressed="true"] { background: var(--accent); }
.ias .switch[aria-pressed="true"]::after { left: 25px; }
.ias .step { display: inline-flex; align-items: center; gap: 4px; }
.ias .step button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); font-weight: 700; font-size: 18px; cursor: pointer; padding: 0; }
.ias .step button.turn { display: inline-flex; align-items: center; justify-content: center; }
.ias .step button.turn svg { width: 22px; height: 22px; }
/* Alle Einstellungen: Speichern / Zurücksetzen */
.ias .prow.saverow { margin-top: 12px; border-top-width: 2px; }
.ias .pbtns { display: inline-flex; gap: 6px; }
.ias .pbtn { height: 38px; min-width: 7.5em; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); font-weight: 700; font-size: 13px; cursor: pointer; }
.ias .pbtn[data-r="save"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.ias .step output { min-width: 56px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.ias .legend { position: absolute; z-index: 3; top: 8px; right: 10px; width: min(400px, calc(100% - 20px)); margin: 0; padding: 10px 14px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); }
.ias .legend li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0; }
.ias .legend b { color: var(--fg); font-weight: 700; min-width: 6.5em; }
.ias .legend p { margin: 0; }
.ias .sw { display: inline-flex; align-items: center; gap: 5px; }
.ias .sw i { width: 13px; height: 13px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1.5px var(--dot-ring); }
.ias .sw i.open { background: transparent; box-shadow: inset 0 0 0 2px var(--fg); }
.ias .toast { position: absolute; z-index: 2001; left: calc(var(--rail-w) + 12px); bottom: 16px; max-width: calc(100% - var(--rail-w) - 28px);
  background: var(--bar-bg); color: var(--bar-fg); padding: 10px 14px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); }

/* Grafik unter den Noten (Instrument mit artBelow, z. B. Ukulele): Noten und Grafik auf einer weißen Fläche,
   Grafik ganz oben und links (24 px Platz für den Akkordnamen). Ausrichtung oben links steckt in der Grafik (preserveAspectRatio). */
.ias.art-below:not(.no-inst) .ias-score { border-bottom: 0; border-radius: 12px 12px 0 0; }
.ias.art-below .ias-inst { margin-top: -8px; border-top: 0; border-radius: 0 0 12px 12px; }
.ias.art-below .ias-inst > svg { top: 0; left: 24px; width: calc(100% - 34px); height: calc(100% - 6px); }
.ias.art-below .chord-now { top: 4px; }

/* Ohne Instrument-Grafik: Noten in mehreren Zeilen, senkrecht scrollen */
.ias.no-inst .ias-score { flex: 1 1 0; min-height: 0; overflow-y: auto; overflow-x: hidden; }

/* Ladeanzeige „Sound wird geladen …“ */
.ias-loading { position: absolute; z-index: 1500; left: calc(var(--rail-w) + (100% - var(--rail-w)) / 2); top: 38%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-radius: 12px;
  background: var(--bar-bg); color: var(--bar-fg); font-weight: 700; font-size: 15px; box-shadow: var(--shadow); }
/* Während des Aktivierens: Player leicht abgeblendet, Klicks sind gesperrt (siehe player.js, activate) */
.ias.activating .ias-main, .ias.activating .ias-rail { opacity: .55; transition: opacity .2s; }
.ias-loading .spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--bar-line); border-top-color: var(--accent); animation: ias-spin .8s linear infinite; }
@keyframes ias-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ias-loading .spin { animation-duration: 2.4s; } }

/* Fehlermeldung statt Player */
.ias-error { padding: 14px 16px; border: 1px solid #e5ded6; border-radius: 10px; background: #fff8f0; color: #2b2520; }
.ias-error.admin { border-color: #b3261e; background: #fdecea; }

/* ===== Instrument-Grafik: gemeinsame Klassen ===== */
.ias .a-ink { fill: var(--art-ink); }
.ias .a-paper { fill: var(--art-paper); }
@media (max-width: 560px) {
  .ias .mrow { grid-template-columns: 1fr repeat(2, 40px); }
  .ias .mrow input, .ias .mrow output { grid-column: 1 / -1; }
}
