/* Schriften lokal ausgeliefert – keine Anfragen an Google (DSGVO).
   Bricolage Grotesque für Überschriften, Atkinson Hyperlegible für Fließtext:
   Atkinson ist für Legasthenie und schwaches Sehen entworfen und bleibt
   deshalb gesetzt, auch wenn modischere Schriften verfügbar wären. */
@font-face { font-family: 'Bricolage'; src: url('fonts/bricolage-grotesque-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Bricolage'; src: url('fonts/bricolage-grotesque-latin-800-normal.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Atkinson'; src: url('fonts/atkinson-hyperlegible-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Atkinson'; src: url('fonts/atkinson-hyperlegible-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Atkinson'; src: url('fonts/atkinson-hyperlegible-latin-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }

/* ══════════════════════════════════════════════════════════════════════════
   Farben, Maße, Schatten
   ══════════════════════════════════════════════════════════════════════════ */
:root {
  --paper: #F7F6F2;          /* warmes Fast-Weiß statt kühlem Blaugrau */
  --surface: #FFFFFF;
  --surface-2: #EFEDE7;      /* ruhige Füllung */
  --ink: #12141A;            /* dunkle Flächen, Fuß, Panels */
  --ink-2: #1C1F28;
  --text: #16181D;
  --muted: #6A6F7E;
  --line: #E5E2DA;           /* Haarlinie */
  --accent: #3A33D6;         /* Signalfarbe */
  --accent-2: #6D5BFF;       /* für Verläufe */
  --accent-soft: #EEECFF;
  --marker: #FFD84D;         /* Textmarker, bleibt aus der alten Fassung */
  --mint: #D8F5E3;
  --mint-ink: #126B3C;
  --red: #C62F28;
  --red-soft: #FDE7E5;

  --display: 'Bricolage', 'Segoe UI', system-ui, sans-serif;
  --body: 'Atkinson', 'Segoe UI', system-ui, sans-serif;

  --r-pill: 999px;
  --r-card: 20px;
  --r-sm: 14px;
  --r-ctrl: 12px;

  /* Gestufte, weiche Erhebung statt harter Versatzschatten */
  --e1: 0 1px 2px rgba(18, 20, 26, .05), 0 2px 8px rgba(18, 20, 26, .04);
  --e2: 0 2px 4px rgba(18, 20, 26, .05), 0 8px 24px rgba(18, 20, 26, .07);
  --e3: 0 4px 8px rgba(18, 20, 26, .06), 0 18px 48px rgba(18, 20, 26, .10);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
/* Kein Weiterreichen von Wischgesten an den Browser (Pull-to-Refresh,
   versehentliches Schließen beim Scrollen in einer Lernapp) */
html { font-size: 106.25%; overscroll-behavior: none; -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  overscroll-behavior: none;
  font-family: var(--body);
  line-height: 1.55;
  color: var(--text);
  background: var(--paper);
  /* Spalte, damit der dunkle Fuß bei kurzen Seiten unten klebt und nicht
     als schwarzes Band mitten im Papier hängt. */
  min-height: 100vh; display: flex; flex-direction: column;
}
/* `width:100%` ist nötig: `margin:0 auto` schlägt im Flexkasten das
   Dehnen auf die Querachse, sonst schrumpft main auf den Inhalt. */
body > main { flex: 1 0 auto; width: 100%; }
/* Sehr zurückhaltendes Punktraster – ein Nicken Richtung Karopapier, aber
   nichts, was dem Inhalt die Ruhe nimmt. */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image: radial-gradient(rgba(18, 20, 26, .055) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(to bottom, #000 0, transparent 70rem);
}
body::after {
  content: ''; position: fixed; inset: 0 0 auto; height: 40rem; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60rem 26rem at 18% -8rem, rgba(109, 91, 255, .16), transparent 70%),
    radial-gradient(44rem 22rem at 86% -10rem, rgba(255, 216, 77, .22), transparent 70%);
}

h1, h2, h3 { font-family: var(--display); color: var(--text); margin: 0; }
h1 { font-weight: 800; font-size: clamp(2.1rem, 5vw, 3.1rem); line-height: 1.02; letter-spacing: -0.028em; }
h2 { font-weight: 800; font-size: clamp(1.45rem, 2.6vw, 1.75rem); line-height: 1.12; letter-spacing: -0.02em; margin-bottom: .9rem; }
h3 { font-weight: 600; font-size: 1.2rem; line-height: 1.2; letter-spacing: -0.012em; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
code { font-size: 1.02em; background: var(--accent-soft); color: var(--accent); padding: .1rem .4rem; border-radius: 6px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
main:focus { outline: none; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 1.4rem; }
main.wrap { padding-top: 2rem; padding-bottom: 5rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Kleiner Vorspann über Überschriften: Punkt plus Kleinschrift */
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .82rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
}
.eyebrow::before { content: ''; width: .4rem; height: .4rem; border-radius: 50%; background: var(--accent); }

/* ── Kopfzeile ───────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(247, 246, 242, .82);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 68px; flex-wrap: wrap; }
.wordmark {
  font-family: var(--display); font-weight: 800; font-size: 1.4rem; letter-spacing: -0.03em;
  color: var(--text); text-decoration: none;
  background: linear-gradient(transparent 62%, var(--marker) 62%, var(--marker) 94%, transparent 94%);
  background-size: 100% 100%; background-repeat: no-repeat;
  padding: 0 .18rem; transition: background-size .35s var(--ease);
}
.wordmark:hover { background-size: 100% 118%; }
.nav { display: flex; align-items: center; gap: .3rem 1.15rem; flex-wrap: wrap; }
.nav a:not(.btn), .linklike {
  position: relative; color: var(--text); text-decoration: none; font-weight: 700; font-size: .97rem;
  padding: .3rem 0;
}
.nav a:not(.btn)::after, .linklike::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform .3s var(--ease);
}
.nav a:not(.btn):hover::after, .linklike:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav a[aria-current="page"] { color: var(--accent); }
.linklike { background: none; border: 0; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; }

/* ── Knöpfe ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: 700 .97rem/1.1 var(--body); padding: .72rem 1.3rem;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface); color: var(--text);
  box-shadow: var(--e1); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background-color .2s, color .2s, border-color .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--e2); }
.btn:active:not([disabled]) { transform: translateY(0); box-shadow: var(--e1); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-2); }
.btn-danger { color: var(--red); border-color: #F0C9C6; background: var(--red-soft); }
.btn-small { font-size: .88rem; padding: .45rem .9rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }

/* ── Seitenkopf, Hinweise ────────────────────────────────────── */
.hero { max-width: 46rem; padding: .5rem 0 .25rem; }
.lead { font-size: 1.15rem; color: var(--muted); margin-top: .9rem; max-width: 40rem; }
.block { margin-top: 3.2rem; }

.crumbs { display: flex; flex-wrap: wrap; gap: .4rem; font-size: .92rem; color: var(--muted); margin-bottom: 1.1rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs .sep { color: #B6B2A8; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.25rem 2rem; flex-wrap: wrap; margin-bottom: 1.8rem; }
.page-head > div:first-child { max-width: 46rem; }
.phase { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .85rem; color: var(--muted); }
.desc { margin-top: .85rem; font-size: 1.05rem; max-width: 44rem; white-space: pre-line; color: var(--muted); }
.sub { color: var(--muted); margin-top: .35rem; }
.by { color: var(--muted); margin-top: .3rem; }
.h-link { color: inherit; text-decoration: none; }
.h-link:hover { text-decoration: underline; }
.empty {
  background: var(--surface); border: 1px dashed #CFCBC0; border-radius: var(--r-card);
  padding: 1.6rem 1.5rem; color: var(--muted); max-width: 44rem;
}
.note { background: var(--accent-soft); border-radius: var(--r-sm); padding: .85rem 1.1rem; margin-bottom: 1.4rem; max-width: 44rem; }

.status {
  display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .01em;
  padding: .25rem .75rem; border-radius: var(--r-pill); white-space: nowrap;
}
.status-offen { color: var(--mint-ink); background: var(--mint); }
.status-abstimmung { color: #7A5200; background: #FFF0BE; }
.status-abgeschlossen { color: var(--muted); background: var(--surface-2); }

/* ── Klassenstufen als Hefte ─────────────────────────────────── */
.heft-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 1.3rem; }
.heft {
  --c: #2F6FD6;
  position: relative; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 3 / 4; padding: 0 13%;
  background: linear-gradient(150deg, var(--c), color-mix(in srgb, var(--c) 72%, #000 28%));
  border-radius: 6px 18px 18px 6px;
  box-shadow: var(--e2); text-decoration: none; color: var(--text);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.heft::before { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: rgba(0, 0, 0, .28); }
.heft:hover { transform: translateY(-6px) rotate(-1deg); box-shadow: var(--e3); }
.heft:active { transform: translateY(-2px); }
.heft-label {
  width: 100%; display: flex; flex-direction: column; align-items: center; text-align: center;
  background: #fff; border-radius: 10px; padding: .6rem .4rem .5rem;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .12);
}
.heft-kind { font-size: .8rem; color: var(--muted); }
.heft-num { font-family: var(--display); font-weight: 800; font-size: clamp(2.4rem, 6vw, 3.3rem); line-height: 1; letter-spacing: -0.045em; }
.heft-meta { width: 100%; margin-top: .4rem; padding-top: .32rem; border-top: 1px dashed #C9C5BA; font-size: .78rem; color: var(--muted); }
.heft.c0 { --c: #E4513F; } .heft.c1 { --c: #2F6FD6; } .heft.c2 { --c: #2E9E5B; }
.heft.c3 { --c: #F2B632; } .heft.c4 { --c: #8A4FC7; } .heft.c5 { --c: #F07E26; }
.heft.c6 { --c: #1FA3A3; } .heft.c7 { --c: #D9487A; } .heft.c8 { --c: #4A5670; }

/* ── Themenlisten: Zeilen, die beim Überfahren volllaufen ────── */
.topic-list { display: grid; gap: .5rem; }
.topic-row {
  position: relative; display: flex; align-items: center; gap: .6rem 1rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 1rem 1.15rem; text-decoration: none; color: var(--text); overflow: hidden;
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease), transform .3s var(--ease);
}
.topic-row::before {
  content: ''; position: absolute; inset: 0; z-index: 0;
  background: var(--surface-2); transform: scaleX(0); transform-origin: left;
  transition: transform .45s var(--ease);
}
.topic-row > * { position: relative; z-index: 1; }
.topic-row:hover { border-color: #D6D2C8; box-shadow: var(--e1); }
.topic-row:hover::before { transform: scaleX(1); }
.topic-main { display: flex; flex-direction: column; flex: 1 1 16rem; min-width: 0; }
.topic-title { font-weight: 700; font-size: 1.08rem; letter-spacing: -0.012em; }
.topic-sub { color: var(--muted); font-size: .9rem; }
.topic-count { color: var(--muted); font-size: .9rem; min-width: 4.5rem; text-align: right; }

/* ── App-Karten ──────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .4rem; }
.toolbar-note { color: var(--muted); font-size: .9rem; margin-bottom: 1.3rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-pill); overflow: hidden; background: var(--surface); box-shadow: var(--e1); }
.seg button { font: 700 .9rem var(--body); border: 0; background: none; color: var(--muted); padding: .5rem 1rem; cursor: pointer; transition: color .2s, background-color .2s; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 1.3rem; margin-top: 1rem; }
.app-card {
  position: relative; display: flex; flex-direction: column; gap: .4rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 1.25rem 1.3rem 1.1rem; box-shadow: var(--e1);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .3s;
}
.app-card:hover { transform: translateY(-5px); box-shadow: var(--e3); border-color: #D6D2C8; }
.app-card h3 a { color: var(--text); text-decoration: none; }
.app-card h3 a::after { content: ''; position: absolute; inset: 0; border-radius: var(--r-card); }
.app-card h3 a:hover { text-decoration: underline; }
.app-card .by a { position: relative; z-index: 1; }
.app-desc { color: var(--muted); font-size: .94rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.app-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: auto; padding-top: .8rem; flex-wrap: wrap; }
.tally { display: inline-flex; gap: .7rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.flag { font-size: .78rem; font-weight: 700; color: var(--muted); background: var(--surface-2); border-radius: var(--r-pill); padding: .18rem .6rem; white-space: nowrap; }
.flag-new { color: var(--accent); background: var(--accent-soft); }
.flag-pending { color: #7A5200; background: #FFF0BE; }
.rank-sticker {
  position: absolute; top: -.7rem; right: 1.1rem; z-index: 2;
  background: var(--ink); color: #fff; border-radius: var(--r-pill); padding: .2rem .8rem;
  font-weight: 700; font-size: .85rem; box-shadow: var(--e2);
}
.app-card.p1 .rank-sticker { background: var(--marker); color: var(--ink); }
.app-card.p2 .rank-sticker, .app-card.p3 .rank-sticker { background: var(--accent); color: #fff; }
.app-card.p1 { border-color: var(--marker); }

/* ── App spielen ─────────────────────────────────────────────── */
.vote-box { display: flex; flex-direction: column; align-items: flex-start; gap: .6rem; max-width: 22rem; }
.vote-buttons { display: flex; gap: .7rem; }
.vote-btn {
  display: inline-flex; align-items: center; gap: .5rem; font: 700 1.15rem var(--body);
  padding: .65rem 1.2rem; border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface); color: var(--text); box-shadow: var(--e1);
  cursor: pointer; font-variant-numeric: tabular-nums;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background-color .2s, border-color .2s;
}
.vote-btn:hover:not([disabled]) { transform: translateY(-2px); box-shadow: var(--e2); }
.vote-btn[disabled] { cursor: not-allowed; box-shadow: none; opacity: .55; }
.vote-btn.up[aria-pressed="true"] { background: var(--mint); border-color: #A8E0C0; color: var(--mint-ink); }
.vote-btn.down[aria-pressed="true"] { background: var(--red-soft); border-color: #F0C9C6; color: var(--red); }
.vote-btn.pop { animation: pop .28s ease-out; }
@keyframes pop { 40% { transform: scale(1.12); } }
.vote-hint { font-size: .9rem; color: var(--muted); }

.player-bar { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.player {
  display: block; width: 100%; height: calc(100vh - 150px); min-height: 520px;
  border: 1px solid var(--line); border-radius: var(--r-card); background: #fff; box-shadow: var(--e2);
  overscroll-behavior: contain;
}

/* Vollbild ohne natives Fullscreen: auf Tablets und Handys schließt dort eine
   Wischgeste das Vollbild, obwohl in der Lernapp nur gescrollt werden soll. */
body.fs-active { overflow: hidden; }
.player.player-fs {
  position: fixed; inset: 0; z-index: 1000;
  width: 100vw; height: 100vh; min-height: 0; max-width: none;
  border: 0; border-radius: 0; box-shadow: none; background: #fff;
}
@supports (height: 100dvh) { .player.player-fs { height: 100dvh; } }
/* Unten rechts: dort liegen bei Lernapps seltener Inhalte als oben */
.fs-exit {
  position: fixed; z-index: 1001;
  bottom: calc(.6rem + env(safe-area-inset-bottom)); right: calc(.6rem + env(safe-area-inset-right));
  font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer;
  padding: .45rem .85rem; border: 1px solid var(--line); border-radius: var(--r-pill);
  background: #fff; color: var(--text); box-shadow: var(--e2);
  opacity: .55; transition: opacity .15s;
}
.fs-exit:hover, .fs-exit:focus-visible, .fs-exit:active { opacity: 1; }

/* ── Quellcode-Ansicht ───────────────────────────────────────── */
.source-panel { margin-top: 1.2rem; }
.source-inner { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); box-shadow: var(--e1); overflow: hidden; }
.source-files { display: flex; flex-wrap: wrap; gap: .4rem; padding: .8rem; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.source-file {
  font: inherit; font-size: .84rem; font-weight: 700; cursor: pointer; padding: .32rem .75rem;
  border: 1px solid var(--line); border-radius: var(--r-pill); background: #fff; color: var(--muted);
  transition: background-color .2s, color .2s;
}
.source-file:hover { color: var(--text); }
.source-file.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.source-file:disabled { opacity: .45; cursor: default; }
.source-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.source-name { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: .88rem; color: var(--muted); word-break: break-all; }
.source-code {
  margin: 0; padding: 1.1rem; max-height: 60vh; overflow: auto;
  background: #0C0E14; color: #E6EBF5; font-size: .82rem; line-height: 1.55;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  white-space: pre; tab-size: 2;
}
.source-code code { font: inherit; color: inherit; background: none; }
.source-note, .source-loading, .source-error { padding: 1rem; margin: 0; color: var(--muted); }
.source-error { color: var(--red); }

/* ── Code bearbeiten ─────────────────────────────────────────── */
.card-form-wide { max-width: 62rem; }
.code-label .source-name { font-size: .84rem; }
.code-area {
  width: 100%; min-height: 24rem; resize: vertical;
  background: #0C0E14; color: #E6EBF5; border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: .9rem; font-size: .82rem; line-height: 1.55; tab-size: 2;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  white-space: pre; overflow-wrap: normal; overflow-x: auto;
}
.code-area:focus { outline: 3px solid var(--accent); outline-offset: 1px; }

/* ── Versionsverlauf ─────────────────────────────────────────── */
.version-box { margin: 2.2rem 0 1rem; max-width: 62rem; }
.version-head { margin-bottom: .4rem; }
.version-hint { color: var(--muted); margin-bottom: 1rem; }
.version-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.version-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  box-shadow: var(--e1); padding: .9rem 1.1rem;
  display: grid; grid-template-columns: 1fr auto; gap: .6rem; align-items: center;
}
.version-meta { display: grid; gap: .15rem; min-width: 0; }
.version-when { font-weight: 700; }
.version-sub { font-size: .84rem; color: var(--muted); }
.version-title { font-size: .9rem; overflow-wrap: anywhere; }
.version-actions { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.version-code { grid-column: 1 / -1; }
.version-code .source-code { max-height: 45vh; border-radius: var(--r-sm); margin-top: .5rem; }
.version-code .source-head { padding: .4rem 0 0; border: 0; }
@media (max-width: 34rem) {
  .version-item { grid-template-columns: 1fr; }
  .version-actions { justify-content: flex-start; }
}

/* ── Formulare ───────────────────────────────────────────────── */
.auth { max-width: 31rem; }
.auth h1 { margin-bottom: 1.3rem; }
.aside { margin-top: 1rem; color: var(--muted); }
.card-form {
  display: grid; gap: 1.05rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 1.6rem; box-shadow: var(--e2); max-width: 42rem;
}
.tabbar { display: flex; gap: .4rem; margin-bottom: 0; }
.tab {
  font: 700 .95rem/1.1 var(--body); padding: .55rem 1.1rem; background: var(--surface-2);
  border: 0; border-radius: var(--r-pill); cursor: pointer; color: var(--muted);
  transition: background-color .2s, color .2s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--ink); color: #fff; }
#upload-form { margin-top: .9rem; }
.grid-form { grid-template-columns: 1fr 1fr; max-width: 52rem; }
.grid-form .span2 { grid-column: 1 / -1; }
.card-form label { display: flex; flex-direction: column; gap: .4rem; font-weight: 700; font-size: .95rem; }
.card-form label.check, label.check { flex-direction: row; align-items: center; gap: .55rem; font-weight: 400; }
.opt, .hint { font-weight: 400; color: var(--muted); font-size: .9rem; }
input:not([type="checkbox"]), select, textarea {
  font: 1rem/1.4 var(--body); color: var(--text); background: #FCFBF9;
  border: 1px solid var(--line); border-radius: var(--r-ctrl); padding: .7rem .85rem; width: 100%;
  transition: border-color .2s, background-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); background: #fff; outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }
input[type="file"] { padding: .75rem; background: var(--accent-soft); border-style: dashed; border-color: #BFB8FF; }
.form-actions { display: flex; gap: .7rem; flex-wrap: wrap; }
.form-error { color: var(--red); background: var(--red-soft); border-radius: var(--r-ctrl); padding: .65rem .9rem; font-weight: 700; }
.help { background: var(--surface-2); border-radius: var(--r-sm); padding: .9rem 1.1rem; font-size: .94rem; color: var(--muted); }
.help ul { margin: .3rem 0 0; padding-left: 1.2rem; }
label.inline { display: inline-flex; flex-direction: row; align-items: center; gap: .45rem; font-weight: 700; font-size: .9rem; }
label.inline select { width: auto; padding: .35rem .6rem; }

/* ── Profil ──────────────────────────────────────────────────── */
.profile-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap; }
.points {
  display: flex; flex-direction: column; align-items: center;
  background: var(--ink); color: #fff; border-radius: var(--r-card);
  padding: .9rem 1.7rem; box-shadow: var(--e2);
}
.points-num { font-family: var(--display); font-weight: 800; font-size: 2.9rem; line-height: 1; font-variant-numeric: tabular-nums; color: var(--marker); }
.points-label { font-weight: 700; font-size: .9rem; color: rgba(255, 255, 255, .65); }
.facts { list-style: none; padding: 0; margin: 1.5rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem 1.8rem; color: var(--muted); }
.facts strong { color: var(--text); font-size: 1.15rem; }

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 1rem; }
.badge {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: .2rem;
  padding: 1.1rem .7rem; border: 1px dashed #CFCBC0; border-radius: var(--r-card);
  background: rgba(255, 255, 255, .55); color: var(--muted);
}
.badge-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; font-size: 1.9rem; background: var(--surface-2); filter: grayscale(1); opacity: .4; margin-bottom: .35rem; }
.badge-name { font-weight: 700; color: var(--text); }
.badge-desc { font-size: .84rem; line-height: 1.4; }
.badge-date { font-size: .8rem; margin-top: .2rem; }
.badge.earned { border: 1px solid var(--line); background: var(--surface); color: var(--text); box-shadow: var(--e1); }
.badge.earned .badge-icon { filter: none; opacity: 1; background: var(--marker); }
.plain-list { margin: 0; padding-left: 1.2rem; display: grid; gap: .35rem; }
details.rules { margin-top: 2.4rem; max-width: 44rem; }
details.rules summary { font-weight: 700; cursor: pointer; color: var(--accent); }
details.rules ul { margin: .7rem 0 0; padding-left: 1.2rem; display: grid; gap: .3rem; color: var(--muted); }

/* ── Bestenliste ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--e1); }
.board { width: 100%; border-collapse: collapse; }
.board th, .board td { padding: .8rem 1rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.board th { font-size: .8rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.board tbody tr { transition: background-color .2s; }
.board tbody tr:hover { background: var(--surface-2); }
.board tbody tr:last-child td { border-bottom: 0; }
.board .num { text-align: right; font-variant-numeric: tabular-nums; }
.board td:first-child { font-weight: 700; width: 4rem; color: var(--muted); }
.board tr.top td:first-child { color: var(--accent); }
.board tr.top td { font-weight: 700; }
.board tr.me { background: #FFF8DC; }
.board tr.me:hover { background: #FFF3C4; }
.badge-icons span { margin-right: .15rem; }

/* ── Verwaltung ──────────────────────────────────────────────── */
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.7rem; }
.tabs a {
  padding: .5rem 1.05rem; font-weight: 700; font-size: .95rem; text-decoration: none; color: var(--muted);
  background: var(--surface-2); border-radius: var(--r-pill); transition: background-color .2s, color .2s;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { background: var(--ink); color: #fff; }
.count-dot { display: inline-grid; place-items: center; min-width: 1.4rem; height: 1.4rem; padding: 0 .35rem; border-radius: var(--r-pill); background: var(--red); color: #fff; font-size: .78rem; }
.admin-list { display: grid; gap: .6rem; }
.admin-row { display: flex; align-items: center; gap: .6rem 1rem; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .9rem 1.1rem; }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-left: auto; }
.admin-row.inactive { opacity: .55; }
.admin-main { display: flex; flex-direction: column; flex: 1 1 14rem; min-width: 0; }
.admin-row .card-form { max-width: none; margin-top: .6rem; padding: 1.1rem; box-shadow: none; }
.admin-row .card-form .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.admin-row .card-form .form-actions { margin-top: 0; }
.join-code {
  font-family: var(--display); font-weight: 800; font-size: 1.3rem; letter-spacing: .14em;
  background: var(--marker); border-radius: var(--r-ctrl); padding: .15rem .7rem;
}
.list-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.pw-note { background: var(--marker); border-radius: var(--r-sm); padding: .9rem 1.1rem; margin-top: 1rem; max-width: 44rem; }
.pw-note code { font-size: 1.25rem; background: #fff; color: var(--text); }

/* ── Hinweis-Toast ───────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 1.6rem; transform: translate(-50%, 150%);
  background: var(--ink); color: #fff; padding: .8rem 1.3rem; border-radius: var(--r-pill); font-weight: 700;
  max-width: calc(100vw - 2rem); z-index: 50; pointer-events: none; box-shadow: var(--e3);
  opacity: 0; visibility: hidden;
  transition: transform .3s var(--ease), opacity .3s var(--ease), visibility 0s linear .3s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition: transform .3s var(--ease), opacity .3s var(--ease), visibility 0s; }
.toast.error { background: var(--red); }

/* ══════════════════════════════════════════════════════════════════════════
   Startseite ohne Anmeldung
   ══════════════════════════════════════════════════════════════════════════ */
.landing { max-width: none; }

.lhero { position: relative; padding: 2rem 0 .5rem; }
.lhero h1 { max-width: 16ch; font-size: clamp(2.3rem, 4.4vw, 3.5rem); line-height: 1.03; letter-spacing: -0.034em; margin: 1.1rem 0 0; }
.lhero .lead { font-size: clamp(1.08rem, 1.5vw, 1.3rem); max-width: 34rem; margin-top: 1.4rem; }
.lhero-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 3.5rem; align-items: center; }
.lcta { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 2rem; }
.lcta .btn { padding: .85rem 1.6rem; font-size: 1.02rem; }

/* Vorschaukarte: zeigt in Kurzform, was die Seite tut */
.lpreview {
  position: relative; background: var(--ink); border-radius: var(--r-card); padding: 1.5rem;
  color: #fff; box-shadow: var(--e3); overflow: hidden;
}
.lpreview::before {
  content: ''; position: absolute; inset: -40% -10% auto; height: 70%;
  background: radial-gradient(50% 60% at 50% 0, rgba(109, 91, 255, .5), transparent 70%);
  pointer-events: none;
}
.lpreview-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.lpreview-head .eyebrow { color: rgba(255, 255, 255, .62); }
.lpreview-head .eyebrow::before { background: var(--marker); }
.lpreview-row {
  position: relative; display: flex; align-items: center; gap: .9rem;
  background: rgba(255, 255, 255, .06); border-radius: var(--r-sm); padding: .8rem .95rem;
}
.lpreview-row + .lpreview-row { margin-top: .5rem; }
.lpreview-rank {
  display: grid; place-items: center; width: 2.1rem; height: 2.1rem; flex: none;
  border-radius: 50%; background: rgba(255, 255, 255, .1); font-weight: 800; font-size: .9rem;
}
.lpreview-row.win .lpreview-rank { background: var(--marker); color: var(--ink); }
.lpreview-name { flex: 1; min-width: 0; font-weight: 700; font-size: .98rem; }
.lpreview-name small { display: block; font-weight: 400; font-size: .82rem; color: rgba(255, 255, 255, .5); }
.lpreview-score { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--marker); }

/* Zahlenband */
.lstats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1.5rem 2rem;
  margin-top: 4rem; padding-top: 2.2rem; border-top: 1px solid var(--line);
}
.lstat-num { font-family: var(--display); font-weight: 800; font-size: clamp(2.2rem, 4vw, 3rem); line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.lstat-label { color: var(--muted); font-size: .94rem; margin-top: .4rem; }

/* Vier Schritte */
.lgrid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); margin-top: 1.6rem; }
.lcard {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 1.5rem 1.4rem 1.4rem; box-shadow: var(--e1);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.lcard:hover { transform: translateY(-5px); box-shadow: var(--e3); }
.lcard h3 { font-size: 1.14rem; margin: .9rem 0 .45rem; }
.lcard p { margin: 0; color: var(--muted); font-size: .96rem; }
.lnum {
  display: inline-flex; align-items: center; justify-content: center; width: 2.3rem; height: 2.3rem;
  border-radius: 50%; background: linear-gradient(145deg, var(--accent-2), var(--accent));
  color: #fff; font-family: var(--display); font-weight: 800; font-size: 1rem;
}

/* Dunkle Tafel „Für Schulen gedacht" */
.lnote {
  position: relative; overflow: hidden;
  background: var(--ink); color: #fff; border-radius: var(--r-card);
  padding: 2.4rem 2.2rem; margin-top: 1.6rem; box-shadow: var(--e3);
}
.lnote::after {
  content: ''; position: absolute; right: -6rem; bottom: -8rem; width: 22rem; height: 22rem;
  border-radius: 50%; background: radial-gradient(circle, rgba(109, 91, 255, .35), transparent 65%);
  pointer-events: none;
}
.lnote h3 { color: #fff; font-size: 1.4rem; margin: .9rem 0 1.1rem; }
.lnote .eyebrow { color: rgba(255, 255, 255, .62); }
.lnote .eyebrow::before { background: var(--marker); }
.lnote ul { position: relative; margin: 0; padding: 0; list-style: none; display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.lnote li { position: relative; padding-left: 1.6rem; color: rgba(255, 255, 255, .78); font-size: .98rem; }
.lnote li::before {
  content: ''; position: absolute; left: 0; top: .55em; width: .55rem; height: .55rem;
  border-radius: 50%; background: var(--marker);
}

#kontaktkarte { max-width: 42rem; margin-top: 1.6rem; }

/* ── Geteilte App ────────────────────────────────────────────── */
.shared { max-width: 72rem; }
.shared h1 { margin: 0 0 .2rem; }
.shared .by { margin: 0 0 .6rem; color: var(--muted); font-weight: 700; }

/* ── Schulanzeige in der Navigation ──────────────────────────── */
.schooltag {
  font-size: .8rem; font-weight: 700; color: var(--accent); background: var(--accent-soft);
  border-radius: var(--r-pill); padding: .25rem .75rem; white-space: nowrap;
}
.schoolpick {
  font: inherit; font-size: .85rem; font-weight: 700; color: var(--text); background: #fff;
  border: 1px solid var(--line); border-radius: var(--r-ctrl); padding: .35rem .6rem; max-width: 11rem;
}

/* ── Listen in der Verwaltung (Schulen, Anfragen) ────────────── */
.adminlist { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.arow {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  box-shadow: var(--e1); padding: .95rem 1.1rem;
  display: grid; grid-template-columns: 1fr auto; gap: .7rem; align-items: start;
}
.arow.done { opacity: .55; }
.arow small { color: var(--muted); }
.arow-act { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 40rem) { .arow { grid-template-columns: 1fr; } .arow-act { justify-content: flex-start; } }

/* ── Fuß mit den Pflichtangaben ──────────────────────────────── */
.fuss { margin-top: 4rem; background: var(--ink); color: rgba(255, 255, 255, .62); border-radius: var(--r-card) var(--r-card) 0 0; }
.fuss-innen {
  display: flex; flex-wrap: wrap; gap: .7rem 1.5rem;
  align-items: center; justify-content: space-between;
  padding-top: 1.6rem; padding-bottom: 1.6rem;
  font-size: .9rem;
}
.fuss-innen nav { display: flex; flex-wrap: wrap; gap: 1.3rem; }
.fuss-innen a { color: rgba(255, 255, 255, .62); text-decoration: none; }
.fuss-innen a:hover, .fuss-innen a:focus-visible { color: #fff; text-decoration: underline; }

/* ── Rechtstexte ─────────────────────────────────────────────── */
.recht { max-width: 46rem; padding: 1.5rem 0 1rem; }
.recht h1 { margin: 0 0 1rem; }
.recht h2 { font-family: var(--display); font-size: 1.18rem; margin: 2.2rem 0 .5rem; padding-bottom: .3rem; border-bottom: 1px solid var(--line); }
.recht p, .recht ul { margin: 0 0 .85rem; }
.recht ul { padding-left: 1.2rem; }
.recht li { margin-bottom: .35rem; }
.recht .lead { font-size: 1.05rem; color: var(--muted); }
.recht-stand { margin-top: 2rem; font-size: .9rem; color: var(--muted); }

/* ══════════════════════════════════════════════════════════════════════════
   Bewegung — die Anfangszustände stehen im CSS, damit nichts aufblitzt,
   bevor das Skript geladen ist. Ohne JavaScript bleibt alles sichtbar:
   motion.js setzt `js-motion` erst, wenn es wirklich läuft.
   ══════════════════════════════════════════════════════════════════════════ */
.js-motion [data-auftritt] { opacity: 0; transform: translateY(18px); }
.js-motion [data-auftritt].ist-da { opacity: 1; transform: none; }

@media (max-width: 680px) {
  html { font-size: 100%; }
  .grid-form { grid-template-columns: 1fr; }
  .topic-count { text-align: left; }
  .player { height: 75vh; min-height: 420px; }
  .heft-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 1rem; }
  .lhero-grid { grid-template-columns: 1fr; gap: 2rem; }
  .lnote { padding: 1.8rem 1.4rem; }
  .fuss-innen { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .btn:hover, .heft:hover, .app-card:hover, .lcard:hover, .vote-btn:hover { transform: none !important; }
  .js-motion [data-auftritt] { opacity: 1 !important; transform: none !important; }
}
