/* ---------- theme ----------
   Light is the default. Dark applies when the OS prefers it (no explicit choice) or when
   <html data-theme="dark"> is set (see theme.js / header.js). data-theme="light" forces light.
   Keep the two dark blocks identical. The login screen has its own fixed dark look. */
:root {
  color-scheme: light;
  --bg: #f8f7f5;
  --text: #202124;
  --muted: #909090;
  --border: #e3e3e3;
  --card: #fff;
  --header: #fff;
  --hover: #f3f2f0;
  --current: #f3ecd9;
  --soft: #555;
  --soft-2: #6b6b6b;
  --dot: #d4d4d4;
  --link: #1a5fd0;
  --notice-bg: #fbf5e4;
  --notice-border: #efe1b4;
  --notice-text: #6b5a20;
  --shadow: rgba(0, 0, 0, .09);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #131314;
    --text: #e8e8ea;
    --muted: #8e8e93;
    --border: #2c2c30;
    --card: #1c1c1f;
    --header: #1c1c1f;
    --hover: #28282c;
    --current: #3a3220;
    --soft: #b4b4ba;
    --soft-2: #9a9aa0;
    --dot: #4a4a50;
    --link: #7ab0ff;
    --notice-bg: #2d2711;
    --notice-border: #574a1c;
    --notice-text: #e2cf8a;
    --shadow: rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131314;
  --text: #e8e8ea;
  --muted: #8e8e93;
  --border: #2c2c30;
  --card: #1c1c1f;
  --header: #1c1c1f;
  --hover: #28282c;
  --current: #3a3220;
  --soft: #b4b4ba;
  --soft-2: #9a9aa0;
  --dot: #4a4a50;
  --link: #7ab0ff;
  --notice-bg: #2d2711;
  --notice-border: #574a1c;
  --notice-text: #e2cf8a;
  --shadow: rgba(0, 0, 0, .5);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }

/* ---------- logo: profile picture of Lesters Hörsaal ---------- */
.logo {
  display: inline-block; flex: none; width: 40px; height: 40px; border-radius: 8px; background-color: #0b0a09;
  background-image: url(/assets/logo.jpg); background-size: cover; background-position: center;
}
.logo.big { width: 88px; height: 88px; border-radius: 16px; box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 8px 30px rgba(0,0,0,.6); }

/* ---------- header (mirrors the Skool header, reduced) ---------- */
.top { background: var(--header); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.top-inner { max-width: 1160px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-name { font-weight: 600; font-size: 16px; letter-spacing: -.1px; }
.brand { min-width: 0; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { margin-left: auto; padding-left: 16px; display: flex; align-items: center; gap: 10px; flex: none; }
.theme-switch { display: flex; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 10px; }
.theme-switch button, .logout {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: none;
  color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
}
.theme-switch button { width: 30px; height: 28px; border-radius: 7px; }
.theme-switch button:hover, .logout:hover { color: var(--text); background: var(--hover); }
.theme-switch button[aria-pressed="true"] { color: var(--text); background: var(--current); }
.logout { height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; }
.theme-switch svg, .logout svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-switch button:focus-visible, .logout:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.tabs-inner { max-width: 1160px; margin: 0 auto; padding: 0 24px; display: flex; gap: 28px; }
.tab { position: relative; padding: 10px 0 14px; font-size: 14px; font-weight: 500; color: var(--muted); }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); font-weight: 600; }
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--text); border-radius: 2px 2px 0 0; }

/* ---------- classroom ---------- */
.wrap { max-width: 1160px; margin: 0 auto; padding: 28px 24px 64px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; transition: box-shadow .15s, transform .15s; }
.card:hover { box-shadow: 0 6px 20px var(--shadow); transform: translateY(-2px); }
.cover { aspect-ratio: 16 / 9; background: #111; overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-fallback { height: 100%; display: grid; place-items: center; padding: 16px; text-align: center; color: #fff; font-weight: 700; font-size: 22px; background: linear-gradient(135deg, #1b1b1b, #3a2e14); }
.card-body { padding: 16px 18px 18px; }
.card h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.card p { margin: 0 0 12px; color: var(--soft-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.meta { color: var(--muted); font-size: 13px; }

/* ---------- lesson ---------- */
.lesson-wrap { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
.side { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px 12px 12px; position: sticky; top: 124px; max-height: calc(100vh - 148px); display: flex; flex-direction: column; }
.side h2 { margin: 6px 10px 12px; font-size: 17px; }
.back { margin: 0 10px; font-size: 13px; color: var(--muted); }
.back:hover { color: var(--text); }
.lesson-list { overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.lesson-link { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; font-size: 14px; color: var(--soft); }
.lesson-link:hover { background: var(--hover); }
.lesson-link.current { background: var(--current); color: var(--text); font-weight: 600; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--dot); }
.dot.ready { background: #3aa655; }
.lesson { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 28px 32px 32px; min-width: 0; }
.lesson h1 { margin: 0 0 4px; font-size: 26px; line-height: 1.25; letter-spacing: -.3px; }
.player { margin: 20px 0; background: #000; border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 9; }
.player.portrait { aspect-ratio: auto; background: #000; text-align: center; }
.player video, .player iframe { width: 100%; height: 100%; display: block; border: 0; }
.player.portrait video { width: auto; max-width: 100%; max-height: 78vh; margin: 0 auto; }
.notice { margin: 20px 0; padding: 16px 18px; background: var(--notice-bg); border: 1px solid var(--notice-border); border-radius: 10px; color: var(--notice-text); }
.notice a { text-decoration: underline; }
.prose { font-size: 16px; line-height: 1.65; }
.prose p { margin: 0 0 14px; }
.prose a { color: var(--link); text-decoration: underline; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 24px; }
.res-title { margin: 28px 0 10px; font-size: 16px; }
.res-list { display: flex; flex-direction: column; gap: 8px; }
.res { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; font-weight: 500; }
a.res:hover { background: var(--hover); }
.res.missing { color: var(--muted); }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 14px; color: var(--soft); }
.pager a:hover { color: var(--text); text-decoration: underline; }

@media (max-width: 860px) {
  .lesson-wrap { grid-template-columns: 1fr; }
  .side { position: static; max-height: 320px; }
  .lesson { padding: 20px; }
}
@media (max-width: 560px) {
  .top-inner, .tabs-inner { padding: 0 16px; }
  .logout span { display: none; }
  .logout { width: 36px; padding: 0; }
}

/* ---------- login ---------- */
/* desktop: card on the left (dark area), Pepe on the right */
.login-body {
  min-height: 100vh; display: flex; justify-content: flex-start; align-items: center; padding: 24px 9vw;
  background: #050505 url(/assets/login-bg-desktop.png) right center / cover no-repeat; color: #f2f2f2;
}
.login {
  width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 28px 28px 30px; border-radius: 16px; background: rgba(10, 10, 10, .72);
  border: 1px solid rgba(255, 255, 255, .1); backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.login h1 { margin: 0 0 6px; font-size: 22px; font-weight: 600; }
.login label { width: 100%; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #b9b9b9; }
.login input { width: 100%; padding: 11px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.07); color: #fff; font: inherit; font-size: 16px; outline: none; }
.login input:focus { border-color: #e9b949; box-shadow: 0 0 0 3px rgba(233, 185, 73, .25); }
.login button { width: 100%; margin-top: 6px; padding: 12px; border: 0; border-radius: 8px; background: #f0b90b; color: #111; font: inherit; font-weight: 600; cursor: pointer; }
.login button:hover { background: #ffc928; }
.login .error { width: 100%; padding: 10px 12px; border-radius: 8px; background: rgba(220, 53, 69, .18); border: 1px solid rgba(220, 53, 69, .5); color: #ffb3ba; font-size: 14px; }

/* mobile / portrait: card above the character */
@media (max-width: 700px), (orientation: portrait) {
  .login-body {
    justify-content: center; align-items: flex-start; padding: 5vh 16px 24px;
    background-image: url(/assets/login-bg-mobile.png); background-position: center bottom;
  }
  .login { gap: 10px; padding: 18px 20px 20px; max-width: 380px; }
  .login .logo.big { width: 56px; height: 56px; border-radius: 12px; }
  .login h1 { font-size: 19px; margin-bottom: 2px; }
  .login input { padding: 9px 12px; }
  .login button { padding: 11px; }
}
@media (max-height: 640px) and (max-width: 700px) { .login .logo.big { display: none; } }
