/* ---------- Leiste ---------- */
.side {
  background: var(--panel);
  border-radius: 18px;
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto; min-height: 0; min-width: 0;
}
.title { font: 800 2.1rem var(--font-ui); letter-spacing: .04em; white-space: nowrap; text-transform: uppercase; margin: 0; } /* wie die Unterüberschriften der Leiste */

/* Umschalter zwischen den Bereichen (--n: Anzahl, setzt die Shell) */
.tabs {
  display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 4px;
  padding: 4px; background: var(--bg); border-radius: 14px;
}
.tab {
  font: 800 1.08rem var(--font-ui); letter-spacing: .04em; color: var(--muted); background: none; /* Schrift wie der Titel, normale Schreibweise */
  border: 0; border-radius: 10px; min-height: 48px;
  cursor: pointer; touch-action: manipulation;
}
.tab[aria-selected="true"] { background: var(--btn); color: var(--fg); box-shadow: 0 1px 4px var(--shadow); }
.panel { display: flex; flex-direction: column; gap: 10px; }
.tools { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
/* Werkzeugreihe oben: zurück, vor, leeren, Lücke schließen, einfügen und „mehr“ in einer Zeile, gleich breit */
.topwrap { position: relative; flex: none; }
.tools.toprow { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 5px; }
.tools.toprow .btn { min-height: 54px; padding: .25rem 3px; }
.tools.toprow .small { font-size: .66rem; white-space: nowrap; }
/* „Lücke schließen“ bricht in zwei Zeilen, damit der Knopf nicht breiter wird als die anderen */
.tools.toprow #btnGap .small { white-space: normal; text-align: center; line-height: 1.05; }
.tools.toprow .big .ico { width: 1.25rem; height: 1.25rem; }
#btnMore[aria-expanded="true"] { background: var(--fg); color: var(--board); border-color: var(--fg); }
/* Feld „mehr“: klappt unter der Werkzeugreihe über die Leiste, mit den selteneren Werkzeugen */
.morepop {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 30; padding: 12px;
  display: flex; flex-direction: column; gap: 10px; max-height: 70vh; overflow-y: auto;
  background: var(--panel); border: 2px solid var(--btn-line); border-radius: 14px; box-shadow: 0 10px 24px var(--shadow);
}
.morepop[hidden] { display: none; }
.tools.moretools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tools.moretools > #btnBreak { grid-column: 1 / -1; }
.tools.moretools .btn { flex-direction: row; justify-content: flex-start; gap: .55rem; min-height: 50px; padding: .3rem .7rem; }
.tools.moretools .btn .small { font-size: .9rem; font-weight: 800; }
.tools.moretools .big .ico { width: 1.3rem; height: 1.3rem; }
/* Grauer Knopf mit Grund (data-why, ui.js lock): der Tipp landet auf dem Behälter, ui.js explainLocked blendet den Grund ein */
.side button:disabled[data-why] { pointer-events: none; }
.tools.t2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tools.t2 .btn { flex-direction: row; gap: .5rem; min-height: 48px; }
/* Zählzeiten von Hand: 1–6, + und Löschen */
.zbtns { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.zbtns .btn { padding: 0; font: 700 1.35rem/1 var(--font-display); }
.autos { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: 6px; }
.autos.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.autos.three .btn { min-height: 48px; padding: .2rem .25rem; font-size: .82rem; line-height: 1.1; hyphens: manual; }
.tools .btn { flex-direction: column; gap: .15rem; min-height: 58px; padding: .3rem .15rem; }
.tools .btn .small { font-size: .72rem; }

/* Töne in zwei Reihen à 7: Stammtöne, darunter die hohen Töne mit Fis und B */
.palette { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.pal { display: contents; }
.note {
  aspect-ratio: 1; border: 0; border-radius: 50%;
  background: var(--c); color: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font: 700 1.7rem/1 var(--font-display);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .16);
  cursor: pointer; touch-action: manipulation; padding: 0;
}
.note:active { transform: scale(.93); }
/* Gruppen der Leiste: Notennamen, Notenwerte, Pausenwerte */
.group { display: flex; flex-direction: column; gap: 6px; }
.glabel { margin: 0; font: 800 .75rem var(--font-ui); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.glabel span { text-transform: none; letter-spacing: 0; font-weight: 700; }
.values { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.values .btn { flex-direction: column; gap: .1rem; min-height: 50px; padding: .3rem .1rem; }
.values .sym { height: 1.6rem; }
.values.v6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.values .vgap { display: block; }
.values .btn .small { font-size: .8rem; }
/* Unten: Umwandeln und Alles löschen mit Abstand, damit man das Gefährliche nicht aus Versehen trifft */
.actions { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; margin-top: auto; position: relative; }
.actions > .btn { padding: 0 .3rem; gap: .3rem; font-size: .88rem; line-height: 1.1; text-align: center; }
/* Feld „Umwandeln“: klappt über den Knöpfen unten auf, erklärt die Umwandlung des offenen Bereichs */
.convertpop {
  position: absolute; bottom: calc(100% + 8px); left: 0; right: 0; z-index: 30; padding: 10px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--panel); border: 2px solid var(--btn-line); border-radius: 14px; box-shadow: 0 10px 24px var(--shadow);
}
.convitem { display: flex; flex-direction: column; gap: 6px; }
#btnConvert .chev { width: 1.1rem; height: 1.1rem; transform: rotate(180deg); transition: transform .18s ease; }
#btnConvert[aria-expanded="true"] .chev { transform: none; }
.savewrap { position: relative; display: flex; }
.savepop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; width: min(340px, calc(100vw - 32px));
  padding: 10px; background: var(--panel);
  border: 2px solid var(--btn-line); border-radius: 14px;
  box-shadow: 0 10px 24px var(--shadow);
}
.savepop .hint { margin: 6px 0 0; font-size: .85rem; font-weight: 700; color: var(--muted); }
.savepop .hint:empty { display: none; }
.savepop .hint.warn { color: var(--danger); }

@media (max-width: 600px) { /* nur Handys; ein iPad (ab 768 px) behält die Leiste an der Seite */
  .side { overflow: visible; }
}
@media (prefers-reduced-motion: reduce) {
  .note:active { transform: none; }
}
/* Schmale Leiste (iPad im Hochformat, Leiste 300 px): Titel und Reiter kompakter, damit nichts abgeschnitten wird */
@media (max-width: 900px) {
  .title { font-size: 1.4rem; letter-spacing: .02em; }
  .tab { font-size: .95rem; letter-spacing: 0; }
}
/* Block „Weitere Symbole“: die Wiederholungen beginnen eine eigene Reihe unter den Strichen */
.tools.three > .row2 { grid-column-start: 1; }

/* ---------- Üben und Spielen ---------- */
/* Umschalter unter den Reitern: „… schreiben“ oder „Üben und Spielen“; die gewählte Hälfte ist dunkel */
.parts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 3px; background: var(--panel); border-radius: 12px; }
.parts[hidden] { display: none; }
.part {
  font: 800 .92rem var(--font-ui); color: var(--muted); background: none;
  border: 0; border-radius: 9px; min-height: 40px; padding: 0 .4rem;
  cursor: pointer; touch-action: manipulation;
}
.part[aria-pressed="true"] { background: var(--fg); color: var(--board); }
.gslot .play { gap: 7px; padding: 10px 10px 14px; border-radius: 14px; background: color-mix(in srgb, var(--fg) 4%, transparent); }
.play .game { gap: 7px; margin-bottom: 4px; }
/* Einstellungen der Spiele: zugeklappt hinter „Einstellungen“ unter dem Startknopf (game.js initOptions) */
.play .gopts { display: flex; flex-direction: column; gap: 7px; }
.play:not(.opts-open) .gopts { display: none; }
.btn.gopt { width: 100%; min-height: 44px; padding: 0 .8rem; justify-content: space-between; font-size: .9rem; }
.btn.gopt .chev { width: 1.1rem; height: 1.1rem; color: var(--muted); transition: transform .18s ease; }
.play.opts-open .gopt .chev { transform: rotate(180deg); }
/* Spielauswahl: Die Kachelreihe .gamepick bleibt als Wahl im Hintergrund (game.js), gezeigt wird die Galerie auf der Tafel */
.gslot .gamepick, .gslot .gamego, .gslot .game > .ghint { display: none; } /* die Karte erklärt das Spiel schon */
/* Galerie beim Üben: große Kacheln mit Name und Erklärung */
.gallery { width: 100%; max-width: 940px; margin: auto 0; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.gallery h2 { margin: 0; font: 800 2.2rem/1.1 var(--font-ui); text-align: center; }
.gtiles { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.gcardtile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 8px;
  min-height: 150px; padding: 18px 20px; border: 3px solid var(--btn-line); border-radius: 22px; text-align: left;
  background: var(--btn); color: var(--fg); box-shadow: 0 3px 10px var(--shadow); cursor: pointer; touch-action: manipulation;
}
.gcardtile:active { transform: scale(.97); }
.gcardtile .gname { font: 800 1.45rem/1.15 var(--font-ui); }
.gcardtile .gdesc { font: 700 .95rem/1.35 var(--font-ui); color: var(--muted); }
/* Lite: gesperrtes Spiel; der Tipp zeigt den Hinweis (Pro) */
.gcardtile.locked { opacity: .55; }
.gcardtile.locked::after { content: 'Pro'; position: absolute; top: 10px; right: 14px; font: 800 .75rem/1 var(--font-ui); letter-spacing: .04em; }
/* Karte des gewählten Spiels: Zurück zur Galerie, Erklärung, Los, darunter die Einstellungen */
.gcard { width: 100%; max-width: 620px; margin: auto 0; display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
.gcard .gback { align-self: flex-start; min-height: 44px; padding: 0 1rem 0 .6rem; font-size: .95rem; }
.gcard .gback .chev { transform: rotate(90deg); }
.gcard .gintro { align-self: center; }
/* Offene Einstellungen brauchen viel Höhe: Name, Erklärung und „Los geht's!“ rücken dann enger zusammen. Auf breiter
   Tafel (quer) stehen sie links und die Einstellungen rechts daneben, so bleibt „Los geht's!“ sichtbar und es muss
   kaum noch gescrollt werden. :has gilt nur für die Karte mit dem Spiel, dessen Einstellungen offen sind. */
@media (min-width: 601px) { /* das Handy hat eigene Größen (base.css) */
  .gameintro:has(> .gcard:not([hidden]) > .gslot > .play.opts-open:not([hidden])) { padding: 12px 40px; }
  .gcard:has(> .gslot > .play.opts-open:not([hidden])) { gap: 12px; }
  .gcard:has(> .gslot > .play.opts-open:not([hidden])) .gintro { gap: 12px; }
  .gcard:has(> .gslot > .play.opts-open:not([hidden])) .gintro h2 { font-size: 2.1rem; }
  .gcard:has(> .gslot > .play.opts-open:not([hidden])) .gintro p { font-size: 1.25rem; line-height: 1.4; }
  .gcard:has(> .gslot > .play.opts-open:not([hidden])) .gintro .gbtn.big { margin-top: 4px; height: 68px; }
  .gcard:has(> .gslot > .play.opts-open:not([hidden])) .seg .btn { min-height: 44px; }
}
@container (min-width: 900px) {
  .gcard:has(> .gslot > .play.opts-open:not([hidden])) {
    max-width: 1040px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); grid-template-rows: auto 1fr;
    column-gap: 32px; align-items: start;
  }
  /* rechts frei für den Knopf „Vorführen“ oben in der Ecke der Tafel */
  .gameintro:has(> .gcard:not([hidden]) > .gslot > .play.opts-open:not([hidden])) { padding-right: 72px; }
  .gcard:has(> .gslot > .play.opts-open:not([hidden])) > .gback { grid-column: 1; grid-row: 1; justify-self: start; }
  .gcard:has(> .gslot > .play.opts-open:not([hidden])) > .gintro { grid-column: 1; grid-row: 2; position: sticky; top: 0; }
  .gcard:has(> .gslot > .play.opts-open:not([hidden])) > .gslot { grid-column: 2; grid-row: 1 / span 2; }
  .gcard:has(> .gslot > .play.opts-open:not([hidden])) .gintro .gbtn.big { min-width: 0; width: 100%; max-width: 320px; }
}
/* Beim Tonnamen-Quiz „Melodie/Lied durchgehen“ braucht es Töne, Tonraum und Vorzeichen nicht */
.play[data-game="quiz"] .songmode { display: none; }
/* Leere Übungstafel: noch keine Zeilennummern */
.grid.blankboard .rnum { visibility: hidden; }
/* Auf der Übungstafel gibt es kein Schritt für Schritt (abgespielt wird nur das Spiel) */
.app.practice .playfab [data-play="step"], .app.practice .playfab [data-play="stepSound"] { display: none; }
.ghint { margin: 0; font-size: .82rem; font-weight: 700; line-height: 1.35; color: var(--muted); }
/* Auswahl aus drei (two, four: zwei, vier) Möglichkeiten; die gewählte ist dunkel */
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.seg.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.seg .btn { flex-direction: column; gap: .1rem; min-height: 48px; padding: .3rem .25rem; font-size: .86rem; line-height: 1.1; text-align: center; hyphens: manual; }
.seg .btn .small { font-size: .66rem; line-height: 1.15; opacity: .85; }
.seg .btn .acc { font: 700 1.2rem/1 var(--font-display); }
.seg.two .btn { flex-direction: row; gap: .35rem; }
.btn.wide { width: 100%; min-height: 44px; font-size: .85rem; }
.btn.gamego { min-height: 56px; margin-top: 4px; background: var(--fg); color: var(--board); border-color: var(--fg); font-size: 1.05rem; }
/* Tonraum: zwei Felder mit ◀ Ton ▶ */
.rangerow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rgroup { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; align-items: center; gap: 4px; }
.rgroup .btn { padding: 0; min-height: 44px; font-size: .8rem; }
.rval { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.rval .small { font: 700 .66rem var(--font-ui); color: var(--muted); }
.rval output { font: 700 1.35rem/1.2 var(--font-display); }

/* Handy: Galerie und Karte schmaler (nach dem Rahmen .gameintro in base.css, der sonst sein Polster behält) */
@media (max-width: 600px) {
  .gameintro { padding: 56px 16px 16px; }
  .gallery { gap: 14px; }
  .gallery h2 { font-size: 1.5rem; }
  .gcardtile { min-height: 0; padding: 14px 16px; }
  .gcardtile .gname { font-size: 1.2rem; }
}
