:root {
  --bg: #141114;
  --bg2: #0e0c0e;
  --card: #1e1a1e;
  --card2: #2a242a;
  --line: #372f36;
  --text: #f0e9e2;
  --muted: #a69ca3;
  --accent: #f2a93b;
  --accent-ink: #2a1806;
  --ok: #5cc98b;
  --bad: #f06a5f;
  --blue: #72b9e6;
  --ivory: #efe6d6;
  --r: 16px;
  --tabs-h: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; color: var(--text);
  background: radial-gradient(120% 60% at 50% -10%, #2a1c14 0%, var(--bg) 55%) fixed, var(--bg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 1.7rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: .4em 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
b { font-weight: 700; }
svg { display: block; }
button { font: inherit; color: inherit; }

/* ——— Kopfzeile & Navigation ——— */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 16px 0;
  background: rgba(20, 17, 20, .97);
  border-bottom: 1px solid var(--line);
}
/* kein backdrop-filter am Header: der würde die fixe Tab-Leiste darin einsperren */
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; }
.brand svg { width: 26px; height: 26px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; font-size: 18px; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { background: var(--card2); }
.streak { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; color: var(--muted); padding: 4px 8px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.streak svg { width: 18px; height: 18px; fill: #5d5359; }
.streak.done { color: var(--text); }
.streak.done svg { fill: var(--accent); }

.tabs a { color: var(--muted); text-decoration: none; display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: .92rem; }
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--accent); }
@media (max-width: 760px) {
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(24, 20, 24, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  }
  .tabs a { flex-direction: column; justify-content: center; gap: 2px; font-size: .7rem; }
}
@media (min-width: 761px) {
  .tabs { display: flex; gap: 4px; margin-left: 24px; }
  .tabs a { padding: 8px 12px; border-radius: 10px; }
  .tabs a:hover { color: var(--text); background: var(--card); }
  .tabs a.on { background: var(--card); }
  .tabs svg { width: 18px; height: 18px; }
}
body.in-quiz .top, body.in-quiz .tabs { display: none; }

/* ——— Seiten ——— */
.page { max-width: 760px; margin: 0 auto; padding: 18px 16px calc(var(--tabs-h) + 32px + env(safe-area-inset-bottom)); }
@media (min-width: 761px) { .page { padding-bottom: 48px; } }
.page.explore, .page.progress { max-width: 1180px; }
.pagetitle { margin: 6px 0 14px; }
.lead { margin-top: -6px; }
.sec { margin: 28px 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.card + .card { margin-top: 12px; }
.hero { background: linear-gradient(160deg, #2b1f17, var(--card) 60%); border-color: #4a3726; }
.eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; margin-bottom: 4px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.back { display: inline-block; margin-bottom: 10px; text-decoration: none; font-weight: 600; }
.warn { color: var(--bad); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card2); color: var(--text);
  font-weight: 650; text-decoration: none; cursor: pointer; transition: transform .08s, background .15s;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: .85rem; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.confirm { background: var(--bad); border-color: var(--bad); color: #fff; }
@media (hover: hover) {
  .btn:hover:not(:disabled) { background: #342c34; }
  .btn.primary:hover:not(:disabled) { background: #ffb84f; }
}
.pill { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--bad); color: #fff; font-size: .75rem; line-height: 20px; }

.bar { height: 6px; border-radius: 99px; background: var(--bg2); overflow: hidden; margin: 10px 0 4px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--ok)); }

.seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 8px 12px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; min-height: 38px; }
.seg button.on { background: var(--card2); color: var(--text); box-shadow: inset 0 0 0 1px #4a4049; }
.seg.multi button.on { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.seg.small button { padding: 5px 10px; min-height: 32px; font-size: .85rem; }
.field { margin-top: 14px; }
.field:first-child { margin-top: 0; }
.field > span { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.strs button { min-width: 44px; }
.frange { display: flex; align-items: center; gap: 10px; }
select { font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; min-height: 40px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chips button { border: 1px solid var(--line); background: var(--card2); border-radius: 999px; padding: 5px 11px; font-weight: 650; font-size: .88rem; cursor: pointer; min-height: 34px; }
.chips button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ——— Lernpfad ——— */
.path { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.lesson { display: flex; align-items: center; gap: 14px; color: var(--text); text-decoration: none; position: relative; }
.lesson .num { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--card2); font-weight: 800; color: var(--muted); }
.lesson.done .num { background: var(--ok); color: #0f2318; }
.lesson.next { border-color: #6a4a24; }
.lesson.next .num { background: var(--accent); color: var(--accent-ink); }
.lmain { flex: 1; min-width: 0; }
.lmain b, .lmain small { display: block; }
.lmain small { color: var(--muted); }
.lmain .bar { margin-bottom: 0; }
.tag { position: absolute; top: 10px; right: 12px; font-size: .7rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
@media (hover: hover) { .lesson:hover { border-color: #5a4b57; } }
.lesson-nav { justify-content: space-between; margin-top: 24px; }

/* ——— Tipps ——— */
.tips { display: grid; gap: 12px; }
.tip h3 { color: var(--accent); }
.tip ul { padding-left: 1.1em; margin: .4em 0; }
.tip li { margin: .2em 0; }
.demo { margin-top: 12px; }
.demo-board { background: var(--bg2); border-radius: 12px; padding: 8px 6px; }
.demo-board svg { width: 100%; height: auto; max-height: 260px; }
.demo-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.demo-cap { flex: 1 1 180px; font-size: .88rem; color: var(--muted); margin: 6px 0 0; }
.demo-cap b { color: var(--text); }
.demo-bar .demo-cap { margin: 0; }
.demo-unit { margin-top: 12px; }
.demo-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }

/* ——— Griffbrett ——— */
.fb { user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.fb text { font-family: inherit; }
.fb-flow { width: 100%; height: auto; }
.slabel { fill: var(--muted); font-size: 13px; font-weight: 700; }
.slabel.on { fill: var(--accent); }
.slabel.dim { opacity: .35; }
.fnum { fill: #6c6369; font-size: 11px; font-weight: 600; }
.fnum.dot { fill: #b3a8b0; }
.fb-mini .slabel { font-size: 11px; }
.fb-mini .fnum { font-size: 9.5px; }
.str { transition: opacity .2s; }
.str.dim { opacity: .28; }
.hit { cursor: pointer; }
.hit.off { cursor: default; }
@media (hover: hover) { .hit:not(.off):hover { fill: rgba(255, 255, 255, .06); } }
.mark { pointer-events: none; }
.mark text { fill: #22170e; font-weight: 800; text-anchor: middle; dominant-baseline: central; }
.mark .disc { fill: var(--ivory); stroke: rgba(0, 0, 0, .5); stroke-width: 1.2; }
.mark.target .disc { fill: var(--accent); stroke: #fff6; }
.mark .pulse { fill: none; stroke: var(--accent); stroke-width: 2.5; transform-box: fill-box; transform-origin: center; animation: pulse 1.4s ease-out infinite; }
@keyframes pulse { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(1.7); } }
.mark.ok .disc { fill: var(--ok); }
.mark.bad .disc { fill: var(--bad); }
.mark.bad text { fill: #2a0d0a; }
.mark.given .disc { fill: var(--blue); }
.mark.tone .disc { fill: var(--ivory); }
.mark.root .disc, .mark.hl .disc { fill: var(--accent); }
.mark.faint { opacity: .5; }
.mark.ref .disc { fill: rgba(20, 15, 12, .85); stroke: var(--accent); stroke-width: 1.8; stroke-dasharray: 3 2; }
.mark.ref text { fill: var(--accent); }
.mark.miss .disc { fill: rgba(20, 15, 12, .85); stroke: var(--bad); stroke-width: 2.2; stroke-dasharray: 3 2; }
.mark.miss text { fill: var(--bad); }
.mark.ping .disc { fill: #fff; }
.mark.flash { animation: pop .9s ease-out forwards; }
@keyframes pop { 0% { opacity: 0; } 15% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
.mark.heat.n .disc { fill: #3a3339; stroke: #00000066; }
.mark.heat.n text { fill: #8c8289; }
.mark.heat.l0 .disc { fill: var(--bad); }
.mark.heat.l1 .disc { fill: #e9c14a; }
.mark.heat.l3 .disc { fill: var(--ok); }
.mline { stroke: var(--ok); stroke-width: 2.6; stroke-dasharray: 5 4; stroke-linecap: round; opacity: .95; }
.mline.refline { stroke: var(--accent); }
.mline.barre { stroke: var(--accent); stroke-width: 12; stroke-dasharray: none; opacity: .4; }
.fb-mini .mline { stroke-width: 2; }
.fb-mini .mline.barre { stroke-width: 9; }
.boardwrap { margin-top: 12px; }
.boardwrap svg { max-width: 100%; }
@media (max-width: 760px) { .boardwrap svg { max-width: 460px; margin: 0 auto; } }

/* ——— Erkunden / Fortschritt ——— */
.controls .info { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0; }
@media (min-width: 761px) { .progress .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; }
.tile b { display: block; font-size: 1.7rem; line-height: 1.1; }
.tile b small { font-size: .9rem; color: var(--muted); }
.tile span { font-size: .8rem; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: .82rem; color: var(--muted); }
.lg::before { content: ""; display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.lg.n::before { background: #3a3339; } .lg.l0::before { background: var(--bad); } .lg.l1::before { background: #e9c14a; } .lg.l3::before { background: var(--ok); }
.perstring { display: grid; gap: 6px; }
.ps { display: grid; grid-template-columns: 24px 1fr 48px; align-items: center; gap: 10px; }
.ps .bar { margin: 0; }
.ps span { text-align: right; color: var(--muted); font-size: .85rem; }
.misslist { padding-left: 1.1em; margin: .3em 0; }
.misslist li { margin: .25em 0; }
.danger h3 { color: var(--bad); }

/* ——— Übungsrunde ——— */
.quiz {
  display: flex; flex-direction: column; height: 100dvh; max-width: 1200px; margin: 0 auto;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.qbar { display: flex; align-items: center; gap: 12px; padding: 8px 12px 0; }
.qprog { flex: 1; height: 6px; border-radius: 99px; background: var(--card2); overflow: hidden; }
.qprog[hidden] { display: block; visibility: hidden; }
.qprog i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.qcount { font-weight: 700; color: var(--muted); font-size: .9rem; min-width: 52px; text-align: right; }
.qprompt { text-align: center; padding: 4px 16px 6px; min-height: 72px; }
.qmain { font-size: 1.9rem; font-weight: 800; letter-spacing: -.01em; }
.qsub { color: var(--muted); font-size: .95rem; min-height: 1.4em; }
.qprompt.good .qmain { color: var(--ok); }
.qprompt.bad .qmain { color: var(--bad); font-size: 1.5rem; }
.fast { color: var(--ok); } .slow { color: #e9c14a; }
.qboard { flex: 1; min-height: 0; overflow: auto; display: flex; justify-content: center; padding: 0 8px; }
.qboard > svg:not(.fb-flow) { width: 100%; height: 100%; }
.qboard > svg.fb-flow { max-width: 460px; flex: none; height: auto; align-self: flex-start; }
.qfoot { padding: 8px 12px 12px; }
.pad { display: grid; gap: 8px; max-width: 560px; margin: 0 auto; }
.pad-acc { display: flex; justify-content: center; gap: 8px; }
.pad-acc button { width: 72px; height: 42px; font-size: 1.35rem; }
.pad-letters { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.pad-letters button { height: 56px; font-size: 1.35rem; }
.pad button { border: 1px solid var(--line); background: var(--card2); border-radius: 12px; font-weight: 800; cursor: pointer; touch-action: manipulation; }
.pad button:active:not(:disabled) { transform: scale(.95); background: #3a313a; }
.pad button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pad button:disabled { opacity: .5; }
.qhint { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px; color: var(--muted); text-align: center; flex-wrap: wrap; }
.shake { display: inline-block; color: var(--accent); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.fbk { max-width: 560px; margin: 0 auto; }
.fbk ul { margin: 0 0 10px; padding: 10px 12px 10px 28px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; font-size: .92rem; }
.fbk li { margin: .15em 0; }
.fbk .btn { width: 100%; }
@media (min-width: 761px) { .qboard { padding: 0 16px; } .qmain { font-size: 2.2rem; } }

.results .res-card { text-align: center; }
.res-score { font-size: 4rem; font-weight: 800; line-height: 1; margin: 10px 0 4px; }
.res-score small { font-size: 1.6rem; color: var(--muted); }
.results h3 { margin-top: 18px; }
.results .misslist { text-align: left; display: inline-block; }
.results .row { justify-content: center; }
.perfect { color: var(--ok); font-weight: 700; }

/* ——— Einstellungen ——— */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .6); display: flex; align-items: flex-end; justify-content: center; padding: 12px; }
.modal[hidden] { display: none; }
.sheet { width: 100%; max-width: 480px; margin-bottom: env(safe-area-inset-bottom); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-head h2 { margin: 0; }
.about { margin-top: 18px; }
@media (min-width: 761px) { .modal { align-items: center; } }
