/*
 * Notenarbeitsplatz - "Studio".
 *
 * Dunkler, ruhiger Grund, weil ein weisses Notenblatt darauf am
 * kontrastreichsten ist; freundliche Farbmarken aus `stil.css` fuer alles,
 * was man anfasst. `stil.css` gilt auf dieser Seite mit - seine blanken
 * Regeln fuer `header`, `main`, `footer`, `label`, `button`, `input` und `kbd`
 * sind fuer die helle Verwaltung gedacht und werden hier gezielt ueberschrieben.
 */

body.arbeitsplatz {
  --studio-grund: #0e171b;
  --studio-flaeche: #15232a;
  --studio-flaeche-2: #1c2f37;
  --studio-flaeche-3: #243b44;
  --studio-rand: rgb(255 255 255 / 10%);
  --studio-rand-stark: rgb(255 255 255 / 20%);
  --studio-schrift: #eef2f0;
  --studio-leise: #a6b4b8;
  --studio-glas: rgb(21 35 42 / 86%);
  --kopf-hoehe: 64px;
  --deck-hoehe: 88px;
  --rund: 14px;

  margin: 0;
  background: var(--studio-grund);
  color: var(--studio-schrift);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font: 15px/1.45 var(--schrift-text);
}

/* --- Grundbausteine im Studio ------------------------------------------- */

.arbeitsplatz button,
.arbeitsplatz a.knopf {
  background: var(--studio-flaeche-2);
  color: var(--studio-schrift);
  border: 1px solid var(--studio-rand);
  border-radius: 12px;
  padding: 0.55rem 0.95rem;
  min-height: 2.75rem;
  font: inherit;
  font-weight: 700;
  gap: 0.45rem;
  /* Kein `background-color` im Uebergang: Ein gewaehltes Werkzeug, eine gewaehlte
     Spur muss sofort als gewaehlt aussehen - ein halb verblasster Zustand wirkte
     wie zwei gleichzeitig gewaehlte Knoepfe (im Browser gefunden). */
  transition: border-color 140ms ease, transform 100ms ease;
}
.arbeitsplatz button:hover,
.arbeitsplatz a.knopf:hover { background: var(--studio-flaeche-3); border-color: var(--studio-rand-stark); }
.arbeitsplatz button:active { transform: translateY(1px); }
.arbeitsplatz button:focus-visible,
.arbeitsplatz input:focus-visible,
.arbeitsplatz select:focus-visible,
.arbeitsplatz textarea:focus-visible,
.arbeitsplatz a:focus-visible,
.arbeitsplatz .karte-werk:focus-visible,
.arbeitsplatz .liste li:focus-visible { outline: 3px solid var(--sonne); outline-offset: 2px; }
.arbeitsplatz button[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.arbeitsplatz button.betont,
.arbeitsplatz a.knopf.betont {
  background: var(--petrol);
  border-color: #1f95a3;
  color: #fff;
}
.arbeitsplatz button.betont:hover { background: var(--petrol-dunkel); }
.arbeitsplatz button.leise { background: none; border-color: transparent; color: var(--studio-leise); }
.arbeitsplatz button.leise:hover { color: var(--studio-schrift); background: var(--studio-flaeche-2); }
.arbeitsplatz button.mini {
  min-width: 2.75rem;
  padding: 0.3rem 0.55rem;
  justify-content: center;
}
.arbeitsplatz button.aktiv,
.arbeitsplatz button[aria-pressed="true"] {
  background: var(--sonne);
  border-color: #ffd98a;
  color: #2b2724;
}

.arbeitsplatz label {
  color: var(--studio-leise);
  font-size: 0.82rem;
}
.arbeitsplatz input,
.arbeitsplatz select,
.arbeitsplatz textarea {
  background: var(--studio-grund);
  color: var(--studio-schrift);
  border: 1px solid var(--studio-rand-stark);
  border-radius: 10px;
  min-width: 0;
}
.arbeitsplatz input[type="range"] { accent-color: var(--sonne); border: 0; background: none; padding: 0; min-height: 2.75rem; }
.arbeitsplatz input[type="checkbox"] { accent-color: var(--sonne); width: 1.2rem; height: 1.2rem; }
.arbeitsplatz kbd {
  background: rgb(255 255 255 / 8%);
  border: 1px solid var(--studio-rand-stark);
  border-bottom-width: 2px;
  color: var(--studio-leise);
  font-size: 0.72rem;
  padding: 0 0.35rem;
  border-radius: 5px;
  line-height: 1.5;
}
.arbeitsplatz code { background: var(--studio-grund); border-color: var(--studio-rand); color: var(--studio-schrift); }
.arbeitsplatz h2 { font-family: var(--schrift-anzeige); font-size: 1.35rem; font-weight: 600; margin: 0; color: var(--studio-schrift); }
.arbeitsplatz .fehler { color: #ff9f8a; }
.arbeitsplatz .hinweis { color: var(--studio-leise); font-size: 0.9rem; }
.luecke { flex: 1 1 auto; }
.nur-vorlesen {
  position: absolute !important;
  width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.mehr-gruppe {
  margin: 0.9rem 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--studio-leise);
}
.klein { display: block; font-size: 0.8rem; font-weight: 500; color: var(--studio-leise); }

/* --- Kopfleiste ------------------------------------------------------------ */

header.bedienung {
  flex: 0 0 auto;
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.9rem 0.7rem;
  background: linear-gradient(180deg, #172a31, var(--studio-flaeche));
  color: var(--studio-schrift);
  border-bottom: 1px solid var(--studio-rand);
}
header.bedienung::after { height: 3px; opacity: 0.9; }
.kopf-links, .kopf-rechts { display: flex; align-items: center; gap: 0.45rem; }
.kopf-mitte { display: flex; align-items: center; justify-content: center; gap: 0.6rem; min-width: 0; }

.arbeitsplatz .kopf-rund {
  width: 2.75rem;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
  background: none;
}
.arbeitsplatz .suchknopf {
  background: var(--studio-grund);
  border-color: var(--studio-rand-stark);
  min-width: 15rem;
  color: var(--studio-leise);
  font-weight: 600;
  border-radius: 999px;
}
.suchknopf span { flex: 1 1 auto; text-align: left; }
.arbeitsplatz .suchknopf:hover { color: var(--studio-schrift); }
.arbeitsplatz .kopf-knopf { border-radius: 999px; }

.stueckinfo { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.stueck {
  font-family: var(--schrift-anzeige);
  font-size: 1.15rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.setlisteninfo {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.25rem;
  border-radius: 999px;
  background: rgb(63 143 210 / 18%);
  border: 1px solid rgb(63 143 210 / 45%);
}
.stueckzahl { min-width: 3.6rem; text-align: center; font-weight: 800; color: #9ccbf2; font-variant-numeric: tabular-nums; }
.arbeitsplatz .setlisteninfo button { background: none; border: 0; min-height: 2.4rem; min-width: 2.4rem; }
.arbeitsplatz .rueckweg {
  border-radius: 999px;
  background: rgb(245 181 61 / 16%);
  border-color: rgb(245 181 61 / 45%);
  color: #ffd98a;
  max-width: 16rem;
}
.rueckweg span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.arbeitsplatz .modus { border-radius: 999px; }
.arbeitsplatz .buehnenknopf {
  border-radius: 999px;
  background: rgb(23 122 134 / 22%);
  border-color: rgb(31 149 163 / 60%);
}
.arbeitsplatz .buehnenknopf.verbunden { background: rgb(63 158 110 / 22%); border-color: rgb(63 158 110 / 70%); }
.status-punkt {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: #6f7f84;
  box-shadow: 0 0 0 3px rgb(111 127 132 / 25%);
}
.verbunden .status-punkt { background: #5fd39a; box-shadow: 0 0 0 3px rgb(95 211 154 / 30%); animation: atmen 2.4s ease-in-out infinite; }

.mehr { position: relative; }
.mehr-menue {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 20rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  padding: 0.4rem 0.6rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: var(--studio-glas);
  border: 1px solid var(--studio-rand-stark);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgb(0 0 0 / 50%);
  backdrop-filter: blur(18px);
  animation: aufklappen 160ms ease-out;
}
.arbeitsplatz .mehr-menue > button {
  justify-content: space-between;
  background: none;
  border-color: transparent;
  font-weight: 600;
  text-align: left;
}
.arbeitsplatz .mehr-menue > button:hover { background: var(--studio-flaeche-3); }
.arbeitsplatz .mehr-menue > button[aria-pressed="true"] { background: rgb(245 181 61 / 22%); color: #ffd98a; border-color: transparent; }
.mehr-zeile { display: flex; align-items: center; gap: 0.35rem; padding: 0.1rem 0.2rem; }
.mehr-zeile #zoomwert { min-width: 3.6rem; text-align: center; font-variant-numeric: tabular-nums; }
.mehr-zeile #autoscroll-geschwindigkeit { width: 5.5rem; }
/* `body.` hebt die Spezifitaet auf die von `stil.css`s `label:has(> input[type="checkbox"])` - sonst dunkle Schrift auf dunklem Grund. */
body.arbeitsplatz label.schalter {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  color: var(--studio-schrift);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}
.arbeitsplatz label.schalter:hover { background: var(--studio-flaeche-3); }

/* --- Snippetleiste --------------------------------------------------------- */

.snippetleiste {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.9rem;
  background: var(--studio-flaeche);
  border-bottom: 1px solid var(--studio-rand);
  overflow-x: auto;
}
.snippetleiste-titel { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 800; color: #ffd98a; font-size: 0.85rem; white-space: nowrap; }
.snippetliste { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.4rem; }
.snippetliste li { display: flex; }
.arbeitsplatz .snippetliste button {
  border-radius: 999px;
  min-height: 2.5rem;
  white-space: nowrap;
  background: rgb(245 181 61 / 12%);
  border-color: rgb(245 181 61 / 35%);
}
.arbeitsplatz .snippetliste button.laeuft { background: var(--sonne); color: #2b2724; }

/* --- Blatt ------------------------------------------------------------------- */

.buehnenflaeche { position: relative; flex: 1 1 auto; min-height: 0; }

/*
 * `margin` und `max-width` stehen hier bewusst: `stil.css` setzt fuer jedes
 * `<main>` `max-width` und `margin: 0 auto` - in einer Flexbox schrumpfte
 * das Blatt dadurch auf seinen Inhalt, und `passeEin()` rechnete daraus eine
 * Einpassung von 25 % (E-128).
 */
.blatt {
  position: absolute;
  inset: 0;
  overflow: auto;
  outline: none;
  padding: 8px;
  margin: 0;
  max-width: none;
  background:
    radial-gradient(90% 60% at 50% 0%, rgb(23 122 134 / 10%), transparent 70%),
    var(--studio-grund);
}

/*
 * Das Blatt ist per Tastatur erreichbar (`tabindex="0"`, es rollt mit den
 * Pfeiltasten), deshalb braucht es einen sichtbaren Fokus - `outline: none`
 * oben ohne Ersatz war ein Verstoss gegen WCAG 2.4.7. Nach INNEN gezeichnet
 * (`outline-offset: -3px`), weil das Blatt das Fenster vollstaendig ausfuellt
 * und ein aeusserer Ring abgeschnitten wuerde.
 */
.blatt:focus-visible {
  outline: 3px solid var(--sonne);
  outline-offset: -3px;
}

.seiten {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 12px;
  min-height: 100%;
}
.blatt.eingepasst .seiten { align-items: center; }

.blattseite {
  position: relative;
  line-height: 0;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 8px 30px rgb(0 0 0 / 45%), 0 0 0 1px rgb(255 255 255 / 4%);
  flex: 0 0 auto;
}
.blattseite canvas { display: block; }
.blattseite.herein { animation: blatt-herein 180ms ease-out both; }
@keyframes blatt-herein { from { opacity: 0.35; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.zeichenebene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.zeichenebene .strich-marker { stroke-opacity: 0.38; mix-blend-mode: multiply; }
.zeichenebene .strich-text { font-family: var(--schrift-text); font-weight: 700; }
body.bearbeitungsmodus .zeichenebene { pointer-events: all; touch-action: none; cursor: crosshair; }
body.bearbeitungsmodus.werkzeug-radierer .zeichenebene { cursor: cell; }
body.bearbeitungsmodus.werkzeug-text .zeichenebene { cursor: text; }
body.bearbeitungsmodus .blattseite { box-shadow: 0 0 0 3px var(--sonne), 0 8px 30px rgb(0 0 0 / 45%); }

.startflaeche {
  max-width: 44rem;
  margin: 8vh auto 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.2rem;
  text-align: center;
}
.start-gruss { margin: 0; font-family: var(--schrift-anzeige); font-size: clamp(2rem, 4vw, 3rem); font-weight: 600; }
.arbeitsplatz .start-suche {
  justify-content: flex-start;
  gap: 0.8rem;
  min-height: 4.2rem;
  padding: 0 1.4rem;
  border-radius: 999px;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--studio-leise);
  background: var(--studio-flaeche);
  border: 1px solid var(--studio-rand-stark);
  box-shadow: 0 16px 40px rgb(0 0 0 / 35%);
}
.start-suche span { flex: 1 1 auto; text-align: left; }
.start-karten { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.arbeitsplatz .start-karte {
  justify-content: flex-start;
  text-align: left;
  gap: 0.9rem;
  padding: 1rem 1.1rem;
  border-radius: 20px;
  background: var(--studio-flaeche);
}
.start-symbol { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 14px; font-size: 1.4rem; color: #fff; flex: 0 0 auto; }
.start-symbol.petrol { background: var(--petrol); }
.start-symbol.himmel { background: var(--himmel-dunkel); }
.start-zuletzt { text-align: left; }

/* Blaetterkanten: gross, erst beim Darueberfahren sichtbar. */
.arbeitsplatz .blattkante {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 4rem;
  height: 9rem;
  padding: 0;
  justify-content: center;
  border-radius: 20px;
  background: rgb(14 23 27 / 55%);
  border-color: var(--studio-rand);
  opacity: 0;
  z-index: 4;
}
.blattkante.links { left: 12px; }
.blattkante.rechts { right: 12px; }
.buehnenflaeche:hover .blattkante { opacity: 0.85; }
.arbeitsplatz .blattkante:hover { opacity: 1; background: var(--studio-flaeche-3); }
body.ohne-stueck .blattkante, body.ohne-stueck .blattsteuerung { display: none; }

.blattsteuerung {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem;
  border-radius: 999px;
  background: var(--studio-glas);
  border: 1px solid var(--studio-rand-stark);
  box-shadow: 0 12px 30px rgb(0 0 0 / 40%);
  backdrop-filter: blur(14px);
}
.arbeitsplatz .blattsteuerung button { border-radius: 999px; background: none; border-color: transparent; }
.arbeitsplatz .blattsteuerung button:hover { background: var(--studio-flaeche-3); }
.seitenzahl { min-width: 4.8rem; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.trenner { width: 1px; align-self: stretch; margin: 0.35rem 0.2rem; background: var(--studio-rand-stark); }

/* --- Audio-Deck -------------------------------------------------------------- */

footer.audiodeck {
  flex: 0 0 auto;
  max-width: none;
  margin: 0;
  position: relative;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 0.6rem 1rem;
  background: linear-gradient(0deg, #122027, var(--studio-flaeche));
  border-top: 1px solid var(--studio-rand);
  flex-wrap: wrap;
}
.deck-spuren { display: flex; align-items: center; gap: 0.6rem; min-width: 16rem; flex: 1 1 24rem; }
.deck-spuren .deck-hinweis { flex: 1 1 12rem; min-width: 11rem; font-size: 0.86rem; line-height: 1.3; }
.deck-spuren .deck-plus { flex: 0 0 auto; }
.spurwahl { display: flex; gap: 0.35rem; flex-wrap: nowrap; overflow-x: auto; max-width: 28rem; scrollbar-width: thin; }
.arbeitsplatz .spurwahl button { flex: 0 0 auto; white-space: nowrap; }
.spurwahl:empty { display: none; }
.arbeitsplatz .spurwahl button {
  border-radius: 999px;
  min-height: 2.6rem;
  padding: 0.3rem 0.9rem;
  background: var(--studio-flaeche-2);
}
.arbeitsplatz .spurwahl button[aria-checked="true"] { background: var(--sonne); color: #2b2724; border-color: #ffd98a; }
.spurwahl .spur-bpm { font-weight: 500; font-size: 0.78rem; opacity: 0.8; }
.deck-hinweis { margin: 0; font-size: 0.9rem; color: var(--studio-leise); max-width: 30rem; }
.deck-hinweis:empty { display: none; }
.arbeitsplatz .deck-plus { border-radius: 999px; border-style: dashed; background: none; white-space: nowrap; }

.deck-transport { display: flex; align-items: center; gap: 0.6rem; flex: 2 1 22rem; }
.arbeitsplatz .deck-play {
  width: 4.2rem;
  height: 4.2rem;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
  border: 0;
  color: #fff;
  background: linear-gradient(145deg, #1f95a3, var(--petrol-dunkel));
  box-shadow: 0 10px 24px rgb(23 122 134 / 40%);
  flex: 0 0 auto;
}
.arbeitsplatz .deck-play:hover { background: linear-gradient(145deg, #22a2b1, var(--petrol)); }
.arbeitsplatz .deck-play[data-spielt="ja"] { background: linear-gradient(145deg, #f07a5f, var(--koralle-dunkel)); box-shadow: 0 10px 24px rgb(232 102 74 / 40%); }
.deck-play .symbol-play { margin-left: 3px; }
.arbeitsplatz .deck-rund { width: 2.9rem; height: 2.9rem; padding: 0; justify-content: center; border-radius: 50%; flex: 0 0 auto; }
.deck-position { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 8rem; }
.deck-position input { width: 100%; }
.deck-zeit { font-size: 0.8rem; color: var(--studio-leise); font-variant-numeric: tabular-nums; margin-top: -0.4rem; }

.deck-tempo { display: flex; align-items: center; gap: 0.5rem; }
.arbeitsplatz .deck-tempo label { font-weight: 800; color: var(--studio-schrift); font-size: 0.85rem; flex-direction: row; }
.deck-tempo input { width: 9rem; }
#audio-tempowert { min-width: 4.2rem; font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
#audio-tempowert .bpm { display: block; font-size: 0.72rem; font-weight: 600; color: var(--studio-leise); }

.deck-schleife { display: flex; align-items: center; gap: 0.3rem; min-width: 0; }
.deck-klein { font-size: 0.78rem; color: var(--studio-leise); }
.deck-schleife .deck-klein { max-width: 11rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-schleife .speicherstand { max-width: 9rem; }

.deck-klick { display: flex; align-items: center; gap: 0.4rem; }
.arbeitsplatz .klick-knopf { border-radius: 999px; }
.arbeitsplatz .klick-knopf[aria-pressed="true"] { background: var(--mint); border-color: #7fd6a9; color: #fff; }
.arbeitsplatz #audio-bpm { width: 4.6rem; text-align: center; min-height: 2.6rem; }

.arbeitsplatz .ton-freigeben {
  position: fixed;
  left: 50%;
  bottom: calc(var(--deck-hoehe) + 24px);
  transform: translateX(-50%);
  z-index: 40;
  gap: 1rem;
  padding: 1rem 1.6rem;
  border-radius: 22px;
  border: 2px solid #ffd98a;
  background: var(--koralle-dunkel);
  color: #fff;
  font-size: 1.1rem;
  text-align: left;
  box-shadow: 0 20px 50px rgb(0 0 0 / 55%);
  animation: puls-schatten 1.6s ease-in-out infinite;
}
.ton-freigeben .klein { color: #ffe2d9; }

/* --- Bearbeiten -------------------------------------------------------------- */

.bearbeiten-leiste {
  position: fixed;
  left: 14px;
  top: calc(var(--kopf-hoehe) + 16px);
  z-index: 25;
  width: 6.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.6rem;
  border-radius: 22px;
  background: var(--studio-glas);
  border: 1px solid var(--studio-rand-stark);
  box-shadow: 0 20px 50px rgb(0 0 0 / 45%);
  backdrop-filter: blur(16px);
  animation: aufklappen 160ms ease-out;
}
.werkzeugwahl { display: grid; gap: 0.35rem; }
.arbeitsplatz .werkzeugwahl button {
  flex-direction: column;
  gap: 0.15rem;
  min-height: 4rem;
  padding: 0.4rem;
  border-radius: 16px;
  font-size: 0.78rem;
  background: none;
  border-color: transparent;
}
.arbeitsplatz .werkzeugwahl button[aria-checked="true"] { background: var(--sonne); color: #2b2724; }
.farbwahl { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; justify-items: center; }
.arbeitsplatz .farbwahl button {
  width: 2.3rem;
  height: 2.3rem;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  border: 3px solid rgb(255 255 255 / 25%);
}
.arbeitsplatz .farbwahl button[aria-checked="true"] { border-color: #fff; box-shadow: 0 0 0 3px var(--sonne); transform: scale(1.06); }
.bearbeiten-verlauf { display: flex; gap: 0.3rem; }
.arbeitsplatz .bearbeiten-verlauf button { flex: 1 1 0; padding: 0; justify-content: center; border-radius: 12px; }
.bearbeiten-stand { margin: 0; font-size: 0.72rem; color: var(--studio-leise); text-align: center; line-height: 1.3; }

.text-eingabe {
  position: fixed;
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 17rem;
  padding: 0.8rem;
  border-radius: 16px;
  background: var(--studio-flaeche);
  border: 1px solid var(--studio-rand-stark);
  box-shadow: 0 20px 50px rgb(0 0 0 / 55%);
}
.text-eingabe input { font-size: 1.2rem; font-weight: 700; }
.text-eingabe-knoepfe { display: flex; gap: 0.4rem; justify-content: flex-end; }

/* --- Dialoge (Bibliothek, Setliste, Tasten, Upload) -------------------------- */

.auswahl {
  position: fixed;
  inset: 0;
  background: rgb(5 10 12 / 72%);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 5vh;
  z-index: 30;
  animation: einblenden 140ms ease-out;
}

.auswahl-innen {
  background: var(--studio-flaeche);
  border: 1px solid var(--studio-rand-stark);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgb(0 0 0 / 55%);
  width: min(52rem, 94vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.2rem;
  gap: 0.7rem;
  overflow: hidden;
}
.auswahl-innen.breit { width: min(76rem, 96vw); }
.auswahl-innen.schmal { width: min(40rem, 94vw); overflow-y: auto; }
.auswahl-kopf { display: flex; align-items: center; gap: 0.6rem; }

.bibliothek-kopf { display: flex; gap: 0.6rem; align-items: center; }
.suchfeld {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 1rem;
  border-radius: 999px;
  background: var(--studio-grund);
  border: 1px solid var(--studio-rand-stark);
  color: var(--studio-leise);
}
.suchfeld:focus-within { border-color: var(--sonne); box-shadow: 0 0 0 3px rgb(245 181 61 / 25%); }
.arbeitsplatz .suchfeld input {
  flex: 1 1 auto;
  border: 0;
  background: none;
  font-size: 1.25rem;
  min-height: 3.4rem;
  padding: 0;
  outline: none;
}
.arbeitsplatz .suchfeld input:focus-visible { outline: none; }

.filterleiste {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.5rem 1rem;
  padding: 0.7rem 0.8rem;
  border-radius: 18px;
  background: var(--studio-flaeche-2);
  border: 1px solid var(--studio-rand);
}
.filtergruppe { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.filtergruppe.weit { grid-column: 1 / -1; }
.filtername { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; color: var(--studio-leise); }
.chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.arbeitsplatz .chip {
  min-height: 2.5rem;
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  font-weight: 600;
  background: var(--studio-flaeche);
}
.arbeitsplatz .chip[aria-pressed="true"] { background: var(--petrol); border-color: #4fc0cc; color: #fff; }
.chip .anzahl { font-size: 0.75rem; font-weight: 700; color: var(--studio-leise); margin-left: 0.15rem; }
.chip[aria-pressed="true"] .anzahl { color: var(--petrol-hell); }
#filter-zuruecksetzen { justify-self: start; }

.zuletzt { display: flex; align-items: center; gap: 0.6rem; overflow-x: auto; }
.zuletzt-liste { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.zuletzt-liste li { display: flex; border-radius: 999px; background: var(--studio-flaeche-2); border: 1px solid var(--studio-rand); overflow: hidden; }
.arbeitsplatz .zuletzt-liste button { border: 0; border-radius: 0; background: none; min-height: 2.5rem; white-space: nowrap; }
.arbeitsplatz .zuletzt-liste button + button { border-left: 1px solid var(--studio-rand); color: #7fd6e0; }
.suchstand { margin: 0; }

/*
 * Null Treffer (Christophers Test): ein Spruch statt einer leeren Flaeche,
 * ueber die volle Breite des Rasters. `.kartenraster` bleibt ein Grid - eine
 * einzelne Kachel darin soll trotzdem die ganze Zeile nutzen.
 */
.kartenraster li.leerspruch {
  grid-column: 1 / -1;
  padding: 2.2rem 1.5rem;
  border-radius: 20px;
  border: 1px dashed var(--studio-rand-stark);
  background: var(--studio-flaeche-2);
  color: var(--studio-schrift);
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
}

.kartenraster {
  list-style: none;
  margin: 0;
  padding: 0.2rem 0.2rem 0.6rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr));
  gap: 0.8rem;
  overflow-y: auto;
  align-content: start;
  flex: 1 1 auto;
}
.karte-werk {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.9rem 1rem;
  border-radius: 20px;
  background: linear-gradient(160deg, var(--studio-flaeche-2), var(--studio-flaeche));
  border: 1px solid var(--studio-rand);
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}
.karte-werk:hover { border-color: rgb(245 181 61 / 55%); transform: translateY(-2px); box-shadow: 0 14px 30px rgb(0 0 0 / 30%); }
.karte-kopf { display: flex; gap: 0.7rem; align-items: flex-start; }
.karte-symbol {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 14px;
  font-family: var(--schrift-anzeige);
  font-weight: 700;
  font-size: 1.3rem;
  color: #fff;
  background: var(--petrol);
}
.karte-symbol.schulwerk { background: var(--beere); }
.karte-symbol.uebung { background: var(--mint-dunkel); }
.karte-symbol.eigenes { background: var(--himmel-dunkel); }
/* `stil.css` setzt `h3` in Versalien und dunklem Grau - auf dem Studiogrund unlesbar. */
.arbeitsplatz .karte-titel {
  margin: 0;
  font-family: var(--schrift-anzeige);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.2;
  text-transform: none;
  letter-spacing: 0;
  color: var(--studio-schrift);
}
.karte-kuenstler { margin: 0.1rem 0 0; color: var(--studio-leise); font-size: 0.9rem; }
.karte-merkmale { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.merkmal {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgb(255 255 255 / 7%);
  color: var(--studio-schrift);
}
.merkmal.art { background: rgb(138 92 198 / 30%); color: #dcc8f7; }
.merkmal.instrument { background: rgb(63 143 210 / 25%); color: #bcdcf7; }
.merkmal.genre { background: rgb(23 122 134 / 28%); color: #b8e6ea; }
.merkmal.audio { background: rgb(245 181 61 / 20%); color: #ffd98a; }
.merkmal.click { background: rgb(63 158 110 / 25%); color: #b5ecd0; }
/*
 * Niveau als drei benannte Stufen statt einer Punktreihe fuer eine Zahl
 * (Christophers Test: "Anfänger/Fortgeschritten/Profi statt Zahlen 1-5").
 * Eigene Farbe je Stufe, damit sie auf einen Blick vom Genre/Instrument-
 * Abzeichen daneben zu unterscheiden ist.
 */
.merkmal.niveau-anfaenger { background: rgb(63 158 110 / 25%); color: #b5ecd0; }
.merkmal.niveau-fortgeschritten { background: rgb(63 143 210 / 25%); color: #bcdcf7; }
.merkmal.niveau-profi { background: rgb(232 102 74 / 25%); color: #ffd3c7; }
.karte-aktionen { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: auto; }
.arbeitsplatz .karte-aktionen button { border-radius: 999px; }
.arbeitsplatz .karte-aktionen .buehne-knopf { background: rgb(23 122 134 / 25%); border-color: rgb(31 149 163 / 60%); }
.karte-fassungen { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.karte-fassungen li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.4rem 0.35rem 0.7rem;
  border-radius: 14px;
  background: rgb(0 0 0 / 22%);
  flex-wrap: wrap;
}
.karte-fassungen .fassung-text { flex: 1 1 10rem; font-size: 0.88rem; }
.karte-fassungen .nicht-lieferbar { color: var(--studio-leise); }
.merkmal-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; padding: 0.6rem; border-radius: 14px; background: rgb(0 0 0 / 25%); }
.merkmal-editor .breit { grid-column: 1 / -1; }
.merkmal-editor fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; }
.merkmal-editor legend { font-size: 0.82rem; color: var(--studio-leise); font-weight: 700; margin-bottom: 0.2rem; }

.setlisten-spalten { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; min-height: 0; overflow: hidden; }
.liste.eintraege li { display: flex; align-items: center; gap: 0.4rem; }
.liste.eintraege .eintrag-text { flex: 1 1 auto; }

.tastentabelle { border-collapse: separate; border-spacing: 0 0.35rem; }
.tastentabelle th { text-align: right; padding-right: 0.6rem; white-space: nowrap; font-weight: 400; }
.tastentabelle td { padding-right: 1rem; color: var(--studio-schrift); }
.tastentabelle kbd { font-size: 0.85rem; color: var(--studio-schrift); }

.upload-formular { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.dateifeld input[type="file"] { padding: 0.8rem; border-style: dashed; }
progress { width: 100%; height: 0.7rem; accent-color: var(--sonne); }

/* Zweitbildschirm-Tafel */
.klapptafel {
  position: fixed;
  right: 14px;
  top: calc(var(--kopf-hoehe) + 8px);
  z-index: 35;
  width: min(34rem, 94vw);
  padding: 1rem 1.1rem;
  border-radius: 22px;
  background: var(--studio-glas);
  border: 1px solid var(--studio-rand-stark);
  box-shadow: 0 30px 70px rgb(0 0 0 / 55%);
  backdrop-filter: blur(18px);
  animation: aufklappen 160ms ease-out;
}
.buehne-inhalt { display: flex; gap: 1rem; margin-top: 0.6rem; }
.buehne-vorschau { flex: 0 0 auto; }
.buehne-vorschau canvas { display: block; width: 135px; height: 240px; border-radius: 10px; background: #081013; border: 1px solid var(--studio-rand-stark); }
.buehne-text { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.buehne-status { margin: 0; font-weight: 800; }
.buehne-status.verbunden { color: #7fd6a9; }
.buehne-text .hinweis { margin: 0; }
.anleitung { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.25rem; color: var(--studio-schrift); font-size: 0.92rem; }

.ladestand {
  position: fixed;
  bottom: calc(var(--deck-hoehe) + 74px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 38;
  background: var(--studio-glas);
  border: 1px solid var(--studio-rand-stark);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  margin: 0;
  box-shadow: 0 10px 26px rgb(0 0 0 / 40%);
  backdrop-filter: blur(10px);
}

/* --- Listen ----------------------------------------------------------------- */

.liste {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  max-height: 55vh;
  border: 1px solid var(--studio-rand);
  border-radius: 14px;
}
.liste li { padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--studio-rand); cursor: pointer; }
.liste li:last-child { border-bottom: 0; }
.liste li:hover { background: var(--studio-flaeche-2); }
.liste li.aktiv { background: var(--petrol); color: #fff; }
.liste li.nicht-lieferbar { color: var(--studio-leise); cursor: not-allowed; }
.liste li .neben { display: block; font-size: 0.82rem; color: var(--studio-leise); }
.liste li.laeuft { background: rgb(63 143 210 / 18%); box-shadow: inset 4px 0 0 var(--himmel); }
.liste li.fehlt { color: #ff9f8a; cursor: default; }
.liste li.nur-lesen { cursor: default; }
.liste li.nur-lesen:hover { background: none; }
.liste li.ausschnitt { display: flex; align-items: center; gap: 0.4rem; }
.liste li.ausschnitt .eintrag-text { flex: 1 1 auto; }

.liste li.zeile { display: flex; align-items: stretch; padding: 0; cursor: default; }
.arbeitsplatz .liste li.zeile button.zeileninhalt {
  flex: 1 1 auto;
  justify-content: flex-start;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  background: none;
  border: none;
  border-radius: 0;
  font-weight: 600;
}
.liste li.zeile button.zeileninhalt .neben { display: block; font-size: 0.82rem; color: var(--studio-leise); }
.arbeitsplatz .liste li.zeile button.entfernen {
  flex: 0 0 auto;
  background: none;
  border: none;
  border-left: 1px solid var(--studio-rand);
  border-radius: 0;
  color: #ff9f8a;
  min-width: 2.75rem;
  justify-content: center;
}

/* --- Werkzeuge am Rand (Snippet, Audio, Randbeschnitt, Seitenfolge, Anmerkungen) --- */

.werkzeug {
  position: fixed;
  top: var(--kopf-hoehe);
  right: 0;
  bottom: var(--deck-hoehe);
  width: min(25rem, 94vw);
  background: var(--studio-glas);
  border-left: 1px solid var(--studio-rand-stark);
  box-shadow: -20px 0 50px rgb(0 0 0 / 35%);
  backdrop-filter: blur(18px);
  padding: 0.9rem 1rem 1.2rem;
  overflow-y: auto;
  z-index: 22;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  animation: von-rechts 180ms ease-out;
}

/* Im Vollbild ist die Bedienleiste weg - das Werkzeug beginnt dann oben. */
body.vollbild .werkzeug { top: 0; bottom: 0; }

.werkzeug-kopf { display: flex; align-items: center; gap: 0.5rem; }
.werkzeug-kopf strong { font-family: var(--schrift-anzeige); font-size: 1.2rem; font-weight: 600; }
.werkzeug-felder {
  border: 1px solid var(--studio-rand);
  border-radius: 14px;
  margin: 0;
  padding: 0.6rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.werkzeug-felder legend { color: var(--studio-leise); font-size: 0.85rem; padding: 0 0.3rem; }
.feldpaar { display: flex; flex-direction: column; gap: 0.25rem; }
.feldpaar.breit { grid-column: 1 / -1; }
.feldpaar input, .feldpaar select, .feldpaar textarea { min-height: 2.75rem; padding: 0.5rem 0.65rem; font: inherit; }
.akzentwahl { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.werkzeug-knoepfe { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.werkzeug-knoepfe button { flex: 1 1 auto; justify-content: center; }
.schritte { margin: 0; padding-left: 1.3rem; display: grid; gap: 0.2rem; font-size: 0.95rem; }
.schritte li::marker { color: var(--sonne); font-weight: 800; }
.arbeitsplatz details.werkzeug-details { background: none; border: 1px solid var(--studio-rand); box-shadow: none; border-radius: 14px; margin: 0; }
.arbeitsplatz details.werkzeug-details > summary { color: var(--studio-schrift); background: none; }
.werkzeug-details[open] { padding-bottom: 0.6rem; }
.ergebnis { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.7rem; border-radius: 16px; background: rgb(63 158 110 / 14%); border: 1px solid rgb(63 158 110 / 40%); }

.vorschau {
  background: var(--studio-grund);
  border: 1px solid var(--studio-rand);
  border-radius: 12px;
  padding: 0.4rem;
  display: flex;
  justify-content: center;
}
.vorschau canvas { background: #fff; max-width: 100%; height: auto; }

/* Der gezogene Rahmen: heller Strich fuer die Farbe, dunkler dahinter fuer
   Sichtbarkeit auf weissem Papier. */
.auswahlrahmen {
  position: fixed;
  border: 2px solid var(--sonne);
  outline: 1px solid #1b1b1b;
  background: rgb(245 181 61 / 18%);
  pointer-events: none;
  z-index: 8;
  border-radius: 3px;
}
body.ausschnittmodus .seiten canvas { cursor: crosshair; }
body.ausschnittmodus .blattseite { box-shadow: 0 0 0 3px var(--sonne), 0 8px 30px rgb(0 0 0 / 45%); }

/* Anmerkungsrechtecke (E-168): kraeftig genug fuer 3:1 auf weissem Papier. */
.anmerkungrahmen-box {
  position: fixed;
  border: 2px solid;
  outline: 1px solid #1b1b1b;
  pointer-events: none;
  z-index: 7;
}
.anmerkungrahmen-box.anmerkung-allgemein { border-color: #3878aa; background: rgb(56 120 170 / 20%); }
.anmerkungrahmen-box.anmerkung-lehrernotiz { border-color: #d34f8f; background: rgb(211 79 143 / 20%); }
.anmerkungrahmen-box.anmerkung-markierung { border-color: #2f7a20; background: rgb(47 122 32 / 20%); }
.anmerkungrahmen-box.anmerkung-entwurf { border-style: dashed; border-color: #bd5f1d; background: rgb(189 95 29 / 22%); }
body.anmerkungsmodus .seiten canvas { cursor: crosshair; }

/* --- Vollbild am Laptop ------------------------------------------------------- */
body.vollbild header.bedienung,
body.vollbild .snippetleiste,
body.vollbild footer.audiodeck { display: none; }
body.vollbild .blatt { padding: 0; }

/* --- Schmale Fenster ---------------------------------------------------------- */
@media (max-width: 70rem) {
  .kopf-links .suchknopf { min-width: 0; }
  .kopf-links kbd, .kopf-rechts .modus span, .kopf-knopf span { display: none; }
  .deck-tempo input { width: 6rem; }
}
@media (max-width: 48rem) {
  header.bedienung { grid-template-columns: 1fr auto; }
  .kopf-mitte { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  /*
   * Die rechte Knopfgruppe muss umbrechen duerfen. Sie erbt `min-width: auto`
   * und hielt das Kopfgitter dadurch auf 633 px fest, obwohl das Fenster nur
   * 320 px breit war - gemessen als Dokumentueberlauf von +328 px bei 320 px
   * und +258 px bei 390 px (`tools/quality/oberflaeche-messen.mjs`). Der
   * Notenarbeitsplatz war damit die einzige Seite, die wirklich ueber den
   * Bildschirmrand hinauslief. `.kopf-mitte` war nur das Symptom: Es spannt
   * hier ueber beide Spalten und wurde so breit wie das Gitter.
   */
  .kopf-links, .kopf-rechts { min-width: 0; flex-wrap: wrap; }
  .kopf-rechts { justify-content: flex-end; }
  .start-karten, .setlisten-spalten, .upload-formular { grid-template-columns: 1fr; }
  .buehne-inhalt { flex-direction: column; }
}

/*
 * Deck in einer Zeile: Jede Zeile weniger ist Hoehe fuer die Noten. Die
 * Gruppen schrumpfen (Positionsregler zuerst), statt umzubrechen; erst unter
 * 70rem darf das Deck zweizeilig werden.
 */
footer.audiodeck { flex-wrap: nowrap; gap: 0.8rem; }
footer.audiodeck > * { min-width: 0; }
.deck-spuren { flex: 1 1 20rem; min-width: 12rem; }
.spurwahl { max-width: 22rem; }
.deck-transport { flex: 1.3 1 16rem; min-width: 11rem; }
.deck-position { min-width: 5rem; }
.deck-tempo input { width: 7rem; }
.deck-schleife .deck-klein { max-width: 6.5rem; }
.deck-schleife .speicherstand { max-width: 6.5rem; }
@media (max-width: 70rem) {
  footer.audiodeck { flex-wrap: wrap; }
}

/* Die Blaetterknoepfe ruhen mit der Maus - dann gehoert die Flaeche den Noten. */
.blattsteuerung, .arbeitsplatz .blattkante { transition: opacity 300ms ease; }
body.maus-ruhig .blattsteuerung:not(:focus-within):not(:hover) { opacity: 0; }
body.maus-ruhig .arbeitsplatz .blattkante, body.maus-ruhig .blattkante { opacity: 0; }

/* Spuren im Werkzeug "Audio & Metronom" */
.liste li.spurzeile { display: flex; flex-direction: column; gap: 0.4rem; cursor: default; }
.liste li.spurzeile .werkzeug-knoepfe button { flex: 0 0 auto; }

@keyframes aufklappen { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes von-rechts { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes einblenden { from { opacity: 0; } to { opacity: 1; } }
@keyframes atmen { 50% { box-shadow: 0 0 0 6px rgb(95 211 154 / 10%); } }
@keyframes puls-schatten { 50% { box-shadow: 0 20px 60px rgb(232 102 74 / 55%); } }

@media (prefers-reduced-motion: reduce) {
  .arbeitsplatz *, .arbeitsplatz *::before, .arbeitsplatz *::after { animation: none !important; transition: none !important; }
}
