:root {
  color-scheme: light;
  --ink: #17324d;
  --ink-soft: #476174;
  --paper: #f4f8fb;
  --white: #fff;
  --line: #cbd9e3;
  --yellow: #ffd166;
  --green: #2a9d6f;
  --coral: #e8664a;
  --violet: #7657b3;
  --shadow: 0 20px 55px rgb(23 50 77 / 12%);
  --radius: 22px;
  --content: 1120px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); line-height: 1.6; }
body.is-locked { overflow: hidden; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
img, svg { max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.08; text-wrap: balance; }
h1 { font-size: clamp(2.4rem, 7vw, 5.7rem); letter-spacing: -.045em; }
h2 { font-size: clamp(1.6rem, 4vw, 2.7rem); letter-spacing: -.025em; }

.visually-hidden { position: absolute!important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 1000; top: 10px; left: 10px; padding: 12px 16px; transform: translateY(-160%); border-radius: 10px; background: var(--yellow); color: var(--ink); font-weight: 800; }
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 3px solid #006ad4; outline-offset: 4px; }

.site-header { position: sticky; z-index: 50; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; padding: 10px max(18px, env(safe-area-inset-left)); border-bottom: 1px solid rgb(203 217 227 / 85%); background: rgb(244 248 251 / 92%); backdrop-filter: blur(16px); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-family: Georgia, serif; font-size: 1.15rem; font-weight: 800; text-decoration: none; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50% 50% 46% 54% / 48% 44% 56% 52%; background: var(--ink); color: #fff; font: 800 .9rem ui-monospace, monospace; transform: rotate(-4deg); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.mode-menu { position: relative; }
.mode-menu summary, .profile-chip { min-height: 44px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; }
.mode-menu summary { display: flex; align-items: center; padding: 8px 15px; font-weight: 750; list-style: none; }
.mode-menu summary::-webkit-details-marker { display: none; }
.mode-options { position: absolute; top: calc(100% + 10px); right: 0; width: min(260px, calc(100vw - 32px)); padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.mode-options button { width: 100%; min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.mode-options button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.profile-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; text-decoration: none; font-weight: 750; }
.profile-chip > span:first-child { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: var(--yellow); }

main { width: min(calc(100% - 32px), var(--content)); min-height: 65vh; margin-inline: auto; padding: 42px 0 80px; }
.kicker { margin-bottom: 10px; color: var(--accent, var(--ink-soft)); font: 800 .78rem/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; }
.lede { max-width: 700px; color: var(--ink-soft); font-size: clamp(1.05rem, 2.4vw, 1.35rem); }
.button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; padding: 10px 18px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font-weight: 800; cursor: pointer; text-decoration: none; }
.button-primary { border-color: var(--ink); background: var(--ink); color: #fff; }
.button.danger { border-color: #c24435; color: #9d3025; }

.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 42px; color: var(--ink-soft); font: 700 .8rem ui-monospace, monospace; }
.breadcrumb a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.breadcrumb span[aria-current] { color: var(--ink); }

.atlas-hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: clamp(28px, 6vw, 80px); align-items: center; min-height: calc(100vh - 150px); padding: 48px 0 78px; }
.hero-copy h1 { max-width: 780px; margin-bottom: 28px; }
.hero-copy h1 em { color: var(--coral); font-weight: 500; }
.age-compass { position: relative; padding: clamp(24px, 4vw, 42px); overflow: hidden; border: 1px solid var(--line); border-radius: 40px 40px 40px 12px; background: #fff; box-shadow: var(--shadow); }
.age-compass::after { position: absolute; right: -70px; bottom: -70px; width: 190px; height: 190px; border: 34px solid rgb(255 209 102 / 35%); border-radius: 50%; content: ""; }
.age-compass h2 { margin-bottom: 10px; }
.age-compass p { color: var(--ink-soft); }
.compass-line { display: flex; align-items: center; gap: 8px; margin-bottom: 26px; }
.compass-line::before, .compass-line::after { height: 2px; flex: 1; background: var(--line); content: ""; }
.compass-line span { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.compass-line span:nth-child(2) { width: 16px; height: 16px; background: var(--coral); }
.age-buttons { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.age-buttons button { min-width: 44px; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); font-weight: 850; cursor: pointer; }
.age-buttons button:hover { border-color: var(--coral); background: #fff1ec; transform: translateY(-2px); }
.mode-legend { position: relative; z-index: 1; display: grid; gap: 6px; margin-top: 18px; color: var(--ink-soft); font-size: .82rem; }

.section-shell { padding: 70px 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.section-heading h2 { margin-bottom: 0; }
.class-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.class-card { display: flex; min-height: 120px; align-items: center; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; text-decoration: none; }
.class-card.available { border-color: var(--ink); box-shadow: 7px 7px 0 var(--yellow); }
.class-card.available:hover { transform: translate(-2px, -2px); box-shadow: 10px 10px 0 var(--yellow); }
.class-number { display: grid; width: 56px; height: 56px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--paper); font: 800 1.8rem Georgia, serif; }
.available .class-number { background: var(--ink); color: #fff; }
.class-card span:nth-child(2) { display: grid; }
.class-card small { color: var(--ink-soft); }
.unavailable { opacity: .62; }
.promise-strip { display: grid; grid-template-columns: .7fr 1.5fr auto; gap: 26px; align-items: center; margin: 60px 0 20px; padding: 28px; border-top: 4px solid var(--green); border-radius: 0 0 var(--radius) var(--radius); background: #e9f7f1; }
.promise-strip h2, .promise-strip p { margin-bottom: 0; }
.promise-strip a { font-weight: 800; }

.page-intro { max-width: 830px; margin-bottom: 50px; }
.page-intro h1 { margin-bottom: 18px; }
.page-intro > p:last-child { color: var(--ink-soft); font-size: 1.15rem; }
.subject-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.subject-card { border: 1px solid var(--line); border-top: 8px solid var(--subject); border-radius: var(--radius); background: #fff; box-shadow: 0 9px 24px rgb(23 50 77 / 7%); }
.subject-card > a { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; height: 100%; padding: clamp(20px, 4vw, 32px); text-decoration: none; }
.subject-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.subject-icon { display: grid; width: 58px; height: 58px; place-items: center; border: 2px solid currentColor; border-radius: 18px 18px 18px 5px; color: var(--subject); font: 800 1.2rem Georgia, serif; }
.subject-card h2 { margin-bottom: 10px; }
.subject-card p { color: var(--ink-soft); }
.card-note { font-size: .88rem; }
.card-arrow { align-self: center; font-size: 1.5rem; }
.progress-line { position: relative; height: 8px; margin-top: 16px; overflow: hidden; border-radius: 999px; background: #e3ebf0; }
.progress-line span, .stats-bar span { display: block; width: var(--value, 0%); height: 100%; border-radius: inherit; background: var(--subject, var(--accent)); transition: width .35s ease; }
.subject-card small { color: var(--ink-soft); }

.subject-intro { display: grid; grid-template-columns: auto 1fr; gap: 34px; max-width: 920px; margin: 0 0 56px; padding: clamp(24px, 5vw, 52px); border-left: 12px solid var(--subject); border-radius: 0 var(--radius) var(--radius) 0; background: #fff; box-shadow: var(--shadow); }
.subject-icon.giant { width: 92px; height: 92px; border-color: var(--subject); color: var(--subject); font-size: 2rem; }
.subject-intro h1 { margin-bottom: 14px; }
.subject-intro > div > p:not(.kicker) { color: var(--ink-soft); font-size: 1.1rem; }
.info-callout { margin: 20px 0; padding: 16px 18px; border-radius: 12px; background: color-mix(in srgb, var(--subject) 10%, white); }
.unit-list { display: grid; gap: 10px; padding: 0; list-style: none; counter-reset: units; }
.unit-row { display: grid; grid-template-columns: 54px 1fr auto; gap: 18px; align-items: center; min-height: 112px; padding: 18px 22px; border: 1px solid var(--line); border-radius: 16px; background: #fff; text-decoration: none; }
.unit-row:hover { border-color: var(--subject); transform: translateX(4px); }
.unit-index { color: var(--subject); font: 800 1rem ui-monospace, monospace; }
.unit-main { display: grid; gap: 5px; }
.unit-main strong { font-family: Georgia, serif; font-size: 1.25rem; }
.unit-main small { color: var(--ink-soft); }
.level { display: inline-flex; width: fit-content; align-items: center; min-height: 24px; padding: 4px 9px; border-radius: 999px; background: #e8eef3; color: #324d61; font: 800 .7rem/1 ui-monospace, monospace; letter-spacing: .03em; }
.level-klasse-1-kern { background: #def3ea; color: #1c704e; }
.level-zusatz { background: #efe9fa; color: #62439e; }

.lesson { max-width: 940px; margin-inline: auto; }
.lesson-heading { display: flex; align-items: start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.lesson-heading h1 { margin: 12px 0 18px; font-size: clamp(2.25rem, 6vw, 4.7rem); }
.learning-goal { max-width: 760px; color: var(--ink-soft); font-size: 1.08rem; }
.speak-button { min-height: 46px; flex: 0 0 auto; padding: 9px 16px; border: 1px solid var(--accent); border-radius: 999px; background: #fff; color: var(--accent); font-weight: 800; cursor: pointer; }
.lesson-pages { border: 1px solid var(--line); border-radius: 30px; background: #fff; box-shadow: var(--shadow); }
.lesson-panel { min-height: 540px; padding: clamp(24px, 6vw, 58px); }
.js .lesson-pages.is-paginated .lesson-panel[hidden] { display: none; }
.panel-label { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; color: var(--accent); font: 800 .76rem ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; }
.panel-label span { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; }
.mode-copy { display: none; }
html[data-mode="discover"] .mode-copy[data-mode-copy="discover"], html[data-mode="learn"] .mode-copy[data-mode-copy="learn"], html[data-mode="review"] .mode-copy[data-mode-copy="review"] { display: block; }
.mode-copy p, .task-text { max-width: 760px; font-size: clamp(1.12rem, 2.5vw, 1.34rem); }
html[data-mode="discover"] .mode-copy p { font-size: clamp(1.3rem, 3.2vw, 1.7rem); line-height: 1.75; }
.quick-check { display: grid; gap: 14px; padding-left: 24px; font-size: 1.15rem; }
.mode-copy details { margin-top: 26px; padding: 16px 18px; border-radius: 12px; background: var(--paper); }
.mode-copy summary { cursor: pointer; font-weight: 800; }
.safety { margin-top: 28px; padding: 18px; border-left: 5px solid var(--coral); background: #fff3ef; }
.safety p { margin: 5px 0 0; }
.lesson-visual { display: block; width: 100%; margin: 22px auto; border-radius: 22px; }
.example-box, .answer { margin-top: 22px; padding: 20px; border-radius: 16px; background: color-mix(in srgb, var(--accent) 9%, white); }
.example-box p, .answer p { margin: 6px 0 0; }
.answer-button { margin-top: 18px; border-color: var(--accent); }
.self-check { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.self-check p { width: 100%; font-weight: 800; }
.self-check button { min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; }
.self-check button:first-of-type { border-color: var(--green); color: #17623f; }
.self-check button:last-of-type { border-color: var(--coral); color: #963d2c; }
.status { color: var(--ink-soft); font-weight: 750; }
.complete-button { display: block; min-height: 48px; margin: 28px 0 0 auto; padding: 10px 18px; border: 2px solid var(--green); border-radius: 999px; background: #fff; color: #17623f; font-weight: 850; cursor: pointer; }
.complete-button.is-complete { background: var(--green); color: #fff; }
.panel-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 70px; padding: 10px 18px; border-top: 1px solid var(--line); }
.panel-nav button { min-height: 44px; border: 0; background: transparent; color: var(--ink); font-weight: 800; cursor: pointer; }
.panel-nav button:last-child { justify-self: end; }
.panel-nav button:disabled { opacity: .32; cursor: not-allowed; }
.panel-nav span { color: var(--ink-soft); font: 750 .82rem ui-monospace, monospace; }
.lesson-path { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.path-button { display: flex; min-height: 54px; align-items: center; padding: 10px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; font-weight: 800; text-decoration: none; }
.path-button.primary { justify-content: flex-end; border-color: var(--accent); }

.login-gate[hidden] { display: none; }
.login-gate { position: fixed; z-index: 500; inset: 0; display: grid; place-items: center; padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom)); overflow-y: auto; background: rgb(23 50 77 / 88%); backdrop-filter: blur(18px); }
.login-card { width: min(100%, 480px); padding: clamp(26px, 6vw, 48px); border: 1px solid rgb(255 255 255 / 50%); border-radius: 38px 38px 38px 12px; background: var(--white); box-shadow: 0 28px 80px rgb(0 0 0 / 30%); }
.login-card h1 { margin-bottom: 14px; font-size: clamp(2.2rem, 8vw, 3.8rem); }
.login-card > p { color: var(--ink-soft); }
.login-form { display: grid; gap: 9px; margin-top: 24px; }
.login-form label { margin-top: 6px; font-weight: 800; }
.login-form input { min-height: 52px; padding: 10px 14px; border: 1px solid #9db2c1; border-radius: 12px; color: var(--ink); background: #fff; font-size: 1.05rem; }
.login-form .button { margin-top: 8px; }
.form-error { min-height: 24px; margin: 2px 0; color: #a52f25!important; font-weight: 750; }
.privacy-note { margin: 18px 0 0; font-size: .82rem; }

.stats-overview { display: grid; grid-template-columns: auto 1fr; gap: clamp(28px, 6vw, 70px); align-items: center; margin-bottom: 70px; padding: clamp(24px, 5vw, 44px); border-radius: 32px; background: var(--ink); color: #fff; }
.progress-ring { --progress: 0deg; display: grid; width: clamp(170px, 25vw, 240px); aspect-ratio: 1; place-content: center; border-radius: 50%; background: radial-gradient(circle at center, var(--ink) 57%, transparent 58%), conic-gradient(var(--yellow) var(--progress), rgb(255 255 255 / 15%) 0); text-align: center; }
.progress-ring span { font: 800 clamp(2.3rem, 6vw, 4.4rem) Georgia, serif; line-height: 1; }
.progress-ring small { color: #d9e5ed; }
.stat-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat-cards article { display: grid; padding: 18px; border: 1px solid rgb(255 255 255 / 20%); border-radius: 15px; background: rgb(255 255 255 / 7%); }
.stat-cards strong { font: 800 2rem Georgia, serif; }
.stat-cards span { color: #d9e5ed; }
.stat-cards .correct strong { color: #72dfad; }
.stat-cards .practice strong { color: #ff9b85; }
.stats-section { margin-bottom: 70px; }
.stats-list { display: grid; gap: 10px; }
.stats-row { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(120px, 1fr) minmax(220px, 1fr); gap: 18px; align-items: center; padding: 16px 20px; border: 1px solid var(--line); border-left: 7px solid var(--subject); border-radius: 14px; background: #fff; }
.stats-row > div:first-child { display: flex; align-items: center; gap: 12px; }
.subject-icon.mini { width: 38px; height: 38px; border-width: 1px; border-radius: 11px 11px 11px 4px; font-size: .84rem; }
.stats-bar { height: 10px; overflow: hidden; border-radius: 999px; background: #e3ebf0; }
.stats-row small { color: var(--ink-soft); }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.settings-grid article { padding: clamp(22px, 4vw, 34px); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.sources { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.source-group { padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.source-group h2 { font-size: 1.45rem; }
.source-group li + li { margin-top: 10px; }
.not-found { max-width: 720px; padding: 80px 0; }
.not-found p { color: var(--ink-soft); font-size: 1.15rem; }

.site-footer { display: flex; width: min(calc(100% - 32px), var(--content)); align-items: center; justify-content: space-between; gap: 20px; margin: 0 auto; padding: 36px 0 max(36px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .9rem; }
.site-footer p { margin: 0; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 18px; }

@media (max-width: 860px) {
  .atlas-hero { grid-template-columns: 1fr; min-height: auto; }
  .class-grid { grid-template-columns: repeat(2, 1fr); }
  .promise-strip { grid-template-columns: 1fr; }
  .subject-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .stats-row small { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  :root { font-size: 15px; }
  .site-header { min-height: 64px; }
  .brand > span:last-child, .profile-chip > span:last-child, .mode-menu summary { font-size: 0; }
  .mode-menu summary::after { content: "Aa"; font-size: .9rem; }
  .profile-chip { padding-right: 5px; }
  main { width: min(calc(100% - 24px), var(--content)); padding-top: 28px; }
  .atlas-hero { padding-top: 24px; }
  .class-grid { grid-template-columns: 1fr; }
  .class-card { min-height: 88px; }
  .subject-card > a { grid-template-columns: auto 1fr; }
  .card-arrow { display: none; }
  .subject-icon { width: 48px; height: 48px; border-radius: 14px 14px 14px 5px; }
  .subject-intro { grid-template-columns: 1fr; border-left-width: 7px; }
  .subject-icon.giant { width: 66px; height: 66px; }
  .unit-row { grid-template-columns: 40px 1fr auto; gap: 10px; padding-inline: 14px; }
  .unit-main small { display: none; }
  .lesson-heading { display: grid; }
  .speak-button { width: fit-content; }
  .lesson-panel { min-height: 500px; padding: 24px 18px; }
  .panel-nav { padding-inline: 8px; }
  .panel-nav button { padding: 6px; font-size: .9rem; }
  .lesson-path { grid-template-columns: 1fr; }
  .path-button { width: 100%; }
  .stats-overview { grid-template-columns: 1fr; justify-items: center; }
  .stat-cards { width: 100%; }
  .stats-row, .settings-grid, .sources { grid-template-columns: 1fr; }
  .stats-row small { grid-column: auto; }
  .site-footer { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto!important; transition-duration: .01ms!important; animation-duration: .01ms!important; }
}

@media print {
  .site-header, .site-footer, .login-gate, .panel-nav, .lesson-path, .speak-button, .answer-button, .complete-button, .self-check { display: none!important; }
  body, .lesson-pages { background: #fff; box-shadow: none; }
  main { width: 100%; padding: 0; }
  .lesson-panel, .answer[hidden], .mode-copy { display: block!important; min-height: auto; page-break-inside: avoid; }
}
