:root {
  /* Club-Farben: Neon auf Nachtblau */
  --primary: #ff2bd6;
  --primary-dark: #a8128c;
  --blue: #00d9ff;
  --blue-dark: #0092b3;
  --green: #b6ff3b;
  --green-dark: #6fb300;
  --red: #ff4d6d;
  --red-dark: #b3203d;
  --gold: #ffd400;
  --violet: #8b5cff;
  --bg: #0d0b1e;
  --bg-soft: #1a1733;
  --card: #151230;
  --text: #f4f1ff;
  --muted: #a39fc4;
  --line: #2e2a55;
  --good-bg: #1d3310;
  --good-text: #c6ff6b;
  --bad-bg: #3a1424;
  --bad-text: #ff8fa3;
  --sel-bg: #0f2e3d;
  --radius: 16px;
  --glow: rgba(255, 43, 214, .35);
  --glow-blue: rgba(0, 217, 255, .35);
  --bg-glow-1: rgba(255, 43, 214, .22);
  --bg-glow-2: rgba(0, 217, 255, .16);
  --tabbar-bg: rgba(13, 11, 30, .92);
  --on-green: #10210a;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse 80% 45% at 15% -5%, var(--bg-glow-1), transparent 70%),
    radial-gradient(ellipse 70% 40% at 100% 5%, var(--bg-glow-2), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  min-height: 100vh;
  min-height: 100dvh;
}

#view {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 16px) 16px calc(var(--safe-bottom) + 96px);
}

body.in-lesson #view { padding-bottom: 0; }
body.in-lesson #tabbar { display: none; }

h1 { font-size: 28px; margin: 8px 0 16px; }
h2 { font-size: 19px; margin: 0 0 10px; }
.section-title { margin: 24px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.hint { color: var(--muted); font-size: 14px; margin: 0; }
.warn { color: var(--bad-text); font-weight: 600; }
code { background: var(--bg-soft); padding: 1px 5px; border-radius: 6px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ---------- Bausteine ---------- */

.card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  position: relative;
}

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .btn { flex: 1; }

label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.label { font-weight: 700; margin-bottom: 6px; }

input, select, textarea {
  font: inherit;
  font-size: 17px; /* verhindert Zoom auf iOS */
  color: var(--text);
  background: var(--bg-soft);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  width: 100%;
  font-weight: 500;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); }
textarea { resize: vertical; line-height: 1.5; }

label.switch { flex-direction: row; align-items: center; gap: 12px; font-weight: 600; }
label.switch input { width: 24px; height: 24px; accent-color: var(--green); flex: none; }

.btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font: inherit;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: .3px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  border: none;
  border-bottom: 4px solid var(--primary-dark);
  border-radius: 14px;
  box-shadow: 0 0 18px var(--glow);
  padding: 12px 18px;
  cursor: pointer;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(3px); border-bottom-width: 1px; margin-bottom: 3px; }
.btn:disabled { background: var(--line); border-bottom-color: var(--line); color: var(--muted); box-shadow: none; }
.btn.big { width: 100%; padding: 15px 18px; font-size: 18px; }
.btn.red { background: var(--red); border-bottom-color: var(--red-dark); box-shadow: 0 0 18px rgba(255, 77, 109, .35); }
.feedback.good .btn { background: var(--green); border-bottom-color: var(--green-dark); color: var(--on-green); box-shadow: 0 0 18px rgba(182, 255, 59, .35); }
.btn.ghost {
  background: var(--card);
  color: var(--blue);
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  box-shadow: none;
}
.btn small { font-weight: 600; opacity: .9; font-size: 14px; }
.file-btn { position: relative; background: linear-gradient(135deg, var(--blue), var(--violet)); border-bottom-color: var(--blue-dark); box-shadow: 0 0 18px var(--glow-blue); }
.file-btn.ghost { background: var(--card); }
.file-btn.busy { opacity: .6; pointer-events: none; }

.icon-btn {
  background: none;
  border: none;
  font-size: 20px;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--muted);
  border-radius: 10px;
}
.icon-btn.close { position: absolute; top: 8px; right: 8px; }

.link {
  background: none; border: none; color: var(--blue); font: inherit; font-weight: 700;
  padding: 6px 0; cursor: pointer;
}

.progress {
  height: 16px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
  flex: 1;
}
.progress.small { height: 10px; margin-top: 10px; }
.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--blue));
  border-radius: 99px;
  transition: width .4s ease;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.08), inset 0 4px 0 rgba(255,255,255,.25);
}
.progress-fill.gold { background: linear-gradient(90deg, var(--gold), var(--green)); }
.progress-fill.alt { background: linear-gradient(90deg, var(--gold), var(--primary)); }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 90px);
  transform: translate(-50%, 20px);
  background: var(--violet);
  color: #fff;
  padding: 12px 18px;
  box-shadow: 0 0 24px rgba(139, 92, 255, .6);
  border-radius: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: .25s;
  max-width: calc(100% - 32px);
  text-align: center;
  z-index: 50;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Tab-Leiste ---------- */

#tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  background: var(--tabbar-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 2px solid var(--line);
  padding: 6px 8px calc(var(--safe-bottom) + 6px);
  z-index: 10;
}
#tabbar button {
  flex: 1;
  background: none;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 4px 0;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  cursor: pointer;
}
#tabbar .ti { font-size: 24px; filter: grayscale(1); opacity: .7; }
#tabbar button.active { color: var(--blue); background: var(--sel-bg); border-color: var(--blue); }
#tabbar button.active .ti { filter: none; opacity: 1; }

/* ---------- Startseite ---------- */

.hello { margin-bottom: 12px; }
.stat-row { display: flex; gap: 10px; margin-bottom: 14px; }
.stat {
  flex: 1;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat b { font-size: 22px; }
.stat small { color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: .5px; }
.stat-icon { font-size: 22px; }
.goal-head { display: flex; justify-content: space-between; font-weight: 800; margin-bottom: 10px; }
.goal-done { color: var(--good-text); font-weight: 800; margin: 10px 0 0; text-align: center; }
.start-btn { margin-bottom: 14px; min-height: 76px; font-size: 22px; }
.empty { text-align: center; }
.tip { background: var(--sel-bg); border-color: var(--blue); padding-right: 40px; }
.tip p { margin: 6px 0 0; }
.share-icon { display: inline-block; border: 1.5px solid currentColor; border-radius: 4px; padding: 0 4px; font-size: 13px; }

.units { display: flex; flex-direction: column; }
.unit {
  font: inherit;
  color: inherit;
  text-align: left;
  border-bottom-width: 4px;
  cursor: pointer;
  width: 100%;
}
.unit:active { transform: translateY(2px); border-bottom-width: 2px; }
.unit-name { font-weight: 800; font-size: 18px; }
.unit-meta { color: var(--muted); font-size: 14px; font-weight: 600; }
.unit-meta .due { color: var(--gold); }

/* ---------- Lektion ---------- */

.lesson {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--safe-top) - 16px);
}
.lesson-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }

.exercise { flex: 1; }
.ex-title { font-size: 22px; margin-bottom: 14px; }
.badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 8px;
  vertical-align: middle;
  margin-right: 6px;
}

.prompt-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.prompt-word {
  font-size: 30px;
  font-weight: 800;
  margin-bottom: 18px;
  word-break: break-word;
}
.prompt-row .prompt-word { margin-bottom: 0; }
.speaker {
  background: var(--blue);
  border: none;
  border-bottom: 4px solid var(--blue-dark);
  color: #fff;
  box-shadow: 0 0 16px var(--glow-blue);
  font-size: 22px;
  border-radius: 14px;
  width: 52px;
  height: 52px;
  flex: none;
  cursor: pointer;
}
.speaker:active { transform: translateY(3px); border-bottom-width: 1px; }
.listen-row { display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin: 10px 0 24px; }
.speaker.big { width: 110px; height: 110px; font-size: 48px; border-radius: 24px; }
.speaker.slow { width: 64px; height: 64px; font-size: 28px; }
.hint-box { background: var(--bg-soft); border-radius: 12px; padding: 10px 14px; font-weight: 700; margin-bottom: 16px; }

.options { display: flex; flex-direction: column; gap: 10px; }
.option, .tile {
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  background: var(--card);
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 14px;
  padding: 12px 16px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.option:active:not(:disabled), .tile:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 2px; }
.opt-num {
  border: 2px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  min-width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.option.right, input.right { background: var(--good-bg); border-color: var(--green); color: var(--good-text); }
.option.wrong, input.wrong { background: var(--bad-bg); border-color: var(--red); color: var(--bad-text); }
.option:disabled { cursor: default; }

.type-form input { font-size: 20px; padding: 16px; }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-col { display: flex; flex-direction: column; gap: 10px; }
.tile { justify-content: center; text-align: center; min-height: 58px; font-size: 16px; word-break: break-word; }
.tile.sel { background: var(--sel-bg); border-color: var(--blue); color: var(--blue); }
.tile.done { opacity: .35; background: var(--good-bg); border-color: var(--green); }
.tile.shake { animation: shake .4s; border-color: var(--red); background: var(--bad-bg); }
@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.lesson-foot {
  position: sticky;
  bottom: 0;
  margin: 16px -16px 0;
  padding: 14px 16px calc(var(--safe-bottom) + 14px);
  background: var(--bg);
  border-top: 2px solid var(--line);
}
.foot-row { display: flex; gap: 10px; }
.foot-row .btn.ghost { flex: 0 0 auto; }
.foot-row .btn.big { flex: 1; width: auto; }
.feedback { margin: -14px -16px calc(-14px - var(--safe-bottom)); padding: 16px 16px calc(var(--safe-bottom) + 16px); animation: slideup .2s ease-out; }
.feedback p { margin: 4px 0 12px; font-weight: 600; }
.feedback .solution { font-size: 20px; font-weight: 800; }
.feedback.good { background: var(--good-bg); color: var(--good-text); }
.feedback.bad { background: var(--bad-bg); color: var(--bad-text); }
.fb-head { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.feedback .btn.big { margin-top: 6px; }
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } }

/* ---------- Ergebnis ---------- */

.result { text-align: center; padding-top: 30px; }
.result-emoji { font-size: 80px; animation: pop .5s ease-out; }
@keyframes pop { 0% { transform: scale(.3); } 70% { transform: scale(1.15); } }
.result .stat { border-width: 2px; }
.result .stat.xp { border-color: var(--gold); }
.result .stat.acc { border-color: var(--green); }
.result .stat.streak { border-color: #ff9600; }
.result .stat.combo-stat { border-color: var(--primary); }
.result .card { text-align: left; }
.missed { margin: 0; padding-left: 20px; }
.missed li { margin: 4px 0; }

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 40; }
.confetti i {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  animation: fall linear forwards;
}
@keyframes fall { to { top: 110%; transform: rotate(720deg) translateX(40px); } }

/* ---------- Wörter ---------- */

.add-card summary { font-weight: 800; cursor: pointer; list-style: none; }
.add-card summary::-webkit-details-marker { display: none; }
.add-card[open] summary { margin-bottom: 14px; }
.search { margin-bottom: 16px; }
.unit-group { margin-bottom: 18px; }
.unit-head { display: flex; align-items: center; gap: 2px; margin-bottom: 8px; }
.unit-head h2 { flex: 1; margin: 0; }
.unit-head small { color: var(--muted); font-size: 14px; }
.word-list { list-style: none; margin: 0; padding: 0; border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.word-list li + li { border-top: 2px solid var(--line); }
.word-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--card);
  border: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.w-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.w-text span { color: var(--muted); font-size: 15px; }
.boxes { display: flex; gap: 3px; flex: none; }
.boxes i { width: 7px; height: 16px; border-radius: 3px; background: var(--line); }
.boxes i.on { background: var(--primary); box-shadow: 0 0 6px var(--primary); }

dialog {
  width: min(92vw, 480px);
  border: none;
  border-radius: 20px;
  padding: 20px;
  background: var(--card);
  color: var(--text);
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }

/* ---------- Erfassen ---------- */

.segmented { display: flex; background: var(--bg-soft); border: 2px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.segmented button {
  flex: 1;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: 9px;
  padding: 9px 4px;
  cursor: pointer;
}
.segmented button.on { background: var(--card); color: var(--blue); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.ocr-status { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.ocr-status[hidden] { display: none; }
.pairs { margin: 0 0 14px; padding-left: 28px; }
.pairs li { padding: 5px 0; border-bottom: 1px solid var(--line); }
.pairs li > * { vertical-align: middle; }
.pair-text { display: inline-block; width: calc(100% - 44px); }
.pairs li b { display: block; }
.pairs li span { color: var(--muted); }
.pairs li.broken { color: var(--bad-text); }
.pairs li.broken span { color: var(--bad-text); }

/* ---------- Einstellungen ---------- */

.facts { list-style: none; margin: 0; padding: 0; }
.facts li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.facts li:last-child { border-bottom: none; }

/* ---------- Club-Extras ---------- */

.wave { display: inline-block; animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-8deg); } }

.stat { background: var(--card); font: inherit; color: inherit; }
button.stat { cursor: pointer; }

.rank-card { display: flex; align-items: center; gap: 16px; border-color: var(--primary); box-shadow: 0 0 22px var(--glow); }
.rank-info { flex: 1; min-width: 0; }
.rank-info small { color: var(--muted); font-weight: 700; display: block; }
.rank-info .progress { margin: 6px 0; }
.rank-name { font-size: 22px; font-weight: 900; background: linear-gradient(90deg, var(--primary), var(--blue)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.vinyl {
  flex: none;
  width: 72px; height: 72px;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--primary) 0 16%, #111 17% 20%, transparent 21%),
    repeating-radial-gradient(circle, #1b1b1b 0 2px, #0a0a0a 2px 4px);
  display: flex; align-items: center; justify-content: center;
  animation: spin 3.5s linear infinite;
  box-shadow: 0 0 0 3px var(--line), 0 0 20px var(--glow);
}
.vinyl span { font-size: 20px; }
@keyframes spin { to { transform: rotate(360deg); } }

.start-btn { font-size: 24px; animation: pulse calc(var(--beat, .484s) * 4) ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 34px var(--glow); } }

.unit { display: flex; align-items: center; gap: 14px; }
.unit-disc { font-size: 34px; flex: none; }
.unit-body { flex: 1; min-width: 0; }

.mixer { display: flex; align-items: center; gap: 6px; min-width: 64px; justify-content: flex-end; }
.eq { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.eq i { width: 5px; height: 30%; border-radius: 2px; background: var(--line); }
.eq i.on { background: linear-gradient(0deg, var(--blue), var(--primary)); box-shadow: 0 0 6px var(--primary); }
.beat-on .eq i.on { animation: eq var(--beat, .484s) ease-in-out infinite alternate; }
.eq i:nth-child(1) { animation-delay: -.1s; }
.eq i:nth-child(2) { animation-delay: -.3s; }
.eq i:nth-child(3) { animation-delay: -.2s; }
.eq i:nth-child(4) { animation-delay: -.4s; }
@keyframes eq { from { height: 25%; } to { height: 100%; } }
.combo { font-weight: 900; color: var(--gold); font-size: 15px; white-space: nowrap; }
.combo.drop { color: var(--primary); text-shadow: 0 0 10px var(--primary); animation: blink var(--beat, .484s) steps(2) infinite; }
@keyframes blink { 50% { opacity: .55; } }

.flash {
  position: fixed; left: 50%; top: 38%;
  transform: translate(-50%, -50%);
  font-size: clamp(28px, 9vw, 46px); font-weight: 900;
  color: #fff;
  text-shadow: 0 0 18px var(--primary), 0 0 40px var(--blue);
  pointer-events: none; z-index: 60;
  animation: flash 1.3s ease-out forwards;
  white-space: nowrap;
}
@keyframes flash {
  0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.3); opacity: 0; }
}

.option.right, input.right { box-shadow: 0 0 14px rgba(182, 255, 59, .35); }
.option.wrong, input.wrong { box-shadow: 0 0 14px rgba(255, 77, 109, .35); }
.tile.sel { box-shadow: 0 0 14px var(--glow-blue); }

.levelup { border-color: var(--gold); box-shadow: 0 0 22px rgba(255, 212, 0, .3); text-align: center !important; }
.levelup-icon { font-size: 44px; animation: pop .5s ease-out; }
.badge-new { display: flex; align-items: center; gap: 14px; border-color: var(--blue); box-shadow: 0 0 20px var(--glow-blue); }
.badge-new small { display: block; color: var(--blue); font-weight: 800; text-transform: uppercase; font-size: 11px; letter-spacing: .5px; }
.badge-icon { font-size: 34px; flex: none; }
.result .stat-row { flex-wrap: wrap; }
.result .stat { min-width: 70px; }

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.badge-tile {
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 10px 6px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  opacity: .5;
}
.badge-tile b { font-size: 13px; line-height: 1.2; }
.badge-tile small { font-size: 11px; color: var(--muted); line-height: 1.2; }
.badge-tile.got { opacity: 1; border-color: var(--primary); box-shadow: 0 0 12px var(--glow); }
input[type=range] { padding: 0; accent-color: var(--primary); background: none; border: none; }

/* ---------- Zuschneiden ---------- */

.hidden { display: none !important; }
#cropper:empty { display: none; }
#cropper { display: flex; flex-direction: column; gap: 12px; }
.crop-stage {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background: #000;
}
.crop-stage canvas { display: block; width: 100%; height: auto; }
.crop-box {
  position: absolute;
  border: 3px solid var(--blue);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55), 0 0 14px var(--blue);
  cursor: move;
}
.crop-handle {
  position: absolute;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: 0 0 10px var(--primary);
}
.crop-handle.nw { left: -16px; top: -16px; cursor: nwse-resize; }
.crop-handle.ne { right: -16px; top: -16px; cursor: nesw-resize; }
.crop-handle.sw { left: -16px; bottom: -16px; cursor: nesw-resize; }
.crop-handle.se { right: -16px; bottom: -16px; cursor: nwse-resize; }

/* ---------- Figur mit der Punktetafel ---------- */

.mascot {
  position: fixed;
  left: 0;
  bottom: calc(var(--safe-bottom) + 120px);
  width: 140px;
  z-index: 55;
  pointer-events: none;
  animation: mascot-walk 4.6s linear forwards;
}
/* reinlaufen, in der Mitte kurz tanzen, rauslaufen */
@keyframes mascot-walk {
  0% { transform: translateX(-160px); }
  30% { transform: translateX(calc(50vw - 70px)); }
  65% { transform: translateX(calc(50vw - 70px)); }
  100% { transform: translateX(calc(100vw + 20px)); }
}
.mascot-bounce { position: relative; animation: mascot-bounce calc(var(--beat, .484s) / 2) ease-in-out infinite alternate; }
@keyframes mascot-bounce { to { transform: translateY(-7px); } }
.mascot-sign {
  position: relative;
  z-index: 1;
  margin: 0 -30px -8px;
  background: #fff;
  color: #1a1433;
  border: 4px solid #2b1a3a;
  border-radius: 12px;
  padding: 6px 4px 5px;
  text-align: center;
  box-shadow: 0 0 0 3px var(--gold), 0 0 22px rgba(255, 212, 0, .6);
  animation: mascot-wiggle calc(var(--beat, .484s) * 2) ease-in-out infinite;
}
.mascot-sign b { display: block; font-size: 22px; font-weight: 900; line-height: 1.1; white-space: nowrap; }
.mascot-sign small { display: block; font-size: 11px; font-weight: 800; color: #6b5f99; line-height: 1.2; }
@keyframes mascot-wiggle { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
.mascot-figure { display: block; width: 100%; height: auto; filter: drop-shadow(0 0 10px var(--glow)); }
.mascot-leg { transform-box: fill-box; transform-origin: 50% 0; animation: mascot-step var(--beat, .484s) ease-in-out infinite alternate; }
.mascot-leg-r { animation-delay: calc(var(--beat, .484s) * -1); }
@keyframes mascot-step { from { transform: rotate(-10deg); } to { transform: rotate(10deg); } }
.mascot-wink { transform-box: fill-box; transform-origin: 50% 50%; animation: mascot-wink 2.4s ease-in-out infinite; }
@keyframes mascot-wink { 0%, 78%, 92%, 100% { transform: scaleY(1); } 84% { transform: scaleY(.1); } }
.mascot-tail { transform-box: fill-box; transform-origin: 50% 0; animation: mascot-tail var(--beat, .484s) ease-in-out infinite alternate; }
.mascot-tail-r { animation-delay: calc(var(--beat, .484s) * -1); }
@keyframes mascot-tail { from { transform: rotate(-6deg); } to { transform: rotate(6deg); } }
.mascot-spark { position: absolute; color: var(--gold); font-size: 16px; animation: mascot-spark calc(var(--beat, .484s) * 2) ease-in-out infinite; }
.mascot-spark.s1 { left: -6px; top: 36%; }
.mascot-spark.s2 { right: -4px; top: 50%; animation-delay: -.3s; color: var(--blue); }
.mascot-spark.s3 { left: 10px; bottom: 6%; animation-delay: -.6s; color: var(--primary); }
@keyframes mascot-spark { 0%, 100% { opacity: 0; transform: scale(.4); } 50% { opacity: 1; transform: scale(1.2); } }
@media (prefers-reduced-motion: reduce) {
  .mascot { animation: mascot-fade 3s forwards; left: calc(50vw - 70px); }
  @keyframes mascot-fade { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }
}

/* ---------- Erfolge ---------- */

.plates { display: inline-flex; gap: 2px; vertical-align: middle; margin-left: 4px; }
.plate { font-size: 15px; filter: grayscale(1); opacity: .3; display: inline-flex; flex-direction: column; align-items: center; }
.plate.got { filter: none; opacity: 1; }
.plate small { font-size: 10px; color: var(--muted); }
.weekly { border-color: var(--violet); }
.weekly.done { border-color: var(--green); box-shadow: 0 0 18px rgba(182, 255, 59, .2); }
.weekly-text { margin: 0 0 10px; font-weight: 700; }
.weekly small { display: block; margin-top: 6px; }
.season { border-color: var(--gold); box-shadow: 0 0 22px rgba(255, 212, 0, .15); }
.season small { display: block; margin-top: 8px; }
.unit-goal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.unit-goal-head .plates { font-size: 20px; gap: 6px; }
.unit-goal-head .plate { font-size: 22px; }
.unit-goal .progress { margin-top: 6px; }
.series-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.series-head .badge-icon { font-size: 28px; }
.series-info { flex: 1; display: flex; flex-direction: column; }
.series-info small { color: var(--muted); font-weight: 700; font-size: 12px; }
.series-val { font-size: 22px; font-weight: 900; color: var(--blue); }
.series > small { display: block; margin-top: 6px; }
.tiers { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.tier { font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 99px; border: 2px solid var(--line); color: var(--muted); }
.tier.got { border-color: var(--primary); color: #fff; background: var(--glow); }
.plate-new { border-color: var(--gold); box-shadow: 0 0 22px rgba(255, 212, 0, .3); }
#tabbar button { font-size: 11px; }

/* ---------- Vibe: Gaming (Retro, Pixel) ---------- */

body[data-vibe="gaming"] {
  --primary: #ff4757; --primary-dark: #b8303d; --violet: #ff9f1a;
  --blue: #1e90ff; --blue-dark: #1565c0; --green: #2ed573; --green-dark: #1e9e52;
  --red: #ff4757; --red-dark: #b8303d; --gold: #ffd32a;
  --bg: #0f1430; --bg-soft: #192048; --card: #151c42; --text: #f1f4ff; --muted: #9aa3d6; --line: #2c3670;
  --good-bg: #14361f; --good-text: #7dffa8; --bad-bg: #3d1520; --bad-text: #ff8d99; --sel-bg: #132a52;
  --glow: rgba(255, 71, 87, .35); --glow-blue: rgba(30, 144, 255, .4);
  --bg-glow-1: rgba(30, 144, 255, .18); --bg-glow-2: rgba(255, 71, 87, .12);
  --tabbar-bg: rgba(15, 20, 48, .95); --on-green: #0b2414;
  --radius: 6px;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 2px, transparent 2px 4px),
    radial-gradient(ellipse 80% 45% at 15% -5%, var(--bg-glow-1), transparent 70%);
}
body[data-vibe="gaming"] h1, body[data-vibe="gaming"] h2, body[data-vibe="gaming"] .btn,
body[data-vibe="gaming"] .rank-name, body[data-vibe="gaming"] .fb-head, body[data-vibe="gaming"] .flash,
body[data-vibe="gaming"] .stat b, body[data-vibe="gaming"] .mascot-sign b {
  font-family: "Courier New", ui-monospace, Menlo, monospace;
  letter-spacing: .5px;
}
body[data-vibe="gaming"] .btn, body[data-vibe="gaming"] .option, body[data-vibe="gaming"] .tile,
body[data-vibe="gaming"] .stat, body[data-vibe="gaming"] .speaker, body[data-vibe="gaming"] input,
body[data-vibe="gaming"] select, body[data-vibe="gaming"] textarea, body[data-vibe="gaming"] .word-list,
body[data-vibe="gaming"] .progress, body[data-vibe="gaming"] .progress-fill, body[data-vibe="gaming"] #tabbar button {
  border-radius: 6px;
}
body[data-vibe="gaming"] .vinyl {
  border-radius: 8px;
  background: linear-gradient(135deg, #ffe066, #ffb800);
  box-shadow: inset -6px -6px 0 rgba(0, 0, 0, .2), 0 0 0 4px #b37a00, 0 0 18px rgba(255, 211, 42, .45);
  animation: coin 1.6s steps(8) infinite;
}
@keyframes coin { 50% { transform: scaleX(.15); } }

/* ---------- Vibe: Pferde (hell, warm) ---------- */

body[data-vibe="horse"] {
  color-scheme: light;
  --primary: #e07a2f; --primary-dark: #a9531a; --violet: #d9567d;
  --blue: #2f9bd0; --blue-dark: #1f6f99; --green: #5aae3a; --green-dark: #3e7f25;
  --red: #d9483b; --red-dark: #a32f25; --gold: #e8b023;
  --bg: #fff7ec; --bg-soft: #fbeedb; --card: #fffdf8; --text: #4a3426; --muted: #8c7360; --line: #ecd8c0;
  --good-bg: #e5f5da; --good-text: #3b7a1f; --bad-bg: #fde4df; --bad-text: #b23a2a; --sel-bg: #e4f3fb;
  --glow: rgba(224, 122, 47, .22); --glow-blue: rgba(47, 155, 208, .22);
  --bg-glow-1: rgba(255, 196, 120, .45); --bg-glow-2: rgba(140, 210, 120, .35);
  --tabbar-bg: rgba(255, 247, 236, .95); --on-green: #fff;
}
body[data-vibe="horse"] .tier.got { color: var(--text); }
body[data-vibe="horse"] .flash { color: var(--primary-dark); text-shadow: 0 0 12px #fff, 0 0 24px var(--gold); }
body[data-vibe="horse"] .vinyl {
  background:
    radial-gradient(circle, var(--gold) 0 34%, #fff 35% 38%, transparent 39%),
    repeating-conic-gradient(var(--primary) 0 10deg, #f29a55 10deg 20deg);
  box-shadow: 0 0 0 3px var(--line), 0 6px 14px rgba(160, 90, 30, .25);
  animation: sway 3s ease-in-out infinite;
}
@keyframes sway { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
body[data-vibe="horse"] .rank-card, body[data-vibe="horse"] .card { box-shadow: 0 2px 10px rgba(160, 100, 40, .08); }

/* Figuren pro Vibe */
.mascot-hop { animation: mascot-hop var(--beat, .484s) steps(1) infinite; }
.mascot-hop-r { animation-delay: calc(var(--beat, .484s) / -2); }
@keyframes mascot-hop { 50% { transform: translateY(-1px); } }
.mascot.mascot-pixel { width: 120px; }
.mascot-pixel .mascot-sign { margin-bottom: -4px; }
.mascot.mascot-horse { width: 170px; }
.mascot-horse .mascot-sign { margin: 0 6px -2px; }
.mascot-horse .mascot-leg { animation-duration: calc(var(--beat, .484s) / 1.2); }
.mascot-horse .mascot-bounce { animation-name: horse-bob; }
@keyframes horse-bob { to { transform: translateY(-4px) rotate(-1.5deg); } }

/* ---------- Ersteinstieg ---------- */

body.in-onboarding #tabbar { display: none; }
body.in-onboarding #view { padding-bottom: calc(var(--safe-bottom) + 24px); }
.onboarding { display: flex; flex-direction: column; gap: 18px; min-height: calc(100dvh - var(--safe-top) - 40px); }
.ob-dots { display: flex; justify-content: center; gap: 8px; }
.ob-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.ob-dots i.on { background: var(--primary); width: 26px; border-radius: 99px; }
.ob-body { flex: 1; }
.ob-body h1 { margin: 6px 0 0; }
.ob-lead { font-size: 19px; font-weight: 700; margin: 0; }
.ob-nav { display: flex; gap: 10px; }
.ob-nav .btn.big { flex: 1; width: auto; }
.ob-footer { display: flex; justify-content: center; }
.ob-tips { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.ob-tips li { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px; }
.ob-tips li > span:first-child { font-size: 24px; }
.mascot-preview { display: flex; justify-content: center; padding: 10px 0; }
.mascot-preview svg { width: 150px; height: auto; filter: drop-shadow(0 0 14px var(--glow)); }
.mascot-preview.mascot-horse svg { width: 220px; }
.mascot-preview.mascot-pixel svg { width: 120px; }

/* Logo */
.logo { display: flex; align-items: center; gap: 12px; margin: 10px 0 4px; }
.logo img { border-radius: 16px; box-shadow: 0 0 22px var(--glow); }
.logo span { font-size: 36px; font-weight: 900; letter-spacing: -.5px; }
.logo i { font-style: normal; background: linear-gradient(90deg, var(--primary), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Vibe-Auswahl */
.vibe-picker { display: flex; flex-direction: column; gap: 10px; }
.vibe-card {
  display: grid; grid-template-columns: 48px 1fr; grid-template-rows: auto auto; column-gap: 12px;
  text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--card); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: var(--radius);
  padding: 12px 14px;
}
.vibe-card .vibe-icon { grid-row: span 2; font-size: 36px; align-self: center; }
.vibe-card b { font-size: 18px; }
.vibe-card small { color: var(--muted); font-weight: 600; }
.vibe-card.on { border-color: var(--primary); background: var(--sel-bg); box-shadow: 0 0 16px var(--glow); }

/* Farbfelder */
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { background: none; border: none; font: inherit; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; padding: 0; }
.swatch i { width: 44px; height: 44px; border-radius: 50%; background: var(--c); border: 3px solid var(--line); }
.swatch.on i { border-color: var(--primary); box-shadow: 0 0 0 3px var(--card), 0 0 0 6px var(--primary); }
.swatch.on small { color: var(--text); font-weight: 800; }

/* Made by Werner */
.werner { background: none; border: none; padding: 0; cursor: pointer; display: inline-flex; }
.werner-badge { display: block; filter: drop-shadow(0 0 10px var(--glow)); }
.werner-ring { transform-origin: 50px 50px; animation: spin 24s linear infinite; }
.about { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 10px 0 20px; }
.about p { margin: 0; }
.mascot-still { display: flex; flex-direction: column; align-items: center; }
.mascot-still .mascot-sign { animation: none; margin-bottom: -6px; min-width: 120px; }
.mascot-preview.mascot-horse .mascot-still .mascot-sign { margin-bottom: -4px; }
.mascot-preview.mascot-horse .mascot-still { width: 220px; }
.mascot-preview.mascot-horse .mascot-still svg { width: 100%; }
.pass-btn { margin-bottom: 14px; }
.pass-img { width: 100%; border-radius: 14px; border: 2px solid var(--line); }
dialog .stack h2 { margin: 0; }
