/* ============================================================================
   ApexAbi — design system
   Dark shell, light "paper" for reading/writing. "Apex" white · "Abi" red.
   ========================================================================= */
/* Self-hosted variable fonts — no external requests, works offline */
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('/static/fonts/inter-var.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk'; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url('/static/fonts/spacegrotesk-var.woff2') format('woff2');
}

:root {
  /* Dark shell */
  --canvas:      #0B0B0D;
  --card:        #141417;
  --card-2:      #1B1B20;
  --border:      #26262B;
  --border-2:    #34343B;
  --text:        #E8E8EA;
  --text-muted:  #9A9AA2;
  --accent:      #FF6B8C;   /* pink-red main brand color — primary CTA + active nav */
  --accent-deep: #E85578;
  --accent-soft: rgba(255,107,140,.15);
  --glass:       rgba(21,21,26,.55);   /* translucent card fill over the ambient bg */
  --glass-line:  rgba(255,255,255,.07);

  /* Light "paper" — the task/Klausur reading & writing surface */
  --paper:       #FAFAF8;
  --paper-2:     #F0F0EA;
  --paper-line:  #E2E2DA;
  --paper-ink:   #1A1A1A;
  --paper-muted: #57574F;

  /* Feedback (dark-tuned) */
  --success:     #4ADE80;
  --success-soft:rgba(74,222,128,.13);
  --warn:        #FBBF24;
  --warn-soft:   rgba(251,191,36,.13);
  --error:       #FF6B6B;
  --error-soft:  rgba(255,107,107,.13);

  /* Subject accents — one pink→blue family (green/yellow are reserved for
     success/warning feedback only) */
  --c-deutsch: #FF7A9C;   /* pink */
  --c-mathe:   #7EA8E8;   /* blue */
  --c-nawi:    #5FC5D9;   /* cyan-blue */
  --c-gewi:    #B58BE8;   /* violet */

  /* Back-compat aliases — existing rules reference these names */
  --bg:        var(--canvas);
  --bg-2:      var(--card-2);
  --surface:   var(--card);
  --line:      var(--border);
  --line-2:    var(--border-2);
  --ink:       var(--text);
  --ink-soft:  #C6C6CB;
  --muted:     var(--text-muted);
  --red:       var(--accent);
  --red-soft:  var(--accent-soft);
  --red-deep:  var(--accent-deep);
  --primary:   var(--text);    /* light neutral fill for default buttons on dark */
  --secondary: #7EA8E8;        /* blue — the one secondary hue */

  --radius:    16px;
  --radius-sm: 11px;
  --shadow:    0 1px 2px rgba(0,0,0,.40), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.45), 0 24px 60px rgba(0,0,0,.50);
  --ease:      cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--canvas); }
body {
  margin: 0;
  background: transparent;
  color: var(--text);
  font: 16px/1.6 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  letter-spacing: -0.006em;
}

/* --- Ambient background: blurred color blobs + faint grid + noise --------- */
/* Blobs follow the mouse a little via --par-x/--par-y (set by JS on the home page). */
html::before, html::after {
  content: ""; position: fixed; z-index: -2; pointer-events: none;
  width: 640px; height: 640px; border-radius: 50%; filter: blur(110px);
  transform: translate3d(var(--par-x, 0px), var(--par-y, 0px), 0);
  transition: transform .6s var(--ease);
}
html::before { top: -260px; left: -180px; background: radial-gradient(circle, rgba(255,107,140,.30), transparent 66%); }
html::after  { top: 4%; right: -260px;  background: radial-gradient(circle, rgba(126,168,232,.24), transparent 66%);
  transform: translate3d(calc(var(--par-x, 0px) * -1), calc(var(--par-y, 0px) * -1), 0); }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(232,232,234,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232,232,234,.025) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 95% 75% at 50% 0%, #000 25%, transparent 78%);
  mask-image: radial-gradient(ellipse 95% 75% at 50% 0%, #000 25%, transparent 78%);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* Drifting particles (added by JS on the home page) */
.bg-dot {
  position: fixed; z-index: -1; pointer-events: none;
  width: 3px; height: 3px; border-radius: 50%;
  background: rgba(232,232,234,.4); opacity: 0;
  animation: floaty var(--d, 16s) linear var(--delay, 0s) infinite;
}
@keyframes floaty {
  0%   { transform: translateY(24px); opacity: 0; }
  12%  { opacity: var(--o, .4); }
  85%  { opacity: var(--o, .4); }
  100% { transform: translateY(-140px); opacity: 0; }
}
h1, h2, h3 { font-family: 'Space Grotesk', 'Inter', sans-serif; letter-spacing: -0.02em; line-height: 1.15; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

/* --- Brand logo ---------------------------------------------------------- */
.logo { font-family: 'Space Grotesk', sans-serif; font-weight: 700; letter-spacing: -0.03em; }
.logo .apex { color: var(--text); }
.logo .abi  { color: var(--accent); }

/* --- Top navigation (glass bar) ------------------------------------------ */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11,11,13,.55);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--glass-line);
}
.nav-inner {
  max-width: 1040px; margin: 0 auto; padding: 15px 24px;
  display: flex; align-items: center; gap: 24px;
}
.nav .logo { font-size: 23px; }
.nav-links { margin-left: auto; display: flex; gap: 6px; align-items: center; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  padding: 9px 15px; border-radius: 999px; font-size: 14.5px; font-weight: 500; white-space: nowrap;
  color: var(--text-muted); transition: background .18s var(--ease), color .18s var(--ease);
}
.nav-links a:hover { background: var(--card-2); color: var(--text); }
.nav-links a.active { background: var(--accent); color: var(--canvas); }
.nav-links a.active:hover { background: var(--accent); }

/* --- Layout -------------------------------------------------------------- */
.wrap { max-width: 1040px; margin: 0 auto; padding: 40px 24px 120px; }
.wrap-narrow { max-width: 780px; }
.section-title { font-size: 14px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-muted); margin: 56px 0 18px; font-family: 'Inter'; font-weight: 600; }
.section-title:first-of-type { margin-top: 40px; }

/* --- Hero: pitch left, live-grading demo right --------------------------- */
.hero {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center;
  padding: 48px 0 16px;
}
.hero .tagline {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: clamp(30px, 4.6vw, 42px); font-weight: 700; line-height: 1.12;
  letter-spacing: -0.03em; color: var(--text); margin: 0;
}
.hero .subline { color: var(--text-muted); font-size: 16px; line-height: 1.6; margin: 16px 0 0; max-width: 52ch; }
.hero .modes { color: var(--text-muted); font-size: 13.5px; font-weight: 600; letter-spacing: .04em; margin: 12px 0 0; }
.hero .modes b { color: var(--ink-soft); font-weight: 600; }

/* Primary CTA — the only accent-filled button on the page */
.cta {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 26px; padding: 16px 34px; min-height: 56px;
  background: var(--accent); color: var(--canvas);
  border-radius: 14px; text-decoration: none;
  font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 600; font-size: 18px;
  box-shadow: 0 4px 14px rgba(0,0,0,.35), 0 0 28px rgba(255,107,140,.25);
  transition: background .15s ease, transform .15s ease, box-shadow .25s ease;
}
.cta:hover {
  background: var(--accent-deep); transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0,0,0,.45), 0 0 44px rgba(255,107,140,.45);
}
.cta:active { transform: translateY(0); }

/* Trust badges under the CTA */
.trust { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 20px; font-size: 13.5px; color: var(--text-muted); }
.trust span { display: inline-flex; align-items: center; gap: 7px; }
.trust svg { width: 15px; height: 15px; color: var(--success); flex: none; }

/* Live-grading demo panel */
.demo-card {
  background: var(--glass); backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--glass-line); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow-lg);
  font-size: 14.5px;
}
.demo-head { display: flex; align-items: center; gap: 9px; color: var(--text-muted); font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.demo-head .pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s var(--ease) infinite; }
.demo-subject { display: flex; align-items: baseline; justify-content: space-between; margin-top: 16px; font-weight: 600; font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 17px; }
.demo-score { font-size: 26px; font-weight: 700; color: var(--success); font-variant-numeric: tabular-nums; }
.demo-bar { height: 8px; background: var(--card-2); border-radius: 999px; overflow: hidden; margin: 12px 0 16px; }
.demo-bar > i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--secondary), var(--success)); transition: width 1.4s var(--ease) .3s; }
.demo-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-top: 1px solid var(--glass-line); opacity: 0; transform: translateY(4px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.demo-row:nth-of-type(1) { transition-delay: .45s; }
.demo-row:nth-of-type(2) { transition-delay: .65s; }
.demo-card.play .demo-row { opacity: 1; transform: none; }
.demo-card.play .demo-bar > i { width: 92%; }
.demo-row svg { width: 15px; height: 15px; color: var(--success); flex: none; }
.demo-row .pts { margin-left: auto; color: var(--text-muted); font-variant-numeric: tabular-nums; font-size: 13.5px; }
.demo-fix { margin-top: 12px; padding: 10px 13px; border-radius: 10px; background: var(--accent-soft); color: var(--ink-soft); font-size: 13.5px; opacity: 0; transition: opacity .5s var(--ease) .9s; }
.demo-card.play .demo-fix { opacity: 1; }
.demo-fix b { color: var(--accent); font-weight: 600; }

/* --- Cards (glass) --------------------------------------------------------- */
.card {
  background: var(--glass); backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--glass-line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}

/* Subject quick-access grid — one visual system: tinted icon + 1px border,
   equal card heights, chips pinned to the bottom. */
.subjects { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; align-items: stretch; }
.subject-card {
  display: flex; flex-direction: column;
  background: var(--glass); backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--glass-line); border-radius: var(--radius); padding: 28px 26px 24px;
  box-shadow: var(--shadow);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.subject-card:hover {
  transform: translateY(-4px); box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--sc, var(--accent)) 45%, var(--glass-line));
}
.subject-card:active { transform: translateY(-1px); }
.subject-card .ic {
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--sc, var(--accent)) 14%, transparent);
  color: var(--sc, var(--accent)); margin-bottom: 18px;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--sc, var(--accent)) 22%, transparent) inset;
}
.subject-card .ic svg { width: 27px; height: 27px; opacity: .9; }
.subject-card h3 { margin: 0 0 6px; font-size: 20px; }
.subject-card .desc { color: var(--text-muted); font-size: 14px; margin: 0; line-height: 1.55; }
.subject-card .go { margin-top: 14px; font-size: 13.5px; font-weight: 600; color: var(--sc, var(--accent)); opacity: 0; transform: translateX(-4px); transition: opacity .22s var(--ease), transform .22s var(--ease); }
.subject-card:hover .go { opacity: 1; transform: none; }
.subject-card .tags { margin-top: auto; padding-top: 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; color: var(--ink-soft); background: var(--card-2); border-radius: 999px; padding: 3px 10px; }

/* Dictation button (Web Speech API) */
.mic-btn {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 10px;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-2); background: var(--card); color: var(--text-muted);
  font: 600 13.5px 'Inter', sans-serif;
  transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}
.mic-btn svg { width: 16px; height: 16px; }
.mic-btn:hover { color: var(--text); border-color: var(--text); }
.mic-btn.rec { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.mic-btn .rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s var(--ease) infinite; }

/* Fortschritt (home): streak + weekly goal + average */
.progress-card { display: flex; flex-wrap: wrap; align-items: center; gap: 22px 40px; text-decoration: none; color: var(--text); }
.progress-card .pstat { min-width: 150px; }
.progress-card .pstat .v { display: flex; align-items: center; gap: 8px; font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 600; font-size: 26px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.progress-card .pstat .v svg { width: 22px; height: 22px; color: var(--accent); flex: none; }
.progress-card .pstat .l { color: var(--text-muted); font-size: 13px; margin-top: 3px; }
.goalbar { height: 7px; width: 150px; background: var(--card-2); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.goalbar > i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--secondary)); transition: width 1s var(--ease) .2s; }
.progress-card .pill-btn { margin-left: auto; }
.progress-empty { color: var(--text-muted); font-size: 15px; }
.progress-empty a { color: var(--accent); font-weight: 600; text-decoration: none; }
.progress-empty a:hover { text-decoration: underline; }

/* Loading skeletons */
.skel {
  border-radius: var(--radius); border: 1px solid var(--glass-line);
  background: linear-gradient(100deg, var(--card) 40%, var(--card-2) 50%, var(--card) 60%);
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* --- Buttons ------------------------------------------------------------- */
.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 600;
  padding: 13px 20px; border-radius: 12px; background: var(--text); color: var(--canvas);
  transition: transform .12s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
  box-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.btn:hover { box-shadow: 0 6px 18px rgba(0,0,0,.5); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
.btn.red { background: var(--accent); color: var(--canvas); }
.btn.red:hover { background: var(--accent-deep); }
.btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--border-2); box-shadow: none; }
.btn.ghost:hover { background: var(--card-2); }
.btn.block { width: 100%; }

.pill-btn {
  appearance: none; cursor: pointer; font: inherit; font-weight: 600; font-size: 14px;
  border: 1px solid var(--border-2); background: var(--card); color: var(--text);
  border-radius: 999px; padding: 9px 16px;
  transition: transform .12s var(--ease), border-color .18s var(--ease), background .18s var(--ease), color .18s var(--ease);
}
.pill-btn:hover { border-color: var(--text); }
.pill-btn:active { transform: scale(.96); }
.pill-btn.on { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }

/* --- Forms --------------------------------------------------------------- */
select, textarea, input[type=text], input[type=email], input[type=number],
input[type=search], input[type=tel], input:not([type]) {
  width: 100%; font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--border-2); border-radius: var(--radius-sm); padding: 12px 14px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
select:focus, textarea:focus, input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 200px; resize: vertical; line-height: 1.65; }
label.fld { display: block; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 8px; }

/* --- Timer widget -------------------------------------------------------- */
.timer {
  display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums;
  font-weight: 600; font-size: 15px; color: var(--text); background: var(--card);
  border: 1px solid var(--border-2); border-radius: 999px; padding: 7px 14px 7px 12px;
  box-shadow: var(--shadow);
}
.timer .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); animation: pulse 1.6s var(--ease) infinite; }
.timer.paused .dot { background: var(--text-muted); animation: none; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.8); } }

.timer-bar {
  position: sticky; top: 68px; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 10px 0; margin-bottom: 8px;
}
.timer-bar .quiz-title { font-family: 'Space Grotesk'; font-weight: 600; font-size: 17px; }
.timer-bar .spacer { margin-left: auto; }

/* time comparison chips */
.timecmp { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.timechip { font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 999px; background: var(--card-2); color: var(--ink-soft); }
.timechip.best { background: var(--success-soft); color: var(--success); }
.timechip.faster { background: var(--success-soft); color: var(--success); }
.timechip.slower { background: var(--warn-soft); color: var(--warn); }

/* --- Quiz --------------------------------------------------------------- */
.q {
  background: var(--glass); backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--glass-line); border-radius: var(--radius);
  padding: 20px 20px 18px; margin-bottom: 16px; box-shadow: var(--shadow);
  transition: border-color .2s var(--ease);
}
/* Section picker (Mathe/NaWi/GeWi portals) */
.pick-card .subj { font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 600; font-size: 19px; margin-bottom: 14px; }
.pick-card .secs { display: flex; flex-wrap: wrap; gap: 10px; }
.pick-card { margin-bottom: 18px; }
.qhead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.qnum { width: 26px; height: 26px; border-radius: 8px; background: var(--border-2); color: var(--text); font-size: 13px; font-weight: 700; display: grid; place-items: center; flex: none; }
.chip { font-size: 12px; font-weight: 600; color: var(--text-muted); background: var(--card-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; }
.qpts { margin-left: auto; font-size: 13px; color: var(--text-muted); font-weight: 500; }
.qprompt { white-space: pre-wrap; line-height: 1.6; margin-bottom: 12px; }
.numrow { display: flex; align-items: center; gap: 10px; }
.numrow input { max-width: 240px; }
.unit { color: var(--text-muted); font-weight: 600; }
.opt { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; transition: border-color .16s var(--ease), background .16s var(--ease); }
.opt:hover { border-color: var(--text); background: var(--card-2); }
.opt input { width: auto; accent-color: var(--accent); }
.opt input:checked + span { font-weight: 600; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.multihint, .freehint { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.freehint { margin-top: 6px; }
textarea.free { min-height: 260px; }

.qfb { margin-top: 12px; padding: 11px 13px; border-radius: var(--radius-sm); font-size: 14px; line-height: 1.55; }
.qfb b { font-variant-numeric: tabular-nums; }
.qfb.ok   { background: var(--success-soft); color: var(--success); }
.qfb.part { background: var(--warn-soft); color: var(--warn); }
.qfb.bad  { background: var(--error-soft); color: var(--error); }
.q.res-ok   { border-color: var(--success); }
.q.res-part { border-color: var(--warn); }
.q.res-bad  { border-color: var(--error); }

/* --- Result summary ------------------------------------------------------ */
.result-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.score { font-family: 'Space Grotesk'; font-weight: 700; font-size: 44px; line-height: 1; }
.score-max { color: var(--text-muted); font-weight: 500; }
.bar { height: 12px; background: var(--card-2); border-radius: 999px; overflow: hidden; margin: 14px 0 6px; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--secondary), var(--success)); transition: width .8s var(--ease); }
.note { color: var(--text-muted); font-size: 14px; }

/* Operatoren / chips row */
.ops { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ops .chip { color: var(--secondary); }

/* --- Celebration --------------------------------------------------------- */
.celebrate {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  pointer-events: none;
}
.celebrate .banner {
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  padding: 18px 30px; border-radius: 999px;
  font-family: 'Space Grotesk'; font-weight: 700; font-size: 24px;
  box-shadow: var(--shadow-lg); transform: scale(.6); opacity: 0;
  animation: pop .5s var(--ease) forwards;
}
.celebrate .banner .spark { color: var(--accent); }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
.confetti { position: fixed; top: -12px; width: 9px; height: 14px; z-index: 99; border-radius: 2px; will-change: transform, opacity; }

/* --- Stats --------------------------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.stat-card {
  background: var(--glass); backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--glass-line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
/* Letzte Läufe list (Statistik page) */
.run-list { display: flex; flex-direction: column; gap: 10px; }
.run-item {
  background: var(--glass); backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--glass-line); border-radius: var(--radius-sm);
  padding: 13px 16px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; font-size: 14px;
}
.run-item .rn { font-weight: 600; }
.run-item .rp { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.run-item .rd { color: var(--text-muted); font-size: 13px; }
.run-item .rs { flex-basis: 100%; color: var(--text-muted); font-size: 13.5px; line-height: 1.5; }
.stat-card .top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.stat-card .subj { font-family: 'Space Grotesk'; font-weight: 600; font-size: 17px; }
.stat-card .sec { font-size: 12px; font-weight: 600; color: var(--text-muted); background: var(--card-2); padding: 3px 9px; border-radius: 999px; }
.stat-row { display: flex; justify-content: space-between; font-size: 14px; padding: 5px 0; border-top: 1px dashed var(--border); }
.stat-row:first-of-type { border-top: 0; }
.stat-row .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--text-muted); padding: 40px 0; }

/* --- Misc ---------------------------------------------------------------- */
.err { color: var(--error); font-size: 14px; margin-top: 10px; }
.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid rgba(11,11,13,.18); border-top-color: rgba(11,11,13,.7); border-radius: 50%; animation: s .7s linear infinite; vertical-align: -2px; margin-right: 8px; }
@keyframes s { to { transform: rotate(360deg); } }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 180px; }
.muted { color: var(--text-muted); }
.center { text-align: center; }
.mt { margin-top: 16px; }
.prompt-box { background: var(--card-2); border-left: 3px solid var(--accent); border-radius: 10px; padding: 14px 16px; white-space: pre-wrap; line-height: 1.6; }

/* --- Paper: the light reading / writing task surface --------------------- */
/* Long-form reading and writing sits on a light "document on a dark desk".
   Inside .paper the shell tokens are remapped to light-legible values, so any
   component (criteria, feedback, notes) placed on paper stays readable. */
.paper, .q:has(.free) {
  --text: var(--paper-ink); --text-muted: var(--paper-muted); --ink-soft: #3A3A34;
  --card: #FCFCFB; --card-2: var(--paper-2);
  --border: var(--paper-line); --border-2: #D8D8CE;
  --glass: #FCFCFB; --glass-line: var(--paper-line);
  --success: #157A46; --warn: #8A6100; --error: #C0394B; --secondary: #3D6FB4;
}
.paper {
  background: var(--paper); color: var(--paper-ink);
  border: 1px solid var(--paper-line); border-radius: var(--radius);
  padding: 30px clamp(22px, 5vw, 40px); box-shadow: var(--shadow-lg);
  line-height: 1.7;
}
.paper, .q:has(.free) { backdrop-filter: none; -webkit-backdrop-filter: none; }
.paper h1, .paper h2, .paper h3, .paper .quiz-title { color: var(--paper-ink); }
.paper .fld { color: var(--paper-muted); }
.paper .prompt-box, .paper .qprompt { max-width: 68ch; }
.paper .prompt-box {
  background: var(--paper-2); border-left: 3px solid var(--accent);
  color: var(--paper-ink); border-radius: 10px; padding: 16px 18px; line-height: 1.7;
}
.paper textarea, .paper input:not([type]), .paper input[type=text], .paper select {
  background: #FCFCFB; color: var(--paper-ink); border-color: var(--paper-line);
}
.paper textarea:focus, .paper input:focus, .paper select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.paper .ops .chip { background: var(--paper-2); color: var(--paper-muted); border-color: var(--paper-line); }
.paper .timer { background: var(--paper-2); color: var(--paper-ink); border-color: var(--paper-line); box-shadow: none; }

/* GeWi Fließtext questions render on paper too (any .q that holds a free text area) */
.q:has(.free) {
  background: var(--paper); color: var(--paper-ink); border-color: var(--paper-line);
  box-shadow: var(--shadow-lg);
}
.q:has(.free) .qprompt { color: var(--paper-ink); line-height: 1.7; max-width: 68ch; }
.q:has(.free) .qnum { background: var(--paper-2); color: var(--paper-ink); }
.q:has(.free) .chip { background: var(--paper-2); color: var(--paper-muted); border-color: var(--paper-line); }
.q:has(.free) .qpts, .q:has(.free) .freehint { color: var(--paper-muted); }
.q:has(.free) textarea.free { background: #FCFCFB; color: var(--paper-ink); border-color: var(--paper-line); max-width: 68ch; }

/* --- Essay trainer (Deutsch) -------------------------------------------- */
.opcheck { font-size: 13px; font-weight: 600; padding: 4px 11px; border-radius: 999px; }
.opcheck.yes { background: var(--success-soft); color: var(--success); }
.opcheck.no  { background: var(--error-soft); color: var(--error); }
.crit { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 15px; margin-bottom: 10px; }
.crit-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.crit-nm { font-weight: 600; }
.crit-r { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.crit-pts { font-variant-numeric: tabular-nums; color: var(--text-muted); font-weight: 600; }
.band { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 3px 9px; border-radius: 999px; }
.b-hoch { background: var(--success-soft); color: var(--success); }
.b-mittel { background: var(--warn-soft); color: var(--warn); }
.b-niedrig, .b-nicht_erfuellt { background: var(--error-soft); color: var(--error); }
.crit-ev { font-size: 14px; color: var(--text-muted); margin: 8px 0 0; }
.crit-ev q { color: var(--text); }
.crit-fix { font-size: 14px; margin: 6px 0 0; color: var(--secondary); font-weight: 500; }
.lf { border-left: 3px solid var(--border-2); padding: 7px 13px; margin: 8px 0; font-size: 14px; border-radius: 0 8px 8px 0; }
.lf.plus { border-color: var(--success); } .lf.minus { border-color: var(--error); } .lf.hinweis { border-color: var(--warn); }
.lf q { display: block; color: var(--text-muted); margin-bottom: 2px; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 36px; padding: 28px 0 8px; }
  .demo-card { max-width: 460px; }
}
/* Mobile-first nav: logo row on top, full-width horizontally scrollable
   link row below — nothing hangs off the screen. */
@media (max-width: 640px) {
  .nav-inner { flex-wrap: wrap; gap: 6px 14px; padding: 10px 16px 8px; }
  .nav-links {
    width: 100%; margin-left: 0; min-width: 0;
    justify-content: flex-start; -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .nav-links a { padding: 7px 12px; font-size: 14px; }
  .cta { width: 100%; justify-content: center; }
  .timer-bar { top: 92px; }   /* nav is two rows here */
}
@media (max-width: 560px) {
  .wrap { padding: 24px 16px 100px; }
  .hero .tagline { font-size: clamp(27px, 8vw, 34px); }
  .section-title { margin: 44px 0 16px; }
}
@media (hover: none) {
  .subject-card .go { opacity: 1; transform: none; }
}

/* --- Accessibility ------------------------------------------------------- */
/* Visible keyboard focus everywhere; form fields keep their ring style. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
a:focus-visible, button:focus-visible { border-radius: 12px; }
select:focus-visible, textarea:focus-visible, input:focus-visible { outline: 0; }

/* No motion for users who ask for none */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
  html { scroll-behavior: auto; }
  .bg-dot { display: none; }
  html::before, html::after { transform: none !important; }
  .demo-card .demo-row, .demo-card .demo-fix { opacity: 1 !important; transform: none !important; }
  .demo-card.play .demo-bar > i { transition: none; }
}
