/* KV-Lernapp – Gestaltung im Stil von apple.com
   Ruhige, helle Flächen, grosse Schlagzeilen, runde Kacheln, Pillen-Knöpfe, Milchglas-Navigation.
   Schrift: Arial. Farben: Anthrazit #20242B, Gebrochenes Weiss #F7F6F2, Kobaltblau #2457E6 (Links und Aktionen). */
:root {
  /* Farbschema gemäss Vorgabe: nur Anthrazit, Gebrochenes Weiss und Kobaltblau (plus deren Abstufungen) */
  --ink: #20242B;
  --paper: #F7F6F2;
  --accent: #2457E6;
  --ink-2: color-mix(in srgb, var(--ink) 85%, var(--paper));
  --paper-2: color-mix(in srgb, var(--ink) 7%, var(--paper));
  --surface: color-mix(in srgb, var(--paper) 35%, #FFFFFF);
  --accent-ink: color-mix(in srgb, var(--accent) 80%, var(--ink));
  --accent-soft: color-mix(in srgb, var(--accent) 10%, var(--paper));
  --accent-light: color-mix(in srgb, var(--accent) 35%, var(--paper));
  --muted: color-mix(in srgb, var(--ink) 68%, var(--paper));
  --on-dark-muted: color-mix(in srgb, var(--paper) 62%, var(--ink));
  --line: color-mix(in srgb, var(--ink) 11%, var(--paper));
  --line-strong: color-mix(in srgb, var(--ink) 22%, var(--paper));
  /* Zustände ebenfalls aus dem Schema: erledigt/richtig = Kobaltblau, Hinweis = Anthrazit-Ton.
     Einzige Ausnahme: Fehler und Löschen in Rot, damit Warnungen eindeutig bleiben. */
  --ok: var(--accent);
  --ok-soft: var(--accent-soft);
  --warn: var(--ink);
  --warn-soft: color-mix(in srgb, var(--ink) 9%, var(--paper));
  --bad: #B02A20;
  --bad-soft: color-mix(in srgb, #B02A20 9%, var(--paper));
  --r-s: 12px;
  --r-m: 18px;
  --r-l: 28px;
  --pill: 980px;
  --nav-h: 64px;
  --bar-h: 52px;
  --t-xs: .78rem;
  --t-s: .875rem;
  --t-m: 1.0625rem;
  --t-l: clamp(1.4rem, 1.1rem + 1vw, 1.9rem);
  --t-xl: clamp(2.4rem, 1.5rem + 3.6vw, 4.2rem);
  --t-xxl: clamp(8.5rem, 3rem + 18vw, 15rem);
  --ease: cubic-bezier(.25,.1,.25,1);
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 17px;
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { overflow-x: clip; }
body { margin: 0; background: var(--paper); min-height: 100vh; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0 0 .5em; font-weight: 700; color: var(--ink); }
h1 { font-size: var(--t-xl); letter-spacing: -0.035em; line-height: 1.05; }
h2 { font-size: var(--t-l); letter-spacing: -0.02em; line-height: 1.15; margin-top: 1.4em; }
h3 { font-size: 1.1rem; letter-spacing: -0.01em; line-height: 1.25; }
p { margin: 0 0 .75em; }
strong { font-weight: 700; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px; z-index: 99; border-radius: var(--r-s); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--paper); }

/* ---------- Kopfleiste und Navigation (Milchglas) ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; height: var(--bar-h); padding: 0 20px;
  background: color-mix(in srgb, var(--paper) 80%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.save-state { font-size: var(--t-xs); color: var(--muted); }
.save-state[data-state="error"] { color: var(--bad); font-weight: 700; }
.save-state[data-state="offline"] { color: var(--warn, #9a6200); font-weight: 700; }

.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: grid; grid-template-columns: repeat(6, 1fr); height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 82%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--line); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: .68rem; min-width: 0; }
.nav a:hover { text-decoration: none; color: var(--ink); }
.nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.nav svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav a.active { color: var(--accent); }
.nav .short { display: none; }
@media (max-width: 899px) { .nav .long { display: none; } .nav .short { display: inline; } }
@media (min-width: 900px) {
  /* Wie die globale Navigation von apple.com: schlanke Textleiste in der Kopfzeile */
  .nav { top: 0; bottom: auto; left: 50%; right: auto; transform: translateX(-50%); height: var(--bar-h); padding: 0; display: flex; align-items: center; gap: 4px; background: transparent; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .nav svg { display: none; }
  .nav a { flex-direction: row; padding: 6px 14px; font-size: .82rem; color: var(--ink-2); border-radius: var(--pill); }
  .nav a:hover { color: var(--ink); background: rgba(32,36,43,.05); }
  .nav a.active { color: var(--ink); font-weight: 700; background: rgba(32,36,43,.07); }
}

main { max-width: 1080px; margin: 0 auto; padding: 28px 16px calc(var(--nav-h) + 48px); outline: none; }
@media (min-width: 900px) { main { padding: 56px 32px 96px; } }
.loading { color: var(--muted); text-align: center; padding-top: 20vh; }

/* ---------- Seitenkopf ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 36px; }
.page-head h1 { margin-bottom: .15em; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 58ch; font-size: 1.05rem; }
.eyebrow { font-size: var(--t-s); font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.eyebrow a { color: var(--accent); }

/* ---------- Kacheln und Bausteine ---------- */
.card, .tile { background: var(--surface); border: 0; border-radius: var(--r-l); padding: 28px; margin-bottom: 20px; }
@media (min-width: 900px) { .card, .tile { padding: 36px; } }
.card > h2:first-child, .card > h3:first-child, .tile > h2:first-child { margin-top: 0; }
.card-accent { box-shadow: inset 0 0 0 2px var(--accent); }
.panel { margin-bottom: 28px; }
.panel h2 { font-size: 1.05rem; margin: 0 0 10px; }
.figure { font-size: clamp(3.5rem, 2.5rem + 4vw, 5.5rem); font-weight: 700; letter-spacing: -0.05em; line-height: .9; }
.grid { display: grid; gap: 20px; }
@media (min-width: 700px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: var(--t-s); }
.big-number { font-size: clamp(2.4rem, 2rem + 1.8vw, 3.4rem); font-weight: 700; line-height: 1; letter-spacing: -0.045em; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list-link { display: flex; justify-content: flex-start; gap: 14px; align-items: center; color: inherit; }
.list-link > :first-child { flex: 1; min-width: 0; }
.list-link:hover { text-decoration: none; }
.list-link:hover .title { color: var(--accent); }
.list-link::after { content: ""; flex: none; width: 8px; height: 8px; border-top: 2px solid var(--line-strong); border-right: 2px solid var(--line-strong); transform: rotate(45deg); margin-left: 4px; }
.list-link > [aria-hidden="true"] { display: none; }
.link-list .list-link { align-items: baseline; }
.link-list .list-link::after { align-self: center; }
.link-list .meta { text-align: right; }
.title { font-weight: 700; }
.meta { font-size: var(--t-s); color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

/* Knöpfe als Pillen */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 22px; border-radius: var(--pill); border: 1.5px solid var(--accent); background: transparent; color: var(--accent); font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer; text-decoration: none; transition: background-color .2s var(--ease), color .2s var(--ease), transform .1s var(--ease); }
.btn:hover { background: var(--accent); color: var(--paper); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--paper); }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-light { background: var(--surface); border-color: var(--surface); color: var(--ink); }
.btn-danger { border-color: transparent; color: var(--bad); background: var(--bad-soft); }
.btn-danger:hover { background: var(--bad); color: var(--paper); }
.dialog .btn-danger { background: var(--bad); color: var(--paper); }
.btn-small { min-height: 34px; padding: 0 15px; font-size: var(--t-s); }
.btn-block { width: 100%; margin-top: 16px; }
.btn[disabled] { opacity: .4; cursor: not-allowed; transform: none; }
.btn[disabled]:hover { background: transparent; color: var(--accent); }
.btn-primary[disabled]:hover { background: var(--accent); color: var(--paper); }
.btn-link { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; padding: 4px; }
.btn-link:hover { text-decoration: underline; }
.link-more { font-size: var(--t-s); font-weight: 700; white-space: nowrap; }
.link-more::after { content: " ›"; }

/* Formulare */
label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.field { margin-bottom: 18px; }
.hint { font-size: var(--t-s); color: var(--muted); margin-top: 6px; font-weight: 400; }
input[type=text], input[type=url], input[type=date], input[type=number], input[type=email], input[type=password], select, textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-s); background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; transition: border-color .2s, box-shadow .2s;
}
textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 4px rgba(36,87,230,.16); }
.check { display: flex; align-items: flex-start; gap: 12px; font-weight: 400; padding: 8px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.inline-new { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 16px; }
fieldset { min-width: 0; }
legend { padding: 0; }

/* Reiter als iOS-Segmentschalter */
.tabs { display: inline-flex; max-width: 100%; gap: 2px; overflow-x: auto; padding: 3px; margin-bottom: 24px; background: var(--paper-2); border-radius: var(--pill); scrollbar-width: none; }
.tabs button { flex: none; border: 0; background: transparent; padding: 8px 18px; font: inherit; font-size: .9rem; font-weight: 700; color: var(--muted); border-radius: var(--pill); cursor: pointer; min-height: 38px; transition: background-color .2s, color .2s; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(32,36,43,.12); }
.card .tabs { background: var(--paper); }

.badge { display: inline-block; padding: 3px 10px; border-radius: var(--pill); font-size: var(--t-xs); font-weight: 700; background: var(--paper-2); color: var(--ink); vertical-align: middle; white-space: nowrap; }
.badge-pdf, .badge-mykv, .badge-quizlet, .badge-onenote { background: var(--paper-2); color: var(--ink); }
.badge-demo { background: var(--warn-soft); color: var(--warn); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); }

.ref { display: inline-block; font-size: var(--t-xs); padding: 3px 10px; border-radius: var(--pill); background: var(--accent-soft); color: var(--accent-ink); margin: 4px 4px 0 0; font-weight: 700; }
.ref:hover { background: var(--accent); color: var(--paper); text-decoration: none; }
.ref-missing { background: var(--warn-soft); color: var(--warn); }

.notice { border-radius: var(--r-m); padding: 16px 18px; margin: 14px 0; font-size: .95rem; }
.notice-warn { background: var(--warn-soft); }
.notice-bad { background: var(--bad-soft); }
.notice-info { background: var(--accent-soft); }
.notice-ok { background: var(--ok-soft); }
.notice h4 { margin: 0 0 4px; font-size: 1rem; }
.notice ol, .notice ul { margin: 6px 0 0; padding-left: 20px; }

.progress { height: 6px; background: var(--paper-2); border-radius: var(--pill); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: var(--pill); }

.empty { padding: 24px 0; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 1.2rem; }

.table-wrap { overflow-x: auto; margin: 10px 0 16px; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; color: var(--muted); font-size: var(--t-s); }
tbody th[scope=row] { width: 32%; }

/* ---------- Meldungen / Dialog ---------- */
.toasts { position: fixed; z-index: 50; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom)); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
@media (min-width: 900px) { .toasts { left: 50%; right: auto; transform: translateX(-50%); bottom: 28px; width: min(480px, 90vw); } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; width: 100%; max-width: 520px; padding: 13px 18px; border-radius: var(--r-m); background: var(--ink); color: var(--paper); box-shadow: 0 12px 40px rgba(32,36,43,.25); font-size: .93rem; animation: toast-in .35s var(--ease) both; }
.toast-error { background: var(--bad); }
.toast span { flex: 1; }
.toast .btn-link { color: var(--paper); text-decoration: underline; }
.toast-close { background: none; border: 0; color: inherit; font-size: 1.3rem; cursor: pointer; min-width: 32px; min-height: 32px; opacity: .7; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.dialog { border: 0; border-radius: var(--r-l); padding: 28px; max-width: min(440px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(32,36,43,.3); }
.dialog p { font-size: 1.05rem; }
.dialog::backdrop { background: rgba(32,36,43,.4); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

/* ---------- Startseite ---------- */
.hero { text-align: center; padding: 28px 0 40px; }
@media (min-width: 900px) { .hero { padding: 24px 0 64px; } }
.hero-date { margin: 0 0 4px; color: var(--muted); font-size: var(--t-m); font-weight: 700; }
.hero-count { display: flex; flex-direction: column; align-items: center; margin: 0; letter-spacing: normal; line-height: 1; }
.hero-num { font-size: var(--t-xxl); font-weight: 700; line-height: .86; letter-spacing: -0.07em; font-variant-numeric: tabular-nums; padding-right: .07em;
  background: linear-gradient(160deg, var(--accent) 20%, var(--ink) 95%); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: hero-in 1s var(--ease) both; }
.hero-text { display: block; margin-top: 10px; font-size: var(--t-xl); font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; color: var(--ink); animation: hero-in 1s .12s var(--ease) both; }
.hero-sub { margin: 14px auto 0; font-size: clamp(1.2rem, 1rem + .9vw, 1.7rem); font-weight: 400; color: var(--ink-2); letter-spacing: -0.01em; max-width: 40ch; animation: hero-in 1s .22s var(--ease) both; }
.hero-title { font-size: clamp(2.6rem, 1.6rem + 4.5vw, 5rem); letter-spacing: -0.045em; line-height: 1.02; max-width: 16ch; margin: 6px auto 14px; }
.hero-meta { margin: 12px auto 0; color: var(--muted); font-size: var(--t-m); max-width: 52ch; }
.hero-ctas { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 26px; }
.hero-ctas .btn { min-height: 46px; padding: 0 24px; font-size: 1rem; }
@keyframes hero-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.tile-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 6px; }
.tile-head h2 { margin: 0; }
.tile-lead { color: var(--muted); margin-bottom: 8px; }
.tile-route { padding-bottom: 20px; }
.tile-route .route-wrap { margin: 14px -28px 0; padding: 0 28px; }
@media (min-width: 900px) { .tile-route .route-wrap { margin: 18px -36px 0; padding: 0 36px; } }
.bento { display: grid; gap: 20px; }
.bento .tile { margin: 0; }
.bento .tile h2 { font-size: 1.5rem; margin: 0 0 10px; }
@media (min-width: 900px) {
  .bento { grid-template-columns: 1.4fr 1fr; align-items: start; }
  .bento .tile-today .tile-head h2 { font-size: var(--t-l); }
}
.tile-dark { background: var(--ink); color: var(--paper); }
.tile-dark h2, .tile-dark .title { color: var(--paper); }
.tile-dark .muted, .tile-dark .meta { color: var(--on-dark-muted); }
.tile-dark .list > li { border-color: color-mix(in srgb, var(--paper) 14%, var(--ink)); }
.tile-dark .list-link::after { border-color: var(--on-dark-muted); }
.tile-dark .list-link:hover .title { color: var(--paper); text-decoration: underline; }
.tile-dark .badge-accent { background: var(--accent); color: var(--paper); }
.tile-dark .btn-primary { background: var(--paper); border-color: var(--paper); color: var(--ink); }
.tile-dark .btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.tile-figure { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 10px; color: var(--on-dark-muted); }
.tile-dark .figure { color: var(--paper); }

/* Route: Stationen bis zur Prüfung */
.route-wrap { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.route-wrap::-webkit-scrollbar { display: none; }
.route { --line-c: var(--line-strong); --dot-c: var(--accent); --txt: var(--ink); --sub: var(--muted); --bg: var(--surface);
  display: flex; list-style: none; margin: 0; padding: 8px 0 6px; min-width: max-content; }
.route-dark { --line-c: var(--muted); --dot-c: var(--paper); --txt: var(--paper); --sub: var(--on-dark-muted); --bg: var(--ink); }
.stop { position: relative; flex: 0 0 68px; }
.stop a { display: grid; justify-items: center; gap: 2px; padding: 4px 0 6px; color: var(--txt); border-radius: var(--r-s); }
.stop a:hover { text-decoration: none; background: rgba(36,87,230,.06); }
.stop::before { content: ""; position: absolute; top: 15px; left: 50%; width: 100%; height: 3px; border-radius: 3px; background: var(--line-c); }
.stop:last-child::before { display: none; }
.stop.is-done::before { background: var(--dot-c); }
.stop.is-blocked::before, .stop:has(+ .is-blocked)::before { background: repeating-linear-gradient(90deg, var(--line-c) 0 5px, transparent 5px 10px); }
.stop-dot { position: relative; z-index: 1; width: 18px; height: 18px; margin-bottom: 8px; border-radius: 50%; background: var(--bg); border: 3px solid var(--dot-c); }
.stop.is-done .stop-dot { background: var(--dot-c); }
.stop.is-partial .stop-dot { background: linear-gradient(90deg, var(--dot-c) 50%, var(--bg) 50%); }
.stop.is-free .stop-dot { width: 10px; height: 10px; margin: 4px 0 12px; border: 0; background: var(--line-c); }
.stop.is-blocked .stop-dot { width: 14px; height: 14px; margin: 2px 0 10px; border: 2px solid var(--line-c); background: var(--bg); }
.stop.is-today .stop-dot { box-shadow: 0 0 0 6px rgba(36,87,230,.18); }
.stop.is-goal { flex-basis: 80px; }
.stop.is-goal .stop-dot { width: 22px; height: 22px; margin: -2px 0 8px; border: 0; border-radius: 4px; background: var(--ink); transform: rotate(45deg); }
.stop-day { font-weight: 700; font-size: var(--t-s); }
.stop.is-today .stop-day { color: var(--accent); }
.stop-date { font-size: var(--t-xs); color: var(--sub); font-variant-numeric: tabular-nums; }
.stop-info { font-size: .75rem; color: var(--sub); max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stop.is-open .stop-info, .stop.is-partial .stop-info { color: var(--txt); }
.stop.is-goal .stop-day { font-size: var(--t-m); }
.route-wrap:not(.tile-route .route-wrap) { margin-bottom: 24px; }
main > .route-wrap { background: var(--surface); border-radius: var(--r-l); padding: 18px 24px; }

/* Lerneinheiten */
.today-unit { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
.unit-check { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; margin: 1px 0 0; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); cursor: pointer; display: grid; place-items: center; transition: background-color .2s var(--ease), border-color .2s var(--ease); }
.unit-check::after { content: ""; width: 7px; height: 12px; border: solid var(--paper); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); opacity: 0; transition: opacity .15s; }
.unit-check:checked { background: var(--accent); border-color: var(--accent); }
.unit-check:checked::after { opacity: 1; }
.unit-check:hover { border-color: var(--accent); }
.unit { padding: 18px 20px; border-radius: var(--r-m); margin-top: 12px; background: var(--paper); }
.tile .unit, .card .unit { background: var(--paper); }
.unit.done { opacity: .6; }
.unit.done .unit-task { text-decoration: line-through; text-decoration-color: var(--line-strong); }
.unit.missed { box-shadow: inset 0 0 0 2px var(--line-strong); }
.unit-task { font-size: 1.05rem; line-height: 1.4; }
.unit-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.unit-actions:empty { display: none; }
.kind { font-size: var(--t-s); font-weight: 700; color: var(--accent); margin-bottom: 3px; }
.kind-selbsttest { color: var(--warn); }
.countdown { font-size: 2.6rem; font-weight: 700; line-height: 1; letter-spacing: -0.04em; }

/* ---------- Import ---------- */
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--r-m); padding: 36px 20px; text-align: center; background: var(--paper); transition: border-color .2s, background-color .2s; }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .btn { margin-top: 6px; }
.page-review { border-radius: var(--r-m); padding: 16px; margin-bottom: 12px; background: var(--paper); }
.page-review.scan { box-shadow: inset 0 0 0 2px var(--line-strong); }
.paste-area { min-height: 130px; padding: 16px; border: 2px dashed var(--line-strong); border-radius: var(--r-m); background: var(--surface); }
.paste-area:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(36,87,230,.16); }
.paste-area:empty::before { content: attr(data-placeholder); color: var(--muted); }
.preview-table td { padding: 5px; }
.preview-table input { min-height: 42px; }
.preview-table tr.flag td { background: var(--warn-soft); }
.split-edit { display: grid; gap: 16px; }
@media (min-width: 1000px) { .split-edit { grid-template-columns: 1fr 1fr; } }
.md-preview { border-radius: var(--r-m); padding: 14px 18px; background: var(--paper); max-height: 420px; overflow: auto; }
.problem { background: var(--warn-soft); border-radius: 4px; }

/* ---------- Unterlagen / Inhalte ---------- */
.source-page { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; scroll-margin-top: 80px; }
.source-page.highlight, .day.highlight { background: var(--accent-soft); border-radius: var(--r-m); padding: 16px; transition: background 1s; }
.source-text { white-space: pre-wrap; font-size: 1rem; max-width: 72ch; }
.md { max-width: 72ch; }
.def { padding: 14px 0; border-bottom: 1px solid var(--line); }
.def:last-child { border-bottom: 0; }
.def dt { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; }
.def dd { margin: 4px 0 6px; max-width: 68ch; }
dl { margin: 0; }
.conflict { box-shadow: inset 3px 0 0 var(--warn); padding-left: 14px; }

/* ---------- Karteikarten ---------- */
.flashcard, .rate, .flashcard ~ .small { max-width: 760px; margin-left: auto; margin-right: auto; }
.flashcard { perspective: 1600px; cursor: pointer; margin-top: 8px; margin-bottom: 20px; outline: none; border-radius: var(--r-l); }
.flashcard:focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; }
.flashcard-inner { position: relative; min-height: 340px; transition: transform .6s cubic-bezier(.3,.7,.2,1); transform-style: preserve-3d; }
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 32px; border-radius: var(--r-l); overflow: auto; }
.face-front { background: var(--ink); color: var(--paper); }
.face-front .eyebrow { color: var(--on-dark-muted); }
.face-front .term { font-size: clamp(2.2rem, 1.2rem + 4vw, 4.4rem); font-weight: 700; letter-spacing: -0.045em; line-height: 1; max-width: 16ch;
  color: var(--paper); padding-bottom: .08em; }
.face-back { transform: rotateY(180deg); background: var(--surface); }
.face-back .eyebrow { color: var(--accent); }
.face-back .def-text { font-size: 1.2rem; line-height: 1.5; max-width: 50ch; }
.face .face-hint { position: absolute; bottom: 16px; font-size: var(--t-xs); color: var(--muted); }
.face-front .face-hint { color: var(--on-dark-muted); }
@media (prefers-reduced-motion: reduce) { .flashcard-inner, .btn { transition: none; } .hero-num, .hero-text, .hero-sub, .toast { animation: none; } }
.rate { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rate .btn { min-height: 56px; font-size: 1.05rem; }
.btn-known { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.btn-known:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-again { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-again:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- Quiz / Prüfung ---------- */
.question { margin-bottom: 20px; }
.question .prompt { white-space: pre-line; font-weight: 700; font-size: clamp(1.2rem, 1.05rem + .6vw, 1.5rem); letter-spacing: -0.015em; line-height: 1.3; margin-bottom: 18px; max-width: 60ch; }
.option { display: flex; gap: 12px; align-items: flex-start; padding: 15px 18px; border: 1.5px solid transparent; border-radius: var(--r-m); margin-bottom: 10px; background: var(--paper); cursor: pointer; font-weight: 400; font-size: 1.02rem; transition: background-color .15s, border-color .15s; }
.option:hover { background: var(--paper-2); }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.option.correct { border-color: var(--ok); background: var(--ok-soft); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.match-row { display: grid; gap: 8px; margin-bottom: 12px; }
@media (min-width: 700px) { .match-row { grid-template-columns: 230px 1fr; align-items: center; } }
.match-row.correct select { border-color: var(--ok); }
.match-row.wrong select { border-color: var(--bad); }
.feedback { border-radius: var(--r-m); padding: 16px 18px; margin-top: 14px; }
.feedback.ok { background: var(--ok-soft); }
.feedback.bad { background: var(--bad-soft); }
.feedback.unsure { background: var(--warn-soft); }
.feedback p:last-child { margin-bottom: 0; }
.points { float: right; font-size: var(--t-s); font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); padding: 3px 11px; border-radius: var(--pill); }
.result-hero { text-align: center; padding: 48px 20px; background: var(--ink); color: var(--paper); }
.result-hero .eyebrow, .result-hero .muted, .result-hero .small { color: var(--on-dark-muted); }
.result-hero .big-number { font-size: clamp(4.5rem, 2rem + 10vw, 9rem); letter-spacing: -0.06em; margin: 8px 0 10px;
  color: var(--paper); }
.result-hero p strong { color: var(--paper); }
.result-hero .btn { border-color: var(--on-dark-muted); color: var(--paper); }
.result-hero .btn:hover { background: var(--paper); color: var(--ink); }
.result-hero .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.result-hero a:not(.btn) { color: var(--paper); }

/* ---------- Lernplan ---------- */
.day { border-top: 1px solid var(--line); padding: 18px 0; scroll-margin-top: 80px; }
.day:first-of-type { border-top: 0; }
.day-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.day-head h3 { margin: 0; font-size: 1.05rem; }
.day.blocked { color: var(--muted); }
.day.today h3::after { content: "Heute"; margin-left: 10px; font-size: var(--t-xs); background: var(--accent); color: var(--paper); padding: 3px 10px; border-radius: var(--pill); vertical-align: 2px; }
.weekday-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 12px; }
.weekday-grid label { font-size: var(--t-s); }
.topic-pick { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.chip-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-s); font-weight: 400; margin: 0; color: var(--muted); }

/* ---------- Anmeldung ---------- */
body.auth-mode .nav { display: none; }
body.auth-mode main { padding-bottom: 48px; }
.auth { display: grid; justify-items: center; text-align: center; gap: 28px; padding-top: 4vh; }
.auth-intro { max-width: 640px; }
.auth-intro .hero-date { color: var(--accent); }
.auth-intro .hero-title { margin: 8px auto 14px; }
.auth-intro .hero-meta { margin: 0 auto; }
.auth-form { width: 100%; max-width: 420px; text-align: left; }
.auth-form .btn-block { min-height: 50px; font-size: 1.02rem; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
code { background: var(--paper-2); padding: 2px 6px; border-radius: 6px; font-size: .88em; }
.flashcard, .nav a, .btn, .option, .stop a { -webkit-tap-highlight-color: transparent; }

@media print {
  .topbar, .nav, .toasts, .no-print, .btn, .route-wrap, .hero-ctas { display: none !important; }
  main { margin: 0 !important; padding: 0 !important; max-width: none; }
  body, :root { background: #fff; font-size: 11pt; }
  .card, .tile { padding: 0; border-radius: 0; }
  .ref { background: none; padding: 0; color: var(--muted); }
}

/* Feinheiten */
h1 .badge, h2 .badge, .big-number span, .figure + span { letter-spacing: normal; }
h1 .badge { vertical-align: .6em; }
.big-number .muted { margin: 0 4px; }
.flashcard:focus-visible { outline: 2px solid rgba(36,87,230,.35); outline-offset: 6px; }

/* =====================================================================
   Look nach dem Upwise-Entwurf (Dribbble), umgesetzt im Farbschema:
   kräftiger Farbgrund mit Punkteraster, wuchtige Titel (Arial Black),
   gestreifte schwarze Pillen, helle Karten mit dickem Rahmen.
   ===================================================================== */
:root {
  --bg: color-mix(in srgb, var(--accent) 70%, var(--paper));      /* heller Kobaltgrund, Anthrazit-Text darauf lesbar */
  --bg-light: color-mix(in srgb, var(--accent) 48%, var(--paper));
  --display: "Arial Black", "Arial", "Helvetica Neue", sans-serif;
  --border: 3px solid var(--ink);
  --lift: 0 6px 0 var(--ink);
  --stripes: repeating-linear-gradient(135deg, var(--ink) 0 7px, color-mix(in srgb, var(--ink) 86%, var(--paper)) 7px 14px);
}
html { background: var(--bg); }
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(color-mix(in srgb, var(--ink) 16%, transparent) 1.2px, transparent 1.6px),
    radial-gradient(120% 80% at 85% 100%, var(--bg-light) 0%, transparent 60%);
  background-size: 22px 22px, 100% 100%;
  background-attachment: fixed, fixed;
}

/* Wuchtige Titel */
h1, h2, .hero-text, .hero-title, .figure, .big-number, .hero-num, .face-front .term, .section-head h2 {
  font-family: var(--display); font-weight: 900;
}
h1 { text-transform: uppercase; letter-spacing: -0.02em; line-height: .95; }
h2 { letter-spacing: -0.01em; }
.page-head p, .page-head .eyebrow, .page-head .eyebrow a { color: var(--ink); }
.page-head .eyebrow a { text-decoration: underline; text-underline-offset: 3px; }
main > .empty, main > .empty h3, main > p.small, .flashcard ~ .small { color: var(--ink); }
main > .page-head .muted, main > .page-head span.muted { color: var(--ink); }

/* Kopfleiste: Wortmarke wie «UPWISE» */
.topbar { background: color-mix(in srgb, var(--bg) 85%, transparent); border-bottom: var(--border); }
.brand { font-family: var(--display); font-weight: 900; font-size: 1.25rem; letter-spacing: .02em; text-transform: uppercase; color: var(--ink); }
.save-state { color: var(--ink); }
@media (min-width: 900px) {
  .nav a { color: var(--ink); font-weight: 700; }
  .nav a:hover { background: color-mix(in srgb, var(--ink) 12%, transparent); }
  .nav a.active { background: var(--ink); color: var(--paper); }
}
@media (max-width: 899px) {
  .nav { background: var(--ink); border-top: 0; }
  .nav a { color: var(--on-dark-muted); }
  .nav a.active { color: var(--paper); }
}

/* Karten wie das Handy im Entwurf: hell, dicker Rahmen, harte Kante */
.card, .tile { background: var(--paper); border: var(--border); box-shadow: var(--lift); border-radius: 32px; }
.tile-dark { background: var(--ink); }
.unit, .tile .unit, .card .unit { background: var(--surface); border: 2px solid var(--ink); }
.option { background: var(--surface); border: 2px solid var(--ink); }
.option:hover { background: var(--accent-soft); }
.page-review, .md-preview { background: var(--surface); border: 2px solid var(--ink); }
.dropzone { background: var(--surface); border: 3px dashed var(--ink); }
input[type=text], input[type=url], input[type=date], input[type=number], input[type=email], input[type=password], select, textarea { border: 2px solid var(--ink); background: var(--surface); }
.notice { border: 2px solid var(--ink); }
main > .notice { box-shadow: 0 4px 0 var(--ink); }

/* Knöpfe: schwarze Pillen mit Streifen, Schrift gesperrt */
.btn { border: 2px solid var(--ink); color: var(--ink); background: var(--paper); letter-spacing: .04em; }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-primary { background: var(--stripes); border-color: var(--ink); color: var(--paper); box-shadow: 0 4px 0 color-mix(in srgb, var(--ink) 55%, var(--accent)); }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-primary:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 55%, var(--accent)); }
.btn-primary[disabled]:hover { background: var(--stripes); }
.btn[disabled]:hover { background: var(--paper); color: var(--ink); }
.btn-danger { border-color: var(--bad); }
.tile-dark .btn-primary, .result-hero .btn-primary { background: var(--paper); color: var(--ink); border-color: var(--paper); box-shadow: none; }
.tabs { background: var(--surface); border: 2px solid var(--ink); }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); box-shadow: none; }
.card .tabs { background: var(--surface); }
.link-more { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
a { color: var(--accent-ink); }
.badge-accent, .ref { background: var(--ink); color: var(--paper); }
.ref:hover { background: var(--accent); }
.unit-check { border-color: var(--ink); }
.unit-check:checked { background: var(--ink); border-color: var(--ink); }
.kind { color: var(--accent-ink); }
.progress { background: color-mix(in srgb, var(--ink) 12%, var(--paper)); border: 2px solid var(--ink); height: 12px; }
.progress span { background: var(--stripes); border-radius: 0; }

/* Startbereich: riesiges Hintergrundwort, schwarze Zahl davor */
.hero { position: relative; isolation: isolate; }
.hero-bg { position: absolute; z-index: -1; left: 50%; top: 46%; transform: translate(-50%, -50%); font-family: var(--display); font-weight: 900;
  font-size: clamp(7rem, 30vw, 26rem); line-height: 1; letter-spacing: -0.04em; color: var(--paper); opacity: .9; white-space: nowrap; pointer-events: none; user-select: none; }
.hero-date { color: var(--ink); }
.hero-num { background: none; color: var(--ink); -webkit-text-fill-color: var(--ink); letter-spacing: -0.06em; }
.hero-text { text-transform: uppercase; letter-spacing: -0.02em; }
.hero-sub, .hero-meta { color: var(--ink); }
.hero-title { text-transform: uppercase; }
.hero-ctas .btn:not(.btn-primary) { background: var(--paper); }

/* Karteikarte und Auswertung */
.face-front { border: var(--border); }
.face-front .term { text-transform: uppercase; letter-spacing: -0.01em; }
.face-back { border: var(--border); }
.flashcard-inner { filter: drop-shadow(0 6px 0 var(--ink)); }
.result-hero { border: var(--border); }
.btn-known { background: var(--stripes); border-color: var(--ink); color: var(--paper); }
.btn-again { background: var(--paper); border-color: var(--ink); color: var(--ink); }

/* Route auf heller Karte */
.stop.is-done .stop-dot, .stop-dot { border-color: var(--ink); }
.stop.is-done .stop-dot { background: var(--ink); }
.stop.is-done::before { background: var(--ink); }
.stop.is-partial .stop-dot { background: linear-gradient(90deg, var(--ink) 50%, var(--bg) 50%); }
.stop.is-today .stop-dot { background: var(--accent); border-color: var(--ink); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 30%, transparent); }
.stop.is-today .stop-day { color: var(--accent-ink); }
.route { --line-c: color-mix(in srgb, var(--ink) 35%, var(--paper)); --bg: var(--paper); }
main > .route-wrap { background: var(--paper); border: var(--border); box-shadow: var(--lift); border-radius: 32px; }

/* Anmeldung */
.auth-intro .hero-date { color: var(--ink); }
.auth-intro .hero-meta { color: var(--ink); }
.day.today h3::after { background: var(--ink); }

@media print { body { background: #fff; } .card, .tile { border: 0; box-shadow: none; } }
/* Startbereich über die ganze Breite, Hintergrundwort sauber abgeschnitten */
.hero { margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); padding-left: 16px; padding-right: 16px; overflow: hidden; }
.hero-bg { opacity: .55; top: 50%; }
body { background-attachment: scroll, scroll; min-height: 100vh; }

/* Schreibmaschinenschrift wie im Upwise-Entwurf (Courier Prime, SIL Open Font License, lokal eingebunden) */
@font-face { font-family: "Courier Prime"; src: url("/fonts/courier-prime-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url("/fonts/courier-prime-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
:root { --mono: "Courier Prime", "Courier New", Courier, monospace; font-family: var(--mono); font-size: 16.5px; }
body, button, input, select, textarea, .btn, .tabs button, .nav a, .toast { font-family: var(--mono); }
.btn { letter-spacing: .02em; }
.title, .def dt, .stop-day, .kind, label, th { font-family: var(--mono); font-weight: 700; }
h1, h2, h3, .brand, .hero-num, .hero-text, .hero-title, .figure, .big-number, .face-front .term, .section-head h2 { font-family: var(--display); }
.hero-sub, .hero-meta, .page-head p, .tile-lead { letter-spacing: -0.01em; }

/* =====================================================================
   Orange wie im Upwise-Screenshot: Rotorange oben, Pfirsich unten,
   schwarze Titel und Knöpfe, weisse Riesenbuchstaben im Hintergrund.
   ===================================================================== */
:root {
  --accent: #E8442C;                                   /* Rotorange für Aktionen und Hervorhebungen */
  --accent-ink: #B5301B;                               /* dunkler für Links auf hellem Grund (gut lesbar) */
  --ink: #1D1B1A;
  --paper: #FBF6F1;
  --bg: #F05A3C;
  --bg-top: #EC3F2B;
  --bg-bottom: #F8A487;
}
html { background: var(--bg); }
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(color-mix(in srgb, var(--ink) 14%, transparent) 1.2px, transparent 1.6px),
    linear-gradient(165deg, var(--bg-top) 0%, var(--bg) 40%, var(--bg-bottom) 100%);
  background-size: 22px 22px, 100% 100%;
}
.topbar { background: color-mix(in srgb, var(--bg-top) 88%, transparent); }
.hero-bg { color: #fff; opacity: .92; }
.btn-primary { box-shadow: 0 4px 0 color-mix(in srgb, var(--ink) 60%, var(--accent)); }
.stop.is-today .stop-dot { background: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 30%, transparent); }
.stop.is-today .stop-day, .kind { color: var(--accent-ink); }
.ref:hover { background: var(--accent); }
.option:has(input:checked) { border-color: var(--ink); background: color-mix(in srgb, var(--accent) 14%, var(--paper)); }
input:focus, select:focus, textarea:focus, .paste-area:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
:focus-visible { outline-color: var(--ink); }
/* Schmale Bildschirme: Zusatzangabe unter den Titel statt daneben (breite Schreibmaschinenschrift) */
@media (max-width: 640px) {
  .link-list .list-link { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: center; }
  .link-list .list-link > .title { grid-column: 1; }
  .link-list .list-link > .meta { grid-column: 1; text-align: left; margin-top: 2px; }
  .link-list .list-link::after { grid-column: 2; grid-row: 1 / span 2; }
}
.hero-sub, .hero-meta { position: relative; }

/* KI-Guthaben */
.credit-box { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; border: 2px solid var(--ink); border-radius: 18px; padding: 16px 18px; margin: 12px 0; background: var(--paper); }
.credit-box .big-number { font-size: clamp(28px, 5vw, 40px); line-height: 1.1; }
