/* Design-Tokens: dSolve brand-* / ink-* Ramp, Light + Dark.
 * Orientierung: Material Design 3 (Tokens, Chips, Segmented Buttons,
 * Bottom-Controls), WCAG 2.2 AA (Kontrast, Fokus, Touch-Ziele ≥ 44 px),
 * Apple HIG (Safe-Area, Zurück-Navigation, System-Font-Stack).
 */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-2: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #ebeef2;
  --surface-3: #d3dae3;
  --border: #d3dae3;
  --text: #1f2733;
  --text-2: #4d5d75;
  --text-3: #61748d;
  --primary: #1f63b0;
  --primary-hover: #1a4f8f;
  --on-primary: #ffffff;
  --primary-container: #d9eafb;
  --on-primary-container: #143456;
  --danger: #b3261e;
  --on-danger: #ffffff;
  --focus: #2f7fd1;
  --shadow: 0 1px 2px rgba(15, 20, 28, 0.08), 0 4px 12px rgba(15, 20, 28, 0.06);
  --shadow-lg: 0 8px 24px rgba(15, 20, 28, 0.14);
  --radius: 14px;
  --radius-sm: 10px;
  /* Bühne */
  --stage-bg: #f6f7f9;
  --ladder-fill: #ffffff;
  --ladder-line: #adb9c8;
  --rung: #1f2733;
  --zone: #ebeef2;
  --zone-text: #61748d;
  --field-no: #8092a8;
  --foot-l: #2f7fd1;
  --foot-l-dark: #163f70;
  --foot-r: #f28c28;
  --foot-r-dark: #8a4a0c;
  --foot-text: #ffffff;
  --body: #384151;
  --body-fill: #ebeef2;
  --ball: #e0b13a;
  --ball-line: #7a5a0a;
  --ok: #1b7f4b;
  --ok-bg: #e2f5ea;
  --err: #b3261e;
  --err-bg: #fbe9e7;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f141c;
  --bg-2: #141b25;
  --surface: #1a2230;
  --surface-2: #232d3d;
  --surface-3: #2e3a4d;
  --border: #2e3a4d;
  --text: #ebeef2;
  --text-2: #b7c2d1;
  --text-3: #8fa0b5;
  --primary: #87baee;
  --primary-hover: #b7d6f6;
  --on-primary: #0a2540;
  --primary-container: #1a4f8f;
  --on-primary-container: #d9eafb;
  --danger: #ffb4ab;
  --on-danger: #690005;
  --focus: #87baee;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --stage-bg: #141b25;
  --ladder-fill: #1a2230;
  --ladder-line: #4d5d75;
  --rung: #ebeef2;
  --zone: #232d3d;
  --zone-text: #8fa0b5;
  --field-no: #61748d;
  --foot-l: #5499e3;
  --foot-l-dark: #b7d6f6;
  --foot-r: #f5a04a;
  --foot-r-dark: #ffd9b3;
  --foot-text: #0f141c;
  --body: #d3dae3;
  --body-fill: #2e3a4d;
  --ball: #f0c24a;
  --ball-line: #5a3f00;
  --ok: #7ad19a;
  --ok-bg: #163a27;
  --err: #ffb4ab;
  --err-bg: #4a1d1a;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overscroll-behavior-x: none; } /* Wischen darf keine Browser-Navigation auslösen */
body { overscroll-behavior-x: none; }
body {
  margin: 0;
  font-family: "Inter Variable", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.05rem; margin-top: 1.25rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--primary); }
ul { padding-left: 1.25rem; margin: 0 0 0.75rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; background: var(--surface-2); padding: 0.05em 0.35em; border-radius: 4px; }
pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8rem; background: var(--surface-2); padding: 0.75rem; border-radius: var(--radius-sm); overflow: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ───────── Header ───────── */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.app-header-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, var(--foot-l), var(--foot-r)); display: inline-block; }
.app-title { font-size: 1.1rem; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }

/* ───────── Buttons ───────── */
.btn, .btn-icon, .chip, .seg, .select, .search {
  font: inherit; color: inherit;
  min-height: 44px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.55rem 1.1rem; border-radius: 999px; border: 1px solid transparent;
  background: var(--surface-2); color: var(--text); font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-tonal { background: var(--primary-container); color: var(--on-primary-container); }
.btn-tonal:hover { filter: brightness(1.05); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; border: none; background: transparent; color: var(--text); cursor: pointer;
  transition: background 0.15s;
}
.btn-icon:hover { background: var(--surface-2); }
.btn-icon.toggle[aria-pressed="true"] { background: var(--primary-container); color: var(--on-primary-container); }
/* Sprachumschalter im Kopf: zeigt die jeweils andere Sprache als Kürzel */
.btn-lang { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; border: 1px solid var(--border); }
/* Kopfzeile: sekundäre Aktionen – inline ab 640px, darunter als Menü hinter „⋯“ */
.hdr-secondary { display: flex; align-items: center; gap: 0.5rem; }
.hdr-label { display: none; }
.btn-more { display: none; }
@media (max-width: 419px) { .brand-text { display: none; } }
@media (max-width: 639px) {
  .btn-more { display: inline-flex; }
  .app-header-inner { position: relative; }
  .hdr-secondary { display: none; position: absolute; right: 0.75rem; top: calc(100% - 4px); flex-direction: column; align-items: stretch; gap: 0.1rem; min-width: 220px; padding: 0.4rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18); z-index: 30; }
  .hdr-secondary.open { display: flex; }
  .hdr-secondary .btn-icon, .hdr-secondary .btn { width: auto; height: auto; min-height: 44px; border-radius: var(--radius-sm); justify-content: flex-start; gap: 0.75rem; padding: 0.5rem 0.75rem; font-size: 0.95rem; font-weight: 500; }
  .hdr-secondary .btn-lang { border: none; }
  .hdr-secondary .lang-code { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); font-size: 0.7rem; }
  .hdr-secondary .hdr-label { display: inline; }
  .hdr-secondary .btn-donate .hide-sm { display: none; }
}
.btn-play { width: 64px; height: 64px; background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow); }
.btn-play:hover { background: var(--primary-hover); }
.hide-sm { display: none; }
@media (min-width: 640px) { .hide-sm { display: inline; } }
.btn-add { padding: 0.55rem 0.8rem; }
@media (min-width: 640px) { .btn-add { padding: 0.55rem 1.1rem; } }

.select {
  padding: 0.5rem 2.2rem 0.5rem 0.9rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2361748d'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 0.6rem center / 20px;
  appearance: none; -webkit-appearance: none; cursor: pointer;
}

/* ───────── Startseite ───────── */
.container { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.hero { padding: 1.25rem 0 0.5rem; }
.hero h2 { font-size: clamp(1.5rem, 4vw, 2.2rem); }
.lead { color: var(--text-2); max-width: 60ch; font-size: 1.05rem; }
.toolbar { display: flex; gap: 0.6rem; align-items: center; margin: 0.75rem 0; }
.search-wrap { position: relative; flex: 1; color: var(--text-3); }
.search-wrap svg { position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search { width: 100%; padding: 0.55rem 1rem 0.55rem 2.7rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.chips { display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.25rem 0 0.5rem; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.95rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 500; cursor: pointer;
  min-height: 40px;
}
.chip[aria-selected="true"] { background: var(--primary-container); color: var(--on-primary-container); border-color: transparent; }
.chip-icon { font-size: 1rem; }
.chips-sport { padding-top: 0; }
.chip-add { border-style: dashed; }
.chips-label { align-self: center; font-size: 0.85rem; color: var(--text-2); }
.sport-form { display: grid; gap: 0.5rem; max-width: 32rem; margin: 0.25rem 0 0.75rem; padding: 0.75rem; border-radius: var(--radius); background: var(--surface-2); }
.sport-form .search { padding-left: 1rem; }
.sport-form[hidden] { display: none; }
.sport-panel { margin: 0.25rem 0 0.75rem; }
.sport-panel[hidden], .sport-pick[hidden] { display: none; }
.sport-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.sport-pick { margin-top: 0.75rem; }
.pick-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0.75rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); min-height: 44px; }
.pick-row .chip { flex: none; }
.pick-id { display: block; font-size: 0.75rem; color: var(--text-3); font-weight: 400; overflow-wrap: anywhere; }
.sport-market h4 { margin: 1rem 0 0.4rem; }
.sport-market-add { display: flex; gap: 0.5rem; align-items: center; }
.sport-market-add .search { flex: 1; margin-bottom: 0; }
.sport-market-list { list-style: none; padding: 0; margin: 0.4rem 0 0; display: grid; gap: 0.3rem; }
.sport-market-list li { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.card-market { border-style: dashed; }
.sport-select { max-width: 14rem; }
.chip-sm { min-height: 34px; padding: 0.25rem 0.75rem; font-size: 0.85rem; border-radius: 8px; }
.btn-donate { background: #fbe9e7; color: #8a1f17; padding: 0.55rem 0.8rem; }
:root[data-theme="dark"] .btn-donate { background: #4a1d1a; color: #ffb4ab; }
@media (min-width: 640px) { .btn-donate { padding: 0.55rem 1.1rem; } }
.tag-sport { background: var(--surface-2); color: var(--text-2); }
.community-note { display: flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; color: var(--text-2); }
.community-box { margin-top: 1rem; padding: 0.9rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.community-box h3 { margin-top: 0; font-size: 1rem; }
.community-box p { font-size: 0.9rem; color: var(--text-2); }
.author { padding-left: 1rem; flex: 1; min-width: 200px; }
.turnstile:empty { display: none; }
.cat-info { color: var(--text-2); min-height: 1.5rem; margin: 0.25rem 0; }
.count { color: var(--text-3); font-size: 0.9rem; margin: 0 0 0.5rem; }
.grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); } }
.card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: transform 0.15s, box-shadow 0.15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.thumb { background: var(--stage-bg); aspect-ratio: 1 / 1.1; display: flex; align-items: center; justify-content: center; padding: 6px; }
.thumb svg { height: 100%; width: 100%; }
.thumb .field-no, .thumb .zone-label { display: none; }
.thumb .foot-label { font-size: 17px; }
.thumb-error { color: var(--err); font-size: 0.85rem; }
.card-body { padding: 0.7rem 0.85rem 0.85rem; display: flex; flex-direction: column; gap: 0.3rem; }
.card-title { font-size: 1rem; margin: 0; }
.card-meta { color: var(--text-3); font-size: 0.8rem; margin: 0; }
.empty { color: var(--text-3); grid-column: 1 / -1; }
.cta { margin: 2rem 0 1rem; padding: 1.25rem; border-radius: var(--radius); background: var(--surface-2); }
.cta h2 { font-size: 1.2rem; }

.badge { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--text-2); }
.dots { display: inline-flex; gap: 2px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-3); display: inline-block; }
.diff-1 .dots i.on { background: var(--ok); }
.diff-2 .dots i.on { background: var(--foot-r); }
.diff-3 .dots i.on { background: var(--err); }
.cat-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag { font-size: 0.8rem; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--primary-container); color: var(--on-primary-container); text-decoration: none; }
.tag:hover { filter: brightness(1.05); }

/* ───────── Detail ───────── */
.detail-grid { display: grid; gap: 1.25rem; }
@media (min-width: 900px) { .detail-grid { grid-template-columns: minmax(340px, 420px) 1fr; align-items: start; } .detail-stage { position: sticky; top: 72px; } }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 0.6rem; }
.seg { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.4rem 1rem; border: none; background: var(--surface); color: var(--text); cursor: pointer; }
.seg + .seg { border-left: 1px solid var(--border); }
.seg[aria-pressed="true"] { background: var(--primary-container); color: var(--on-primary-container); }
.stage-box { background: var(--stage-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem; }
.stage { display: flex; justify-content: center; }
.stage svg { width: auto; max-width: 100%; height: min(46vh, 640px); }
@media (min-width: 900px) { .stage svg { height: min(62vh, 640px); } }
.editor-stage svg { height: min(58vh, 560px); }
.cue { text-align: center; font-weight: 600; min-height: 1.6rem; margin: 0.5rem 0; color: var(--primary); }
.controls { display: flex; flex-direction: column; gap: 0.4rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.6rem 0.8rem; }
.controls.disabled { opacity: 0.45; pointer-events: none; }
.controls-row { display: flex; align-items: center; justify-content: center; gap: 0.35rem; flex-wrap: wrap; }
.controls-row.tempo { gap: 0.6rem; }
.tempo-label { font-size: 0.85rem; color: var(--text-2); }
.slider { flex: 1; min-width: 120px; accent-color: var(--primary); height: 44px; margin: 0; }
.bpm-out { font-variant-numeric: tabular-nums; font-size: 0.85rem; color: var(--text-2); min-width: 8.5rem; text-align: right; }
.sound-icon { display: inline-flex; color: var(--text-3); }
.btn-sm { min-height: 40px; padding: 0.35rem 0.8rem; font-size: 0.9rem; }
.sound-status { margin: 0.25rem 0 0; font-size: 0.82rem; color: var(--text-3); text-align: center; max-width: 34rem; }
.sound-status[hidden] { display: none; }
.info .meta-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 0.6rem; }
.aliases { color: var(--text-3); font-size: 0.9rem; }
.desc { font-size: 1.05rem; }
.shows { color: var(--text-2); font-size: 0.9rem; }
.steps { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.steps.compact { max-height: 200px; }
.step { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0.7rem; cursor: pointer; min-height: 40px; }
.step:hover { background: var(--surface-2); }
.step.active { background: var(--primary-container); color: var(--on-primary-container); }
.step .no { width: 2rem; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-3); font-weight: 600; }
.step.active .no { color: inherit; }
.step.jump .cue-text::before { content: "⤴ "; }
.arm-hint { margin-left: auto; font-size: 0.8rem; color: var(--text-3); }
.step.active .arm-hint { color: inherit; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; align-items: center; }
.def { width: 100%; }
.def summary { cursor: pointer; color: var(--text-2); }
.error { color: var(--err); }

/* ───────── Editor ───────── */
.editor-grid { display: grid; gap: 1.25rem; }
@media (min-width: 900px) { .editor-grid { grid-template-columns: 1fr minmax(320px, 400px); align-items: start; } .editor-right { position: sticky; top: 72px; } }
.editor-toolbar { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.code { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; line-height: 1.45; padding: 0.75rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); resize: vertical; tab-size: 2; }
.msg { margin: 0.5rem 0; padding: 0.6rem 0.8rem; border-radius: var(--radius-sm); font-size: 0.9rem; }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.error { background: var(--err-bg); color: var(--err); }
.msg ul { margin: 0; }
.help { margin-top: 1rem; }
.help summary { cursor: pointer; font-weight: 600; }
.help-body { font-size: 0.9rem; color: var(--text-2); }
/* Konto + Marktplatz */
.login-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0 1rem; }
.konto-list { margin: 1rem 0; }
.konto-list h3 { margin: 0 0 0.5rem; }
.konto-list h4 { margin: 1rem 0 0.4rem; font-size: 0.9rem; color: var(--text-2); }
.konto-item { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding: 0.6rem 0.8rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 0.4rem; }
.konto-item-main { flex: 1 1 240px; min-width: 0; }
.konto-item-main p { margin: 0.15rem 0 0; }
.konto-item-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
.market-toolbar { flex-wrap: wrap; }
.market-list { display: grid; gap: 0.6rem; margin: 0.5rem 0 1rem; }
@media (min-width: 720px) { .market-list { grid-template-columns: 1fr 1fr; } }
.market-card { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.75rem 0.9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: inherit; text-decoration: none; }
.market-card:hover { border-color: var(--primary); }
.market-card-body { flex: 1; min-width: 0; }
.market-card h3 { margin: 0 0 0.2rem; font-size: 1.05rem; }
.market-card p { margin: 0.1rem 0; }
.market-desc { font-size: 0.9rem; color: var(--text-2); }
.btn-account .avatar-initial { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; font-size: 0.85rem; }
.cloud-row { align-items: center; gap: 0.75rem; }
.cloud-row .cat-info { margin: 0; }
/* Werbeplatz – zurückhaltend */
.ad-slot { margin: 1.25rem 0 0.5rem; padding: 0.6rem 0.8rem; border: 1px dashed var(--border); border-radius: var(--radius); font-size: 0.9rem; }
.ad-label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin-bottom: 0.35rem; }
.ad-card { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.45rem 0.6rem; margin: 0 0 0.35rem; border-radius: var(--radius-sm); background: var(--surface); color: inherit; text-decoration: none; border: 1px solid var(--border); }
.ad-card:hover { border-color: var(--primary); }
.ad-consent { margin: 0.25rem 0 0; color: var(--text-2); font-size: 0.85rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.detail-side .ad-slot { margin-top: 1rem; }
/* Premium, Gruppen, Feedback */
.premium-box ul { margin: 0.25rem 0 0.5rem; padding-left: 1.2rem; }
/* Trainingsprotokoll, Trainer-Dashboard */
.check-row { display: flex; align-items: flex-start; gap: 0.5rem; margin: 0.5rem 0; font-size: 0.9rem; color: var(--text-2); }
.check-row input { margin-top: 0.2rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.6rem; margin: 1rem 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.7rem 0.8rem; display: flex; flex-direction: column; gap: 0.15rem; }
.tile strong { font-size: 1.5rem; line-height: 1.1; color: var(--primary); }
.tile span { font-size: 0.8rem; color: var(--text-2); }
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; align-items: end; height: 150px; padding: 1.2rem 0 1.4rem; margin: 0 0 1rem; }
.bar-col { position: relative; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; min-width: 0; }
.bar { background: var(--primary); border-radius: 3px 3px 0 0; min-height: 2px; opacity: 0.85; }
.bar-val { position: absolute; top: -1.1rem; left: 0; right: 0; text-align: center; font-size: 0.72rem; color: var(--text-2); }
.bar-lbl { position: absolute; bottom: -1.3rem; left: 0; right: 0; text-align: center; font-size: 0.62rem; color: var(--text-3); white-space: nowrap; overflow: hidden; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.top-list { padding-left: 1.3rem; margin: 0.3rem 0 1rem; }
.top-list li { margin-bottom: 0.2rem; }
.log-list { margin: 0.5rem 0; }
.player-logged { margin-top: 0.6rem; display: flex; align-items: center; gap: 0.2rem; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; margin: 0.5rem 0 1rem; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.dash-table th, .dash-table td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.dash-table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-2); }
.dash-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.avatar-sm { width: 22px; height: 22px; border-radius: 50%; vertical-align: middle; }
.progress h3 { display: flex; align-items: center; gap: 0.3rem; margin: 1.2rem 0 0.4rem; }
.group-box summary { cursor: pointer; font-weight: 700; font-size: 1.05rem; margin-bottom: 0.5rem; }
.group-plans { margin-top: 0.4rem; }
.feedback-form { display: grid; gap: 0.75rem; max-width: 40rem; }
.feedback-form .field { display: grid; gap: 0.25rem; font-size: 0.9rem; color: var(--text-2); }
.feedback-text { min-height: 9rem; font-family: inherit; font-size: 1rem; }
/* Einstellungen */
.settings-section { max-width: 46rem; margin: 0 0 1.25rem; padding: 0.9rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.settings-section h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.settings-section .cat-info { margin: 0.25rem 0 0.5rem; }
.settings-preview { margin-top: 0.5rem; }
.settings-preview .thumb { width: 150px; margin: 0; border-radius: var(--radius-sm); }
.settings-preview .thumb .field-no { display: block; }
/* Hilfeseite */
.help-page .hero { padding-bottom: 0.25rem; }
.help-toc { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0 1rem; }
.help-toc a { font-size: 0.85rem; padding: 0.3rem 0.7rem; border-radius: 999px; background: var(--surface-2); color: var(--text); text-decoration: none; }
.help-toc a:hover { background: var(--primary-container); color: var(--on-primary-container); }
.help-section { margin: 0 0 1.5rem; max-width: 46rem; }
.help-section h3 { margin: 1rem 0 0.4rem; scroll-margin-top: 4.5rem; }
.help-section p { margin: 0 0 0.6rem; line-height: 1.55; }
.help-figure { margin: 1rem 0 1.25rem; padding: 0.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); max-width: 46rem; }
.help-figure figcaption { font-size: 0.85rem; color: var(--text-2); margin-bottom: 0.5rem; }
.help-matrix { width: 100%; height: auto; display: block; font-family: inherit; }
.help-matrix .hm-head { font-size: 13px; font-weight: 700; fill: var(--text-2); }
.help-matrix .hm-label { font-size: 13px; fill: var(--text); }
.help-matrix .hm-total .hm-label { font-weight: 700; }
.help-matrix .hm-num { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.help-matrix .hm-sum { fill: var(--text); }
.help-matrix .hm-pct { font-size: 12px; fill: var(--text-2); font-variant-numeric: tabular-nums; }
.help-matrix .hm-cell { cursor: help; }
.help-matrix .hm-cell:hover rect { stroke: var(--text); stroke-width: 1.5; }
.help-table-wrap { margin-top: 0.5rem; font-size: 0.85rem; }
.help-table-wrap summary { cursor: pointer; color: var(--text-2); }
.help-table { border-collapse: collapse; margin-top: 0.4rem; width: 100%; }
.help-table th, .help-table td { padding: 0.25rem 0.5rem; text-align: right; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.help-table th:first-child { text-align: left; font-weight: 500; }

/* ───────── Bühne (SVG) ───────── */
.stage-svg { display: block; }
.stage-svg text { font-family: inherit; }
.zone { fill: var(--zone); }
.zone-label { fill: var(--zone-text); font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.ladder-body { fill: var(--ladder-fill); }
.rung { stroke: var(--rung); stroke-width: 4; stroke-linecap: round; }
.rail { stroke: var(--ladder-line); stroke-width: 2; }
.field-no { fill: var(--field-no); font-size: 10px; font-weight: 600; }
.foot path { stroke-width: 1.5; }
.foot-l path { fill: var(--foot-l); stroke: var(--foot-l-dark); }
.foot-r path { fill: var(--foot-r); stroke: var(--foot-r-dark); }
.foot-label { fill: var(--foot-text); font-size: 13px; font-weight: 700; }
.foot.ghost path { fill: none; stroke-dasharray: 3 3; }
.foot.ghost .foot-label { fill: var(--text-3); }
.foot.repeat { opacity: 0.85; }
.static .foot { cursor: pointer; }
.body .shoulders { stroke: var(--body); stroke-width: 7; stroke-linecap: round; stroke-opacity: 0.9; }
.body .head { fill: var(--body-fill); stroke: var(--body); stroke-width: 2.5; fill-opacity: 0.92; }
.body .arm { fill: none; stroke: var(--body); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.body .hand { fill: var(--body-fill); stroke: var(--body); stroke-width: 2; }
.body .hand.raised { fill: var(--primary); stroke: var(--body); }
.ball-shadow { fill: rgba(0, 0, 0, 0.15); transform: translate(2px, 3px); }
.ball-body { fill: var(--ball); stroke: var(--ball-line); stroke-width: 1.5; }
.ball-seam { fill: none; stroke: var(--ball-line); stroke-width: 1.2; }
.ball-foot .ball-seam { fill: var(--ball-line); stroke: none; }
.in-air .ball-body { stroke-dasharray: 3 2; }
.in-air .ball-shadow { transform: translate(6px, 8px); }

/* Touch: Sprechblase für lange gedrückte Knöpfe, Blättern, Wisch-Animation */
#tip { position: fixed; z-index: 60; max-width: min(320px, calc(100vw - 16px)); background: var(--text); color: var(--bg); font-size: 0.85rem; line-height: 1.35; padding: 0.5rem 0.75rem; border-radius: 10px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity 0.15s; }
#tip.show { opacity: 1; }
button, a, .chip, .seg, .step { -webkit-touch-callout: none; }
.touch-hint { font-size: 0.8rem; color: var(--text-3); margin: 0 0 0.25rem; }
.nav-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin: 0 0 0.75rem; }
.nav-pos { font-size: 0.85rem; color: var(--text-2); text-align: center; flex: 1; min-width: 0; }
.btn-nav { max-width: 40%; }
.btn-nav span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes swipe-left { from { transform: translateX(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes swipe-right { from { transform: translateX(-24px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.grid.swipe-left { animation: swipe-left 0.25s ease-out; }
.grid.swipe-right { animation: swipe-right 0.25s ease-out; }
@media (prefers-reduced-motion: reduce) { .grid.swipe-left, .grid.swipe-right { animation: none; } }
.prev, .next { display: inline; }

#toast { position: fixed; left: 50%; bottom: calc(1.5rem + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 0.6rem 1.1rem; border-radius: 999px; opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none; z-index: 50; box-shadow: var(--shadow-lg); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .card, .btn, .btn-icon { transition: none; }
}

/* ───────── Trainingspläne (plans.js) ───────── */
.plan-list { display: grid; gap: 0.75rem; }
.plan-toolbar { margin-bottom: 0.5rem; }
.plan-groups { display: grid; gap: 1.25rem; margin: 0.5rem 0 1.25rem; }
.plan-group-title { margin: 0 0 0.5rem; font-size: 1.05rem; display: flex; align-items: baseline; gap: 0.4rem; }
.count-inline { font-size: 0.8rem; color: var(--text-3); font-weight: 500; }
.badge-tpl { background: var(--surface-2); color: var(--text-2); font-size: 0.72rem; padding: 0.1rem 0.5rem; border-radius: 999px; vertical-align: middle; }
.plan-card-ro { border-style: dashed; }
/* Standardwerte / „Für alle Übungen“ */
.defaults-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; margin: 0.5rem 0 0.75rem; }
.defaults-block h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.defaults-block .cat-info { margin: 0 0 0.5rem; }
.defaults-row { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: center; }
.defaults-field { display: inline-flex; align-items: center; gap: 0.4rem; }
.defaults-label { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.85rem; color: var(--text-2); font-weight: 600; }
.defaults-details { margin-top: 1rem; }
.defaults-details .defaults-block { border: none; padding: 0.25rem 0 0; margin: 0; }
.chip-muted { color: var(--text-3); border-style: dashed; cursor: help; }
.chip[disabled] { opacity: 0.6; cursor: not-allowed; }
.custom-mark { color: var(--primary); font-weight: 800; }
.custom-mark[hidden] { display: none; }
.plan-item-ro { grid-template-columns: auto 1fr; }
.plan-items-ro { gap: 0.5rem; }
.plan-card { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1rem; box-shadow: var(--shadow); }
.plan-card-body { flex: 1 1 260px; min-width: 0; }
.plan-card-body h3 { margin: 0 0 0.2rem; }
.plan-card-body h3 a { color: inherit; text-decoration: none; }
.plan-card-actions { display: flex; align-items: center; gap: 0.25rem; }
.plan-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.75rem 0 0.25rem; }
.plan-name { flex: 1 1 220px; padding-left: 1rem; font-weight: 600; }
.plan-items { display: flex; flex-direction: column; margin: 0.5rem 0 1.5rem; }
.plan-block { display: flex; flex-direction: column; }
.plan-block.dragging { opacity: 0.35; }
.drag-ghost { position: fixed; z-index: 70; pointer-events: none; opacity: 0.95; box-shadow: var(--shadow-lg); border-radius: var(--radius); background: var(--surface); }
.drag-ghost .plan-gap { display: none; }
.plan-item { display: grid; grid-template-columns: auto auto 1fr auto; gap: 0.5rem; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem 0.6rem; box-shadow: var(--shadow); }
.plan-item.missing { grid-template-columns: 1fr auto; color: var(--err); }
.drag-handle { width: 36px; height: 56px; border: none; background: var(--surface-2); border-radius: 10px; color: var(--text-3); cursor: grab; touch-action: none; display: inline-flex; align-items: center; justify-content: center; font: inherit; }
.drag-handle:active { cursor: grabbing; }
.plan-thumb { width: 44px; }
.thumb.thumb-xs { aspect-ratio: auto; width: 44px; height: 68px; padding: 2px; border-radius: 8px; }
.thumb-xs .foot-label { display: none; }
.plan-item-main { min-width: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.plan-item-head { display: flex; align-items: baseline; gap: 0.5rem; min-width: 0; }
.plan-no { font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; }
.plan-item-name { font-weight: 600; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.plan-item-name:hover { color: var(--primary); }
.plan-item-dur { font-size: 0.8rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.plan-item-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; }
.plan-item-controls .chip { gap: 0.3rem; }
.chip[aria-pressed="true"] { background: var(--primary-container); color: var(--on-primary-container); border-color: transparent; }
.tempo-ctrl { display: inline-flex; align-items: center; gap: 0.35rem; flex: 1 1 150px; }
.slider-sm { height: 36px; min-width: 90px; }
.stepper { display: inline-flex; align-items: center; gap: 0.1rem; }
.stepper-value { min-width: 3.6rem; text-align: center; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.btn-mini { width: 36px; height: 36px; font-size: 1.1rem; font-weight: 600; }
.plan-item-side { display: grid; grid-template-columns: 1fr 1fr; gap: 0.1rem; }
.plan-gap { display: flex; align-items: center; gap: 0.5rem; padding: 0.15rem 0.5rem; color: var(--text-2); font-size: 0.85rem; }
.gap-line { flex: 1; height: 1px; background: var(--border); }
.gap-label { display: inline-flex; align-items: center; gap: 0.25rem; }
.pick { margin-top: 1rem; padding: 1rem; border-radius: var(--radius); background: var(--surface-2); }
.pick h3 { margin-top: 0; }
.pick .search { padding-left: 1rem; margin-bottom: 0.5rem; }
.pick-results { display: grid; gap: 0.3rem; max-height: 320px; overflow: auto; }
.pick-item { display: flex; align-items: center; gap: 0.6rem; width: 100%; text-align: left; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; min-height: 44px; }
.pick-item:hover { border-color: var(--primary); }
.pick-name { flex: 1; font-weight: 500; }
.pick-meta { font-size: 0.8rem; color: var(--text-3); }
.plan-add { width: 100%; }
.plan-add-menu { display: grid; gap: 0.3rem; margin-top: 0.5rem; }
@media (max-width: 640px) {
  .plan-item { grid-template-columns: auto 1fr auto; }
  .plan-thumb { display: none; }
  .plan-item-side { grid-template-columns: 1fr; }
}
/* Abspielen */
.player-head { margin: 0.5rem 0 0.75rem; }
.player-head h2 { margin: 0.1rem 0; font-size: 1.4rem; }
.player-step { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); font-weight: 600; }
.player-grid { display: grid; gap: 1rem; }
@media (min-width: 900px) { .player-grid { grid-template-columns: minmax(340px, 420px) 1fr; align-items: start; } }
.player-big { font-size: clamp(2.4rem, 8vw, 4rem); font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--primary); }
.player-sub { color: var(--text-2); margin-bottom: 0.5rem; }
.player-progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin: 0.5rem 0 0.75rem; }
.player-progress i { display: block; height: 100%; width: 0; background: var(--primary); transition: width 0.5s linear; }
.player-next { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.player-next .thumb-xs { flex: 0 0 auto; }
.player-done { display: flex; align-items: center; justify-content: center; height: min(46vh, 400px); color: var(--ok); }

/* ───────── Druck- / PDF-Ansichten (print.js) ───────── */
.print-view { background: #eef0f3; min-height: 100vh; }
.print-bar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; padding: 0.6rem 1rem; background: var(--bg); border-bottom: 1px solid var(--border); }
.print-hint { flex: 1; font-size: 0.85rem; color: var(--text-2); min-width: 200px; }
/* Das Dokument ist immer hell – auch im Dark Mode der App und beim Drucken */
.print-doc {
  --bg: #fff; --text: #1f2733; --text-2: #4d5d75; --text-3: #61748d; --border: #d3dae3; --surface-2: #ebeef2;
  --stage-bg: #fff; --ladder-fill: #fff; --ladder-line: #adb9c8; --rung: #1f2733; --zone: #ebeef2; --zone-text: #61748d; --field-no: #8092a8;
  --foot-l: #2f7fd1; --foot-l-dark: #163f70; --foot-r: #f28c28; --foot-r-dark: #8a4a0c; --foot-text: #fff;
  color: var(--text); background: #fff; max-width: 210mm; margin: 1rem auto; padding: 14mm 14mm 10mm; box-shadow: var(--shadow-lg); font-size: 10.5pt; line-height: 1.4;
}
.print-doc h1 { font-size: 22pt; margin: 0 0 0.2rem; }
.print-doc h2 { font-size: 15pt; margin: 0 0 0.15rem; }
.print-doc h3 { font-size: 10.5pt; margin: 0.6rem 0 0.2rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); }
.print-doc p { margin: 0 0 0.4rem; }
.print-doc ul, .print-doc ol { margin: 0 0 0.4rem; padding-left: 1.2rem; }
.pd-eyebrow { font-size: 9pt; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin-bottom: 0.2rem; }
.pd-head { border-bottom: 2px solid var(--text); padding-bottom: 0.5rem; margin-bottom: 0.9rem; }
.pd-meta { color: var(--text-2); font-size: 9.5pt; }
.pd-aliases { color: var(--text-3); font-size: 9pt; }
.pd-table { width: 100%; border-collapse: collapse; margin: 0.4rem 0 0.6rem; font-size: 9.5pt; }
.pd-table th, .pd-table td { text-align: left; padding: 0.3rem 0.45rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.pd-table th { font-size: 8.5pt; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); border-bottom: 1px solid var(--text); }
.pd-table td.num, .pd-table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pd-note { font-size: 8.5pt; color: var(--text-3); }
.pd-checkboxes { letter-spacing: 0.3em; }
.pd-section { margin-top: 1.2rem; padding-top: 0.6rem; border-top: 1px solid var(--border); }
.pd-sheet { break-inside: avoid; page-break-inside: avoid; margin: 0.8rem 0 1rem; padding-top: 0.6rem; border-top: 1px dashed var(--border); }
.pd-plan .pd-sheet:first-of-type, .pd-single .pd-sheet { border-top: none; padding-top: 0; }
.pd-sheet-head { display: flex; align-items: flex-start; gap: 0.6rem; margin-bottom: 0.5rem; }
.pd-no { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; background: var(--text); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11pt; }
.pd-sheet-body { display: grid; grid-template-columns: 62mm 1fr; gap: 6mm; align-items: start; }
.pd-single .pd-sheet-body { grid-template-columns: 80mm 1fr; }
.pd-diagram svg { width: 100%; height: auto; display: block; }
.pd-diagram .foot-label { font-size: 15px; }
.pd-steps { columns: 2; column-gap: 1.2rem; font-size: 9.5pt; }
.pd-steps li { break-inside: avoid; }
.pd-desc { font-size: 10.5pt; }
.pd-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5mm; }
.pd-card { display: grid; grid-template-columns: 30mm 1fr; gap: 3mm; break-inside: avoid; page-break-inside: avoid; border: 1px solid var(--border); border-radius: 6px; padding: 3mm; }
.pd-card h3 { text-transform: none; letter-spacing: 0; color: var(--text); font-size: 11pt; margin: 0 0 0.1rem; }
.pd-card .pd-meta { font-size: 8.5pt; margin-bottom: 0.2rem; }
.pd-desc-sm { font-size: 9pt; }
.pd-steps-inline { font-size: 8pt; color: var(--text-2); margin: 0; }
.pd-footer { margin-top: 1rem; padding-top: 0.4rem; border-top: 1px solid var(--border); font-size: 8pt; color: var(--text-3); overflow-wrap: anywhere; }
/* Ein Diagramm wird nie geteilt: eigener Block, der als Ganzes umbricht, und
   nie höher als eine Seite (A4 minus Ränder ≈ 270 mm). */
.pd-diagram { break-inside: avoid; page-break-inside: avoid; display: block; }
.pd-diagram svg { max-height: 250mm; }
.pd-sheet-head, .pd-gcard-head { break-after: avoid; page-break-after: avoid; }
/* Nur-Grafik-Modus */
.pd-ggrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5mm; }
.pd-ggrid-4 { grid-template-columns: repeat(4, 1fr); }
.pd-gcard { break-inside: avoid; page-break-inside: avoid; border: 1px solid var(--border); border-radius: 6px; padding: 3mm; }
.pd-gcard-head { display: flex; align-items: flex-start; gap: 0.4rem; margin-bottom: 0.3rem; min-height: 2.2rem; }
.pd-gcard-head h2 { font-size: 10.5pt; margin: 0; line-height: 1.2; }
.pd-gcard-head .pd-meta { font-size: 8pt; margin: 0.1rem 0 0; }
.pd-gcard .pd-no { width: 22px; height: 22px; font-size: 9pt; }
.pd-diagram-g svg { width: 100%; height: auto; }
.pd-ggrid-4 .pd-diagram .foot-label { font-size: 18px; }
.pd-gsingle { text-align: center; }
.pd-gsingle h2 { font-size: 18pt; }
.pd-diagram-big { max-width: 120mm; margin: 0.5rem auto 0; }
@media (max-width: 640px) {
  .print-doc { padding: 6mm; margin: 0.5rem; font-size: 10pt; }
  .pd-ggrid, .pd-ggrid-4 { grid-template-columns: repeat(2, 1fr); }
  .pd-sheet-body, .pd-single .pd-sheet-body { grid-template-columns: 1fr; }
  .pd-sheet-body .pd-diagram { max-width: 60mm; }
  .pd-grid { grid-template-columns: 1fr; }
}
@media print {
  @page { size: A4; margin: 12mm; }
  html, body { background: #fff !important; }
  .print-bar, .app-header, #toast, #tip { display: none !important; }
  .print-view { background: #fff; }
  .print-doc { max-width: none; margin: 0; padding: 0; box-shadow: none; }
  .pd-grid { grid-template-columns: repeat(2, 1fr); }
  .pd-ggrid { grid-template-columns: repeat(3, 1fr); }
  .pd-ggrid-4 { grid-template-columns: repeat(4, 1fr); }
  a { color: inherit; text-decoration: none; }
}

/* Site footer under <main>; not printed. */
.site-foot { max-width: 1100px; margin: 0 auto; padding: 1rem; font-size: 0.8rem; color: var(--text-3); text-align: center; }
.site-foot a { color: var(--text-3); }
.site-foot .site-foot-cancel { display: inline-block; margin-top: 0.3rem; padding: 0.15rem 0.5rem; border: 1px solid var(--text-3); border-radius: 999px; white-space: nowrap; }
@media print { .site-foot { display: none; } }

/* ───────── Grafischer Übungs-Editor (editor.js) ───────── */
.ed-section { margin: 0 0 1.25rem; padding: 0.9rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.ed-section h3 { margin: 0 0 0.6rem; font-size: 1rem; }
.ed-row { display: grid; gap: 0.75rem; }
@media (min-width: 640px) { .ed-row { grid-template-columns: 1fr 1fr; } }
.ed-field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.75rem; min-width: 0; }
.ed-label { font-size: 0.85rem; color: var(--text-2); font-weight: 600; }
.ed-hint { font-size: 0.8rem; color: var(--text-3); }
.ed-input { width: 100%; padding: 0.55rem 0.75rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; }
.ed-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem; }
.ed-chips { flex-wrap: wrap; overflow: visible; }
.ed-actions { margin: 0; }
.ed-check { display: inline-flex; align-items: center; gap: 0.3rem; min-height: 40px; font-size: 0.9rem; }
.seg-wrap { flex-wrap: wrap; border-radius: var(--radius-sm); margin-bottom: 0; }
.seg-wrap .seg { padding: 0.4rem 0.75rem; font-size: 0.9rem; }
.beat-editor { display: grid; gap: 1rem; margin-top: 0.5rem; }
@media (min-width: 640px) { .beat-editor { grid-template-columns: minmax(200px, 1fr) minmax(260px, 1.3fr); align-items: start; } }
.beat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; max-height: 420px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.beat { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; padding: 0.35rem 0.5rem 0.35rem 0.7rem; min-height: 44px; cursor: pointer; font-size: 0.9rem; }
.beat:hover { background: var(--surface-2); }
.beat.active { background: var(--primary-container); color: var(--on-primary-container); }
.beat-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.beat-actions { display: inline-flex; gap: 0.1rem; }
.beat-actions .btn-mini { width: 32px; height: 32px; }
.beat-actions .btn-mini[disabled] { opacity: 0.3; cursor: default; }
.beat-grid-box { margin: 0.5rem 0; }
.beat-grid { width: 100%; max-width: 300px; height: auto; display: block; margin: 0 auto; touch-action: manipulation; }
.bg-cell { fill: var(--surface-2); stroke: var(--border); stroke-width: 1; cursor: pointer; }
.bg-cell.bg-field { fill: var(--ladder-fill); stroke: var(--ladder-line); }
.bg-cell.bg-cycle { stroke: var(--primary); stroke-width: 1.5; }
.bg-cell.bg-half { opacity: 0.7; }
.bg-cell:hover, .bg-cell:focus-visible { fill: var(--primary-container); outline: none; }
.bg-rung { stroke: var(--rung); stroke-width: 3; stroke-linecap: round; pointer-events: none; }
.bg-label { fill: var(--field-no); font-size: 11px; font-weight: 600; }
.bg-foot circle { stroke-width: 2; opacity: 0.45; }
.bg-foot.moved circle { opacity: 1; }
.bg-foot-l circle { fill: var(--foot-l); stroke: var(--foot-l-dark); }
.bg-foot-r circle { fill: var(--foot-r); stroke: var(--foot-r-dark); }
.bg-foot text { fill: var(--foot-text); font-size: 12px; font-weight: 700; }
.bg-ball circle { fill: var(--ball); stroke: var(--ball-line); stroke-width: 2; }
.bg-ball text { font-size: 12px; }
.bg-note { text-align: center; margin: 0.25rem 0 0; }
.beat-opts .ed-field { margin-bottom: 0.5rem; }
