/* Nisemio – Systemschriften, keine externen Ressourcen oder Tracking-Dienste. */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;
  --hairline: rgba(0, 0, 0, .08);
  --fill: rgba(118, 118, 128, .12);
  --fill-hover: rgba(118, 118, 128, .18);
  --accent: #c8642e;
  --accent-ink: #a94f1d;
  --button: #1d1d1f;
  --button-ink: #ffffff;
  --nav: rgba(251, 251, 253, .78);
  --ok: #248a3d;
  --ok-soft: rgba(52, 199, 89, .14);
  --error: #c4122f;
  --error-soft: rgba(255, 59, 48, .1);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 28px rgba(0, 0, 0, .06);
  --shadow-hover: 0 2px 6px rgba(0, 0, 0, .06), 0 18px 44px rgba(0, 0, 0, .10);
  --radius-lg: 28px;
  --radius: 20px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.25, .1, .25, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --ink: #f5f5f7;
    --ink-2: #a1a1a6;
    --ink-3: #8e8e93;
    --hairline: rgba(255, 255, 255, .1);
    --fill: rgba(118, 118, 128, .24);
    --fill-hover: rgba(118, 118, 128, .34);
    --accent: #e8834d;
    --accent-ink: #f0a072;
    --button: #f5f5f7;
    --button-ink: #1d1d1f;
    --nav: rgba(22, 22, 23, .74);
    --ok: #30d158;
    --ok-soft: rgba(48, 209, 88, .16);
    --error: #ff6961;
    --error-soft: rgba(255, 69, 58, .16);
    --shadow: 0 0 0 1px rgba(255, 255, 255, .06);
    --shadow-hover: 0 0 0 1px rgba(255, 255, 255, .14), 0 18px 44px rgba(0, 0, 0, .5);
  }
}

/* Grundlagen */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -.022em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis: none;
}
h1, h2, h3, p, dl, dd { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button, a, input { -webkit-tap-highlight-color: transparent; }
input { min-width: 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 3px; border-radius: 8px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.icon { width: 1.1em; height: 1.1em; flex-shrink: 0; }
.muted { color: var(--ink-3); }
.eyebrow { font-size: 14px; font-weight: 600; letter-spacing: -.01em; color: var(--accent-ink); margin-bottom: 8px; }
.lead { font-size: 19px; line-height: 1.42; color: var(--ink-2); letter-spacing: -.02em; }
.brand svg .dot, .auth-wordmark svg .dot, .footer-mark svg .dot { fill: var(--accent); }

/* Schaltflächen */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 24px; border: 0; border-radius: 980px;
  background: var(--button); color: var(--button-ink);
  font-size: 17px; font-weight: 500;
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.button:hover { opacity: .86; }
.button:active { transform: scale(.98); }
.link-button { border: 0; background: none; padding: 6px 2px; font-size: 14px; color: var(--accent-ink); }
.link-button:hover { text-decoration: underline; }

/* Anmeldung, Einrichtung, Hinweise */
.auth {
  min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: max(40px, env(safe-area-inset-top)) 20px max(32px, env(safe-area-inset-bottom));
}
.auth-card {
  width: min(440px, 100%);
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 48px 40px 36px; text-align: center;
  animation: rise .6s var(--ease) both;
}
.auth-mark { display: inline-flex; width: 64px; margin-bottom: 28px; color: var(--ink); }
.auth-mark svg { width: 100%; height: auto; display: block; }
.auth-card h1 { font-size: 32px; line-height: 1.125; font-weight: 600; letter-spacing: -.028em; margin-bottom: 12px; }
.auth-card .lead { font-size: 17px; }
.auth-card > .button { margin-top: 28px; }
.auth-form { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 32px; text-align: left; }
.field { position: relative; width: 100%; }
.field input {
  width: 100%; height: 56px; padding: 0 60px 0 18px;
  border: 1px solid var(--hairline); border-radius: 14px;
  background: var(--surface-2); font-size: 17px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field input::placeholder, .field-row input::placeholder { color: var(--ink-3); }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.field-submit {
  position: absolute; right: 10px; top: 10px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; border: 0; background: var(--button); color: var(--button-ink);
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.field-submit:hover { opacity: .85; }
.field-submit:active { transform: scale(.94); }
.field-submit .icon { width: 18px; height: 18px; }
.field-group {
  width: 100%; border: 1px solid var(--hairline); border-radius: 14px; background: var(--surface-2); overflow: hidden;
}
.field-row { display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 54px; }
.field-row + .field-row { border-top: 1px solid var(--hairline); }
.field-row span { flex: 0 0 96px; font-size: 15px; color: var(--ink-2); }
.field-row input { flex: 1; height: 52px; border: 0; background: none; font-size: 17px; outline: none; }
.field-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.auth-form .button { width: 100%; margin-top: 14px; }
.hint { align-self: stretch; font-size: 13px; line-height: 1.45; color: var(--ink-3); padding: 0 4px; }
.notice {
  margin-top: 22px; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--ok-soft); color: var(--ok); font-size: 15px; line-height: 1.4; text-align: left;
}
.notice.error { background: var(--error-soft); color: var(--error); }
.auth-foot {
  display: flex; align-items: center; gap: 6px; margin-top: 24px;
  font-size: 13px; color: var(--ink-3); text-align: center;
}
.auth-wordmark { color: var(--ink-3); }
.auth-wordmark svg { width: 96px; height: auto; display: block; }

/* Navigation mit Milchglas */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: var(--nav);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s var(--ease);
}
.nav.scrolled, .nav-lesson { border-bottom-color: var(--hairline); }
.nav-inner {
  max-width: 1080px; margin: 0 auto; min-height: 56px;
  padding: 0 max(22px, env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: inline-flex; color: var(--ink); }
.brand svg { height: 24px; width: auto; display: block; }
.nav-right { display: flex; align-items: center; gap: 18px; }
.nav-right form { margin: 0; }
.nav-status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.nav-button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 14px;
  border: 0; border-radius: 980px; background: var(--fill); font-size: 14px; font-weight: 500;
  transition: background .2s var(--ease);
}
.nav-button:hover { background: var(--fill-hover); }
.nav-button .icon { width: 15px; height: 15px; }

/* Lernbereich */
.page { max-width: 1080px; margin: 0 auto; padding: 0 22px; }
.hero { padding: 72px 0 48px; animation: rise .7s var(--ease) both; }
.hero h1 { font-size: clamp(40px, 6vw, 64px); line-height: 1.06; font-weight: 700; letter-spacing: -.035em; margin-bottom: 18px; }
.hero .lead { max-width: 560px; font-size: clamp(19px, 2vw, 21px); }
.stats { display: flex; gap: 40px; margin-top: 36px; }
.stats div { display: flex; flex-direction: column-reverse; gap: 2px; }
.stats dt { font-size: 14px; color: var(--ink-2); }
.stats dd { font-size: 34px; line-height: 1.1; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

.library { padding-bottom: 40px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.toolbar h2 { font-size: 28px; font-weight: 600; letter-spacing: -.028em; }
.search {
  display: flex; align-items: center; gap: 8px; width: 280px; height: 40px; padding: 0 14px;
  background: var(--fill); border-radius: 12px; color: var(--ink-2);
  transition: background .2s var(--ease), box-shadow .2s var(--ease);
}
.search:focus-within { background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent), 0 0 0 1px var(--accent); }
.search .icon { width: 17px; height: 17px; }
.search input { flex: 1; border: 0; background: none; font-size: 15px; height: 100%; outline: none; color: var(--ink); }
.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-cancel-button { cursor: pointer; }

.segmented {
  display: flex; gap: 2px; width: max-content; max-width: 100%; padding: 3px; margin-bottom: 14px;
  background: var(--fill); border-radius: 11px; overflow-x: auto; scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.filter {
  flex-shrink: 0; border: 0; background: none; border-radius: 8px; padding: 6px 16px;
  font-size: 14px; font-weight: 500; color: var(--ink); white-space: nowrap;
  transition: background .2s var(--ease), box-shadow .2s var(--ease);
}
.filter:hover:not(.active) { background: var(--fill); }
.filter.active { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
@media (prefers-color-scheme: dark) { .filter.active { background: #636366; } }
.result-count { font-size: 13px; color: var(--ink-3); margin-bottom: 14px; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.card {
  position: relative; display: flex; flex-direction: column; min-height: 228px; padding: 24px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
  animation: rise .6s var(--ease) both;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.type {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  background: var(--fill); color: var(--ink-2);
}
.type .icon { width: 22px; height: 22px; }
.type-pdf { background: rgba(255, 59, 48, .12); color: #d70015; }
.type-doc { background: rgba(0, 122, 255, .12); color: #0062cc; }
.type-sheet { background: rgba(52, 199, 89, .14); color: #1d7a34; }
.type-slides { background: rgba(255, 149, 0, .14); color: #b25000; }
.type-image { background: rgba(175, 82, 222, .13); color: #8944ab; }
.type-page { background: var(--button); color: var(--accent); }
@media (prefers-color-scheme: dark) {
  .type-pdf { color: #ff6961; } .type-doc { color: #64a8ff; } .type-sheet { color: #4cd964; }
  .type-slides { color: #ffb340; } .type-image { color: #d39cf0; } .type-page { background: #2c2c2e; }
}
.badge { font-size: 12px; font-weight: 600; color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 4px 10px; border-radius: 980px; }
.card-subject { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-bottom: 4px; }
.card h3 { font-size: 19px; line-height: 1.26; font-weight: 600; letter-spacing: -.02em; overflow-wrap: anywhere; margin-bottom: 8px; }
.card-meta { font-size: 13px; color: var(--ink-3); margin-bottom: 22px; }
.card-action {
  display: inline-flex; align-items: center; gap: 4px; margin-top: auto; align-self: flex-start;
  font-size: 15px; font-weight: 500; color: var(--accent-ink);
}
.card-action .icon { width: 16px; height: 16px; transition: transform .25s var(--ease); }
.card-action::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card:hover .card-action .icon { transform: translateX(2px); }
.card:hover .card-action[href*="download"] .icon { transform: translateY(2px); }
.card-action:focus-visible { outline: none; }
.card-action:focus-visible::after { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.card-page { grid-column: span 2; min-height: 228px; }
.card-page h3 { font-size: 28px; line-height: 1.14; letter-spacing: -.028em; max-width: 440px; }

.empty-state { text-align: center; padding: 56px 20px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--fill); color: var(--ink-2); margin-bottom: 18px; }
.empty-icon .icon { width: 24px; height: 24px; }
.empty-state h3 { font-size: 21px; font-weight: 600; letter-spacing: -.02em; margin-bottom: 8px; }
.empty-state p { font-size: 15px; color: var(--ink-2); }
.grid + .empty-state { margin-top: 0; }

.footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 28px 0 max(36px, env(safe-area-inset-bottom)); border-top: 1px solid var(--hairline);
  font-size: 12px; color: var(--ink-3);
}
.footer-mark svg { height: 16px; width: auto; display: block; }

/* Lernseite im Rahmen */
.lesson-body { height: 100svh; display: flex; flex-direction: column; overflow: hidden; }
.nav-lesson .nav-inner { max-width: none; display: grid; grid-template-columns: 1fr auto 1fr; }
.nav-back { display: inline-flex; align-items: center; gap: 2px; font-size: 15px; color: var(--accent-ink); justify-self: start; }
.nav-back .icon { width: 20px; height: 20px; }
.nav-back:hover span { text-decoration: underline; }
.lesson-title { display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.2; min-width: 0; }
.lesson-title span { font-size: 11px; color: var(--ink-3); }
.lesson-title strong { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.nav-lesson .nav-button { justify-self: end; }
.lesson-frame { flex: 1; width: 100%; border: 0; display: block; background: var(--surface); }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Tablet */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { padding: 56px 0 40px; }
  .search { width: 240px; }
}

/* Smartphone */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .auth-card { padding: 40px 24px 28px; border-radius: 24px; }
  .auth-card h1 { font-size: 28px; }
  .field-row span { flex-basis: 84px; font-size: 14px; }
  .nav-inner { padding: 0 16px; }
  .brand svg { height: 21px; }
  .nav-status { display: none; }
  .page { padding: 0 16px; }
  .hero { padding: 40px 0 32px; }
  .hero .lead { font-size: 18px; }
  .stats { gap: 28px; margin-top: 28px; }
  .stats dd { font-size: 28px; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 14px; }
  .search { width: 100%; height: 42px; }
  .segmented { width: auto; }
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .card, .card-page { grid-column: auto; min-height: 0; padding: 20px; }
  .card-page h3 { font-size: 24px; }
  .footer { flex-direction: column; align-items: flex-start; gap: 10px; }
  .hide-sm { display: none; }
  .nav-lesson .nav-button { padding: 0 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
