@font-face { font-family: "Atkinson"; src: url("/static/fonts/atkinson-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("/static/fonts/atkinson-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Young Serif"; src: url("/static/fonts/young-serif-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  color-scheme: light;
  --ground: oklch(95.5% .012 95);
  --surface: oklch(98.5% .006 95);
  --ink: oklch(25% .02 200);
  --muted: oklch(44% .02 200);
  --line: oklch(86% .015 95);
  --paper: oklch(97% .022 90);
  --paper-ink: oklch(26% .02 250);
  --paper-rule: oklch(82% .045 240);
  --paper-head: oklch(58% .17 25);
  --good: oklch(42% .11 155);
  --good-soft: oklch(92% .05 155);
  --bad: oklch(47% .16 28);
  --bad-soft: oklch(93% .04 28);
  --mid: oklch(47% .1 75);
  --mid-soft: oklch(93% .06 85);
  --shell: oklch(33% .055 185);
  --on-shell: oklch(96% .012 95);
  --accent: oklch(39% .075 185);
  --on-accent: oklch(98% .006 95);
  --accent-soft: oklch(91% .035 185);
  --radius: 10px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --serif: "Young Serif", Georgia, serif;
  --sans: "Atkinson", system-ui, sans-serif;
}
:root[data-tone="road"] {
  --shell: oklch(37% .1 48);
  --accent: oklch(46% .135 48);
  --accent-soft: oklch(92% .05 60);
}
:root[data-tone="plain"] { --shell: oklch(33% .03 250); --accent: oklch(40% .06 250); --accent-soft: oklch(91% .02 250); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: oklch(21% .018 200);
    --surface: oklch(26% .02 200);
    --ink: oklch(93% .012 95);
    --muted: oklch(74% .018 200);
    --line: oklch(36% .02 200);
    --paper: oklch(91% .026 90);
    --good: oklch(80% .13 155);
    --good-soft: oklch(32% .05 155);
    --bad: oklch(80% .12 28);
    --bad-soft: oklch(33% .06 28);
    --mid: oklch(84% .11 85);
    --mid-soft: oklch(34% .05 85);
    --accent: oklch(76% .09 185);
    --on-accent: oklch(20% .03 200);
    --accent-soft: oklch(33% .04 185);
  }
  :root[data-tone="road"]:not([data-theme="light"]) { --accent: oklch(78% .14 60); --accent-soft: oklch(35% .06 55); }
  :root[data-tone="plain"]:not([data-theme="light"]) { --accent: oklch(78% .06 250); --accent-soft: oklch(34% .03 250); }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 1.0625rem/1.55 var(--sans); }
::selection { background: var(--accent); color: var(--on-accent); }
html { scrollbar-color: var(--line) transparent; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; text-wrap: balance; line-height: 1.2; }
h1 { font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.4rem); margin: 0 0 .5rem; }
h2 { font-size: 1.3rem; margin: 0 0 .75rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); text-underline-offset: .18em; }
small, .small { font-size: .9rem; }
.muted { color: var(--muted); }
.lead { max-width: 62ch; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
section { margin-top: 2.25rem; }
.icon { width: 1.35em; height: 1.35em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* Gerüst */
.shell { min-height: 100dvh; }
.brand { font-family: var(--serif); font-size: 1.2rem; color: inherit; text-decoration: none; }
.brand.big { font-size: 1.5rem; margin-bottom: 2.5rem; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: var(--shell); color: var(--on-shell); padding: calc(.6rem + env(safe-area-inset-top)) calc(1rem + env(safe-area-inset-right)) .6rem calc(1rem + env(safe-area-inset-left)); }
.group-name { font-size: .95rem; }
.group-switch select { width: auto; min-height: 36px; padding: .15rem 1.6rem .15rem .6rem; background-color: transparent; color: inherit; border-color: color-mix(in oklch, var(--on-shell) 45%, transparent); font-size: .95rem; }
.group-switch option { color: #1b2b2b; }
.page { max-width: 46rem; margin: 0 auto; padding: 1.5rem max(1rem, env(safe-area-inset-right)) calc(6.5rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); }
.rail { display: none; }
.tabs { position: fixed; inset: auto 0 0; z-index: 5; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .55rem 0 .45rem; min-height: 56px; font-size: .82rem; color: var(--muted); text-decoration: none; }
.nav-item[aria-current] { color: var(--accent); font-weight: 700; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 15rem 1fr; }
  .topbar, .tabs { display: none; }
  .rail { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 2rem; background: var(--shell); color: var(--on-shell); padding: 1.5rem 1rem; }
  .rail .brand { font-size: 1.5rem; padding: 0 .75rem; }
  .nav-list { display: grid; gap: .25rem; flex: 1; align-content: start; }
  .rail .nav-item { flex-direction: row; gap: .75rem; padding: .6rem .75rem; min-height: 44px; font-size: 1rem; color: inherit; border-radius: var(--radius); }
  .rail .nav-item:hover { background: color-mix(in oklch, var(--on-shell) 12%, transparent); }
  .rail .nav-item[aria-current] { background: var(--on-shell); color: var(--shell); }
  .rail .group-name, .rail .group-switch { padding: 0 .75rem; }
  .page { padding: 3rem 2rem 4rem; width: 100%; }
}

/* Bedienelemente */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 46px; padding: .55rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: 700 1rem/1.2 var(--sans); text-decoration: none; cursor: pointer; transition: background-color .15s, transform .15s var(--ease); }
.btn:hover { background: var(--accent-soft); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: color-mix(in oklch, var(--accent) 86%, var(--ink)); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.wide { width: 100%; }
.tall { min-height: 54px; font-size: 1.08rem; }
.actions { display: grid; gap: .6rem; margin: 1.25rem 0; }
.actions-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: var(--radius); background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--accent-soft); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.text-btn { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; padding: 0 .35rem; border: 0; background: none; color: var(--accent); font: inherit; font-size: .95rem; text-decoration: none; cursor: pointer; }
.text-btn:hover { text-decoration: underline; }
.back { margin: -.5rem 0 .5rem -.35rem; }
.skip { display: flex; margin: .75rem auto 0; color: var(--muted); }

input, select, textarea { width: 100%; min-height: 46px; padding: .55rem .7rem; border: 1px solid color-mix(in oklch, var(--ink) 40%, var(--line)); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 1.0625rem; }
input[type=checkbox] { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); flex: none; }
input[type=file] { padding: .55rem; }
input::file-selector-button { margin-right: .75rem; padding: .35rem .75rem; border: 1px solid var(--line); border-radius: 6px; background: var(--ground); color: var(--ink); font: inherit; }
::placeholder { color: var(--muted); }
textarea { resize: vertical; }
label { font-weight: 700; }
.stack-form { display: grid; gap: .45rem; margin: 1rem 0; }
.stack-form input + label, .stack-form select + label, .stack-form textarea + label, .stack-form .muted + label { margin-top: .6rem; }
.stack-form > .btn, .stack-form > .check, .stack-form > .actions-row, .stack-form > fieldset { margin-top: .6rem; }
.inline-form { display: flex; gap: .5rem; }
.inline-form input { flex: 1; min-width: 0; }
.check { display: flex; align-items: center; gap: .6rem; font-weight: 400; min-height: 40px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 700; padding: 0; }
.notice { padding: .65rem .85rem; border-radius: 8px; background: var(--accent-soft); margin: .75rem 0; }
.notice.error { background: var(--bad-soft); color: var(--bad); }
.notice.good { background: var(--good-soft); color: var(--good); }

/* Listen */
.list, .docs, .users, .goals, .cards, .group-list { list-style: none; padding: 0; margin: 0; }
.list { border-top: 1px solid var(--line); margin-top: 1rem; }
.row-link { display: flex; align-items: center; gap: .75rem; padding: .85rem .25rem; min-height: 60px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.row-link > .icon { color: var(--muted); }
.row-link:hover strong { color: var(--accent); }
.row-link.solo { border-top: 1px solid var(--line); }
.row-main { display: grid; gap: .25rem; flex: 1; min-width: 0; }
.row-main small { color: var(--muted); }
.count { min-width: 2rem; padding: .05rem .5rem; border-radius: 99px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: .92rem; text-align: center; font-variant-numeric: tabular-nums; }
.bar { display: block; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); transition: width .5s var(--ease); }
.subject-sum { display: grid; gap: .3rem; max-width: 26rem; }
.today { margin-top: .5rem; }
.goals li { display: grid; gap: .3rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.goals .text-btn { justify-self: start; }
.chapter { border-bottom: 1px solid var(--line); }
.chapter summary { display: flex; justify-content: space-between; gap: 1rem; align-items: center; min-height: 52px; font-weight: 700; cursor: pointer; }
.chapter small { font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-row { border-top: 1px solid var(--line); }
.card-open { display: grid; gap: .1rem; width: 100%; padding: .6rem 0; min-height: 48px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.card-back { display: none; padding: 0 0 .6rem; white-space: pre-line; }
.card-row.open .card-back { display: block; }
.card-tools { display: flex; justify-content: center; gap: 1rem; margin-top: .4rem; }
.card-back .card-tools { justify-content: flex-start; margin-left: -.35rem; }
.doc { display: flex; align-items: flex-start; gap: .5rem; padding: .85rem 0; border-top: 1px solid var(--line); }
.doc-main { display: grid; gap: .2rem; flex: 1; min-width: 0; }
.doc-main strong { overflow-wrap: anywhere; }
.doc-status { margin: .1rem 0 0; font-weight: 700; }
.doc-status.fertig { color: var(--good); }
.doc-status.fehler, .doc-status.kein_text { color: var(--bad); }
.user { padding: 1rem 0; border-top: 1px solid var(--line); display: grid; gap: .5rem; }
.user-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: baseline; }
.user-groups { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
.group-list li { display: flex; justify-content: space-between; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.invite { padding: .9rem; margin: 1rem 0; border-radius: var(--radius); background: var(--accent-soft); }
.invite p { margin: .2rem 0 .6rem; }

/* Willkommen */
.welcome { min-height: 100dvh; max-width: 26rem; margin: 0 auto; padding: calc(3rem + env(safe-area-inset-top)) 1.25rem 2rem; display: flex; flex-direction: column; }

/* Karteikarte: das Erkennungszeichen der App */
.study, .quiz { max-width: 36rem; margin: 0 auto; }
.study-head { display: flex; align-items: center; justify-content: space-between; margin: -.75rem 0 .75rem -.5rem; }
.left { color: var(--muted); font-variant-numeric: tabular-nums; }
.pile { position: relative; margin: 0 .7rem 2.1rem 0; perspective: 1400px; }
.stack-layer { position: absolute; inset: 0; border-radius: 6px; background: var(--paper); box-shadow: 0 1px 2px oklch(20% .03 80 / .28); transform: translate(calc(var(--i) * 2.5px), calc(var(--i) * 4px)); z-index: calc(10 - var(--i)); filter: brightness(calc(1 - var(--i) * .03)); }
.paper { position: relative; z-index: 20; display: grid; transform-style: preserve-3d; transition: transform .55s var(--ease); }
.paper.flipped { transform: rotateY(180deg); }
.face { grid-area: 1 / 1; display: flex; flex-direction: column; min-height: min(52dvh, 24rem); padding: 2.6rem 1.35rem 1rem; border-radius: 6px; color: var(--paper-ink); backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 2px 4px oklch(20% .03 80 / .2), 0 14px 28px -12px oklch(20% .03 80 / .4);
  background:
    linear-gradient(var(--paper-head), var(--paper-head)) 0 2.1rem / 100% 1.5px no-repeat,
    repeating-linear-gradient(to bottom, transparent 0, transparent calc(1.9rem - 1px), var(--paper-rule) calc(1.9rem - 1px), var(--paper-rule) 1.9rem) 0 2.1rem,
    var(--paper); }
.front { background: linear-gradient(var(--paper-head), var(--paper-head)) 0 2.1rem / 100% 1.5px no-repeat, var(--paper); }
.reverse { transform: rotateY(180deg); }
.paper-text { flex: 1; margin: 0; font-size: 1.15rem; line-height: 1.9rem; white-space: pre-line; overflow-wrap: anywhere; }
.big-text { font-family: var(--serif); font-size: clamp(1.35rem, 1.2rem + 1vw, 1.7rem); line-height: 1.9rem; display: flex; align-items: center; justify-content: center; text-align: center; display: block; margin: auto 0; flex: 0 1 auto; }
.paper-ask { margin: 0 0 1.9rem; font-family: var(--serif); line-height: 1.9rem; }
.paper-foot { margin: 1rem 0 0; padding-top: .1rem; font-size: .85rem; line-height: 1.3; color: oklch(40% .02 250); }
.gap { display: inline-block; min-width: 4em; border-bottom: 2px solid var(--paper-ink); line-height: 1.2; }
.gap.shown { background: none; color: var(--paper-head); font-weight: 700; border-bottom-color: var(--paper-head); min-width: 0; }
.ratings { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.rate { display: grid; gap: .05rem; justify-items: center; min-height: 62px; padding: .4rem .15rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; transition: background-color .15s; }
.rate strong { font-size: .98rem; }
.rate small { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.rate-1 strong { color: var(--bad); }
.rate-3 strong { color: var(--good); }
.rate:hover { background: var(--accent-soft); }

/* Abfrage */
.question { font-size: clamp(1.3rem, 1.15rem + .8vw, 1.7rem); margin: .35rem 0 1.1rem; }
.quiz-place { margin: 0; }
.choices { display: grid; gap: .5rem; margin-bottom: 1rem; }
.choice { width: 100%; min-height: 52px; padding: .65rem .9rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.choice:hover:not(:disabled) { background: var(--accent-soft); }
.choice:disabled { cursor: default; }
.choice.correct { background: var(--good-soft); border-color: var(--good); font-weight: 700; }
.choice.wrong { background: var(--bad-soft); border-color: var(--bad); }
.verdict { padding: .85rem 1rem; margin: .75rem 0; border-radius: var(--radius); }
.verdict p { margin: .25rem 0 0; }
.verdict.good { background: var(--good-soft); }
.verdict.good strong { color: var(--good); }
.verdict.bad { background: var(--bad-soft); }
.verdict.bad strong { color: var(--bad); }
.verdict.mid { background: var(--mid-soft); }
.verdict.mid strong { color: var(--mid); }
.your { margin: .75rem 0; white-space: pre-line; color: var(--muted); }
.waiting { padding: .85rem 1rem; border-radius: var(--radius); background: var(--accent-soft); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .6; } }
.points ul { margin: .35rem 0 .75rem; padding-left: 1.2rem; }
.order { list-style: none; counter-reset: step; margin: 0 0 1rem; padding: 0; display: grid; gap: .4rem; }
.order-item { display: flex; align-items: center; gap: .4rem; padding: .3rem .3rem .3rem .75rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.order-text { flex: 1; min-width: 0; }
.order-move { display: flex; }
.solution { margin: .35rem 0 0; padding-left: 1.3rem; }
.figure { margin: 0 0 .75rem; }
.figure-svg { display: block; width: 100%; height: auto; max-height: 56dvh; background: var(--paper); border-radius: 6px; }
.done { padding-top: 2rem; }

dialog.source { width: min(56rem, 100vw); max-height: 100dvh; padding: 0; border: 0; border-radius: var(--radius); background: var(--surface); color: var(--ink); }
dialog.source::backdrop { background: oklch(15% .02 200 / .65); }
.source-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .25rem .25rem .25rem 1rem; background: var(--surface); overflow-wrap: anywhere; }
dialog.source img { display: block; width: 100%; height: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .paper, .paper.flipped { transform: none; }
  .reverse { transform: none; }
  .paper .reverse { visibility: hidden; }
  .paper.flipped .reverse { visibility: visible; }
  .paper.flipped .front { visibility: hidden; }
}
form[hidden] ~ .skip { display: none; }

/* Noch zu bearbeiten */
.paper-review { margin: .75rem 0 0; padding: .4rem .6rem; border-radius: 4px; background: oklch(90% .08 85); color: oklch(30% .07 70); font-size: .92rem; line-height: 1.4; }
.review-flag { padding: .45rem .7rem; border-radius: 8px; background: var(--mid-soft); color: var(--ink); font-size: .95rem; }
.review-small { color: var(--mid); font-weight: 700; }
.marks { list-style: none; margin: 0; padding: 0; }
.mark { padding: 1.1rem 0; border-top: 1px solid var(--line); }
.mark-head { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; margin-bottom: .35rem; }
.mark-head strong { color: var(--mid); }
.mark-suggestion { padding: .65rem .85rem; border-radius: var(--radius); background: var(--accent-soft); overflow-wrap: anywhere; }
.mark-suggestion p { margin: .15rem 0 0; }
