/* ===== Lernreich — Redesign tokens ===== */
@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:ital,wght@0,400;0,500;0,600;0,700;0,800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --accent: #4659e6;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in oklab, var(--accent) 12%, transparent);
  --accent-softer: color-mix(in oklab, var(--accent) 7%, transparent);

  --font-ui: 'Hanken Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --r-sm: 9px;
  --r-md: 13px;
  --r-lg: 18px;
  --r-xl: 24px;
}

/* Light (default) */
.app-root {
  --bg: #f7f7f4;
  --bg-2: #f1f1ec;
  --surface: #ffffff;
  --surface-2: #fbfbf9;
  --border: #e9e9e3;
  --border-strong: #deded6;
  --ink: #18191c;
  --ink-2: #44464d;
  --muted: #7c7d84;
  --faint: #a7a8ad;
  --shadow-sm: 0 1px 2px rgba(24, 25, 28, .04), 0 1px 3px rgba(24, 25, 28, .03);
  --shadow-md: 0 2px 6px rgba(24, 25, 28, .05), 0 8px 24px rgba(24, 25, 28, .05);
  --shadow-lg: 0 6px 16px rgba(24, 25, 28, .07), 0 22px 48px rgba(24, 25, 28, .09);
  --heat-0: #ecedf0;
  --heat-track: #edeee9;
}

/* Dark */
.app-root[data-theme="dark"] {
  --bg: #0d0e10;
  --bg-2: #131417;
  --surface: #16171b;
  --surface-2: #1b1c21;
  --border: #26282e;
  --border-strong: #32343b;
  --ink: #f3f3f1;
  --ink-2: #c7c8cd;
  --muted: #8b8d95;
  --faint: #5d5f67;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, .4), 0 12px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 8px 20px rgba(0, 0, 0, .5), 0 26px 60px rgba(0, 0, 0, .5);
  --heat-0: #232429;
  --heat-track: #232429;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: #1a1a1d;
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 700px at 50% -10%, #26262b 0%, #161618 55%, #111113 100%);
  overflow: hidden;
}

/* Desktop window chrome */
.win {
  width: 1080px;
  height: 720px;
  background: var(--bg);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 40px 120px rgba(0,0,0,.55), 0 8px 30px rgba(0,0,0,.4);
  display: flex;
  flex-direction: column;
  position: relative;
  border: 1px solid rgba(255,255,255,.06);
}
.titlebar {
  height: 38px;
  flex: 0 0 38px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 8px;
  user-select: none;
}
.tl-dots { display: flex; gap: 8px; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; }
.tl-dot.r { background: #ec6a5e; }
.tl-dot.y { background: #f4bf4f; }
.tl-dot.g { background: #61c554; }
.titlebar .tb-title {
  position: absolute; left: 0; right: 0; text-align: center;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  letter-spacing: .2px; pointer-events: none;
}

.app-root {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 248px 1fr;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

/* ===== Sidebar ===== */
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 16px;
  min-height: 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.brand .bn { font-weight: 800; font-size: 16px; letter-spacing: -.2px; }
.brand .bv { font-size: 10.5px; color: var(--faint); font-weight: 600; margin-top: 1px; }

.profile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 13px;
  box-shadow: var(--shadow-sm);
}
.profile .pf-top { display: flex; align-items: center; gap: 11px; }
.avatar {
  width: 40px; height: 40px; border-radius: 11px; flex: 0 0 40px;
  background: linear-gradient(150deg, var(--accent), color-mix(in oklab, var(--accent) 60%, #000));
  color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 16px;
}
.profile .pf-name { font-weight: 700; font-size: 13.5px; }
.profile .pf-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; display: flex; align-items: center; gap: 4px; }
.streak-dots { display: flex; gap: 5px; margin-top: 12px; }
.streak-dot {
  flex: 1; height: 6px; border-radius: 3px; background: var(--border-strong);
}
.streak-dot.on { background: var(--accent); }

.nav { margin-top: 18px; display: flex; flex-direction: column; gap: 3px; }
.nav-label { font-size: 10px; font-weight: 700; letter-spacing: .9px; color: var(--faint); padding: 0 10px 7px; text-transform: uppercase; }
.nav-btn {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--r-sm);
  border: none; background: transparent; cursor: pointer;
  color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 600;
  width: 100%; text-align: left; transition: background .14s, color .14s;
}
.nav-btn svg { width: 18px; height: 18px; flex: 0 0 18px; }
.nav-btn:hover { background: var(--bg); color: var(--ink-2); }
.nav-btn.active { background: var(--accent-soft); color: var(--accent); }
.app-root[data-theme="dark"] .nav-btn.active { color: color-mix(in oklab, var(--accent) 70%, #fff); }

.side-spacer { flex: 1 1 auto; }

/* XP card in sidebar */
.xp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 13px;
  box-shadow: var(--shadow-sm);
}
.xp-row { display: flex; align-items: baseline; justify-content: space-between; }
.xp-lvl { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.xp-lvl .chip {
  font-size: 10px; font-weight: 800; color: var(--accent);
  background: var(--accent-soft); padding: 2px 6px; border-radius: 6px;
}
.xp-num { font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); }
.xp-track { height: 7px; border-radius: 4px; background: var(--heat-track); margin-top: 9px; overflow: hidden; }
.xp-fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width .5s cubic-bezier(.2,.7,.2,1); }

.side-tools { display: flex; align-items: center; gap: 4px; margin-top: 12px; padding: 0 2px; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer;
  display: grid; place-items: center; transition: background .14s, color .14s, border-color .14s;
}
.icon-btn:hover { background: var(--surface); color: var(--ink); border-color: var(--border); }
.icon-btn svg { width: 17px; height: 17px; }
.side-tools .ver { margin-left: auto; font-size: 10.5px; color: var(--faint); font-weight: 700; font-family: var(--font-mono); }

/* ===== Content area ===== */
.content { min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.view { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 26px 30px 30px; }
.view::-webkit-scrollbar { width: 10px; }
.view::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid var(--bg); }

.view-head { margin-bottom: 20px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--accent); }
.app-root[data-theme="dark"] .eyebrow { color: color-mix(in oklab, var(--accent) 72%, #fff); }
.view-title { font-size: 25px; font-weight: 800; letter-spacing: -.5px; margin: 5px 0 0; }
.view-sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

/* card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

/* generic field */
.field-label { font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 7px; display: block; }
.input {
  width: 100%; padding: 11px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--ink); font: inherit; font-size: 14px; transition: border-color .14s, box-shadow .14s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.input::placeholder { color: var(--faint); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: var(--r-sm); border: 1px solid transparent;
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: transform .08s, background .14s, border-color .14s, color .14s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: color-mix(in oklab, var(--accent) 88%, #000); }
.btn-ghost { background: var(--surface-2); color: var(--ink); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg-2); }
.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-soft:hover { background: color-mix(in oklab, var(--accent) 18%, transparent); }

.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }

/* fade between views — transform-only so content is never stuck hidden in a throttled iframe */
@keyframes viewIn { from { transform: translateY(7px); } to { transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .view > * { animation: viewIn .34s cubic-bezier(.2,.7,.2,1) both; }
}
