/* ==========================================================================
   PrepPet – Stylesheet
   Dark-Mode standardmäßig, Light-Mode via data-theme oder System-Präferenz.
   ========================================================================== */

:root {
  /* Dark theme (default) */
  --bg:         #0a0f1f;
  --bg-deep:    #060a17;
  --bg-soft:    #131a2e;
  --card:       #161f38;
  --card-hover: #1c2749;
  --card-border-gradient: linear-gradient(135deg, rgba(124,92,255,.25), rgba(38,208,180,.18));
  --text:       #eef2ff;
  --muted:      #93a1c2;
  --primary:       #667eea;
  --primary-2:     #7c5cff;
  --primary-hover: #7b90ff;
  --accent:     #26d0b4;
  --accent-2:   #4ade80;
  --danger:     #ff4d6a;
  --warn:       #ffb547;
  --border:     #273154;
  --border-soft: #1f2a4a;
  --ring: rgba(124, 92, 255, .35);

  --radius:    16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow-sm: 0 2px 10px rgba(0,0,0,.22);
  --shadow:    0 14px 40px rgba(4, 8, 20, .55), 0 2px 6px rgba(0,0,0,.25);
  --shadow-glow: 0 8px 28px rgba(102, 126, 234, .35);

  --grad-primary: linear-gradient(135deg, #667eea 0%, #7c5cff 50%, #a855f7 100%);
  --grad-accent:  linear-gradient(135deg, #26d0b4 0%, #4ade80 100%);
  --grad-brand:   linear-gradient(135deg, #667eea, #a855f7 60%, #ec4899);

  --font: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont,
          'Segoe UI Variable', 'Segoe UI', system-ui, Roboto,
          'Helvetica Neue', Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg:         #f4f6fc;
    --bg-deep:    #e9ecf5;
    --bg-soft:    #ffffff;
    --card:       #ffffff;
    --card-hover: #f2f5fc;
    --card-border-gradient: linear-gradient(135deg, rgba(102,126,234,.28), rgba(38,208,180,.22));
    --text:       #0c1426;
    --muted:      #5a6785;
    --border:     #e1e6f2;
    --border-soft: #edf0f8;
    --shadow-sm: 0 1px 4px rgba(15,23,36,.06);
    --shadow:    0 10px 32px rgba(102,126,234,.14), 0 2px 6px rgba(15,23,36,.05);
    --shadow-glow: 0 10px 26px rgba(102,126,234,.28);
  }
}

:root[data-theme="light"] {
  --bg:         #f4f6fc;
  --bg-deep:    #e9ecf5;
  --bg-soft:    #ffffff;
  --card:       #ffffff;
  --card-hover: #f2f5fc;
  --card-border-gradient: linear-gradient(135deg, rgba(102,126,234,.28), rgba(38,208,180,.22));
  --text:       #0c1426;
  --muted:      #5a6785;
  --border:     #e1e6f2;
  --border-soft: #edf0f8;
  --shadow-sm: 0 1px 4px rgba(15,23,36,.06);
  --shadow:    0 10px 32px rgba(102,126,234,.14), 0 2px 6px rgba(15,23,36,.05);
  --shadow-glow: 0 10px 26px rgba(102,126,234,.28);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02','cv03','cv04','cv11';
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  /* Dezente Aurora-Lichter im Hintergrund */
  background-image:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(124,92,255,.18), transparent 60%),
    radial-gradient(ellipse 70% 60% at 110% 10%, rgba(38,208,180,.14), transparent 60%),
    radial-gradient(ellipse 80% 40% at 50% 110%, rgba(236,72,153,.10), transparent 60%);
  background-attachment: fixed;
}
:root[data-theme="light"] body,
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) body {
    background-image:
      radial-gradient(ellipse 80% 50% at 10% -10%, rgba(124,92,255,.10), transparent 60%),
      radial-gradient(ellipse 70% 60% at 110% 10%, rgba(38,208,180,.09), transparent 60%),
      radial-gradient(ellipse 80% 40% at 50% 110%, rgba(236,72,153,.06), transparent 60%);
  }
}

/* ---------- Header ---------- */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 22px 14px;
  gap: 12px;
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  background: transparent;
  border: 0;
  padding: 6px 10px;
  margin: -6px -10px;
  border-radius: var(--radius-sm);
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}
.brand:hover { background: color-mix(in oklab, var(--text) 6%, transparent); }
.brand:active { transform: scale(.98); }
.brand:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.logo {
  font-size: 30px;
  line-height: 1;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--grad-brand);
  box-shadow: 0 6px 18px rgba(124,92,255,.35), inset 0 1px 0 rgba(255,255,255,.18);
  animation: logo-float 6s ease-in-out infinite;
}
.logo .logo-paw {
  width: 28px;
  height: 28px;
  fill: #ffffff;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.18));
}

@keyframes logo-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-2px) rotate(-2deg); }
}

.app-header h1 {
  font-size: 17px;
  margin: 0;
  letter-spacing: -0.015em;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text), color-mix(in oklab, var(--text) 65%, var(--primary)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  font-size: 11.5px;
  color: var(--muted);
  margin: 3px 0 0 0;
  letter-spacing: .02em;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.user-chip #userName {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70px; /* Begrenzt die Breite auf dem Desktop/Tablet */
  display: inline-block;
  vertical-align: middle;
}
@media (max-width: 520px) {
  /* Auf Mobile den User-Namen ausblenden — Header soll luftig bleiben */
  .user-chip #userName {
    display: none;
  }
  .user-chip {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    gap: 0;
  }
}

.bones-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--bg-soft) 85%, #fbbf24),
    var(--bg-soft));
  border: 1px solid rgba(251, 191, 36, .35);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: transform 150ms;
}
.bones-chip strong {
  color: #fbbf24;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.bones-chip.bump {
  animation: bones-bump .45s cubic-bezier(.2,.9,.3,1.3);
}
@keyframes bones-bump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.25) rotate(-5deg); }
  70%  { transform: scale(1.08) rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}

@media (max-width: 520px) {
  .bones-chip { padding: 4px 9px; font-size: 12px; }
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  display: grid;
  place-items: center;
  transition: background 150ms, color 150ms, border-color 150ms, transform 120ms;
}
.icon-btn:hover { background: var(--card-hover); color: var(--text); border-color: var(--border); }
.icon-btn:active { transform: scale(.92); }
.icon-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.theme-toggle { font-size: 17px; }

/* ---------- Layout ---------- */

main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 22px 96px; /* unten Platz für Bottom-Nav (Mobile) */
}

/* ========================================================================
   Hauptnavigation (Bottom-Bar Mobile, Sidebar Desktop) + Tab-Container
   ======================================================================== */

.main-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  background: var(--card);
  border-top: 1px solid var(--border-soft);
  z-index: 50;
  padding: 8px 4px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 20px rgba(0, 0, 0, .25);
  backdrop-filter: saturate(140%) blur(10px);
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color 150ms, background 150ms, transform 120ms;
}
.nav-btn:hover {
  color: var(--text);
  background: color-mix(in oklab, var(--bg-soft) 70%, var(--primary) 12%);
}
.nav-btn:active { transform: scale(.95); }
.nav-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.nav-btn.active {
  color: var(--primary);
  font-weight: 800;
  background: color-mix(in oklab, var(--bg-soft) 60%, var(--primary) 14%);
}
.nav-icon {
  font-size: 22px;
  line-height: 1;
}
.nav-label {
  font-size: 11px;
  letter-spacing: .02em;
}

/* Tab-Container im Dashboard */
.tab-content {
  display: none;
}
.tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: fade .25s ease;
}

/* Auf Mobile: Mascot oberhalb der Bottom-Nav, Shop-FAB ebenfalls */
.mascot {
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}
.shop-fab {
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 520px) {
  .mascot {
    width: 48px; height: 48px; font-size: 24px;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    left: 14px;
    z-index: 60;
  }
  .shop-fab {
    width: 38px; height: 38px; font-size: 17px;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    left: 70px;
    z-index: 60;
  }
}

/* ---- Desktop-Layout: Sidebar links statt Bottom-Bar ---- */
@media (min-width: 768px) {
  .main-nav {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: 220px;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 8px;
    padding: 100px 16px 24px; /* oben Platz für Header */
    border-top: none;
    border-right: 1px solid var(--border-soft);
    box-shadow: 4px 0 20px rgba(0, 0, 0, .15);
    z-index: 8;
  }
  .nav-btn {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 16px;
    font-size: 14.5px;
    border-radius: var(--radius-sm);
    text-align: left;
  }
  .nav-icon { font-size: 22px; }
  .nav-label { font-size: 14.5px; font-weight: 600; }
  .nav-btn.active .nav-label { font-weight: 800; }

  /* Body bekommt linken Versatz */
  body { padding-left: 220px; }
  /* Header bleibt sticky aber lässt Sidebar-Bereich frei */
  .app-header { padding-left: 24px; }

  main { padding: 28px 22px; max-width: 1100px; }

  /* Mascot + Shop-FAB sitzen wieder unten links im Hauptbereich */
  .mascot { bottom: 20px; left: calc(220px + 20px); }
  .shop-fab { bottom: 20px; left: calc(220px + 86px); }
}

/* ---- Tab-Layout: Lernen-Tab als 2-Spalten-Grid auf Desktop ---- */

.learn-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  align-items: start;
}
@media (min-width: 880px) {
  .learn-grid { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
}
.learn-main-col {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0; /* verhindert Overflow durch lange select-Optionen im 1fr-Track */
}
.learn-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Auf Desktop bekommen die 3 täglichen Missionen eigene Spalten,
   damit die linke Hauptspalte unten nicht leer wirkt. */
@media (min-width: 880px) {
  .quests-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
}

/* ---- Pet-Tab: 2-Spalten für Streak + Status auf Desktop ---- */
.pet-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
@media (min-width: 720px) {
  .pet-grid { grid-template-columns: 1fr 1fr; }
}
.shop-card { margin-top: 4px; }

/* Andere Screens enger halten (Quiz, Auth, Ergebnis) */
#screen-auth,
#screen-quiz,
#screen-result,
#screen-history { max-width: 820px; margin: 0 auto; }

.app-footer {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--border-soft);
}

/* ---------- Screens / Fade ---------- */

.screen {
  display: none;
  animation: fade .28s cubic-bezier(.2,.8,.2,1);
}
.screen.active { display: block; }

@keyframes fade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Card (gradient border via pseudo) ---------- */

.card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-soft);
}
.card::before {
  /* dezenter Glanz oben links */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,.04), transparent 40%);
  pointer-events: none;
}

.hero h2 {
  margin: 0 0 8px;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 800;
}
.hero h2 .hero-accent {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
  font-size: 14.5px;
}

/* ---------- Auth ---------- */

.auth-card { max-width: 440px; margin: 30px auto; }

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
  background: var(--bg-soft);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
}
.tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: color .15s, background .2s;
  font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: #fff;
  background: var(--grad-primary);
  box-shadow: var(--shadow-glow);
}
:root[data-theme="light"] .tab.active,
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .tab.active { color: #fff; }
}

[hidden] { display: none !important; }

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-form .field small {
  color: var(--muted);
  font-weight: 400;
  font-size: 11px;
  margin-left: 4px;
}

.form-error {
  background: linear-gradient(135deg, rgba(255,77,106,.14), rgba(255,77,106,.08));
  color: var(--danger);
  border: 1px solid rgba(255,77,106,.45);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 500;
}

/* ---------- Form elements ---------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 24px 0 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: .01em;
}

.field select,
.field input {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  font-weight: 500;
}
.field select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%2393a1c2' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.field input:hover,
.field select:hover { border-color: color-mix(in oklab, var(--primary) 40%, var(--border)); }

.field select:focus,
.field input:focus {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 4px var(--ring);
  background: var(--card);
}

/* ---------- Buttons ---------- */

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  background: var(--card-hover);
  color: var(--text);
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform .1s, background .18s, border-color .18s, box-shadow .18s, opacity .15s;
  letter-spacing: -0.005em;
  line-height: 1.2;
}
.btn:hover { background: var(--card-hover); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 12px 30px rgba(124,92,255,.42);
}
.btn-primary:active { filter: brightness(.96); }

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover {
  background: var(--bg-soft);
  border-color: color-mix(in oklab, var(--primary) 40%, var(--border));
}

/* Zurück-Buttons — alle Screens nutzen .back-btn für einheitliche Affordance.
   Der Pfeil ist Teil des Buttons-Texts (← Zurück). Beim Hover gleitet der
   Pfeil sanft nach links (Microinteraction für „rückwärts geht's"). */
.back-btn {
  font-weight: 600;
  letter-spacing: 0;
  /* Etwas mehr Akzent als die Standard-Ghost-Optik, damit der Button auf
     vollen Screens nicht in der Hintergrundfarbe untergeht. */
  background: color-mix(in oklab, var(--card) 60%, transparent);
  border-color: color-mix(in oklab, var(--primary-2) 18%, var(--border));
  transition: background 180ms, border-color 180ms, color 180ms,
              letter-spacing 180ms, padding-left 180ms;
  white-space: nowrap;
}
.back-btn:hover {
  color: var(--primary);
  border-color: color-mix(in oklab, var(--primary-2) 50%, var(--border));
  /* sanfter „nach links"-Impuls — der Pfeil scheint sich zurück zu bewegen */
  padding-left: 12px;
  padding-right: 18px;
}
.back-btn:active { transform: scale(.98); }
.back-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* Mobile: Back-Button in der row-between-Header-Zeile bleibt kompakt */
@media (max-width: 520px) {
  .back-btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  .back-btn:hover {
    padding-left: 10px;
    padding-right: 14px;
  }
}

/* ---------- Stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 26px;
}
.stat {
  position: relative;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 16px 14px;
  text-align: center;
  overflow: hidden;
  transition: transform 150ms, border-color 150ms;
}
.stat::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--grad-primary);
  opacity: .7;
}
.stat:hover { transform: translateY(-2px); border-color: color-mix(in oklab, var(--primary) 30%, var(--border)); }
.stat-clickable {
  cursor: pointer;
  user-select: none;
}
.stat-clickable:hover {
  border-color: color-mix(in oklab, var(--primary) 55%, var(--border));
  box-shadow: 0 6px 18px rgba(124,92,255,.18);
}
.stat-clickable:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.stat-clickable:active { transform: translateY(-1px) scale(.99); }
.stat strong {
  display: block;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text), color-mix(in oklab, var(--text) 60%, var(--primary)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .01em;
}
.stat:nth-child(2)::before { background: var(--grad-accent); }
.stat:nth-child(3)::before { background: linear-gradient(135deg, #ffb547, #ff4d6a); }
.stat:nth-child(4)::before { background: linear-gradient(135deg, #ff4d6a, #a855f7); }

.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- Quiz ---------- */

.quiz-top { margin-bottom: 18px; }
.progress {
  height: 10px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.15);
}
.progress-bar {
  height: 100%;
  background: var(--grad-primary);
  width: 0%;
  transition: width .4s cubic-bezier(.2,.8,.2,1);
  position: relative;
  overflow: hidden;
}
.progress-bar::after {
  content: "";
  position: absolute;
  top: 0; left: 0; bottom: 0; width: 50%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  animation: progress-shimmer 2.2s infinite;
}
@keyframes progress-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

.quiz-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.badge {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text);
}

#questionText {
  margin: 4px 0 22px;
  font-size: 20px;
  line-height: 1.45;
  letter-spacing: -0.015em;
  font-weight: 600;
}

.answers {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.answer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  background: var(--bg-soft);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  line-height: 1.4;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
  user-select: none;
  position: relative;
}
.answer:hover {
  background: var(--card-hover);
  border-color: color-mix(in oklab, var(--primary) 55%, var(--border));
  transform: translateX(3px);
  box-shadow: 0 4px 14px rgba(102,126,234,.15);
}
.answer:active { transform: translateX(3px) scale(.99); }
.answer.locked { cursor: default; transform: none; box-shadow: none; }
.answer.locked:hover { transform: none; }

.answer.correct {
  border-color: var(--accent-2);
  background: linear-gradient(135deg, rgba(38,208,180,.14), rgba(74,222,128,.10));
  box-shadow: 0 4px 20px rgba(38,208,180,.18);
}
.answer.wrong {
  border-color: var(--danger);
  background: linear-gradient(135deg, rgba(255,77,106,.14), rgba(255,77,106,.06));
  box-shadow: 0 4px 20px rgba(255,77,106,.18);
}

.answer-marker {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  transition: background .2s, color .2s, border-color .2s, transform .2s;
}
.answer:hover .answer-marker {
  background: var(--grad-primary);
  color: #fff;
  border-color: transparent;
}
.answer.locked:hover .answer-marker {
  /* Nicht mehr umfärben, wenn gelockt */
}
.answer.correct .answer-marker {
  background: var(--grad-accent);
  color: #fff;
  border-color: transparent;
}
.answer.wrong .answer-marker {
  background: linear-gradient(135deg, #ff4d6a, #ff8ba0);
  color: #fff;
  border-color: transparent;
}

.quiz-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

/* ---------- Cheer (Ehrenrunde) ---------- */

.cheer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 0;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(38,208,180,.22), rgba(124,92,255,.20));
  border: 1px solid rgba(38,208,180,.5);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 6px 24px rgba(38,208,180,.2);
  animation: cheer-pop 460ms cubic-bezier(.18,.9,.35,1.3);
}
.cheer-emoji {
  font-size: 26px;
  display: inline-block;
  animation: cheer-wiggle 750ms ease-in-out;
}
.cheer-text { font-size: 15px; line-height: 1.35; }

@keyframes cheer-pop {
  0%   { transform: scale(.85) translateY(8px); opacity: 0; }
  60%  { transform: scale(1.04) translateY(0);  opacity: 1; }
  100% { transform: scale(1)    translateY(0);  opacity: 1; }
}
@keyframes cheer-wiggle {
  0%, 100% { transform: rotate(0); }
  25%      { transform: rotate(-14deg) scale(1.15); }
  55%      { transform: rotate(12deg)  scale(1.15); }
  80%      { transform: rotate(-6deg); }
}

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

.result-card { text-align: center; }

.score-ring {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  margin: 18px auto 14px;
  background: conic-gradient(var(--accent-2) 0%, var(--bg-soft) 0%);
  display: grid;
  place-items: center;
  position: relative;
  transition: background 1s ease;
  box-shadow:
    0 20px 50px rgba(124,92,255,.2),
    inset 0 0 0 1px rgba(255,255,255,.05);
}
.score-ring::before {
  content: "";
  position: absolute;
  inset: 12px;
  background: var(--card);
  border-radius: 50%;
  box-shadow: inset 0 2px 8px rgba(0,0,0,.12);
}
#scorePercent {
  position: relative;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text), color-mix(in oklab, var(--text) 55%, var(--primary)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.score-detail { color: var(--muted); margin: 0 0 6px; font-size: 14px; }
.score-msg { font-weight: 700; margin: 6px 0 20px; font-size: 16px; letter-spacing: -0.01em; }

.review-list {
  text-align: left;
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-item {
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  position: relative;
  overflow: hidden;
}
.review-item::before {
  content: "";
  position: absolute;
  top: 0; left: 0; bottom: 0; width: 4px;
  background: var(--border);
}
.review-item.correct::before { background: var(--grad-accent); }
.review-item.wrong::before   { background: linear-gradient(180deg, #ff4d6a, #ff8ba0); }
.review-item.skipped::before { background: linear-gradient(180deg, #ffb547, #ffd77f); }

.review-q { font-weight: 600; margin: 0 0 10px; line-height: 1.4; }
.review-a { font-size: 14px; color: var(--muted); margin: 3px 0; }
.review-a.highlight-correct { color: var(--accent-2); font-weight: 500; }
.review-a.highlight-wrong   { color: var(--danger); font-weight: 500; }

.review-tag {
  display: inline-block;
  font-size: 10.5px;
  padding: 3px 10px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.review-tag.correct { background: rgba(74,222,128,.18); color: var(--accent-2); }
.review-tag.wrong   { background: rgba(255,77,106,.18); color: var(--danger); }
.review-tag.skipped { background: rgba(255,181,71,.18); color: var(--warn); }

/* ---------- History ---------- */

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.row-between h2 { margin: 0; font-size: 22px; letter-spacing: -0.015em; }

.cat-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}
.cat-summary .cat {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  transition: transform .15s, border-color .15s;
}
.cat-summary .cat::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--grad-primary);
  opacity: .75;
}
.cat-summary .cat:hover {
  transform: translateY(-2px);
  border-color: color-mix(in oklab, var(--primary) 35%, var(--border));
}
.cat .cat-name { font-weight: 700; font-size: 13.5px; margin-bottom: 4px; letter-spacing: -0.01em; }
.cat .cat-nums { font-size: 12px; color: var(--muted); }

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  padding: 12px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: transform .15s, border-color .15s;
}
.history-list li:hover {
  transform: translateX(2px);
  border-color: color-mix(in oklab, var(--primary) 25%, var(--border));
}
.history-list .hx-date { color: var(--muted); font-size: 12px; grid-column: 1 / -1; }
.history-list .hx-cat  { font-weight: 700; letter-spacing: -0.005em; }
.history-list .hx-score {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.02em;
  padding: 2px 10px;
  border-radius: 999px;
}
.history-list .hx-score.good { color: var(--accent-2); background: rgba(74,222,128,.14); }
.history-list .hx-score.mid  { color: var(--warn);    background: rgba(255,181,71,.14); }
.history-list .hx-score.low  { color: var(--danger);  background: rgba(255,77,106,.14); }

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .app-header { padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 12px; gap: 8px; }
  .app-header h1 {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .subtitle { display: none; }
  .logo { width: 38px; height: 38px; font-size: 24px; border-radius: 10px; }
  .logo .logo-paw { width: 24px; height: 24px; }
  /* Brand darf schrumpfen, ggf. mit Ellipsis */
  .brand {
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
  }
  /* Rechte Seite (Icons) niemals quetschen */
  .header-actions {
    flex-shrink: 0;
    gap: 6px;
  }
  main { padding: 18px 14px; }

  /* Card-Padding reduzieren für mehr Platz */
  .card { padding: 16px; border-radius: 14px; }

  /* Hauptbereich des Quiz kompakter machen */
  #questionText { font-size: 16.5px; margin: 0 0 12px; }
  .quiz-meta { margin-top: 8px; }

  /* Joker in eine scrollbare, horizontale Zeile zwingen (1-zeilig) */
  .joker-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 12px;
    scrollbar-width: none; /* Firefox */
    -webkit-overflow-scrolling: touch;
  }
  .joker-bar::-webkit-scrollbar { display: none; } /* Safari/Chrome */
  .joker { flex-shrink: 0; padding: 6px 10px; font-size: 11.5px; }

  /* Antworten schmaler machen */
  .answers { gap: 8px; margin-bottom: 10px; }
  .answer { padding: 10px 12px; gap: 10px; font-size: 13.5px; }
  .answer-marker { width: 28px; height: 28px; min-width: 28px; font-size: 12px; }

  /* Verhindern, dass Maskottchen/Shop die Footer-Buttons verdecken */
  .quiz-footer { margin-bottom: 64px; margin-top: 10px; }

  .hero h2 { font-size: 22px; }
  .header-actions .btn { display: none; }
  .score-ring { width: 150px; height: 150px; }
  #scorePercent { font-size: 32px; }
}

/* ========================================================================
   Compact-Quiz für kleine Bildschirme (iPhone SE 2022 = 375×667 px etc.)
   Greift bei sehr schmalem Viewport ODER niedriger Höhe — fasst alles
   so eng, dass das Quiz OHNE Scrollen sichtbar bleibt. Verfügbarer
   Content-Bereich auf SE: ~520 px (Header 58 + Bottom-Nav 76 abgezogen).
   ======================================================================== */

@media (max-height: 720px), (max-width: 400px) {
  /* Main-Padding minimieren — Bottom-Nav steht eh fixed, Footer gibt eigene Marge */
  body[data-screen="quiz"] main {
    padding: 8px 12px 12px;
  }

  /* Quiz-Top: Progress-Bar dünner, Meta-Zeile kompakter */
  body[data-screen="quiz"] .quiz-top { margin-bottom: 8px; }
  body[data-screen="quiz"] .progress { height: 6px; }
  body[data-screen="quiz"] .quiz-meta {
    margin-top: 6px;
    font-size: 11px;
    gap: 6px;
    flex-wrap: wrap;
  }
  body[data-screen="quiz"] .badge {
    padding: 3px 8px;
    font-size: 10px;
    letter-spacing: .04em;
  }

  /* Quiz-Card eng */
  body[data-screen="quiz"] .card {
    padding: 12px 14px;
    border-radius: 12px;
  }

  /* Frage: kleinere Schrift + engere Zeilenhöhe */
  body[data-screen="quiz"] #questionText {
    font-size: 15px;
    margin: 0 0 8px;
    line-height: 1.32;
  }

  /* Joker-Leiste maximal kompakt — Cost wird auf <360px ausgeblendet */
  body[data-screen="quiz"] .joker-bar {
    margin: 0 0 8px;
    gap: 5px;
    padding-bottom: 0;
  }
  body[data-screen="quiz"] .joker {
    padding: 4px 8px;
    font-size: 10.5px;
    gap: 4px;
  }
  body[data-screen="quiz"] .joker-icon { font-size: 12px; }
  body[data-screen="quiz"] .joker-cost { font-size: 9.5px; }

  /* Antworten kompakter — Marker schrumpft mit, bleibt aber tap-friendly (24px) */
  body[data-screen="quiz"] .answers { gap: 6px; margin-bottom: 8px; }
  body[data-screen="quiz"] .answer {
    padding: 8px 10px;
    gap: 8px;
    font-size: 13px;
    line-height: 1.3;
    border-width: 1px;
  }
  body[data-screen="quiz"] .answer-marker {
    width: 24px;
    height: 24px;
    min-width: 24px;
    font-size: 11px;
    border-radius: 7px;
  }

  /* Footer eng — kein 64px-Spacer mehr nötig, weil Mascot+FAB ausgeblendet */
  body[data-screen="quiz"] .quiz-footer {
    margin-top: 8px;
    margin-bottom: 0;
    gap: 8px;
  }
  body[data-screen="quiz"] .quiz-footer .btn {
    padding: 9px 14px;
    font-size: 13px;
  }

  /* Mascot + Shop-FAB im Quiz ausblenden — sie überlappen sonst die Footer-
     Buttons und lassen das Layout um 64px wachsen. Im Quiz braucht man die
     beiden Buttons sowieso nicht (Pet kann man später wieder streicheln). */
  body[data-screen="quiz"] .mascot,
  body[data-screen="quiz"] .shop-fab {
    display: none !important;
  }

  /* Cheer-Bubble dezenter */
  body[data-screen="quiz"] .cheer {
    padding: 6px 10px;
    margin-top: 6px;
    font-size: 13px;
  }

  /* Inline-Erklärung (nach Antwort) kompakter */
  body[data-screen="quiz"] #inlineExplanation {
    padding: 8px 10px;
    font-size: 12.5px;
    margin-top: 8px;
  }

  /* Zen-Toggle + Abort-Button schrumpfen — sie sitzen in der quiz-meta-Zeile */
  body[data-screen="quiz"] .zen-toggle {
    width: 26px; height: 26px;
    font-size: 14px;
  }
  body[data-screen="quiz"] #abortQuizBtn {
    padding: 3px 8px !important;
    font-size: 10.5px !important;
  }
}

/* Sehr enge Viewports (< 360 px, alte Geräte): Joker-Cost komplett verstecken */
@media (max-width: 360px) {
  body[data-screen="quiz"] .joker-cost { display: none; }
  body[data-screen="quiz"] .joker-label { font-size: 10.5px; }
}

/* ========================================================================
   Dashboard (Startbildschirm)
   ======================================================================== */

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}
@media (min-width: 880px) {
  .hero-grid { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
}

.side-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.side-col .card { padding: 18px 20px; }

/* ---- Streak ---- */
.streak-card {
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--card) 92%, #ff7a33),
    var(--card) 60%);
  border-color: rgba(255,122,51,.28);
  overflow: hidden;
}
.streak-top {
  display: flex;
  align-items: center;
  gap: 14px;
}
.streak-icon {
  font-size: 36px;
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(255,122,51,.4));
  animation: streak-flicker 3s ease-in-out infinite;
}
.streak-icon.cold { filter: grayscale(1) opacity(.5); animation: none; }
@keyframes streak-flicker {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-1px) scale(1.05); }
}
.streak-num {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  background: linear-gradient(135deg, #ffb547, #ff7a33, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.streak-sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-top: 2px;
}
.streak-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 16px;
}
.streak-day {
  aspect-ratio: 1;
  border-radius: 7px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  display: grid;
  place-items: center;
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  position: relative;
  transition: transform .15s;
}
.streak-day.active {
  background: var(--grad-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 10px rgba(124,92,255,.35);
}
/* Tag mit Login/Activity, aber ohne Test-Abschluss — gedämpfter Akzent,
   damit sichtbar dass der User da war, aber visuell klar von Test-Tagen
   unterscheidbar bleibt. */
.streak-day.active-only {
  background: color-mix(in oklab, var(--primary-2) 22%, transparent);
  border-color: color-mix(in oklab, var(--primary-2) 35%, var(--border));
  color: var(--text);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--primary-2) 18%, transparent);
}
:root[data-theme="light"] .streak-day.active-only {
  background: color-mix(in oklab, var(--primary-2) 14%, transparent);
}
.streak-day.today {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}
.streak-day.future {
  opacity: .35;
  background: transparent;
  border-style: dashed;
}
.streak-day:hover { transform: translateY(-2px); }

/* ---- Quick Review ---- */
.quick-review-card {
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--card) 88%, #667eea),
    var(--card) 70%);
  border-color: rgba(124,92,255,.35);
}
.quick-review-text {
  margin: 4px 0 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}
.quick-review-text strong {
  color: var(--danger);
  font-size: 18px;
  font-weight: 800;
}
.btn.btn-small { padding: 10px 16px; font-size: 14px; }

/* ---- Changelog-Modal („Was ist neu?") ----
   Reuse die .level-up-Modal-Struktur, aber mit scrollbarer Content-Area
   für mehrere Versions-Einträge. Auf Mobile hält max-height den Modal
   im Viewport, auf Desktop bekommt er etwas mehr Luft. */
.changelog-card {
  max-width: 520px;
  text-align: left;
  padding: 28px 24px 22px;
}
.changelog-card .level-up-title {
  text-align: center;
  margin-bottom: 6px;
}
.changelog-card .level-up-sub {
  text-align: center;
  margin-bottom: 18px;
}
.changelog-emoji {
  font-size: 56px;
  text-align: center;
  line-height: 1;
  margin: 0 auto 10px;
  filter: drop-shadow(0 6px 16px rgba(168, 85, 247, .35));
  animation: changelog-sparkle 2.4s ease-in-out infinite;
}
@keyframes changelog-sparkle {
  0%, 100% { transform: rotate(-4deg) scale(1); }
  50%      { transform: rotate(4deg)  scale(1.05); }
}
.changelog-content {
  max-height: min(50vh, 380px);
  overflow-y: auto;
  padding: 4px 6px 4px 0;
  margin: 0 0 18px;
  /* Subtile Inset-Linie als Abgrenzung */
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  /* Scrollbar dezent stylen (Webkit) */
  scrollbar-width: thin;
  scrollbar-color: color-mix(in oklab, var(--primary-2) 35%, transparent) transparent;
}
.changelog-content::-webkit-scrollbar { width: 6px; }
.changelog-content::-webkit-scrollbar-thumb {
  background: color-mix(in oklab, var(--primary-2) 35%, transparent);
  border-radius: 999px;
}

.changelog-entry {
  padding: 14px 4px;
  border-bottom: 1px dashed var(--border-soft);
}
.changelog-entry:last-child { border-bottom: none; }

.changelog-entry-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.changelog-version {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.05em;
  background: color-mix(in oklab, var(--primary-2) 14%, transparent);
  border: 1px solid color-mix(in oklab, var(--primary-2) 30%, var(--border));
  padding: 2px 8px;
  border-radius: 999px;
}
.changelog-new-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--grad-accent);
  color: #0c1426;
  box-shadow: 0 2px 8px rgba(38, 208, 180, .35);
  animation: changelog-pulse 1.8s ease-in-out infinite;
}
@keyframes changelog-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}
.changelog-date {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.changelog-entry.is-unseen {
  background: color-mix(in oklab, var(--accent) 6%, transparent);
  border-radius: var(--radius-sm);
  padding-left: 10px;
  padding-right: 10px;
  margin: 4px 0;
}
.changelog-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.changelog-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.changelog-items li {
  position: relative;
  padding-left: 22px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
}
.changelog-items li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-weight: 800;
  font-size: 14px;
}

@media (max-width: 480px) {
  .changelog-card {
    padding: 22px 18px 18px;
  }
  .changelog-content { max-height: 55vh; }
  .changelog-title { font-size: 14px; }
  .changelog-items li { font-size: 13px; }
}

/* ---- Quick-Action-Tiles (Mock / Wrong / Recommend) ----
   Prominente CTA-Reihe oben im Lernen-Tab. Auf Desktop nebeneinander, auf
   Mobile gestapelt. Jede Tile hat einen eigenen Akzent-Gradient. */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}
.quick-action-tile {
  appearance: none;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  color: var(--text);
  background: var(--card);
  transition: transform 140ms, background 180ms, border-color 180ms, box-shadow 180ms;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.quick-action-tile::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--grad-primary);
  opacity: .85;
}
.quick-action-tile.qat-mock::before    { background: linear-gradient(135deg, #ffb547, #ec4899); }
.quick-action-tile.qat-wrong::before   { background: linear-gradient(135deg, #ff4d6a, #a855f7); }
.quick-action-tile.qat-recommend::before { background: var(--grad-accent); }
.quick-action-tile.qat-due::before     { background: linear-gradient(135deg, #7c5cff, #26d0b4); }

/* Locked-Variante fuer Mock-Tile — heute bereits absolviert.
   Vorher war der Button farbig + hover-interaktiv; jetzt grau + keine
   Ablenkung, weil der Klick eh nur eine Absage triggert. */
.quick-action-tile.mock-locked {
  opacity: 0.55;
  cursor: default;
}
.quick-action-tile.mock-locked::before {
  background: var(--muted-soft, #4a5568);
  opacity: 0.7;
}
.quick-action-tile.mock-locked:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}
.quick-action-tile:hover {
  transform: translateY(-1px);
  background: var(--card-hover);
  box-shadow: 0 6px 18px rgba(124,92,255,.15), var(--shadow-sm);
}
.quick-action-tile:active { transform: scale(.99); }
.quick-action-tile:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.qat-emoji {
  font-size: 28px;
  line-height: 1;
  flex: 0 0 auto;
  filter: drop-shadow(0 4px 10px rgba(124,92,255,.25));
}
.qat-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}
.qat-title {
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: -0.01em;
}
.qat-sub {
  font-size: 12.5px;
  color: var(--muted);
}
.qat-sub strong {
  color: var(--text);
  font-weight: 700;
}

/* ---- Stat-Action-Hint (auf der "Offene Fehler"-Card) ---- */
.stat.stat-actionable {
  position: relative;
}
.stat-action-hint {
  display: block;
  font-size: 11px;
  color: var(--accent-2);
  font-weight: 700;
  margin-top: 4px;
  letter-spacing: 0.02em;
  opacity: .85;
  transition: opacity 150ms, transform 150ms;
}
.stat.stat-actionable:hover .stat-action-hint {
  opacity: 1;
  transform: translateX(2px);
}

/* ---- Score-Delta auf Result-Screen ---- */
.score-delta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  margin: 6px auto 8px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid var(--border-soft);
}
.score-delta .sd-icon {
  font-size: 16px;
  line-height: 1;
}
.score-delta-up {
  background: color-mix(in oklab, var(--accent) 18%, var(--card));
  border-color: color-mix(in oklab, var(--accent) 40%, var(--border));
  color: var(--accent);
}
.score-delta-down {
  background: color-mix(in oklab, var(--danger) 14%, var(--card));
  border-color: color-mix(in oklab, var(--danger) 30%, var(--border));
  color: var(--danger);
}
.score-delta-flat {
  background: var(--bg-soft);
  color: var(--muted);
}
.score-delta strong {
  font-weight: 800;
  background: linear-gradient(135deg, #fbbf24, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---- Last-Test-Banner (Top des Lernen-Tabs) ----
   Schmale Kontext-Zeile statt großer Card. Gibt vor dem nächsten Test-Setup
   einen Quick-Glance-Hinweis auf das letzte Ergebnis, ohne visuell mit dem
   Hero/Setup zu konkurrieren. */
.last-test-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  background: color-mix(in oklab, var(--card) 88%, var(--accent) 12%);
  border: 1px solid color-mix(in oklab, var(--accent) 25%, var(--border-soft));
  box-shadow: var(--shadow-sm);
}
.last-test-banner .ltb-icon {
  font-size: 16px;
  line-height: 1;
  flex: 0 0 auto;
}
.last-test-banner .ltb-label {
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.005em;
}
.last-test-banner .ltb-percent {
  font-weight: 800;
  font-size: 14.5px;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.01em;
}
.last-test-banner .ltb-cat {
  color: var(--text);
  font-weight: 600;
}
.last-test-banner .ltb-time {
  color: var(--muted);
}
.last-test-banner .ltb-sep {
  opacity: .45;
}
@media (max-width: 480px) {
  .last-test-banner {
    font-size: 12.5px;
    padding: 8px 12px;
    gap: 6px;
  }
  .last-test-banner .ltb-percent { font-size: 13.5px; }
}

/* Mini-Label bleibt verfügbar für andere Stellen, falls gebraucht. */
.mini-label {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  margin-bottom: 8px;
}

/* ---- Pet-Status ---- */
.pet-status-card {
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--card) 88%, var(--primary-2) 12%),
    var(--card) 70%);
  border-color: rgba(124,92,255,.32);
}
.pet-status-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.pet-status-icon {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  display: grid;
  place-items: center;
  position: relative; /* Anker für absolut positionierte Accessoires */
}
.pet-status-icon svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.25));
}
.pet-status-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.015em;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.pet-status-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.pet-status-meta .dot { opacity: .5; }

.pet-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.pet-progress-label strong { color: var(--text); font-weight: 700; }
.pet-progress-pct {
  color: var(--accent-2);
  font-weight: 800;
  letter-spacing: -0.01em;
}
.pet-progress-need {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
}
.pet-status-edit {
  margin-top: 12px;
  width: 100%;
}
.pet-max {
  text-align: center;
  padding: 12px;
  font-weight: 700;
  font-size: 14px;
  background: linear-gradient(135deg, rgba(251,191,36,.14), rgba(236,72,153,.10));
  border-radius: var(--radius-sm);
  border: 1px solid rgba(251,191,36,.4);
  color: var(--text);
}

/* ---- Section heads ---- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 8px 4px 12px;
}
.section-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.section-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cat-back-btn {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 150ms, transform 120ms, border-color 150ms;
}
.cat-back-btn:hover {
  background: var(--card-hover);
  border-color: color-mix(in oklab, var(--primary) 55%, var(--border));
}
.cat-back-btn:active { transform: scale(.92); }
.cat-back-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.section-sub {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}

/* ---- Category progress grid ---- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.cat-card {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  text-align: left;
  font: inherit;
  color: inherit;
}
.cat-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in oklab, var(--cat-color, var(--primary)) 55%, var(--border));
  box-shadow: 0 8px 22px color-mix(in oklab, var(--cat-color, var(--primary)) 20%, transparent);
}
.cat-card:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.cat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.cat-emoji {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 18px;
  background: color-mix(in oklab, var(--cat-color, var(--primary)) 18%, var(--bg));
  border: 1px solid color-mix(in oklab, var(--cat-color, var(--primary)) 35%, transparent);
}
.cat-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.cat-meta {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
}
.cat-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
}
.cat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg,
    var(--cat-color, var(--primary)),
    color-mix(in oklab, var(--cat-color, var(--primary)) 50%, var(--accent-2)));
  width: 0%;
  transition: width .6s cubic-bezier(.2,.8,.2,1);
}
.cat-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}
.cat-pct {
  color: var(--cat-color, var(--primary));
  font-weight: 700;
}

/* ---- Radar-/Spinnennetz-Chart ---- */
/* Zwei Einsatzorte:
    .radar-card    → eigenständige Card im Fortschritts-Tab
    .radar-inline  → inline-Block innerhalb der bestehenden Verlaufs-Card  */
.radar-card {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.radar-inline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 18px 0 24px;
  padding: 18px 14px 20px;
  border-radius: var(--radius);
  /* Neumorphismus-Look: leicht vertiefte Card innerhalb der Verlaufs-Card,
     mit sanftem inneren Schatten + dezenter Akzent-Outline. */
  background: color-mix(in oklab, var(--card) 92%, var(--primary-2) 4%);
  border: 1px solid color-mix(in oklab, var(--primary-2) 20%, var(--border));
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.18),
    inset 0 -1px 0 color-mix(in oklab, var(--primary-2) 12%, transparent),
    0 1px 0 rgba(255, 255, 255, 0.03);
}
:root[data-theme="light"] .radar-inline {
  box-shadow:
    inset 0 2px 6px rgba(15, 23, 36, 0.06),
    inset 0 -1px 0 color-mix(in oklab, var(--primary-2) 14%, transparent),
    0 1px 2px rgba(15, 23, 36, 0.04);
}
.radar-head {
  text-align: center;
  width: 100%;
}
.radar-title {
  margin: 0 0 4px;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.radar-head .section-sub {
  font-size: 12.5px;
}
.radar-canvas-wrap {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1 / 1;
  padding: 8px;
  border-radius: 50%;
  /* Dezenter innerer Glow + Neumorphismus-Schatten-Andeutung */
  background: radial-gradient(
    circle at center,
    color-mix(in oklab, var(--primary-2) 8%, transparent) 0%,
    transparent 70%
  );
  box-shadow:
    inset 0 2px 10px rgba(124, 92, 255, 0.08),
    inset 0 -2px 10px rgba(0, 0, 0, 0.15);
  display: grid;
  place-items: center;
}
:root[data-theme="light"] .radar-canvas-wrap {
  box-shadow:
    inset 0 2px 10px rgba(124, 92, 255, 0.10),
    inset 0 -2px 10px rgba(15, 23, 36, 0.06);
}
/* Mobile: etwas schlanker, damit das Radar auf kleinen Displays genug Luft hat */
@media (max-width: 520px) {
  .radar-inline { padding: 14px 10px 16px; margin: 14px 0 18px; }
  .radar-canvas-wrap { max-width: 340px; }
}
.radar-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
}

/* ---- Weekly Sparkline ---- */
.weekly-card { padding: 20px 22px; }
.sparkline {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  align-items: end;
  min-height: 120px;
}
.spark-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 120px;
  justify-content: end;
}
.spark-bar {
  width: 100%;
  min-height: 4px;
  border-radius: 8px 8px 4px 4px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  position: relative;
  transition: transform .15s;
}
.spark-bar.active {
  background: var(--grad-primary);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(124,92,255,.3);
}
.spark-bar:hover { transform: translateY(-2px); }
.spark-bar.future {
  opacity: .3;
  background: transparent;
  border-style: dashed;
}
.spark-label.future { opacity: .4; }
.spark-bar::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  border: 1px solid var(--border);
  transition: opacity .15s;
}
.spark-bar:hover::after { opacity: 1; }
.spark-label {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.spark-label.today { color: var(--accent-2); }

/* Pulse-Hervorhebung bei Kategoriewechsel */
.pulse-hint select {
  animation: pulse-hint 1.6s ease-out;
  border-color: var(--primary-2) !important;
}
@keyframes pulse-hint {
  0%   { box-shadow: 0 0 0 0 var(--ring); }
  40%  { box-shadow: 0 0 0 10px rgba(124,92,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(124,92,255,0); }
}

/* ========================================================================
   Frage des Tages
   ======================================================================== */

.daily-card {
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--card) 85%, #a855f7),
    var(--card) 60%);
  border-color: rgba(168,85,247,.3);
}
.daily-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.daily-head h3 { margin: 2px 0 0; font-size: 15px; font-weight: 700; color: var(--muted); letter-spacing: -0.01em; }
.daily-badge {
  background: rgba(74,222,128,.18);
  color: var(--accent-2);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid rgba(74,222,128,.4);
  white-space: nowrap;
}
.daily-question {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
  margin: 0 0 14px;
}
.daily-answers {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
}
.daily-answers .answer {
  padding: 11px 14px;
  font-size: 14px;
}
.daily-result {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.5;
}
.daily-result.correct { background: rgba(74,222,128,.1); border-color: rgba(74,222,128,.4); }
.daily-result.wrong   { background: rgba(255,77,106,.1); border-color: rgba(255,77,106,.4); }
.daily-result strong { font-weight: 700; }

/* ========================================================================
   Tägliche Missionen (Daily Quests)
   ======================================================================== */

.quests-card {
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--card) 85%, #38bdf8),
    var(--card) 60%);
  border-color: rgba(56,189,248,.3);
}
.quests-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.quest-item {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 4px 10px;
  transition: opacity .25s, border-color .2s, background .2s;
}
.quest-item.done {
  opacity: .55;
  background: rgba(74,222,128,.08);
  border-color: rgba(74,222,128,.35);
}
.quest-item.claimable {
  border-color: rgba(255,181,71,.55);
  background: rgba(255,181,71,.08);
  box-shadow: 0 0 0 2px rgba(255,181,71,.12);
}
.quest-title {
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}
.quest-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.quest-desc {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.3;
  padding-left: 24px;
}
.quest-item.done .quest-title::after {
  content: "✓";
  color: var(--accent-2, #4ade80);
  font-weight: 900;
  font-size: 14px;
  margin-left: 4px;
}
.quest-reward {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  align-self: center;
  white-space: nowrap;
}
.quest-progress {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.quest-bar {
  flex: 1;
  height: 8px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.quest-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #4ade80);
  border-radius: 999px;
  transition: width .35s ease;
}
.quest-count {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.quest-claim-btn {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #ffb547, #ec4899);
  color: #fff;
  cursor: pointer;
  transition: transform .12s, filter .15s;
}
.quest-claim-btn:hover { filter: brightness(1.08); }
.quest-claim-btn:active { transform: scale(0.97); }

/* ========================================================================
   Achievements
   ======================================================================== */

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.ach-card {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: center;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  position: relative;
  overflow: hidden;
}
.ach-card.unlocked {
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--bg-soft) 80%, #ffb547),
    var(--bg-soft));
  border-color: rgba(255,181,71,.4);
}
.ach-card.unlocked::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #ffb547, #ec4899, #a855f7);
}

/* Hidden Achievement Karte — dramatischer Look */
.ach-card.ach-hidden {
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--card) 75%, #a855f7),
    color-mix(in oklab, var(--card) 85%, #ec4899) 60%,
    var(--card));
  border-color: rgba(168, 85, 247, .55);
  box-shadow: 0 8px 26px rgba(168, 85, 247, .25);
}
.ach-card.ach-hidden::before {
  background: linear-gradient(90deg, #fbbf24, #ec4899, #a855f7, #38bdf8);
  height: 4px;
}
.ach-hidden-badge {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  padding: 3px 7px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fbbf24, #ec4899);
  color: #fff;
  box-shadow: 0 2px 8px rgba(236, 72, 153, .35);
}

/* Meta-Achievement (Schatzsucher) */
.ach-card.ach-meta {
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--bg-soft) 70%, #fbbf24),
    var(--bg-soft));
  border-color: rgba(251, 191, 36, .4);
}
.ach-card:hover { transform: translateY(-2px); }
.ach-emoji {
  font-size: 34px;
  line-height: 1;
  margin-bottom: 8px;
  display: inline-block;
  filter: grayscale(1) opacity(.4);
  transition: filter .3s;
}
.ach-card.unlocked .ach-emoji {
  filter: none;
  animation: ach-pop .5s cubic-bezier(.2,.9,.3,1.3);
}
@keyframes ach-pop {
  0%   { transform: scale(.8) rotate(-8deg); }
  60%  { transform: scale(1.15) rotate(6deg); }
  100% { transform: scale(1) rotate(0); }
}
.ach-title {
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: -0.005em;
  margin-bottom: 4px;
  color: var(--text);
}
.ach-card:not(.unlocked) .ach-title { color: var(--muted); }
.ach-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

/* ---- Toast ---- */
.toast-container {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid #ffb547;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: 0 12px 32px rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
  max-width: 360px;
  animation: toast-in .4s cubic-bezier(.2,.9,.3,1.2), toast-out .4s ease forwards 4.5s;
  pointer-events: auto;
}
.toast-emoji { font-size: 28px; }

/* Hidden-Toast: auffälliger magischer Look */
.toast.toast-hidden {
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--card) 65%, #a855f7),
    color-mix(in oklab, var(--card) 75%, #ec4899));
  border-color: rgba(251, 191, 36, .7);
  border-left: 4px solid #fbbf24;
  box-shadow: 0 14px 40px rgba(168, 85, 247, .45), 0 0 0 1px rgba(251, 191, 36, .25);
  animation: toast-in .5s cubic-bezier(.18,.9,.35,1.3), hidden-shimmer 2.5s ease-in-out infinite, toast-out .4s ease forwards 5s;
}
.toast.toast-hidden .toast-emoji {
  animation: cheer-wiggle 900ms ease-in-out;
}
@keyframes hidden-shimmer {
  0%, 100% { box-shadow: 0 14px 40px rgba(168, 85, 247, .45), 0 0 0 1px rgba(251, 191, 36, .25); }
  50%      { box-shadow: 0 18px 50px rgba(236, 72, 153, .55), 0 0 0 2px rgba(251, 191, 36, .5); }
}
.toast-title { font-weight: 700; font-size: 14px; letter-spacing: -0.01em; }
.toast-desc  { font-size: 12px; color: var(--muted); margin-top: 2px; }
@keyframes toast-in {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes toast-out {
  to { transform: translateX(110%); opacity: 0; }
}

/* ---- App-Toasts (Ersatz für native alert()-Popups) ---- */
.app-toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toast-in .4s cubic-bezier(.2,.9,.3,1.2), toast-out .4s ease forwards 3.5s;
  pointer-events: auto;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  min-width: 260px;
  max-width: 360px;
}
.app-toast.error   { border-left: 4px solid var(--danger); }
.app-toast.info    { border-left: 4px solid var(--primary); }
.app-toast.success { border-left: 4px solid var(--accent-2); }
.app-toast.warn    { border-left: 4px solid var(--warn); }

/* ========================================================================
   Timer + Mock-Test
   ======================================================================== */

.timer-badge {
  background: linear-gradient(135deg, rgba(255,181,71,.2), rgba(255,77,106,.15));
  border-color: rgba(255,181,71,.5);
  color: var(--warn);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: .04em;
}
.timer-badge.low {
  background: linear-gradient(135deg, rgba(255,77,106,.3), rgba(255,77,106,.15));
  border-color: var(--danger);
  color: var(--danger);
  animation: timer-pulse 1s ease-in-out infinite;
}
@keyframes timer-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

/* ========================================================================
   Erklärungen in Review
   ======================================================================== */

.explanation {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  background: color-mix(in oklab, var(--bg-soft) 70%, var(--primary) 12%);
  border-left: 3px solid var(--primary);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}
.explanation::before {
  content: "💡 ";
}

/* Durchlauf-Detail-Kopf */
.run-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 10px 0 18px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}
.run-pct {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  background: rgba(127,127,127,.1);
  border: 1px solid var(--border);
}
.run-pct.good { color: var(--accent-2); background: rgba(74,222,128,.12);  border-color: rgba(74,222,128,.35); }
.run-pct.mid  { color: var(--warn);     background: rgba(255,181,71,.12);  border-color: rgba(255,181,71,.35); }
.run-pct.low  { color: var(--danger);   background: rgba(255,77,106,.12);  border-color: rgba(255,77,106,.35); }
.run-meta { font-weight: 600; font-size: 14.5px; }
.run-date { margin-top: 2px; }

/* History-Liste klickbar */
.hx-item { cursor: pointer; }
.hx-item:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* Mehr-Info-Expander */
.more-info-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  transition: color 150ms, border-color 150ms, background 150ms;
}
.more-info-toggle:hover {
  color: var(--text);
  border-color: color-mix(in oklab, var(--primary) 50%, var(--border));
  background: color-mix(in oklab, var(--bg-soft) 60%, var(--primary) 10%);
}
.more-info-toggle.open {
  color: var(--text);
  border-color: color-mix(in oklab, var(--primary) 55%, var(--border));
  background: color-mix(in oklab, var(--bg-soft) 55%, var(--primary) 12%);
}
.mi-chevron { font-size: 10px; display: inline-block; transition: transform 180ms; }
.more-info-toggle.open .mi-chevron { transform: rotate(0deg); }

.more-info-body {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: color-mix(in oklab, var(--bg-soft) 65%, var(--primary) 8%);
  border: 1px solid color-mix(in oklab, var(--primary) 30%, var(--border));
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  animation: fade .25s ease;
}
.more-info-body p { margin: 0 0 10px; }
.more-info-body p:last-child { margin-bottom: 0; }

.inline-explanation {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: color-mix(in oklab, var(--bg-soft) 75%, var(--primary) 8%);
  border: 1px solid var(--border-soft);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  animation: fade .25s ease;
}

/* Wrong-Answer-Hook: nach falscher Antwort erscheint ein „📖 Lesetext zu
   diesem Thema"-Button unter der Erklaerung. Mint-Tint, kompakt, button-
   artig. Sofort klickbar — oeffnet den LessonReader im Quiz-Kontext. */
.inline-lesson-hint {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  background: rgba(38, 208, 180, 0.14);
  border: 1px solid rgba(38, 208, 180, 0.5);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
  font-family: inherit;
  transition: background-color .15s, transform .12s;
  animation: fade .25s ease;
}
.inline-lesson-hint:hover {
  background: rgba(38, 208, 180, 0.24);
}
.inline-lesson-hint:active {
  transform: scale(0.97);
}

/* ========================================================================
   Mini-Hunde-Maskottchen
   ======================================================================== */

.mascot {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 40;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.15);
  background: var(--grad-primary);
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(124,92,255,.35);
  display: grid;
  place-items: center;
  font-size: 30px;
  line-height: 1;
  padding: 0;
  transition: transform .2s ease, box-shadow .2s ease;
  animation: mascot-idle 4s ease-in-out infinite;
}
.mascot:hover {
  transform: scale(1.1) rotate(-8deg);
  box-shadow: 0 12px 28px rgba(124,92,255,.5);
}
.mascot:active { transform: scale(.92); }
.mascot:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }
.mascot.wag { animation: mascot-wag .6s ease-in-out; }
.mascot.jump { animation: mascot-jump .5s cubic-bezier(.2,.9,.3,1.3); }

@keyframes mascot-idle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-3px) rotate(2deg); }
}
@keyframes mascot-wag {
  0%   { transform: rotate(0); }
  25%  { transform: rotate(-12deg); }
  50%  { transform: rotate(14deg); }
  75%  { transform: rotate(-8deg); }
  100% { transform: rotate(0); }
}
@keyframes mascot-jump {
  0%   { transform: translateY(0) scale(1); }
  40%  { transform: translateY(-14px) scale(1.15); }
  70%  { transform: translateY(-6px) scale(1.05); }
  100% { transform: translateY(0) scale(1); }
}

.mascot-face {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.25));
}
.mascot-face svg,
.mascot-face img.dog-photo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* Foto-Hund auch im Pet-Status (Begleiter-Karte) und Pet-Setup-Modal */
.pet-status-icon img.dog-photo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.25));
}
.pet-breed-icon img.dog-photo,
.pet-breed-card img.dog-photo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mascot-accessory {
  position: absolute;
  pointer-events: none;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
}
.mascot-accessory.slot-top {
  top: -2px;
  left: 50%;
  transform: translateX(-50%) rotate(-8deg);
  font-size: 26px;
}
.mascot-accessory.slot-eyes {
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 24px;
}
.mascot-accessory.slot-body {
  bottom: 0px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 22px;
}

/* Shop-FAB */
.shop-fab {
  position: fixed;
  bottom: 20px;
  left: 86px;
  z-index: 39;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.15);
  background: linear-gradient(135deg, #fbbf24, #ec4899);
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(236,72,153,.35);
  color: #fff;
  font-size: 20px;
  display: grid;
  place-items: center;
  padding: 0;
  transition: transform .2s ease;
}
.shop-fab:hover { transform: scale(1.12) rotate(8deg); }
.shop-fab:active { transform: scale(.92); }
@media (max-width: 520px) {
  .shop-fab { width: 38px; height: 38px; font-size: 17px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); left: 70px; z-index: 60; }
}

.mascot-bubble {
  position: absolute;
  bottom: calc(100% + 12px);
  left: -10px;
  width: max-content;
  max-width: 240px;
  white-space: normal;
  text-align: center;
  line-height: 1.4;
  background: var(--card);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(0,0,0,.25);
  animation: bubble-pop .4s cubic-bezier(.2,.9,.3,1.3);
}
.mascot-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 32px;
  border: 6px solid transparent;
  border-top-color: var(--card);
}
@keyframes bubble-pop {
  0%   { transform: translateY(5px) scale(.8); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@media (max-width: 520px) {
  .mascot { width: 48px; height: 48px; font-size: 24px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); left: 14px; z-index: 60; }
}

/* ========================================================================
   Joker-Leiste im Quiz
   ======================================================================== */

.joker-bar {
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
  flex-wrap: wrap;
}
.joker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  transition: background 150ms, border-color 150ms, transform 120ms, opacity 150ms;
}
.joker:hover:not(:disabled) {
  background: color-mix(in oklab, var(--bg-soft) 75%, var(--primary) 12%);
  border-color: color-mix(in oklab, var(--primary) 50%, var(--border));
}
.joker:active:not(:disabled) { transform: scale(.95); }
.joker:disabled { opacity: .4; cursor: not-allowed; }
.joker.used { background: rgba(127,127,127,.1); border-style: dashed; }
.joker-icon { font-size: 14px; }
.joker-label { font-weight: 700; }
.joker-cost {
  color: #fbbf24;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: -0.01em;
}

/* Antwort gestrichen (50/50-Joker) */
.answer.crossed {
  opacity: .25;
  pointer-events: none;
  text-decoration: line-through;
}

/* Hint-Box vom Hinweis-Joker */
.joker-hint {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: color-mix(in oklab, var(--bg-soft) 70%, #fbbf24 18%);
  border: 1px solid rgba(251,191,36,.45);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  animation: fade .25s ease;
}

/* ========================================================================
   Shop
   ======================================================================== */

.shop-bones {
  margin: 4px 0 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(251,191,36,.18), rgba(236,72,153,.10));
  border: 1px solid rgba(251,191,36,.4);
  font-size: 14px;
  font-weight: 600;
}
.shop-bones strong { color: #fbbf24; font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }

.shop-group-title {
  margin: 18px 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.shop-group-title:first-of-type { margin-top: 6px; }

.shop-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.shop-item {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 14px 12px 12px;
  text-align: center;
  transition: transform .15s, border-color .15s;
  position: relative;
}
.shop-item:hover { transform: translateY(-2px); }
.shop-item.owned { border-color: rgba(74,222,128,.4); }
.shop-item.equipped {
  background: linear-gradient(135deg, rgba(74,222,128,.12), var(--bg-soft));
  border-color: rgba(74,222,128,.6);
}
.shop-item.locked {
  opacity: 0.55;
  border-color: rgba(255, 215, 0, 0.35);
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.06), var(--bg-soft));
}
.shop-item.locked .shop-emoji { filter: grayscale(60%); }
.shop-item.locked .shop-btn { opacity: 0.6; cursor: not-allowed; }
.shop-emoji {
  font-size: 34px;
  line-height: 1;
  margin-bottom: 8px;
}
/* Bild-basierte Shop-Items (statt Emoji) — gleiche visuelle Größe */
.shop-emoji.shop-img {
  font-size: 0;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shop-emoji.shop-img img {
  height: 100%;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.25));
}

/* Foto-basierte Accessoires auf dem Maskottchen */
.mascot-accessory.has-image .accessory-img {
  display: block;
  pointer-events: none;
}

/* 1. Bildgrößen definieren */
.mascot-accessory.has-image.slot-top  .accessory-img { width: 34px; height: auto; }
.mascot-accessory.has-image.slot-eyes .accessory-img { width: 32px; height: auto; }
.mascot-accessory.has-image.slot-body .accessory-img { width: 30px; height: auto; }

/* 2. Positionen für Bilder überschreiben (hebt die Krone an und macht sie gerade) */
.mascot-accessory.has-image.slot-top {
  top: -16px;
  transform: translateX(-50%); /* Überschreibt die -8deg Rotation der Emojis */
}
.mascot-accessory.has-image.slot-eyes {
  top: 14px;
}

/* 3. Anpassungen für den großen Pet-Status-Kreis (Begleiter-Tab) */
.pet-status-icon .mascot-accessory.has-image.slot-top  .accessory-img { width: 44px; }
.pet-status-icon .mascot-accessory.has-image.slot-eyes .accessory-img { width: 40px; }
.pet-status-icon .mascot-accessory.has-image.slot-body .accessory-img { width: 36px; }

.pet-status-icon .mascot-accessory.has-image.slot-top {
  top: -22px; /* Bei größerem Hund muss die Krone weiter hoch */
}
.pet-status-icon .mascot-accessory.has-image.slot-eyes {
  top: 18px;
}
.shop-name {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.shop-status {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}
.shop-btn {
  width: 100%;
  padding: 7px 10px !important;
  font-size: 12.5px !important;
}

/* Info-Badge im Shop-Item */
.shop-info {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background 150ms, color 150ms, border-color 150ms, transform 120ms;
  z-index: 2;
}
.shop-info:hover {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
  transform: scale(1.08);
}
.shop-info:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* Effekt-Tooltip (Pop-up beim Klick) */
.effect-tooltip {
  position: fixed;
  z-index: 110;
  max-width: 260px;
  padding: 10px 14px;
  background: var(--card);
  color: var(--text);
  border: 1px solid color-mix(in oklab, var(--primary) 40%, var(--border));
  border-radius: var(--radius-sm);
  box-shadow: 0 14px 32px rgba(0,0,0,.45);
  font-size: 12.5px;
  line-height: 1.5;
  font-weight: 500;
  animation: bubble-pop .3s cubic-bezier(.18,.9,.35,1.3);
  pointer-events: none;
}

/* ========================================================================
   Theme-Varianten (durch Shop-Item freischaltbar)
   ======================================================================== */

:root.theme-sunset {
  --primary:     #ff8c42;
  --primary-2:   #ff5f8a;
  --primary-hover: #ffa66a;
  --accent:      #ffc75f;
  --accent-2:    #ffb347;
  --grad-primary: linear-gradient(135deg, #ff8c42, #ff5f8a 55%, #ec4899);
  --grad-accent:  linear-gradient(135deg, #ffc75f, #ff8c42);
  --grad-brand:   linear-gradient(135deg, #ff8c42, #ec4899 60%, #a855f7);
  --ring: rgba(255, 140, 66, .35);
}
:root.theme-mint {
  --primary:     #26d0b4;
  --primary-2:   #10b981;
  --primary-hover: #3bdac1;
  --accent:      #4ade80;
  --accent-2:    #86efac;
  --grad-primary: linear-gradient(135deg, #26d0b4, #10b981 55%, #3b82f6);
  --grad-accent:  linear-gradient(135deg, #4ade80, #26d0b4);
  --grad-brand:   linear-gradient(135deg, #26d0b4, #10b981 60%, #3b82f6);
  --ring: rgba(38, 208, 180, .35);
}
:root.theme-sakura {
  --primary:     #f472b6;
  --primary-2:   #e879f9;
  --primary-hover: #f48bcb;
  --accent:      #ec4899;
  --accent-2:    #f9a8d4;
  --grad-primary: linear-gradient(135deg, #f472b6, #e879f9 55%, #a78bfa);
  --grad-accent:  linear-gradient(135deg, #f9a8d4, #f472b6);
  --grad-brand:   linear-gradient(135deg, #f9a8d4, #f472b6 60%, #a78bfa);
  --ring: rgba(244, 114, 182, .35);
}

/* ========================================================================
   Level-Up-Modal
   ======================================================================== */

.level-up {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: radial-gradient(ellipse at center, rgba(124,92,255,.4), rgba(0,0,0,.85));
  backdrop-filter: blur(14px);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fade .35s ease;
}
.level-up-card {
  background: var(--card);
  border: 2px solid var(--primary-2);
  border-radius: var(--radius);
  padding: 36px 28px 28px;
  max-width: 460px;
  width: 100%;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(124,92,255,.6), 0 0 0 4px rgba(251,191,36,.2);
  animation: level-up-pop .6s cubic-bezier(.18,.9,.35,1.4);
}
@keyframes level-up-pop {
  0%   { transform: scale(.6) rotate(-8deg); opacity: 0; }
  60%  { transform: scale(1.08) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.level-up-emoji {
  font-size: 80px;
  line-height: 1;
  margin: 0 auto 12px;
  display: inline-block;
  animation: level-up-bounce 1s cubic-bezier(.4,0,.6,1) infinite alternate;
  filter: drop-shadow(0 8px 20px rgba(251,191,36,.6));
}
@keyframes level-up-bounce {
  0%   { transform: translateY(0) scale(1); }
  100% { transform: translateY(-8px) scale(1.05); }
}

.level-up-title {
  margin: 8px 0 12px;
  font-size: 28px;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fbbf24, #ec4899, #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.level-up-text {
  font-size: 16px;
  margin: 8px 0 6px;
  color: var(--text);
  line-height: 1.5;
}
.level-up-stage {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
}
.level-up-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 6px 0 22px;
  line-height: 1.5;
}

/* Konfetti-Stücke fliegen aus der Mitte */
.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.confetti span {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 22px;
  animation: confetti-fly 1.6s cubic-bezier(.2,.6,.4,1) forwards;
}
.confetti span:nth-child(1) { animation-delay: .05s; --tx: -120px; --ty: -100px; --r:  -40deg; }
.confetti span:nth-child(2) { animation-delay: .10s; --tx:  120px; --ty: -100px; --r:   30deg; }
.confetti span:nth-child(3) { animation-delay: .15s; --tx: -160px; --ty:   40px; --r:  -90deg; }
.confetti span:nth-child(4) { animation-delay: .20s; --tx:  160px; --ty:   40px; --r:   80deg; }
.confetti span:nth-child(5) { animation-delay: .25s; --tx:  -80px; --ty:  140px; --r:  -60deg; }
.confetti span:nth-child(6) { animation-delay: .30s; --tx:   80px; --ty:  140px; --r:   60deg; }
.confetti span:nth-child(7) { animation-delay: .35s; --tx: -200px; --ty:  -40px; --r: -120deg; }
.confetti span:nth-child(8) { animation-delay: .40s; --tx:  200px; --ty:  -40px; --r:  120deg; }
@keyframes confetti-fly {
  0%   { transform: translate(-50%, -50%) scale(.5) rotate(0); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1) rotate(var(--r)); opacity: 0; }
}

/* ========================================================================
   Pet-Setup-Modal
   ======================================================================== */

body.modal-open { overflow: hidden; }

.pet-setup {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(8, 12, 24, .75);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fade .35s ease;
}
.pet-setup-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 26px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 60px rgba(0,0,0,.6);
  animation: pet-pop .5s cubic-bezier(.18,.9,.35,1.3);
}
@keyframes pet-pop {
  0%   { transform: scale(.85) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0);     opacity: 1; }
}

.pet-setup-header { text-align: center; margin-bottom: 20px; }
.pet-setup-emoji {
  display: inline-block;
  font-size: 48px;
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(124,92,255,.4));
  animation: cheer-wiggle 1.2s ease-in-out infinite alternate;
}
.pet-setup-card h2 {
  margin: 12px 0 8px;
  font-size: 24px;
  letter-spacing: -0.02em;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.pet-setup-intro {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
}

.pet-setup .field { margin-bottom: 18px; }
.field-label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 8px;
  letter-spacing: .01em;
}

.pet-breed-section { margin-bottom: 22px; }
.pet-breed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.breed-card {
  position: relative;
  background: var(--bg-soft);
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  cursor: pointer;
  text-align: center;
  font: inherit;
  color: inherit;
  transition: transform .15s, border-color .15s, background .15s;
}
.breed-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in oklab, var(--primary) 40%, var(--border));
}
.breed-card.selected {
  border-color: var(--primary-2);
  background: color-mix(in oklab, var(--bg-soft) 60%, var(--primary) 18%);
  box-shadow: 0 6px 20px rgba(124,92,255,.25);
}
.breed-card.selected::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--accent-2);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  z-index: 2;
}
.breed-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 8px;
  display: grid;
  place-items: center;
}
.breed-icon svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.25));
}
.breed-emoji {
  font-size: 38px;
  line-height: 1;
  margin-bottom: 8px;
}
.breed-name {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.breed-desc {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.35;
}

.pet-setup-save {
  width: 100%;
  font-size: 15.5px;
  padding: 14px;
}

/* ---------- Motion accessibility ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .logo { animation: none; }
  .progress-bar::after { display: none; }
}

/* ========================================================================
   Zen-/Fokus-Modus
   ======================================================================== */

.zen-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  padding: 0;
  margin-left: auto;
  transition: background 150ms, color 150ms, transform 120ms;
}
.zen-toggle:hover {
  background: var(--bg-soft);
  color: var(--text);
  border-color: color-mix(in oklab, var(--primary) 40%, var(--border));
}
.zen-toggle:active { transform: scale(.92); }
.zen-toggle:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

body.zen-mode.zen-active-quiz .zen-toggle {
  background: var(--grad-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(124, 92, 255, .35);
}

/* Wenn Zen aktiv UND Quiz-Screen offen: alles Ablenkende ausblenden */
body.zen-mode.zen-active-quiz .app-header,
body.zen-mode.zen-active-quiz .main-nav,
body.zen-mode.zen-active-quiz .mascot,
body.zen-mode.zen-active-quiz .shop-fab,
body.zen-mode.zen-active-quiz .joker-bar,
body.zen-mode.zen-active-quiz #cheer,
body.zen-mode.zen-active-quiz #mascotBubble,
body.zen-mode.zen-active-quiz .app-footer {
  display: none !important;
}

body.zen-mode.zen-active-quiz {
  padding-left: 0 !important;
  padding-bottom: 0 !important;
}

body.zen-mode.zen-active-quiz #screen-quiz {
  max-width: 720px;
  margin: 0 auto;
  padding-top: 12px;
}

body.zen-mode.zen-active-quiz main {
  padding: 16px;
  max-width: 760px;
}

/* Schwebender Exit-Button im Zen-Modus */
body.zen-mode.zen-active-quiz .zen-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 70;
  width: 40px;
  height: 40px;
  font-size: 18px;
  border-radius: 50%;
  margin: 0;
}

/* Vorlese-Button (Text-to-Speech) */
.speak-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  margin-left: 8px;
  opacity: 0.6;
  padding: 2px 6px;
  border-radius: 8px;
  transition: opacity 150ms ease, transform 120ms ease, background 150ms ease;
  vertical-align: middle;
  line-height: 1;
}
.speak-btn:hover {
  opacity: 1;
  transform: scale(1.1);
  background: color-mix(in oklab, var(--bg-soft) 70%, var(--primary) 12%);
}
.speak-btn:active {
  transform: scale(0.95);
}
.speak-btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  opacity: 1;
}

/* ========================================================================
   Custom-Select-UI (Ersatz für native <select>-Dropdowns)
   ======================================================================== */

/* Original-<select> komplett aus dem Render-Baum entfernen.
   "Visually hidden" reicht auf iOS NICHT — Safari fängt Label-Klicks ab und
   öffnet trotzdem das System-Rad. Mit display:none ist das Element für iOS
   einfach nicht mehr da. Der Wert bleibt trotzdem als Form-Datenquelle gültig,
   weil das <select>-Element selbst weiter im DOM hängt. */
.custom-select-native-hidden {
  display: none !important;
}

.custom-select-wrapper {
  position: relative;
  width: 100%;
}

/* Trigger sieht aus wie .field select */
.custom-select-trigger {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  padding-right: 36px; /* Platz für Pfeil */
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.custom-select-trigger:hover {
  border-color: color-mix(in oklab, var(--primary) 40%, var(--border));
}
.custom-select-wrapper.open .custom-select-trigger,
.custom-select-trigger:focus-visible {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 4px var(--ring);
  background: var(--card);
}

.custom-select-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-caret {
  position: absolute;
  right: 14px;
  top: 50%;
  width: 12px;
  height: 8px;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%2393a1c2' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  transform: translateY(-50%);
  transition: transform .18s ease;
}
.custom-select-wrapper.open .custom-select-caret {
  transform: translateY(-50%) rotate(180deg);
}

/* Dropdown-Liste */
.custom-select-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 100;
  max-height: 250px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 4px;
  display: none;
  /* Smooth-Scroll auf iOS */
  -webkit-overflow-scrolling: touch;
}
.custom-select-wrapper.open .custom-select-options {
  display: block;
  animation: cs-fade-in .15s ease;
}
@keyframes cs-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.custom-select-option {
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
  transition: background .12s, color .12s;
  user-select: none;
  line-height: 1.3;
}
.custom-select-option:hover,
.custom-select-option:focus-visible {
  background: var(--card-hover);
  outline: none;
}
.custom-select-option.selected {
  background: color-mix(in oklab, var(--primary) 18%, transparent);
  color: var(--accent-2);
  font-weight: 600;
}
.custom-select-option.disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ========================================================================
   Profil / Spitzname
   ======================================================================== */

.profile-card { padding: 18px; max-width: 560px; }
.profile-card h2 { margin: 0; }
.profile-card .small { margin: 4px 0 16px; }

.profile-field {
  margin: 12px 0 6px;
}
.profile-field input {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 16px;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  width: 100%;
  transition: border-color .15s, box-shadow .15s, background .15s;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08);
}
.profile-field input:hover {
  border-color: color-mix(in oklab, var(--primary) 40%, var(--border));
}
.profile-field input:focus {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 4px var(--ring), inset 0 1px 2px rgba(0, 0, 0, .08);
  background: var(--card);
}

.profile-username {
  margin: 14px 0 0;
  padding: 8px 12px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}
.profile-username strong { color: var(--text); font-weight: 700; }

.profile-feedback {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  border: 1px solid var(--border);
}
.profile-feedback-success {
  background: rgba(74, 222, 128, .12);
  border-color: rgba(74, 222, 128, .45);
  color: var(--accent-2, #4ade80);
}
.profile-feedback-error {
  background: rgba(255, 77, 106, .12);
  border-color: rgba(255, 77, 106, .45);
  color: var(--danger);
}
.profile-feedback-info {
  background: var(--bg-soft);
  color: var(--text);
}

@media (max-width: 520px) {
  .profile-card { padding: 14px; }
  .profile-field input { font-size: 15px; }
}

.profile-divider {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: 24px 0 14px;
}
.profile-section-title {
  font-size: 16px;
  margin: 0 0 6px;
  color: var(--text);
}

.settings-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  transition: border-color .15s, background .15s;
}
.settings-row:hover {
  border-color: color-mix(in oklab, var(--primary) 35%, var(--border));
}
.settings-label {
  flex: 1;
  display: grid;
  grid-template-columns: 32px 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  cursor: pointer;
  user-select: none;
}
.settings-icon {
  grid-column: 1; grid-row: 1 / 3;
  font-size: 24px;
  display: grid; place-items: center;
}
.settings-label-text {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.settings-label small {
  font-size: 12px;
  display: block;
  margin-top: 1px;
}

/* Custom-Switch für die Checkbox */
.settings-toggle {
  appearance: none;
  -webkit-appearance: none;
  width: 44px;
  height: 26px;
  background: var(--border);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .2s ease;
  outline: none;
}
.settings-toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,.25);
  transition: transform .2s ease;
}
.settings-toggle:checked {
  background: var(--accent-2, #4ade80);
}
.settings-toggle:checked::after {
  transform: translateX(18px);
}
.settings-toggle:focus-visible {
  box-shadow: 0 0 0 3px var(--ring);
}

/* ========================================================================
   Leaderboard / Bestenliste
   ======================================================================== */

.leaderboard-card { padding: 18px; }
.leaderboard-card h2 { margin: 0; }
.leaderboard-card .small { margin: 4px 0 16px; }

/* ---- Segment-Control (Wettbewerb: Rangliste ↔ Erfolge) ---- */
/* Neumorphismus-Look: Container wirkt vertieft (inset shadows), aktiver Button
   schwebt darüber mit erhabenem Schatten + Akzent-Gradient. */
.segment-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin: 14px 0 18px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--bg-deep) 70%, var(--card) 30%);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.28),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04),
    0 1px 0 rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
}
:root[data-theme="light"] .segment-control {
  background: color-mix(in oklab, var(--bg-deep) 60%, var(--card) 40%);
  box-shadow:
    inset 0 2px 5px rgba(15, 23, 36, 0.08),
    0 1px 2px rgba(255, 255, 255, 0.6);
}
.segment-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: background 180ms, color 180ms, box-shadow 180ms, transform 120ms;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  min-width: 0;
}
.segment-btn:hover { color: var(--text); }
.segment-btn:active { transform: scale(.97); }
.segment-btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.segment-btn.active {
  background: var(--grad-primary);
  color: #fff;
  box-shadow:
    0 4px 14px rgba(124, 92, 255, .35),
    0 1px 0 rgba(255, 255, 255, .15) inset;
}
@media (max-width: 420px) {
  .segment-btn { font-size: 12.5px; padding: 9px 8px; }
}

.competition-view {
  /* leichter Fade-In, sodass der Wechsel nicht hart wirkt */
  animation: comp-view-fade 220ms ease;
}
@keyframes comp-view-fade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0);   }
}

/* ---- Dashboard-Erfolge-Button ---- */
.dashboard-summary-btn {
  appearance: none;
  border: 1px solid var(--border-soft);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  cursor: pointer;
  transition: transform 140ms, background 180ms, border-color 180ms, box-shadow 180ms;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.dashboard-summary-btn::before {
  /* sanfter Akzent-Glow am linken Rand */
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--grad-primary);
  opacity: .9;
}
.dashboard-summary-btn:hover {
  transform: translateY(-1px);
  background: var(--card-hover);
  border-color: color-mix(in oklab, var(--primary-2) 30%, var(--border));
  box-shadow:
    0 6px 18px rgba(124, 92, 255, .15),
    var(--shadow-sm);
}
.dashboard-summary-btn:active { transform: scale(.99); }
.dashboard-summary-btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.dsb-icon {
  font-size: 26px;
  line-height: 1;
  flex: 0 0 auto;
  filter: drop-shadow(0 4px 10px rgba(124, 92, 255, .3));
}
.dsb-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}
.dsb-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.dsb-sub {
  font-size: 12.5px;
  color: var(--muted);
}
.dsb-chevron {
  font-size: 22px;
  color: var(--muted);
  flex: 0 0 auto;
  transition: transform 180ms, color 180ms;
}
.dashboard-summary-btn:hover .dsb-chevron {
  color: var(--text);
  transform: translateX(2px);
}

/* Gefahren-Variante: fuer "Account loeschen" u.ae. destruktive Aktionen.
   Roter Akzent-Glow und leicht getoentes Icon, damit der Button sich
   eindeutig von den grau-violetten Standard-Buttons abhebt. */
.dashboard-summary-btn.danger::before {
  background: linear-gradient(180deg, #f87171, #dc2626);
  opacity: 1;
}
.dashboard-summary-btn.danger:hover {
  border-color: #dc2626;
  box-shadow: 0 6px 18px rgba(220, 38, 38, .18), var(--shadow-sm);
}
.dashboard-summary-btn.danger .dsb-icon {
  filter: drop-shadow(0 4px 10px rgba(220, 38, 38, .35));
}

/* Rechtliche Links unter Profil + Auth-Formular */
.profile-legal-links,
.auth-legal-links {
  margin-top: 12px;
  text-align: center;
  font-size: 13px;
}
.profile-legal-links a,
.auth-legal-links a {
  color: var(--primary-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.profile-legal-links a:hover,
.auth-legal-links a:hover {
  color: var(--text);
}

/* Password-Strength-Meter — direkt unter dem Passwort-Input im Register-Form.
   Reine Client-Visualisierung, Server waltet. Data-Attribute "score" 0-4
   steuert Fuell-Farbe und Fuell-Breite. */
.pw-strength {
  position: relative;
  height: 16px;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
}
.pw-strength-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: #6b7280;
  transition: width 180ms ease, background-color 180ms ease;
}
.pw-strength[data-score="1"] .pw-strength-fill { background: linear-gradient(90deg, #dc2626, #ef4444); }
.pw-strength[data-score="2"] .pw-strength-fill { background: linear-gradient(90deg, #d97706, #f59e0b); }
.pw-strength[data-score="3"] .pw-strength-fill { background: linear-gradient(90deg, #16a34a, #22c55e); }
.pw-strength[data-score="4"] .pw-strength-fill { background: linear-gradient(90deg, #059669, #10b981); }
.pw-strength-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  text-transform: uppercase;
}

/* Consent-Checkbox in der Registrierung — optisch anders als Text-Input-Felder,
   damit User die Einwilligung bewusst wahrnimmt. */
.consent-field {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  cursor: pointer;
}
.consent-field input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--primary-2);
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}
.consent-field .consent-text {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}
.consent-field .consent-text a {
  color: var(--primary-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.leaderboard-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-item {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  transition: transform .12s ease, box-shadow .15s, border-color .15s;
}
.leaderboard-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}

.lb-rank {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  letter-spacing: -0.02em;
}
.lb-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.lb-username {
  font-weight: 700;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-me-badge {
  background: linear-gradient(135deg, #38bdf8, #4ade80);
  color: #0f1724;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.lb-stats {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 13.5px;
  color: var(--muted);
  white-space: nowrap;
}
.lb-bones strong {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Top 3 — Medaillen-Akzente (gold / silber / bronze) */
.leaderboard-item.lb-top-1 {
  border-color: rgba(251, 191, 36, .55);
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--card) 85%, #fbbf24),
    var(--card) 65%);
  box-shadow: 0 4px 18px rgba(251, 191, 36, .18);
}
.leaderboard-item.lb-top-1 .lb-rank { color: #fbbf24; }

.leaderboard-item.lb-top-2 {
  border-color: rgba(203, 213, 225, .5);
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--card) 88%, #cbd5e1),
    var(--card) 70%);
}
.leaderboard-item.lb-top-2 .lb-rank { color: #cbd5e1; }

.leaderboard-item.lb-top-3 {
  border-color: rgba(217, 119, 6, .45);
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--card) 88%, #d97706),
    var(--card) 70%);
}
.leaderboard-item.lb-top-3 .lb-rank { color: #d97706; }

/* Eigener Account — sanft leuchtend, klar abgehoben */
.leaderboard-item.is-me {
  border: 2px solid var(--primary);
  background: color-mix(in oklab, var(--card) 88%, var(--primary));
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 18%, transparent),
              0 4px 16px rgba(102, 126, 234, .18);
}
.leaderboard-item.is-me .lb-username {
  color: var(--text);
}
/* Wenn Top-1 + is-me → beide Akzente kombinieren */
.leaderboard-item.is-me.lb-top-1 {
  border: 2px solid var(--primary);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 18%, transparent),
              0 4px 18px rgba(251, 191, 36, .25);
}

.lb-foot-note {
  margin-top: 12px;
  text-align: center;
  padding: 10px;
  background: var(--bg-soft);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

/* Mobile */
@media (max-width: 520px) {
  .leaderboard-card { padding: 14px; }
  .leaderboard-item {
    padding: 10px 12px;
    grid-template-columns: 44px 1fr auto;
    gap: 10px;
  }
  .lb-rank { font-size: 19px; }
  .lb-username { font-size: 14px; }
  .lb-stats { font-size: 12.5px; gap: 10px; }
  .lb-me-badge { font-size: 9px; padding: 1px 6px; }
}

/* ========================================================================
   Admin-Dashboard
   ======================================================================== */

.admin-card { padding: 18px; }
.admin-card h2 { margin: 0; }
.admin-card .small { margin: 4px 0 16px; }

/* ---- Bulk-Aktion: Knochen-Bonus für alle ---- */
.admin-bulk-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  margin: 4px 0 18px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--accent) 14%, transparent),
    color-mix(in oklab, var(--primary-2) 12%, transparent));
  border: 1px solid color-mix(in oklab, var(--accent) 30%, var(--border));
}
.admin-bulk-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1 1 280px;
  min-width: 0;
}
.admin-bulk-icon {
  font-size: 26px;
  line-height: 1;
  flex: 0 0 auto;
  filter: drop-shadow(0 4px 10px rgba(38,208,180,.35));
}
.admin-bulk-title {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.admin-bulk-hint {
  line-height: 1.4;
}
.admin-bulk-panel .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Such- und Sortier-Leiste oberhalb der User-Liste. Flex-Layout klappt auf
   schmalen Screens um, damit die Controls nicht brechen. */
.admin-users-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 10px;
}
.admin-users-toolbar input[type="search"] {
  flex: 1 1 220px;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: var(--bg-soft, rgba(255, 255, 255, 0.04));
  color: var(--text);
  font-size: 14px;
}
.admin-users-toolbar input[type="search"]:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}
.admin-users-toolbar select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: var(--bg-soft, rgba(255, 255, 255, 0.04));
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.admin-user-list {
  display: block;
}

/* Pagination-Nav unter der User-Liste. Buttons kompakt, aktuelle Seite
   hervorgehoben. Gap-Ellipse ("…") trennt nicht-zusammenhaengende Gruppen. */
.admin-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.admin-page-btn {
  appearance: none;
  border: 1px solid var(--border-soft);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  min-width: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, transform 80ms;
}
.admin-page-btn:hover:not(:disabled):not(.is-current) {
  background: var(--card-hover);
  border-color: color-mix(in oklab, var(--primary-2) 30%, var(--border));
}
.admin-page-btn:active:not(:disabled) { transform: scale(0.96); }
.admin-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.admin-page-btn.is-current {
  background: var(--primary-2);
  color: #fff;
  border-color: var(--primary-2);
  font-weight: 700;
}
.admin-page-gap {
  color: var(--muted);
  padding: 0 4px;
  font-size: 13px;
}

/* ---- Aktivitäts-Tracking (Online-Status + Zeit-Stats) ---- */
.admin-activity-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
  background: color-mix(in oklab, var(--card) 80%, var(--accent) 8%);
  border: 1px solid var(--border-soft);
}
.admin-activity-summary strong { color: var(--text); font-weight: 800; }
.admin-summary-refresh { opacity: .6; }
.admin-summary-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: 0 0 auto;
}
.admin-summary-dot.live {
  background: var(--accent-2);
  box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent-2) 60%, transparent);
  animation: admin-online-pulse 2s ease-out infinite;
}

/* Online-Badge (grüner Puls-Dot + Text) */
.admin-badge-online {
  background: color-mix(in oklab, var(--accent-2) 20%, transparent);
  border: 1px solid color-mix(in oklab, var(--accent-2) 55%, var(--border));
  color: var(--accent-2);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
}
.admin-badge-online .online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent-2) 60%, transparent);
  animation: admin-online-pulse 2s ease-out infinite;
}
@keyframes admin-online-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent-2) 50%, transparent); }
  70%  { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

/* Offline-Badge mit „vor X min"-Text */
.admin-badge-offline {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  color: var(--muted);
  font-weight: 500;
  font-size: 10.5px;
}

/* Online-User-Row leicht hervorheben (dezenter Akzent-Rand links) */
.admin-user-row.admin-user-online {
  border-left: 3px solid var(--accent-2);
  padding-left: calc(12px - 3px); /* visuell gleichbleibender Innenabstand */
}

/* Time-Stat: monospace-ziffern für tabularen Look */
.admin-stat-time {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.admin-table-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-x: auto;
}

.admin-user-row {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-user-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-user-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  flex-wrap: wrap;
}
.admin-user-name strong { font-size: 16px; }
.admin-user-id {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.admin-user-meta {
  font-size: 11.5px;
  color: var(--muted);
}

.admin-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.admin-badge-admin {
  background: linear-gradient(135deg, #fbbf24, #ec4899);
  color: #fff;
}
.admin-badge-blocked {
  background: var(--danger);
  color: #fff;
}
.admin-badge-force {
  background: linear-gradient(135deg, #38bdf8, #a855f7);
  color: #fff;
}
.admin-user-blocked {
  opacity: .65;
  border-style: dashed;
}
.admin-btn-block {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.admin-btn-block:hover { background: color-mix(in oklab, var(--danger) 88%, #fff); }
.admin-btn-unblock {
  background: var(--accent-2, #4ade80);
  color: #0f1724;
  border-color: var(--accent-2, #4ade80);
  font-weight: 700;
}

.admin-user-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.admin-stat {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  min-width: 110px;
  flex: 1 1 auto;
}
.admin-stat-label {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.admin-stat-val {
  font-size: 18px;
  font-weight: 700;
  margin-top: 2px;
}
.admin-streak-overridden {
  font-size: 14px;
  color: var(--accent-2, #fbbf24);
  margin-left: 4px;
  cursor: help;
}

.admin-user-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-edit-stats { /* Standard ghost-Stil reicht */ }
.admin-reset-pw {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.admin-reset-pw:hover {
  background: color-mix(in oklab, var(--danger) 88%, #fff);
}

/* Mobile: Stats stacken, Buttons full-width */
@media (max-width: 520px) {
  .admin-card { padding: 14px; }
  .admin-user-row { padding: 12px; }
  .admin-user-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .admin-user-stats { gap: 8px; }
  .admin-stat { min-width: 0; padding: 6px 10px; }
  .admin-stat-val { font-size: 16px; }
  .admin-user-actions .btn { flex: 1 1 0; }
}

/* Admin-Tab im Bottom-Nav: golden eingefärbt zur Abgrenzung */
.nav-btn-admin .nav-icon { filter: drop-shadow(0 0 2px rgba(251, 191, 36, .5)); }

/* ---------- Fragen-Verwaltung (CRUD-Liste) ---------- */
.admin-questions-card { margin-top: 18px; }

.admin-questions-toolbar {
  display: flex;
  gap: 10px;
  margin: 12px 0 14px;
  align-items: center;
  flex-wrap: wrap;
}
.admin-search-input {
  flex: 1 1 240px;
  min-width: 0;
  appearance: none;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.admin-search-input:focus {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 4px var(--ring);
}
.admin-cat-filter {
  appearance: none;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 32px 10px 14px;
  font-size: 14px;
  font-family: inherit;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%2393a1c2' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
.admin-q-count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin-left: auto;
}

.admin-questions-list {
  max-height: 600px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}
.admin-question-row {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 4px 12px;
  align-items: start;
}
.admin-q-meta {
  grid-column: 1;
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
  font-size: 11.5px;
}
.admin-q-id {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 700;
  background: var(--card);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--accent-2);
}
.admin-q-cat {
  color: var(--muted);
}
.admin-q-text {
  grid-column: 1;
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.admin-q-actions {
  grid-column: 2;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-self: center;
}
.admin-q-actions .btn {
  font-size: 11.5px;
  padding: 4px 10px;
  white-space: nowrap;
}
.admin-q-delete {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.admin-q-delete:hover { background: color-mix(in oklab, var(--danger) 88%, #fff); }

/* ---------- Frage-Editor-Modal ---------- */
.admin-editor-card {
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.admin-editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin: 16px 0 12px;
}
.admin-editor-grid .field { margin: 0; }
.admin-editor-full { grid-column: 1 / -1; }
.admin-editor-grid textarea,
.admin-editor-grid input[type="text"],
.admin-editor-grid select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  width: 100%;
  font-weight: 500;
  transition: border-color .15s, box-shadow .15s;
  resize: vertical;
}
.admin-editor-grid select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%2393a1c2' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.admin-editor-grid input:focus,
.admin-editor-grid select:focus,
.admin-editor-grid textarea:focus {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 4px var(--ring);
}
.admin-editor-grid input[readonly] {
  background: var(--card);
  color: var(--muted);
  cursor: not-allowed;
}

/* Antwort-Block */
.admin-editor-options {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: var(--bg-soft);
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-editor-options legend {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.qed-option-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.qed-option-row input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-2);
  cursor: pointer;
  flex-shrink: 0;
}
.qed-option-letter {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}
.qed-option-row input[type="radio"]:checked ~ .qed-option-letter,
.qed-option-row input[type="radio"]:checked + .qed-option-letter {
  background: var(--accent-2);
  color: #0f1724;
  border-color: var(--accent-2);
}
.qed-option-input { flex: 1; min-width: 0; }

.admin-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}
.qed-error {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(255, 77, 106, .12);
  border: 1px solid rgba(255, 77, 106, .4);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
}

/* Mobile */
@media (max-width: 720px) {
  .admin-editor-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .admin-questions-toolbar { gap: 8px; }
  .admin-q-count { width: 100%; text-align: right; margin: 0; }
  .admin-question-row {
    grid-template-columns: 1fr;
  }
  .admin-q-actions {
    grid-column: 1;
    grid-row: 3;
    flex-direction: row;
  }
  .admin-q-actions .btn { flex: 1; }
  .admin-editor-card { max-height: 95vh; padding: 14px; }
}

/* ========================================================================
   Custom Modal (App-eigenes alert/confirm/prompt)
   ======================================================================== */

.hidden {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modal-fade-in .15s ease;
}
@keyframes modal-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  max-width: 460px;
  width: 100%;
  animation: modal-pop-in .25s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes modal-pop-in {
  from { transform: translateY(10px) scale(.95); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-box h3 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.modal-box p {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.modal-box input#modal-input {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  margin-bottom: 16px;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08);
}
.modal-box input#modal-input:focus {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 4px var(--ring), inset 0 1px 2px rgba(0, 0, 0, .08);
  background: var(--card);
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.modal-buttons .btn { min-width: 88px; }

/* Mobile: Modal schmaler + Buttons full-width gestapelt */
@media (max-width: 520px) {
  .modal-box { padding: 18px; }
  .modal-buttons {
    flex-direction: column-reverse;
  }
  .modal-buttons .btn { width: 100%; }
}

/* "Force"-Variante: ungeschlossener Zwangs-Modal (kein Cancel, keine Esc) */
.modal-overlay.force-modal { background: rgba(0, 0, 0, .82); }

/* ========================================================================
   Lesson-Reader Modal — Erklaer-Texte pro Subkategorie
   ========================================================================
   Eigene Variante des Standard-Modals, breiter + scrollbarer Body. Header
   mit Emoji-Stern + Titel + Lesezeit + ✕-Button. Sections haben einen
   farbigen Punkt + uppercase-Heading. Tips-Box: amber/warm Hintergrund,
   abgesetzt vom Body.
   ======================================================================== */
.lesson-overlay {
  align-items: flex-end;
  padding: 0;
}
.lesson-overlay .lesson-box {
  max-width: 720px;
  width: 100%;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  padding: 24px 24px 28px;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  position: relative;
  background:
    linear-gradient(135deg, rgba(38, 208, 180, 0.08), rgba(124, 92, 255, 0.05)),
    var(--card);
  border: 1px solid rgba(38, 208, 180, 0.35);
  box-shadow: 0 -12px 40px rgba(38, 208, 180, 0.18), 0 0 0 1px rgba(124, 92, 255, 0.18) inset;
}
@media (min-width: 720px) {
  .lesson-overlay { align-items: center; padding: 24px; }
  .lesson-overlay .lesson-box {
    border-radius: var(--radius);
  }
}

.lesson-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.lesson-emoji {
  font-size: 30px;
  line-height: 1;
  flex-shrink: 0;
}
.lesson-header-text {
  flex: 1;
  min-width: 0;
}
.lesson-title {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.lesson-readtime {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.lesson-close {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 22px;
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: background-color .15s, color .15s;
}
.lesson-close:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.lesson-summary {
  margin: 0 0 16px;
  font-size: 15px;
  font-style: italic;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
}

.lesson-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 6px;
  margin-right: -6px;
}
.lesson-scroll::-webkit-scrollbar { width: 6px; }
.lesson-scroll::-webkit-scrollbar-thumb {
  background: rgba(124, 92, 255, 0.35);
  border-radius: 3px;
}

.lesson-section { margin-bottom: 18px; }
.lesson-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.lesson-section-dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: var(--primary-2, #7c5cff);
  flex-shrink: 0;
}
.lesson-section-heading {
  margin: 0;
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
}
.lesson-section-body {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
}

.lesson-tips {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 8px;
}
.lesson-tips-title {
  font-size: 15px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 6px;
}
.lesson-tips-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.lesson-tips-list li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 4px 0;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--text);
}
.lesson-tip-bullet {
  color: var(--primary-2, #7c5cff);
  font-weight: 900;
  flex-shrink: 0;
  width: 14px;
}

.lesson-footer {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.lesson-footer .btn { flex: 1; min-width: 0; }

/* Mini-Button neben dem Subcategory-Dropdown — oeffnet die Lesson */
.lesson-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(38, 208, 180, 0.12);
  border: 1px solid rgba(38, 208, 180, 0.45);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .15s, transform .12s;
}
.lesson-trigger:hover {
  background: rgba(38, 208, 180, 0.22);
}
.lesson-trigger:active {
  transform: scale(0.97);
}
.lesson-trigger .lesson-trigger-emoji { font-size: 16px; }
/* Gelesen: gruener Tint statt Mint, mit ✓-Schimmer im Hintergrund */
.lesson-trigger.read {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.5);
  color: var(--text);
}
.lesson-trigger.read:hover {
  background: rgba(34, 197, 94, 0.24);
}

/* ========================================================================
   FAB-/Maskottchen-Sichtbarkeit
   ======================================================================== */

/* Schwebenden Shop-Button global ausblenden (ist jetzt über den Tab "Begleiter" erreichbar) */
.shop-fab {
  display: none !important;
}

/* Auf Smartphones: Hund ausblenden, ES SEI DENN, wir sind im Quiz-Screen */
@media (max-width: 520px) {
  body:not([data-screen="quiz"]) .mascot {
    display: none !important;
  }
}
