/* ScoreM Builder – Gestaltung angelehnt an herrpetri.de (MkDocs Material: schwarz/indigo, flach) */
[hidden] { display: none !important; }
:root {
  --bg: #ffffff; --panel: #ffffff; --ink: rgba(0, 0, 0, .87); --muted: rgba(0, 0, 0, .54); --faint: rgba(0, 0, 0, .32);
  --line: rgba(0, 0, 0, .12); --line-strong: rgba(0, 0, 0, .26); --hover: rgba(0, 0, 0, .04);
  --head: #14151a; --head-ink: #ffffff; --head-muted: rgba(255, 255, 255, .7);
  --accent: #4051b5; --accent-hover: #526cfe; --accent-ink: #ffffff; --accent-soft: rgba(64, 81, 181, .08); --accent-line: rgba(64, 81, 181, .4);
  --bad: #b3372c;
  --warn-bg: #fff8e1; --warn-line: #ffd54f; --warn-ink: #5c4a00;
  --foot: rgba(0, 0, 0, .87); --foot-ink: #ffffff; --foot-muted: rgba(255, 255, 255, .6);
  --radius: 2px;
  --font: -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1e2129; --panel: #232633; --ink: rgba(255, 255, 255, .86); --muted: rgba(255, 255, 255, .56); --faint: rgba(255, 255, 255, .3);
    --line: rgba(255, 255, 255, .12); --line-strong: rgba(255, 255, 255, .26); --hover: rgba(255, 255, 255, .05);
    --head: #14151a; --accent: #8c9eff; --accent-hover: #a5b2ff; --accent-ink: #14151a; --accent-soft: rgba(140, 158, 255, .12); --accent-line: rgba(140, 158, 255, .45);
    --bad: #ff8a80; --warn-bg: #3a3214; --warn-line: #6b5a1e; --warn-ink: #f3e3a4;
    --foot: #14151a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1e2129; --panel: #232633; --ink: rgba(255, 255, 255, .86); --muted: rgba(255, 255, 255, .56); --faint: rgba(255, 255, 255, .3);
  --line: rgba(255, 255, 255, .12); --line-strong: rgba(255, 255, 255, .26); --hover: rgba(255, 255, 255, .05);
  --head: #14151a; --accent: #8c9eff; --accent-hover: #a5b2ff; --accent-ink: #14151a; --accent-soft: rgba(140, 158, 255, .12); --accent-line: rgba(140, 158, 255, .45);
  --bad: #ff8a80; --warn-bg: #3a3214; --warn-line: #6b5a1e; --warn-ink: #f3e3a4;
  --foot: #14151a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.6 var(--font); padding-bottom: 64px; -webkit-font-smoothing: antialiased; }
h2 { font-size: 24px; font-weight: 300; letter-spacing: -.01em; margin: 0 0 6px; line-height: 1.3; }
h3 { font-weight: 400; }
code { background: var(--hover); padding: 1px 6px; border-radius: var(--radius); }
a { color: var(--accent); }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 2px; }

/* ---------------------------------------------------------------- Kopfzeile (wie herrpetri.de) */
.appbar { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: space-between; align-items: center;
  padding: 10px 24px; background: var(--head); color: var(--head-ink); box-shadow: 0 0 4px rgba(0,0,0,.15), 0 4px 8px rgba(0,0,0,.2); }
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand .logo { width: 28px; height: 32px; flex: none; display: block; }
.brand .name { font-weight: 700; font-size: 18px; letter-spacing: .01em; }
.brand .sub { color: var(--head-muted); font-size: 13px; }
.appbar-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.appbar .btn { color: var(--head-ink); border-color: transparent; background: transparent; }
.appbar .btn:hover:not(:disabled) { background: rgba(255,255,255,.1); color: var(--head-ink); border-color: transparent; }
.appbar .btn.primary { background: var(--accent); border-color: var(--accent); }
.appbar .btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.appbar .btn:disabled { opacity: .4; }

/* ---------------------------------------------------------------- Knöpfe (Material: kantig, 2px Rand) */
.btn { font: inherit; font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 2px solid var(--accent); background: transparent; color: var(--accent);
  border-radius: var(--radius); padding: 6px 16px; cursor: pointer; min-height: 38px; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.btn:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.btn.small { padding: 3px 12px; min-height: 32px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.linkbtn { border: 0; background: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
.linkbtn:hover { color: var(--accent-hover); text-decoration: underline; }

.warn { margin: 12px 24px 0; padding: 10px 14px; border-radius: var(--radius); background: var(--warn-bg); border-left: 4px solid var(--warn-line); color: var(--warn-ink); }

/* ---------------------------------------------------------------- Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr); gap: 32px; padding: 24px 24px; align-items: start; max-width: 1440px; margin: 0 auto; }
.panel { background: transparent; min-width: 0; }
.panel.side { border-left: 1px solid var(--line); padding-left: 28px; }
.panel-head { margin-bottom: 14px; }
.panel-head.mt { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.hint { margin: 0; color: var(--muted); font-size: 14px; }
.side { position: sticky; top: 78px; max-height: calc(100vh - 150px); overflow: auto; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 16px; gap: 24px; }
  .panel.side { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 20px; }
  .side { position: static; max-height: none; }
  .appbar { padding: 10px 16px; }
}

/* ---------------------------------------------------------------- Startseite: Übung wählen */
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chooser { display: grid; gap: 12px; margin-top: 8px; }
.choice-card { display: grid; grid-template-columns: 150px 1fr auto; gap: 18px; align-items: center;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--panel); transition: border-color .15s; }
.choice-card:hover { border-color: var(--accent-line); }
.choice-card h3 { margin: 0 0 4px; font-size: 19px; font-weight: 400; }
.choice-card p { margin: 0; font-size: 14px; }
.choice-card .cc-meta { margin-top: 6px; font-size: 13px; color: var(--accent); }
.cc-art { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); height: 92px; display: flex; align-items: center; justify-content: center; line-height: 0; color: #000; overflow: hidden; }
.cc-art svg { max-width: 100%; height: auto; }
@media (max-width: 620px) {
  .choice-card { grid-template-columns: 1fr; }
  .cc-art { height: 80px; }
}

/* ---------------------------------------------------------------- Vorlagen-Kacheln */
.items { display: grid; gap: 8px; padding: 8px 0 12px; }
.items.notes { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.items.rhythms { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.item { position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); transition: border-color .1s, background .1s; }
.item.on { border-color: var(--accent-line); background: var(--accent-soft); }
.item label { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 6px 6px; cursor: pointer; }
.item input { position: absolute; top: 6px; left: 6px; width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }
.item .abc { background: #fff; border-radius: var(--radius); line-height: 0; color: #000; }
.items.notes .item .abc { min-height: 70px; display: flex; align-items: center; }
.items.rhythms .item .abc svg { max-width: 100%; height: auto; }
.item span { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.item .play { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--accent); font-size: 10px; cursor: pointer; display: grid; place-items: center; padding: 0; }
.item .play:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------------------------------------------------------------- Abschnitte (wie die Seitennavigation) */
.sections { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 4px; }
.section { border-left: 3px solid transparent; padding: 6px 8px 6px 10px; cursor: pointer; background: transparent; transition: background .1s; }
.section:hover { background: var(--hover); }
.section.active { border-left-color: var(--accent); background: var(--accent-soft); }
.sec-head { display: flex; align-items: center; gap: 6px; }
.sec-select { border: 0; background: transparent; padding: 0; cursor: pointer; }
.num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--line); color: var(--ink); }
.section.active .num { background: var(--accent); color: var(--accent-ink); }
.sec-title { flex: 1; min-width: 0; font: inherit; font-size: 15px; border: 1px solid transparent; background: transparent; color: var(--ink); padding: 3px 6px; border-radius: var(--radius); }
.section.active .sec-title { color: var(--accent); }
.sec-title:hover, .sec-title:focus { border-color: var(--line-strong); background: var(--panel); color: var(--ink); }
.sec-tools { display: flex; gap: 2px; }
.icon { width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted); border-radius: var(--radius); cursor: pointer; }
.icon:hover:not(:disabled) { background: var(--line); color: var(--ink); }
.icon:disabled { opacity: .3; cursor: default; }
.sec-body { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 2px 0 2px 34px; font-size: 13px; color: var(--muted); }
.sec-kind { font-size: 12px; font-weight: 700; color: var(--accent); }
.sec-count { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- Formulare */
.settings { display: grid; gap: 14px; }
.field { display: grid; gap: 4px; align-content: start; font-size: 13px; font-weight: 700; color: var(--muted); }
.field small { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea { font: inherit; font-weight: 400; font-size: 15px; color: var(--ink); padding: 7px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 1px var(--accent); }
.field textarea { resize: vertical; }
.opt { font-weight: 400; color: var(--muted); }
.suffix { display: flex; align-items: center; gap: 6px; font-weight: 400; color: var(--ink); }
.suffix input { width: 90px; }
.group { border: 0; border-top: 1px solid var(--line); padding: 12px 0 4px; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.group legend { font-weight: 700; font-size: 13px; color: var(--muted); padding: 0 8px 0 0; }
.full { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14.5px; cursor: pointer; color: var(--ink); }
.check input { margin-top: 4px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
@media (max-width: 480px) { .group { grid-template-columns: 1fr; } }

.iv-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 14px; padding: 4px 0; }
.r-levels { grid-template-columns: 1fr; }
.sc-roots { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
.iv-example { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.iv-ex-notes { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; line-height: 0; min-height: 40px; color: #000; }
.iv-ex-notes:empty { display: none; }
.iv-ex-side { flex: 1; min-width: 200px; }
.iv-ex-side p { margin: 0 0 8px; }
.pool-info { margin: 0; font-size: 14px; color: var(--accent); }
.pool-info.bad { color: var(--bad); }
details.pool { border-top: 1px solid var(--line); padding: 12px 0 0; }
details.pool summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--accent); }
details.pool p { margin: 8px 0 0; }

/* ---------------------------------------------------------------- Statusleiste (dunkel wie der Footer) */
.statusbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; align-items: center;
  padding: 10px 24px; background: var(--foot); color: var(--foot-ink); font-size: 14px; z-index: 9; }
.statusbar b { font-weight: 700; }
.lms-note { color: var(--foot-muted); font-size: 12.5px; }

/* ---------------------------------------------------------------- Dialoge */
dialog { border: 0; border-radius: var(--radius); background: var(--panel); color: var(--ink); padding: 0; box-shadow: 0 8px 40px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(0, 0, 0, .54); }
.preview { width: min(900px, 96vw); height: min(860px, 92vh); }
.preview[open] { display: flex; flex-direction: column; }
.preview-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--head); color: var(--head-ink); flex-wrap: wrap; }
.preview-bar .muted { font-size: 13px; color: var(--head-muted); }
.preview-bar .btn { margin-left: auto; color: var(--head-ink); border-color: rgba(255,255,255,.5); }
.preview-bar .btn:hover { background: rgba(255,255,255,.12); border-color: #fff; }
.preview iframe { flex: 1; border: 0; width: 100%; background: #fff; }
.exportdlg { width: min(480px, 94vw); padding: 22px 24px; }
.exportdlg h3 { margin: 0 0 12px; font-size: 22px; font-weight: 300; }
.exportdlg progress { width: 100%; height: 8px; accent-color: var(--accent); }
.dlg-actions { display: flex; justify-content: flex-end; margin-top: 12px; }

.toast { position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%); background: #323232; color: #fff; padding: 12px 20px; border-radius: var(--radius); z-index: 50; font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,.3); }

/* ---------------------------------------------------------------- Sprachumschalter (in der dunklen Kopfzeile) */
.langsw { display: inline-flex; align-self: center; border: 1px solid rgba(255,255,255,.35); border-radius: var(--radius); overflow: hidden; margin-right: 6px; }
.langsw button { font: inherit; font-size: 13px; font-weight: 700; border: 0; background: transparent; color: var(--head-muted); padding: 5px 11px; cursor: pointer; min-height: 32px; }
.langsw button:hover { color: #fff; background: rgba(255,255,255,.08); }
.langsw button[aria-pressed="true"] { background: #fff; color: var(--head); }
.langsw button:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: -2px; }

@media (max-width: 700px) {
  .appbar { position: static; padding: 10px 16px 12px; }
  .brand .sub { display: none; }
  .brand .name { font-size: 17px; }
  .appbar-actions { width: 100%; gap: 4px; }
  .appbar-actions .btn { padding: 3px 10px; min-height: 34px; font-size: 13px; }
  .appbar-actions .btn.primary { margin-left: auto; }
  .lms-note, .preview-bar .muted { display: none; }
  .statusbar { padding: 8px 16px; }
  .preview { width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; border-radius: 0; }
}
