/* RhythmJemp – Ein-Bildschirm-App im Erscheinungsbild von EarJemp.
   Farben, Schriften: vendor/theme/theme.css.
   Aufbau (Hochformat, ohne Scrollen): Kopfzeile · Bühne (Abspielen + Notenfeld, wächst) ·
   Rückmeldung · Eingabe unten in Daumenreichweite. */
* { box-sizing: border-box; min-width: 0; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 15px; line-height: 1.4;
  touch-action: manipulation; overflow: hidden; overscroll-behavior: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.lbl { font: 600 10px var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.kbd { font: 500 10px/1.5 var(--font-mono); opacity: .6; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin: 0 2px; }

.app {
  height: 100vh; height: 100dvh; max-width: 760px; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px));
}

/* Kopfzeile */
.top { display: flex; align-items: center; gap: 10px; height: 50px; flex: none; }
.brand { display: flex; align-items: center; gap: 9px; font: 700 17px/1 var(--font-display); color: var(--fg); text-decoration: none; letter-spacing: -.01em; }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.hub-link { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 2px; border-right: 1px solid var(--line); color: var(--muted); font: 500 13px var(--font-body); text-decoration: none; white-space: nowrap; flex: none; }
.hub-link svg { fill: currentColor; }
.hub-link:hover, .hub-link:focus-visible { color: var(--fg); }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--surface); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line2); font: 600 12.5px var(--font-body); white-space: nowrap; max-width: 52vw; }
.chip span { overflow: hidden; text-overflow: ellipsis; }
.chip svg { flex: none; color: var(--brass); }
.chip:hover { background: var(--raise); }
.gbtn { display: inline-flex; align-items: center; justify-content: center; height: 34px; min-width: 34px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.gbtn:hover { background: var(--raise); color: var(--fg); }
.gbtn[aria-expanded="true"] { color: var(--brass); }
@media (max-width: 640px) { .hub-link span { display: none; } .hub-link { padding-right: 8px; } }
@media (max-width: 520px) { .top { gap: 8px; } .brand span { display: none; } }

/* Hauptbereich */
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* Bühne: Abspielen und Notenfeld als eine Einheit */
.stagebox { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; padding: 12px 12px 8px; }
.stagehead { display: flex; align-items: center; gap: 12px; flex: none; }
.playbtn { width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--brass); color: var(--brass-ink); display: grid; place-items: center; position: relative; flex: none; box-shadow: 0 6px 16px color-mix(in srgb, var(--brass) 30%, transparent); }
.playbtn:hover { filter: brightness(1.07); }
.playbtn:active { transform: scale(.96); }
.playbtn.playing::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--brass); opacity: .5; animation: ring 1.1s ease-out infinite; }
@keyframes ring { from { transform: scale(.92); opacity: .7 } to { transform: scale(1.18); opacity: 0 } }
.stagetxt { display: flex; flex-direction: column; min-width: 0; }
.stagetxt b { font: 700 17px/1.15 var(--font-display); letter-spacing: -.01em; }
.stagetxt span { font: 500 12px var(--font-mono); color: var(--faint); }
.minibtn { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line2); font: 600 12.5px var(--font-body); white-space: nowrap; }
.minibtn:hover { color: var(--fg); background: var(--raise); }
.minibtn:disabled { opacity: .35; cursor: default; }
.sheet { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding-top: 6px; }
.sheet::before, .sheet::after { content: ""; flex: 1 1 0; }  /* mittig, ohne oben abzuschneiden */
.seg.mini { padding: 2px; }
.seg.mini button { min-height: 28px; padding: 0 12px; font-size: 12.5px; }
.lblrow { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.stats { font: 500 11px var(--font-mono); color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats b { color: var(--muted); font-weight: 600; }
.staff { cursor: pointer; user-select: none; -webkit-user-select: none; color: var(--fg); padding: 2px 0; }
.staff.ro { cursor: default; }
.staff svg { display: block; max-width: 100%; height: auto; overflow: visible; margin: 0 auto; }
.staff .ts { font: 700 23px var(--font-display); text-anchor: middle; fill: currentColor; }
.cur { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.solbox { border-top: 1px dashed var(--line2); padding-top: 6px; margin-top: 4px; }

/* Rückmeldung: eine Zeile, bei der Auswertung zwei */
.feedback { flex: none; text-align: center; font-weight: 600; min-height: 22px; margin: 8px 0; font-size: 15px; line-height: 1.3; }
.feedback.hint { color: var(--brass); font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feedback .ic { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; margin-right: 6px; font-size: 13px; vertical-align: -3px; }
.feedback.ok { color: var(--ok); } .feedback.ok .ic { background: var(--ok); color: var(--bg); }
.feedback.bad { color: var(--bad); } .feedback.bad .ic { background: var(--bad); color: var(--bg); }
.feedback.mid { color: var(--mid); } .feedback.mid .ic { background: var(--mid); color: var(--bg); }
.feedback .count { font: 700 24px var(--font-display); letter-spacing: -.02em; margin-right: 6px; vertical-align: -2px; }
.feedback small { display: block; color: var(--muted); font-weight: 500; font-size: 12.5px; }
.legend { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 500; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }

/* Eingabe unten */
.dock { flex: none; display: flex; flex-direction: column; gap: 8px; padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)); }
.toolrow { display: flex; align-items: center; gap: 6px; }
.grow { flex: 1; }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--bg); border-radius: 10px; padding: 3px; gap: 2px; box-shadow: inset 0 0 0 1px var(--line2); }
.seg button { border: 0; background: transparent; color: var(--muted); min-height: 36px; padding: 0 14px; border-radius: 8px; font: 600 13.5px var(--font-body); white-space: nowrap; }
.seg button:hover { color: var(--fg); }
.seg button[aria-pressed="true"] { background: var(--raise); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line2), 0 1px 2px #0001; }
.tbtn { display: inline-flex; align-items: center; justify-content: center; height: 42px; min-width: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: 600 13.5px var(--font-body); }
.tbtn:hover { background: var(--raise); color: var(--fg); }
.tbtn.icon { background: var(--surface); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line2); width: 52px; }
.tbtn:disabled { opacity: .35; cursor: default; }
.answers { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.abtn { position: relative; height: 60px; border: 0; border-radius: 12px; background: var(--surface); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); transition: transform .06s, background .15s; padding: 0; display: grid; place-items: center; overflow: hidden; }
.abtn:hover { background: var(--raise); }
.abtn:active, .abtn.hit { transform: scale(.95); background: color-mix(in srgb, var(--brass) 18%, var(--surface)); }
.abtn .k { position: absolute; top: 4px; right: 6px; font: 500 10px var(--font-mono); color: var(--faint); }
.abtn svg { width: 36px; height: 50px; }
.pbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 50px; padding: 0 22px; border: 0; border-radius: 14px; background: var(--brass); color: var(--brass-ink); font: 700 16px var(--font-body); width: 100%; }
.pbtn:hover { filter: brightness(1.07); }
.pbtn.wait { background: var(--surface); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line2); }
.pbtn small { font: 500 12px var(--font-mono); opacity: .75; }
.sbtn { display: inline-flex; align-items: center; justify-content: center; height: 50px; padding: 0 16px; border-radius: 14px; border: 0; background: var(--surface); color: var(--fg); font: 600 15px var(--font-body); box-shadow: inset 0 0 0 1px var(--line2); white-space: nowrap; }
.sbtn:hover { background: var(--raise); }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 8px; }
.hintline { color: var(--faint); font-size: 12px; text-align: center; margin: 0; }

/* Einstellungen: Blatt von unten */
.backdrop { position: fixed; inset: 0; z-index: 30; background: var(--backdrop, #0006); }
.optsheet { position: fixed; z-index: 31; left: 50%; bottom: 0; transform: translateX(-50%); width: min(560px, 100%); max-height: 88dvh; overflow-y: auto; background: var(--raise); border-radius: 20px 20px 0 0; box-shadow: var(--shadow-pop); padding: 6px 18px max(16px, env(safe-area-inset-bottom, 0px)); animation: up .2s ease-out; }
@keyframes up { from { transform: translate(-50%, 30px); opacity: 0; } }
.opthead { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 4px; }
.opthead h3 { margin: 0; font: 700 18px var(--font-display); }
.opthead .tbtn { color: var(--brass); }
.vrow { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; padding: 10px 0; flex-wrap: wrap; }
.vrow + .vrow { border-top: 1px solid var(--line); }
.vrow > span, .vrow > label { color: var(--muted); font-size: 14px; font-weight: 600; }
.vrow small { color: var(--faint); font-size: 12px; font-weight: 500; }
.vrow.col { flex-direction: column; align-items: stretch; }
.seg.wide { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.seg.wide button { padding: 0 4px; font-size: 13px; }
#lvSeg button { font-size: 12px; }
.switch { width: 44px; height: 26px; border-radius: 999px; border: 0; background: var(--line2); position: relative; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--fg); transition: transform .15s; }
.switch[aria-pressed="true"] { background: var(--brass); }
.switch[aria-pressed="true"]::after { transform: translateX(18px); background: var(--brass-ink); }
.tempo { display: flex; align-items: center; gap: 10px; flex: 1; justify-content: flex-end; }
.tempo input { accent-color: var(--brass); width: min(200px, 100%); height: 28px; }
.tempo b { font: 600 13px var(--font-mono); min-width: 58px; text-align: right; white-space: nowrap; }
.optnote { color: var(--faint); font-size: 12px; margin: 4px 0 0; }

/* Hilfe */
.pop { position: fixed; right: max(12px, env(safe-area-inset-right, 0px)); top: calc(52px + env(safe-area-inset-top, 0px)); z-index: 40; width: min(340px, calc(100vw - 24px)); background: var(--raise); border: 1px solid var(--line2); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow-pop); }
.pop h3 { margin: 0 0 10px; font: 700 15px var(--font-display); }
.pop dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 12.5px; }
.pop dt { font-family: var(--font-mono); color: var(--brass); white-space: nowrap; }
.pop dd { margin: 0; color: var(--muted); }

/* Größere Bildschirme: etwas mehr Luft */
@media (min-width: 700px) and (min-height: 700px) {
  .top { height: 60px; }
  .stagebox { padding: 18px 20px 12px; }
  .playbtn { width: 72px; height: 72px; }
  .stagetxt b { font-size: 21px; }
  .abtn { height: 68px; }
  .abtn svg { width: 40px; height: 54px; }
  .feedback { margin: 12px 0; }
}
/* Sehr niedrige Bildschirme */
@media (max-height: 600px) {
  .top { height: 44px; }
  .stagebox { padding: 8px 10px 6px; }
  .playbtn { width: 46px; height: 46px; }
  .abtn { height: 52px; }
  .abtn svg { width: 32px; height: 44px; }
  .pbtn, .sbtn { height: 46px; }
  .feedback { margin: 6px 0; }
  .dock { gap: 6px; }
  .optnote { display: none; }
}
@media (pointer: coarse) { .abtn .k, .hintline { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .switch::after, .abtn { transition: none; }
  .cur, .playbtn.playing::after, .optsheet { animation: none; }
}
