/* Write to Relax – Kursbereich. CI: Lila #471854, Gold #c19318, Weiß, Mulish */
@font-face { font-family: "Mulish"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/mulish-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Mulish"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/mulish-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Mulish"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/mulish-latin-700-normal.woff2") format("woff2"); }

:root {
  --lila: #471854;
  --lila-dark: #36103f;
  --ink: #2e1236;
  --muted: #6f5d76;
  --gold: #c19318;
  --gold-soft: #fbf4dc;
  --surface: #f8f4f9;
  --mauve: #efe6f1;
  --border: #e6dbe9;
  --white: #fff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(71, 24, 84, .04), 0 8px 24px rgba(71, 24, 84, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Mulish", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--white); line-height: 1.6; -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 3.2vw, 2.6rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 1em; }
a { color: var(--lila); }
img { max-width: 100%; }

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 620px; }
.page-pad { padding-top: 40px; padding-bottom: 72px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin: 0 0 .9em; display: block; }
.eyebrow.gold { color: var(--gold); }
.stack > * + * { margin-top: 14px; }

/* Topbar */
.topbar { border-bottom: 1px solid var(--border); background: rgba(255,255,255,.92); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { font-weight: 700; font-size: 1.08rem; color: var(--ink); text-decoration: none; line-height: 1.15; }
.brand span { display: block; font-size: .72rem; font-weight: 400; color: var(--muted); letter-spacing: .02em; }
.brand-center { text-align: center; margin-bottom: 28px; }
.topnav { display: flex; align-items: center; gap: 22px; font-size: .92rem; }
.topnav a, .linklike { color: var(--muted); text-decoration: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.topnav a:hover, .linklike:hover { color: var(--ink); }
.topnav form { margin: 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; padding: 12px 24px; font: inherit; font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer; border: 1.5px solid transparent; transition: background .15s, border-color .15s, color .15s, transform .05s; line-height: 1.2; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--lila); color: #fff; }
.btn-primary:hover { background: var(--lila-dark); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: #a97f12; }
.btn-ghost { background: #fff; color: var(--lila); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--lila); }
.btn-done { background: var(--gold-soft); color: #7d5d05; border-color: #ecd9a0; }
.btn-block { width: 100%; }
.btn .when-done { display: none; }
.btn-done .when-done { display: inline; }
.btn-done .when-open { display: none; }

/* Forms */
.field { display: block; }
.field span { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; }
input[type=email], input[type=text], input[type=search], select { width: 100%; font: inherit; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px; background: #fff; color: var(--ink); }
input:focus, select:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid rgba(193, 147, 24, .45); outline-offset: 2px; border-color: var(--lila); }

/* Cards */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card.soft { background: var(--surface); box-shadow: none; }
.card h3 { margin-bottom: .8em; }

/* Progress */
.progress { height: 6px; background: var(--mauve); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--gold); border-radius: 99px; transition: width .4s ease; }
.progress-lg { height: 8px; }

/* Hero */
.hero { background: radial-gradient(1200px 400px at 85% -10%, rgba(193,147,24,.12), transparent 60%), linear-gradient(180deg, var(--surface), #fff); border-bottom: 1px solid var(--border); padding: 48px 0 44px; }
.hero-small { padding: 44px 0 36px; }
.hero .lead { font-size: 1.12rem; color: var(--muted); max-width: 640px; }
.hero-progress { display: flex; align-items: center; gap: 16px; max-width: 520px; margin: 22px 0 26px; }
.hero-progress .progress { flex: 1; }
.hero-progress .small { white-space: nowrap; color: var(--muted); }
.back { display: inline-block; font-size: .88rem; color: var(--muted); text-decoration: none; margin-bottom: 18px; }
.back:hover { color: var(--lila); }

/* Dashboard */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.course-card { display: flex; flex-direction: column; gap: 4px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.course-card:hover { border-color: var(--lila); transform: translateY(-2px); }
.course-card .progress { margin: 14px 0 6px; }
.course-card .btn { align-self: flex-start; margin-top: 12px; }
.course-card.locked { background: var(--surface); box-shadow: none; }

/* Kursübersicht */
.course-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 36px; align-items: start; }
.intro { margin-bottom: 32px; max-width: none; }
.module { margin-bottom: 30px; }
.module-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.module-head h2 { margin: 0; }
.module-no { font-size: .72rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); white-space: nowrap; }
.lesson-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; }
.lesson-row + .lesson-row { border-top: 1px solid var(--border); }
.lesson-row > a, .lesson-row > div { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px; padding: 14px 18px; text-decoration: none; color: var(--ink); }
.lesson-row > a:hover { background: var(--surface); }
.lesson-row .state { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--mauve); color: var(--lila); }
.lesson-row.done .state { background: var(--gold); color: #fff; }
.lesson-row.locked { color: var(--muted); }
.lesson-row.locked .state { background: #f2eef3; color: #a596ab; }
.lesson-row.locked .lesson-title { color: var(--muted); }
.lesson-title { font-weight: 600; }
.lesson-title .no { color: var(--muted); font-weight: 400; margin-right: 8px; }
.lesson-row .meta { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.side { position: sticky; top: 92px; }
.downloads { list-style: none; margin: 0; padding: 0; }
.downloads li + li { margin-top: 8px; }
.downloads a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .93rem; background: #fff; border: 1px solid var(--border); }
.downloads a:hover { border-color: var(--lila); }
.dl-icon { font-size: .62rem; font-weight: 700; letter-spacing: .06em; color: #fff; background: var(--lila); border-radius: 6px; padding: 5px 6px; }

/* Lektion */
.lesson-top { display: flex; justify-content: space-between; align-items: center; padding-top: 22px; padding-bottom: 14px; }
.lesson-top .back { margin: 0; }
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 36px; align-items: start; padding-bottom: 72px; }
.video { position: relative; padding-top: 56.25%; border-radius: var(--radius); overflow: hidden; background: #1c0a21; box-shadow: var(--shadow); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lesson-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin: 26px 0 12px; }
.lesson-head h1 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); margin: 0; }
.lesson-head .btn { flex-shrink: 0; }
.prose { font-size: 1.04rem; max-width: 70ch; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose blockquote { margin: 1.2em 0; padding: 14px 20px; border-left: 3px solid var(--gold); background: var(--gold-soft); border-radius: 0 10px 10px 0; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); }
.lesson-side { border: 1px solid var(--border); border-radius: var(--radius); background: #fff; position: sticky; top: 92px; max-height: calc(100vh - 116px); overflow: auto; }
.side-head { padding: 18px 18px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff; }
.side-head .progress { margin: 10px 0 6px; }
.side-module { font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin: 16px 18px 6px; }
.side-list { list-style: none; margin: 0; padding: 0 8px 6px; }
.side-list a, .side-list li > span { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; font-size: .88rem; color: var(--ink); text-decoration: none; }
.side-list a:hover { background: var(--surface); }
.side-list .dot { flex: 0 0 10px; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; border: 1.5px solid #cbbcd0; }
.side-list li.done .dot { background: var(--gold); border-color: var(--gold); }
.side-list li.current a { background: var(--mauve); font-weight: 700; }
.side-list li.current .dot { border-color: var(--lila); }
.side-list li.locked > span { color: #a596ab; }

/* Auth */
body.auth { background: radial-gradient(900px 500px at 80% 0%, rgba(193,147,24,.10), transparent 60%), linear-gradient(180deg, var(--surface), #fff 70%); }
.auth-shell { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 40px 36px; box-shadow: 0 20px 60px rgba(71,24,84,.08); }
.auth-card h1 { font-size: 1.55rem; text-align: center; }
.auth-card > .muted { text-align: center; }
.auth-foot { margin-top: 22px; font-size: .82rem; color: var(--muted); }
.auth-foot a { color: var(--muted); }
.icon-circle { width: 60px; height: 60px; border-radius: 50%; background: var(--gold-soft); color: var(--gold); display: grid; place-items: center; margin: 0 auto 18px; }

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 26px 0; font-size: .84rem; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--lila); }

/* Admin */
.admin h1 { font-size: 1.7rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 28px; }
.kpi { background: var(--surface); border-radius: 12px; padding: 16px 18px; }
.kpi b { display: block; font-size: 1.6rem; color: var(--lila); }
.kpi span { font-size: .82rem; color: var(--muted); }
table.t { width: 100%; border-collapse: collapse; font-size: .88rem; background: #fff; }
table.t th, table.t td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.t th { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 28px; }
.bar { display: inline-block; height: 8px; background: var(--gold); border-radius: 4px; vertical-align: middle; }
.flash { background: var(--gold-soft); border: 1px solid #ecd9a0; padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { flex: 1 1 180px; }
.tag { display: inline-block; font-size: .72rem; padding: 2px 8px; border-radius: 99px; background: var(--mauve); }
.tag.ok { background: #e3f3e6; color: #1d6b31; }
.tag.bad { background: #fbe4e4; color: #9b1c1c; }
pre.code { background: var(--surface); padding: 16px; border-radius: 10px; overflow: auto; font-size: .8rem; }

/* Mobile Leiste & Kursinhalt (Desktop: aus) */
.mobile-bar { display: none; }
.mb-complete .when-done { display: none; }
.mb-complete.btn-done .when-done { display: inline; }
.mb-complete.btn-done .when-open { display: none; }

/* Mobil */
@media (max-width: 900px) {
  .course-layout { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; }
  .lesson-head { flex-direction: column; }
}
@media (max-width: 760px) {
  body { -webkit-tap-highlight-color: transparent; }
  .wrap { padding-left: 18px; padding-right: 18px; }
  .hide-mobile { display: none !important; }
  .topbar-inner { height: 56px; }
  .topbar { padding-top: env(safe-area-inset-top); }
  input[type=email], input[type=text], input[type=search], select { font-size: 16px; }

  /* untere Aktionsleiste */
  .mobile-bar { display: flex; align-items: center; gap: 10px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.97); backdrop-filter: blur(10px);
    border-top: 1px solid var(--border); box-shadow: 0 -6px 20px rgba(71,24,84,.06); }
  body:has(.mobile-bar) { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  body:has(.mobile-bar) .footer { padding-bottom: 8px; }
  .mb-icon { flex: 0 0 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; line-height: 1; color: var(--lila); text-decoration: none; border: 1.5px solid var(--border); background: #fff; }
  .mb-icon.disabled { opacity: .35; }
  .mb-complete { flex: 1; height: 46px; border-radius: 999px; border: 1.5px solid var(--border); background: #fff; color: var(--lila); font: inherit; font-weight: 600; font-size: .95rem; }
  .mb-complete.btn-done { background: var(--gold-soft); color: #7d5d05; border-color: #ecd9a0; }
  .mb-next { flex: 1; height: 46px; padding: 0 18px; }
  .mb-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
  .mb-info strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .95rem; }
  .mobile-bar .btn-gold.mb-next { flex: 0 0 auto; }

  /* Lektion: Video randlos */
  .lesson-top { padding: 12px 18px; }
  .lesson-layout { gap: 0; padding-bottom: 24px; }
  .lesson-main { padding: 0; }
  .video { margin: 0 -18px; border-radius: 0; box-shadow: none; }
  .lesson-head { margin: 20px 0 10px; }
  .prose { font-size: 1.02rem; }
  .lesson-main .card.soft { margin-top: 18px; }

  /* Kursinhalt (Bottom Sheet) */
  .lesson-count { display: none; }
  .side-list a, .side-list li > span { min-height: 44px; align-items: center; }
  .side-list .dot { margin-top: 0; }

  /* Kursübersicht */
  .lesson-row > a, .lesson-row > div { min-height: 56px; }
  .downloads a { min-height: 48px; }
  .hero .btn-gold { display: none; }
  .hero { padding: 30px 0 26px; }
  .page-pad { padding-top: 24px; }
}

@media (max-width: 560px) {
  .wrap { padding-left: 18px; padding-right: 18px; }
  .topnav { gap: 14px; font-size: .85rem; }
  .topnav a:first-child { display: none; }
  .hero { padding: 34px 0 30px; }
  .hero-progress { flex-direction: column; align-items: stretch; gap: 8px; margin-bottom: 0; }
  .hero-progress .progress { flex: none; width: 100%; }
  .lesson-row > a, .lesson-row > div { grid-template-columns: 30px 1fr auto; gap: 10px; padding: 12px 14px; }
  .lesson-row .meta { font-size: .76rem; }
  .lesson-title .no { margin-right: 5px; }
  .intro { padding: 18px 20px; }
  .module-head { flex-direction: column; gap: 2px; }
  .auth-card { padding: 32px 22px; }
  .pager { flex-direction: column-reverse; }
  .lesson-top { padding-top: 16px; padding-bottom: 16px; font-size: .85rem; }
  .pager .btn { width: 100%; }
}

/* Kursinhalt ein-/ausblenden */
.lesson-top { gap: 14px; }
.lesson-top .back { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson-top-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.toc-btn { display: inline-flex; align-items: center; gap: 9px; height: 40px; padding: 0 16px 0 14px; border-radius: 999px; border: 1.5px solid var(--border); background: #fff; color: var(--lila); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s; }
.toc-btn:hover { border-color: var(--lila); }
.toc-btn[aria-expanded="true"] { background: var(--mauve); border-color: var(--mauve); }
.toc-ico { display: inline-flex; flex-direction: column; gap: 3px; width: 15px; }
.toc-ico i { display: block; height: 2px; border-radius: 2px; background: currentColor; }
.toc-ico i:nth-child(2) { width: 70%; }
.toc-count { display: none; font-weight: 400; color: var(--muted); }
.side-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.toc-close { flex: 0 0 32px; width: 32px; height: 32px; margin: -6px -8px 0 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.toc-close:hover { background: var(--surface); color: var(--lila); }
.toc-backdrop { display: none; }

/* große Bildschirme: Spalte rechts, einklappbar -> Video in voller Breite */
@media (min-width: 1101px) {
  .lesson-layout { transition: grid-template-columns .25s ease; }
  .lesson-layout.toc-collapsed { grid-template-columns: minmax(0, 1fr) 0; gap: 0; }
  .lesson-layout.toc-collapsed .lesson-side { display: none; }
}

/* Tablet, Handy quer, Handy: Video volle Breite, Kursinhalt als Panel von unten */
@media (max-width: 1100px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-head { flex-direction: column; }
  .lesson-side { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; top: auto; width: 100%; max-width: 640px; margin: 0 auto;
    max-height: 82vh; max-height: 82dvh; overflow: auto; overscroll-behavior: contain; border-radius: 22px 22px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -12px 40px rgba(28,10,33,.18);
    transform: translateY(105%); visibility: hidden; transition: transform .28s cubic-bezier(.2,.8,.2,1), visibility 0s .28s; }
  .lesson-side::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: #ddd2e0; margin: 10px auto 0; }
  .side-head { z-index: 1; padding-top: 12px; }
  body.toc-open .lesson-side { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2,.8,.2,1); }
  .toc-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(28,10,33,.42); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .toc-backdrop[hidden] { display: block; }
  body.toc-open .toc-backdrop { opacity: 1; pointer-events: auto; }
  body.toc-open { overflow: hidden; }
  .toc-btn[aria-expanded="true"] { background: #fff; border-color: var(--border); }
  .side-list li.current a { scroll-margin: 90px 0 20px; }
}
@media (max-width: 560px) {
  .toc-label { display: none; }
  .toc-count { display: inline; color: var(--lila); font-weight: 600; }
  .toc-btn { height: 38px; padding: 0 14px 0 12px; }
}

/* Handy quer: Video so groß wie der Bildschirm hoch ist */
@media (orientation: landscape) and (max-height: 520px) {
  .topbar { position: static; }
  .lesson-top { padding-top: 8px; padding-bottom: 8px; }
  .video { width: 100%; max-width: calc((100vh - 24px) * 16 / 9); max-width: calc((100dvh - 24px) * 16 / 9); margin-left: auto; margin-right: auto; padding-top: 0; aspect-ratio: 16 / 9; border-radius: 12px; }
  .lesson-side { max-height: 92vh; max-height: 92dvh; }
}

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