/* Forty Steps — design system v2
   Light warm paper, soft sky/butter glow, frosted-glass cards.
   Accents: steel blue (actions), yellow (progress), deep brown (steps), tan (current step). */

@font-face { font-family: "Inter"; src: url("../fonts/Inter-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/Inter-Medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/Inter-SemiBold.woff") format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter Display"; src: url("../fonts/InterDisplay-SemiBold.woff") format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter Display"; src: url("../fonts/InterDisplay-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }

:root {
  /* brand */
  --sky: #C4DFFC;
  --sky-soft: #DCEAF8;
  --sky-tile: #D6E6F5;
  --sky-deep: #8FB4DC;
  --steel: #6886AB;
  --steel-deep: #4F6F96;
  --blue: #2F6FAD;
  --butter: #F7E39E;
  --butter-soft: #FCEFC2;
  --yellow: #F2C64A;
  --brown: #4A2411;
  --brown-2: #6B3A1C;
  --tan: #B98A5E;
  --brown-soft: #EEE6DA;

  /* surfaces */
  --bg: #F6F3EC;
  --glass: rgba(255, 255, 255, .58);
  --glass-strong: rgba(255, 255, 255, .82);
  --glass-edge: rgba(255, 255, 255, .85);
  --well: rgba(255, 255, 255, .7);
  --card: var(--glass);
  --paper: #FFFFFF;
  --text: #1E1611;
  --ink: #1E1611;
  --muted: #7C7167;
  --line: rgba(30, 22, 17, .08);
  --line-2: rgba(30, 22, 17, .14);
  --empty: #E3E1D9;

  --ok: #2F7A4B; --ok-soft: #DDF0E1;
  --warn: #8A5A00; --warn-soft: #FCEFC2;
  --danger: #B3402A; --danger-soft: #F9E0D9;

  --primary: var(--steel);
  --on-primary: #fff;

  --r-xl: 26px; --r-lg: 22px; --r-md: 16px; --r-sm: 12px;
  --shadow: 0 1px 2px rgba(30,22,17,.04), 0 12px 32px -18px rgba(60,45,30,.22);
  --shadow-lg: 0 24px 60px -28px rgba(60,45,30,.35);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --nav-h: 72px;
  --side-w: 236px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14110E; --glass: rgba(38, 33, 28, .66); --glass-strong: rgba(46, 40, 34, .9); --glass-edge: rgba(255,255,255,.07);
    --well: rgba(255,255,255,.05); --paper: #221D18; --text: #F3EDE4; --ink: #F3EDE4; --muted: #A79B8E;
    --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.14); --empty: #34302A; --brown-soft: #2E2721;
    --sky-tile: #22303F; --sky-soft: #1E2A36; --butter-soft: #3A3218; --brown: #C79A6E; --tan: #8A6440;
    --ok-soft: #1D3324; --warn-soft: #3A3018; --danger-soft: #3D1E17; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14110E; --glass: rgba(38, 33, 28, .66); --glass-strong: rgba(46, 40, 34, .9); --glass-edge: rgba(255,255,255,.07);
  --well: rgba(255,255,255,.05); --paper: #221D18; --text: #F3EDE4; --ink: #F3EDE4; --muted: #A79B8E;
  --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.14); --empty: #34302A; --brown-soft: #2E2721;
  --sky-tile: #22303F; --sky-soft: #1E2A36; --butter-soft: #3A3218; --brown: #C79A6E; --tan: #8A6440;
  --ok-soft: #1D3324; --warn-soft: #3A3018; --danger-soft: #3D1E17; color-scheme: dark;
}

* { box-sizing: border-box; }
svg:not([width]) { width: 20px; height: 20px; flex: none; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); min-height: 100dvh;
  font: 400 15.5px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
/* the soft glow behind everything */
body::before {
  content: ""; position: fixed; inset: -10%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38% 30% at 88% 6%, rgba(160, 200, 240, .55), transparent 70%),
    radial-gradient(34% 30% at 30% 42%, rgba(247, 227, 158, .55), transparent 70%),
    radial-gradient(40% 30% at 92% 70%, rgba(247, 227, 158, .5), transparent 70%),
    radial-gradient(36% 28% at 8% 92%, rgba(196, 223, 252, .55), transparent 70%);
  filter: blur(10px);
}
:root[data-theme="dark"] body::before { opacity: .18; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body::before { opacity: .18; } }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: "Inter Display", "Inter", sans-serif; font-weight: 600; letter-spacing: -.025em; margin: 0; line-height: 1.15; }
h1 { font-size: clamp(26px, 5.4vw, 34px); }
h2 { font-size: clamp(20px, 4.2vw, 24px); }
h3 { font-size: 18px; }
p { margin: 0 0 .75em; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
.upper { font-size: 12.5px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.nowrap { white-space: nowrap; }
.num { font-family: "Inter Display"; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* glass */
.card, .stat, .module, .slot, .bl, .cal, .auth-card, .tabbar, .course-card, .hero, .player-xl, .sheet {
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
}

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 18px; }
.stack > * + * { margin-top: 14px; }
.stack-lg > * + * { margin-top: 26px; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrapy { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr)); }

.shell { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
.main { padding: 14px 0 calc(var(--nav-h) + 40px); min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 70%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.brandmark { display: flex; align-items: center; gap: 10px; }
.brandmark b { font-family: "Inter Display"; font-size: 16px; letter-spacing: -.02em; }
.logo-chip { height: 34px; width: 34px; border-radius: 10px; }
.icon-btn { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--glass-strong);
  border: 1px solid var(--glass-edge); box-shadow: var(--shadow); color: var(--text); cursor: pointer; position: relative; }
.icon-btn .dot-red { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: #E2563D; box-shadow: 0 0 0 2px var(--paper); }

/* mobile tab bar: light glass pill */
.tabbar { position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40;
  display: flex; justify-content: space-around; gap: 2px; height: var(--nav-h); padding: 7px; border-radius: 24px;
  background: color-mix(in srgb, var(--glass-strong) 92%, transparent); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-lg); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 17px;
  color: var(--muted); font-size: 11.5px; font-weight: 500; transition: background .25s var(--ease), color .25s var(--ease); min-width: 0; }
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.on { background: var(--sky-soft); color: var(--ink); }

/* desktop sidebar: light, like the reference */
.sidenav { display: none; }
@media (min-width: 1000px) {
  .shell.has-side { grid-template-columns: var(--side-w) 1fr; }
  .sidenav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100dvh; padding: 18px 12px;
    background: color-mix(in srgb, #FFFDF8 70%, transparent); border-right: 1px solid var(--line); overflow-y: auto;
    -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
  :root[data-theme="dark"] .sidenav { background: rgba(28,24,20,.75); }
  .sidenav .logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
  .sidenav .logo img { width: 36px; height: 36px; border-radius: 10px; }
  .sidenav .logo b { display: block; font-family: "Inter Display"; font-size: 15.5px; letter-spacing: -.02em; line-height: 1.1; }
  .sidenav .logo span { font-size: 11.5px; color: var(--muted); }
  .sidenav a.nav { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; font-weight: 500;
    font-size: 14.5px; color: var(--text); transition: background .2s var(--ease); }
  .sidenav a.nav:hover { background: rgba(30,22,17,.04); }
  .sidenav a.nav.on { background: var(--sky-soft); }
  .sidenav a.nav svg { width: 19px; height: 19px; color: var(--muted); }
  .sidenav a.nav.on svg { color: var(--ink); }
  .sidenav .badge { margin-left: auto; }
  .sidenav .foot { margin-top: auto; padding-top: 14px; }
  .has-side .tabbar { display: none; }
  .has-side .main { padding-bottom: 48px; padding-top: 26px; }
  .has-side .topbar { display: none; }
  .has-side .wrap { padding: 0 32px; }
}
.side-card { padding: 14px; border-radius: 16px; background: var(--glass-strong); border: 1px solid var(--glass-edge); box-shadow: var(--shadow); }
.me-row { display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; }
.me-row .avatar { width: 36px; height: 36px; font-size: 12.5px; }

/* page header like the reference: date + big greeting */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.page-head .date { font-size: 13.5px; color: var(--muted); margin-bottom: 4px; }
.page-head h1 { font-size: clamp(26px, 5.6vw, 34px); }

/* ---------- cards ---------- */
.card { background: var(--glass); border: 1px solid var(--glass-edge); border-radius: var(--r-xl); padding: 20px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card.pad-lg { padding: 24px; }
.card.sky { background: linear-gradient(160deg, rgba(214,228,240,.92), rgba(196,214,232,.78)); color: var(--ink); }
.card.butter { background: linear-gradient(160deg, rgba(252,240,196,.95), rgba(248,232,170,.8)); color: var(--ink); }
.card.brown { background: linear-gradient(160deg, rgba(255,255,255,.75), rgba(252,239,194,.65)); color: var(--ink); }
.card.sky .muted, .card.butter .muted, .card.brown .muted { color: #6F665C; }
a.card { display: block; transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
a.card.row { display: flex; }
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-title h2 { font-size: 21px; }
.section-title > a, .section-title > span { white-space: nowrap; flex: none; font-size: 13.5px; color: var(--muted); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head b { font-size: 14px; font-weight: 600; }
.card-head a, .card-head span.muted { font-size: 13px; color: var(--muted); }

.hero { border-radius: var(--r-xl); padding: 22px; background: linear-gradient(160deg, rgba(214,228,240,.92), rgba(205,220,235,.75));
  border: 1px solid var(--glass-edge); box-shadow: var(--shadow); color: var(--ink); position: relative; overflow: hidden; }
.hero h1 { font-size: clamp(26px, 6vw, 36px); }
.asterisk { position: absolute; right: -10px; top: -14px; width: 170px; height: 170px; color: rgba(255,255,255,.7); pointer-events: none; }
.asterisk svg { width: 100%; height: 100%; }

.stat { padding: 16px 18px; border-radius: var(--r-lg); background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--shadow); min-width: 0; }
.stat .v { font-family: "Inter Display"; font-weight: 700; font-size: 26px; letter-spacing: -.03em; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 4px; }
.stat.sky { background: linear-gradient(160deg, rgba(214,228,240,.92), rgba(200,218,236,.75)); }
.stat.butter { background: linear-gradient(160deg, rgba(252,240,196,.95), rgba(248,232,170,.8)); }
.stat.brown { background: linear-gradient(160deg, rgba(249,224,217,.9), rgba(245,210,198,.75)); }
.stat.sky .l, .stat.butter .l, .stat.brown .l { color: #6F665C; }
a.stat { display: block; transition: transform .2s var(--ease); }
a.stat:hover { transform: translateY(-2px); }

/* ---------- buttons & inputs ---------- */
.btn { --b: var(--primary); --c: var(--on-primary); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 12px; border: 0; background: var(--b); color: var(--c); font: 600 14.5px/1 "Inter";
  cursor: pointer; transition: transform .15s var(--ease), filter .2s, background .2s; white-space: nowrap; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 6px 16px -8px rgba(60,80,110,.5); }
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn.sky { --b: var(--sky-soft); --c: var(--ink); box-shadow: none; }
.btn.butter { --b: var(--yellow); --c: var(--brown); }
.btn.ghost { --b: var(--glass-strong); --c: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.soft { --b: var(--well); --c: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.btn.danger { --b: var(--danger-soft); --c: var(--danger); box-shadow: none; }
.btn.sm { height: 38px; padding: 0 14px; font-size: 13.5px; border-radius: 11px; }
.btn.xs { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.icon { width: 44px; padding: 0; }
.btn.icon.sm { width: 38px; }
.play-btn { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--steel);
  color: var(--yellow); box-shadow: 0 10px 24px -10px rgba(60,90,130,.7); border: 0; cursor: pointer; }
.play-btn svg { width: 22px; height: 22px; margin-left: 3px; }

.field { display: block; }
.field > span { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 0 6px 2px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--glass-strong); color: var(--text); font: 400 15.5px/1.4 "Inter"; outline: none; transition: border-color .2s, box-shadow .2s; }
textarea.input { min-height: 110px; resize: vertical; }
.input:focus { border-color: var(--steel); box-shadow: 0 0 0 4px rgba(104,134,171,.2); }
.input.sm { min-height: 38px; padding: 7px 11px; font-size: 14.5px; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 14.5px; }
.check input { width: 19px; height: 19px; accent-color: var(--steel); }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
  background: var(--well); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.chip svg { width: 14px; height: 14px; }
.chip.sky { background: var(--sky-soft); box-shadow: none; }
.chip.butter { background: var(--butter-soft); box-shadow: none; color: #6A4E00; }
.chip.ok { background: var(--ok-soft); box-shadow: none; color: var(--ok); }
.chip.warn { background: var(--warn-soft); box-shadow: none; color: var(--warn); }
.chip.danger { background: var(--danger-soft); box-shadow: none; color: var(--danger); }
.chip.muted { background: transparent; color: var(--muted); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--yellow); color: var(--brown);
  font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.badge.red { background: #E2563D; color: #fff; }

.alert { padding: 13px 15px; border-radius: var(--r-md); background: var(--sky-soft); color: var(--text); font-size: 14.5px; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }

.avatar { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none; font-weight: 600; font-size: 13.5px;
  background: var(--sky-tile); color: #233B57; }
.avatar svg { width: 19px; height: 19px; }
.avatar.butter { background: var(--butter-soft); color: #6A4E00; }
.avatar.lg { width: 54px; height: 54px; font-size: 17px; border-radius: 16px; }
.avatar.round { border-radius: 50%; }
summary.avatar { border-radius: 50%; }

/* progress */
.bar { height: 6px; border-radius: 99px; background: rgba(30,22,17,.08); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--blue); transition: width 1s var(--ease); }
.bar.yellow > i { background: var(--yellow); }
.card.sky .bar, .hero .bar { background: rgba(255,255,255,.75); }
.card.sky .bar > i, .hero .bar > i { background: var(--yellow); }
.ring { --p: 0; --size: 92px; --w: 9px; --c: var(--blue); --t: rgba(30,22,17,.08); width: var(--size); height: var(--size); border-radius: 50%; flex: none;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--t) 0); display: grid; place-items: center; position: relative; }
.ring::before { content: ""; position: absolute; inset: var(--w); border-radius: 50%; background: var(--ring-bg, #FBFAF7); }
:root[data-theme="dark"] .ring::before { background: var(--paper); }
.ring b { position: relative; font-family: "Inter Display"; font-size: calc(var(--size) * .24); font-weight: 700; letter-spacing: -.02em; }
.card.sky .ring, .hero .ring { --c: var(--steel-deep); --t: rgba(255,255,255,.7); --ring-bg: #D9E6F2; }

/* the 40 steps strip */
.steps { display: grid; grid-template-columns: repeat(40, 1fr); gap: 3px; margin: 16px 0 10px; }
.steps i { aspect-ratio: 1 / 1.05; border-radius: 4px; background: var(--empty); }
.steps i.done { background: var(--brown); }
.steps i.cur { background: var(--tan); }
@media (max-width: 760px) { .steps { grid-template-columns: repeat(20, 1fr); gap: 4px; } }
.steps-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.kpis { display: flex; gap: 28px; flex-wrap: wrap; }
.kpi .v { font-family: "Inter Display"; font-weight: 700; font-size: 20px; letter-spacing: -.02em; }
.kpi .l { font-size: 12px; color: var(--muted); }

/* week streak */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; }
.week div { text-align: center; font-size: 11.5px; color: var(--muted); }
.week i { display: block; aspect-ratio: 1; border-radius: 8px; border: 1.5px dashed var(--line-2); margin-bottom: 5px; }
.week i.on { background: var(--brown); border: 0; }
.week i.today { background: var(--tan); border: 0; }
.week i.today-empty { border: 1.5px solid var(--tan); }

/* homework rows */
.hw { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--well); border: 1px solid var(--glass-edge); }
.hw + .hw { margin-top: 8px; }
.hw.hot { background: var(--butter-soft); border-color: transparent; }
.hw .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.7); flex: none; }
.hw .ico svg { width: 17px; height: 17px; }
.hw b { display: block; font-size: 14px; font-weight: 600; }
.hw .when { font-size: 12.5px; font-weight: 600; color: #6A4E00; white-space: nowrap; }
.hw .when.muted { color: var(--muted); font-weight: 500; }

/* course tiles */
.course-tile { display: flex; gap: 16px; padding: 12px; border-radius: var(--r-xl); background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.course-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.course-tile .cover { width: 96px; min-height: 86px; border-radius: 16px; display: flex; align-items: flex-end; padding: 10px 12px; flex: none;
  font-family: "Inter Display"; font-weight: 700; font-size: 30px; letter-spacing: -.03em; background: var(--sky-tile); color: #213954; }
.course-tile .cover.butter { background: var(--butter-soft); color: #7A6420; }
.course-tile .cover.brown { background: #EEDFD0; color: var(--brown); }
.course-tile .body { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 4px 4px 4px 0; }
.course-tile .body .tiny, .course-tile .body .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-tile .body b { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.course-tile .foot { margin-top: auto; display: flex; align-items: center; gap: 12px; padding-top: 12px; }
.course-tile .foot .bar { flex: 1; }
.course-tile .foot span { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
@media (min-width: 760px) { .course-tile .cover { width: 112px; min-height: 96px; font-size: 34px; } }

.course-card { position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 22px; min-height: 190px; display: flex; flex-direction: column;
  justify-content: space-between; color: var(--ink); border: 1px solid var(--glass-edge); box-shadow: var(--shadow); transition: transform .25s var(--ease); }
.course-card:hover { transform: translateY(-2px); }
.course-card.sky { background: linear-gradient(160deg, rgba(214,228,240,.95), rgba(196,214,232,.8)); }
.course-card.butter { background: linear-gradient(160deg, rgba(252,240,196,.95), rgba(248,232,170,.85)); }
.course-card.brown { background: linear-gradient(160deg, rgba(240,226,212,.95), rgba(230,210,190,.85)); }
.course-card .star { position: absolute; right: -36px; top: -36px; width: 180px; opacity: .1; transform: rotate(12deg); }
.course-card h3 { font-size: 22px; max-width: 80%; }
.course-card .bar { background: rgba(255,255,255,.7); }
.course-card .upper { color: #6F665C; }

/* modules & lessons */
.module { border-radius: var(--r-xl); background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--shadow); overflow: hidden; }
.module-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 12px; }
.module-num { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--butter-soft); color: #6A4E00; font-weight: 700; flex: none; }
.lesson-row { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-top: 1px solid var(--line); transition: background .2s; }
a.lesson-row:hover { background: rgba(255,255,255,.5); }
.lesson-row .dot { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--empty); color: var(--muted); }
.lesson-row .dot svg { width: 16px; height: 16px; }
.lesson-row.done .dot { background: var(--brown); color: #F6F0E4; }
.lesson-row.open .dot { background: var(--steel); color: var(--yellow); }
.lesson-row.locked { opacity: .55; }
.lesson-row .t { flex: 1; min-width: 0; font-weight: 500; }

.lesson-wrap { max-width: 860px; margin: 0 auto; }
.block { margin-top: 18px; }
.block-label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; margin-bottom: 10px; }
.block-label svg { width: 15px; height: 15px; }
.prose { font-size: 16.5px; line-height: 1.65; }
.prose h2, .prose h3 { margin: 1.1em 0 .5em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose blockquote { margin: 0; padding: 12px 16px; border-radius: var(--r-md); background: var(--butter-soft); }
.prose mark { background: var(--butter); color: #3D2A00; padding: 0 .2em; border-radius: 4px; }

/* video */
.player { position: relative; border-radius: var(--r-xl); overflow: hidden; background: #1B2633; aspect-ratio: 16 / 9; box-shadow: var(--shadow-lg); user-select: none; -webkit-user-select: none; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player .wm { position: absolute; z-index: 3; pointer-events: none; color: rgba(255,255,255,.3); font: 600 13px/1.2 "Inter"; text-shadow: 0 1px 2px rgba(0,0,0,.35);
  transition: top 1.6s var(--ease), left 1.6s var(--ease); white-space: nowrap; }
.player .stopped { position: absolute; inset: 0; z-index: 4; display: none; place-items: center; text-align: center; padding: 24px; background: rgba(20,28,38,.92); color: #fff; }
.player.is-stopped .stopped { display: grid; }
.player .empty { position: absolute; inset: 0; display: grid; place-items: center; color: #A9B8C8; font-size: 15px; text-align: center; padding: 20px; }

/* inline audio */
.audio { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r-xl); color: var(--ink);
  background: linear-gradient(160deg, rgba(214,228,240,.95), rgba(196,214,232,.8)); border: 1px solid var(--glass-edge); box-shadow: var(--shadow); }
.audio .play { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--steel); color: var(--yellow); display: grid; place-items: center; cursor: pointer; flex: none; transition: transform .15s; }
.audio .play:active { transform: scale(.94); }
.audio .play svg { width: 22px; height: 22px; }
.audio .meta { flex: 1; min-width: 0; }
.audio .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio .seek { width: 100%; margin: 8px 0 2px; accent-color: var(--steel-deep); height: 4px; }
.audio .times { display: flex; justify-content: space-between; font-size: 12px; color: #5D6B7A; font-variant-numeric: tabular-nums; }
.audio .speed { border: 0; border-radius: 10px; background: rgba(255,255,255,.7); color: var(--ink); font: 600 13px "Inter"; height: 32px; padding: 0 10px; cursor: pointer; }

/* audio tab */
.now-playing { position: sticky; top: 74px; z-index: 5; }
.player-xl { border-radius: var(--r-xl); padding: 20px; background: linear-gradient(160deg, rgba(214,228,240,.95), rgba(196,214,232,.82));
  border: 1px solid var(--glass-edge); box-shadow: var(--shadow); color: var(--ink); }
.player-xl .art { width: 100%; aspect-ratio: 1.7; border-radius: 20px; display: grid; place-items: center; margin-bottom: 16px; position: relative; overflow: hidden;
  background: radial-gradient(60% 70% at 50% 50%, #FFF8E6, rgba(255,248,230,0) 70%), linear-gradient(160deg, #CFE0F2, #E9D9A8); }
.player-xl .art img { width: 30%; border-radius: 22%; box-shadow: 0 16px 40px -18px rgba(74,36,17,.6); }
.player-xl .controls { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 12px; }
.player-xl .cbtn { width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255,255,255,.7); color: var(--ink); display: grid; place-items: center; cursor: pointer; font: 600 12px "Inter"; }
.player-xl .cbtn svg { width: 20px; height: 20px; }
.player-xl .cbtn.big { width: 66px; height: 66px; background: var(--steel); color: var(--yellow); box-shadow: 0 12px 28px -12px rgba(60,90,130,.7); }
.player-xl .cbtn.big svg { width: 28px; height: 28px; }
.player-xl input[type=range] { width: 100%; accent-color: var(--steel-deep); }
.player-xl .times { display: flex; justify-content: space-between; font-size: 12px; color: #5D6B7A; font-variant-numeric: tabular-nums; }
.player-xl .np-sub { color: #5D6B7A; }
.track { display: flex; align-items: center; gap: 14px; padding: 11px; border-radius: 14px; cursor: pointer; transition: background .2s; }
.track:hover { background: rgba(255,255,255,.55); }
.track.on { background: var(--sky-soft); }
.track .n { width: 34px; height: 34px; border-radius: 10px; background: var(--empty); display: grid; place-items: center; font-weight: 600; font-size: 13.5px; flex: none; }
.track.on .n { background: var(--steel); color: var(--yellow); }

/* tests */
.q { padding: 16px 0; border-top: 1px solid var(--line); }
.q:first-of-type { border-top: 0; }
.q-title { font-weight: 600; font-size: 16.5px; margin-bottom: 10px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-top: 8px; border-radius: var(--r-md); border: 1px solid var(--line-2);
  cursor: pointer; transition: border-color .2s, background .2s; background: var(--glass-strong); }
.opt:hover { border-color: var(--steel); }
.opt input { accent-color: var(--steel); width: 18px; height: 18px; flex: none; }
.opt:has(input:checked) { border-color: var(--steel); background: var(--sky-soft); }
.q.right .q-title::after { content: "  ✓"; color: var(--ok); }
.q.wrong .q-title::after { content: "  ✕"; color: var(--danger); }
.q .explain { display: none; margin-top: 10px; font-size: 14px; }
.q.wrong .explain, .q.right .explain { display: block; }
.result { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: var(--r-lg); margin-top: 14px; }
.result.pass { background: var(--ok-soft); color: var(--ok); }
.result.fail { background: var(--warn-soft); color: var(--warn); }

/* voice */
.rec { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rec-btn { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--danger-soft); color: var(--danger); display: grid; place-items: center; cursor: pointer; flex: none; }
.rec-btn svg { width: 22px; height: 22px; }
.rec.on .rec-btn { background: #D9482E; color: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(217,72,46,.45); } 70% { box-shadow: 0 0 0 16px rgba(217,72,46,0); } 100% { box-shadow: 0 0 0 0 rgba(217,72,46,0); } }

/* schedule */
.day-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.day-strip::-webkit-scrollbar { display: none; }
.day-pill { flex: none; width: 52px; padding: 8px 0; border-radius: 14px; text-align: center; background: var(--glass); border: 1px solid var(--glass-edge); color: var(--text); transition: all .2s; }
.day-strip.fit .day-pill { flex: 1; width: auto; min-width: 0; }
.day-pill .w { font-size: 11.5px; color: var(--muted); }
.day-pill .d { font-family: "Inter Display"; font-weight: 700; font-size: 19px; }
.day-pill.today { border-color: var(--steel); }
.day-pill.on { background: var(--steel); color: #fff; border-color: var(--steel); }
.day-pill.on .w { color: rgba(255,255,255,.8); }
.day-pill .dots { height: 6px; display: flex; gap: 3px; justify-content: center; margin-top: 3px; }
.day-pill .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--yellow); }

.slot { display: flex; gap: 14px; padding: 15px; border-radius: var(--r-lg); background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--shadow); align-items: stretch; }
.slot .time { width: 62px; flex: none; }
.slot .time b { display: block; font-family: "Inter Display"; font-size: 19px; letter-spacing: -.02em; }
.slot .line { width: 4px; border-radius: 4px; background: var(--sky-deep); flex: none; }
.slot.done .line { background: var(--ok); }
.slot.missed .line { background: var(--danger); }
.slot.next { background: linear-gradient(160deg, rgba(214,228,240,.95), rgba(196,214,232,.8)); }
.slot.next .line { background: var(--steel-deep); }

.week-cols { display: grid; gap: 10px; grid-template-columns: repeat(7, minmax(150px, 1fr)); }
.week-col h4 { font-size: 13.5px; font-weight: 600; margin-bottom: 8px; display: flex; justify-content: space-between; }
.mini-slot { padding: 10px 12px; border-radius: 13px; background: var(--sky-soft); margin-bottom: 8px; font-size: 13.5px; display: block; border: 1px solid var(--glass-edge); }
.mini-slot.done { background: var(--ok-soft); color: var(--ok); }
.mini-slot.missed { background: var(--danger-soft); color: var(--danger); }
.mini-slot.need { background: var(--butter-soft); color: #5A4300; }

.cal { display: grid; position: relative; border: 1px solid var(--glass-edge); border-radius: var(--r-xl); background: var(--glass); overflow: auto; max-height: 76vh; box-shadow: var(--shadow); }
.cal-head { position: sticky; top: 0; z-index: 3; display: grid; background: var(--glass-strong); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.cal-head div { padding: 11px 10px; font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; border-left: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-head div:first-child { border-left: 0; }
.cal-hours div { height: 60px; font-size: 11.5px; color: var(--muted); text-align: right; padding: 4px 8px 0 0; border-top: 1px solid var(--line); }
.cal-col { position: relative; border-left: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 60px); cursor: copy; }
.cal-ev { position: absolute; left: 5px; right: 5px; border-radius: 11px; padding: 6px 9px; background: var(--sky-soft); color: #233B57; font-size: 12px; line-height: 1.3; overflow: hidden; cursor: pointer;
  border-left: 3px solid var(--steel); box-shadow: 0 6px 16px -10px rgba(60,80,110,.5); transition: transform .15s; }
.cal-ev:hover { transform: scale(1.015); }
.cal-ev.done { background: var(--ok-soft); color: var(--ok); border-left-color: var(--ok); }
.cal-ev.missed { background: var(--danger-soft); color: var(--danger); border-left-color: var(--danger); }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: #E2563D; z-index: 2; pointer-events: none; }

/* lists & tables */
.list { display: flex; flex-direction: column; }
.list > .item { display: flex; align-items: center; gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--line); }
.list > .item:last-child { border-bottom: 0; }
a.item:hover { background: rgba(255,255,255,.45); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12.5px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.link { cursor: pointer; }
.table tr.link:hover td { background: rgba(255,255,255,.45); }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- landing / auth ---------- */
.auth { min-height: 100dvh; display: flex; flex-direction: column; }
.auth-inner { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px 30px; gap: 24px; text-align: center; }
.auth .logo-big { width: 84px; height: 84px; border-radius: 24px; box-shadow: 0 18px 40px -18px rgba(74,36,17,.6); }
.auth .wordmark { font-family: "Inter Display"; font-weight: 700; font-size: 15px; letter-spacing: .14em; text-transform: uppercase; color: var(--brown); }
.auth h1 { font-size: clamp(30px, 7.5vw, 50px); max-width: 13em; letter-spacing: -.035em; }
.auth .lead { color: var(--muted); font-size: 17px; max-width: 30em; }
.role-pick { display: grid; gap: 12px; width: min(560px, 100%); grid-template-columns: 1fr 1fr; }
.role { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; padding: 20px; border-radius: var(--r-xl); text-align: left; color: var(--ink);
  border: 1px solid var(--glass-edge); box-shadow: var(--shadow); transition: transform .3s var(--ease), box-shadow .3s var(--ease);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.role:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.role.student { background: linear-gradient(160deg, rgba(214,228,240,.95), rgba(196,214,232,.82)); }
.role.teacher { background: linear-gradient(160deg, rgba(252,240,196,.95), rgba(248,232,170,.85)); }
.role .ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: rgba(255,255,255,.7); }
.role .ico svg { width: 24px; height: 24px; }
.role b { font-family: "Inter Display"; font-size: 21px; letter-spacing: -.02em; }
.role span { font-size: 13.5px; color: #6F665C; }
@media (max-width: 460px) { .role-pick { grid-template-columns: 1fr; } .role { flex-direction: row; align-items: center; } }
.auth-card { width: min(420px, 100%); text-align: left; background: var(--glass-strong); border: 1px solid var(--glass-edge);
  border-radius: var(--r-xl); padding: 26px; box-shadow: var(--shadow-lg); }
.auth-foot { padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }
.auth-foot a { text-decoration: underline; text-underline-offset: 3px; }

/* sheets */
.sheet-bg { position: fixed; inset: 0; z-index: 80; background: rgba(30,25,20,.32); opacity: 0; pointer-events: none; transition: opacity .25s; }
.sheet { position: fixed; z-index: 81; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow-y: auto; background: color-mix(in srgb, var(--bg) 92%, white);
  border-radius: 26px 26px 0 0; padding: 22px 20px calc(24px + env(safe-area-inset-bottom)); transform: translateY(105%); visibility: hidden;
  transition: transform .35s var(--ease), visibility 0s linear .35s; box-shadow: var(--shadow-lg); }
.sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: var(--line-2); margin: -8px auto 16px; }
.sheet.open { transform: none; visibility: visible; transition: transform .35s var(--ease), visibility 0s; }
.sheet-bg.open { opacity: 1; pointer-events: auto; }
@media (min-width: 760px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(620px, 94vw); border-radius: 26px; transform: translate(-50%, -46%) scale(.97); opacity: 0; pointer-events: none;
    transition: transform .3s var(--ease), opacity .25s, visibility 0s linear .3s; }
  .sheet.open { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; visibility: visible; transition: transform .3s var(--ease), opacity .25s, visibility 0s; }
  .sheet .grab { display: none; }
}

/* constructor */
.builder { display: grid; gap: 18px; }
@media (min-width: 1100px) { .builder { grid-template-columns: 1fr 290px; align-items: start; } .builder aside { position: sticky; top: 26px; } }
.bl { border-radius: var(--r-lg); background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--shadow); transition: box-shadow .2s, border-color .2s, opacity .2s; }
.bl.dragging { opacity: .5; }
.bl-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; }
.bl-handle { cursor: grab; color: var(--muted); padding: 6px; border-radius: 8px; display: grid; place-items: center; touch-action: none; }
.bl-handle:active { cursor: grabbing; }
.bl-handle svg, .bl-type svg { width: 19px; height: 19px; }
.bl-type { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.t-video { background: var(--steel); color: var(--yellow); }
.t-audio { background: var(--sky-tile); color: #233B57; }
.t-text { background: var(--empty); color: var(--ink); }
.t-test { background: var(--butter-soft); color: #6A4E00; }
.t-task { background: #F3DCCF; color: var(--brown); }
.t-file { background: #E1E8DA; color: #3B4A2E; }
.bl-body { display: none; padding: 4px 16px 18px; border-top: 1px solid var(--line); }
.bl.open .bl-body { display: block; }
.bl.open { box-shadow: var(--shadow-lg); background: var(--glass-strong); }
.add-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 620px) { .add-grid { grid-template-columns: repeat(3, 1fr); } }
.add-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; border-radius: 16px; border: 1px dashed var(--line-2);
  background: transparent; cursor: pointer; color: var(--text); font: 500 14px "Inter"; text-align: left; transition: border-color .2s, background .2s; }
.add-btn:hover { border-color: var(--steel); background: var(--glass-strong); }
.qed { padding: 14px; border-radius: var(--r-md); background: var(--well); border: 1px solid var(--line); margin-top: 12px; }
.opt-ed { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.saved { font-size: 12.5px; color: var(--ok); opacity: 0; transition: opacity .3s; }
.saved.show { opacity: 1; }

/* misc */
.empty-state { text-align: center; padding: 38px 20px; border-radius: var(--r-xl); border: 1px dashed var(--line-2); color: var(--muted); background: rgba(255,255,255,.25); }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.fade-in { animation: fade .45s var(--ease) both; }
@keyframes fade { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: none; } }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 30px); transform: translateX(-50%) translateY(20px); z-index: 99; background: var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: 14px; font-size: 14.5px; box-shadow: var(--shadow-lg); opacity: 0; transition: all .3s var(--ease); pointer-events: none; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.theme-toggle { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 8px; border-radius: 10px; display: grid; place-items: center; }
.theme-toggle svg { width: 19px; height: 19px; }
.no-select { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.hide-m { display: none; }
@media (min-width: 760px) { .hide-m { display: initial; } .show-m { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* dashboard grid (student home) */
.dash { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.dash > * { min-width: 0; }
@media (min-width: 900px) {
  .dash { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .dash .span2 { grid-column: 1 / -1; }
  .dash .w-week { grid-column: 1; }
}
.dash .pair { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.dash .pair > * { min-width: 0; }
@media (min-width: 900px) { .dash .pair { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr); } }
.week { max-width: 340px; }
a.card.continue, .card.continue { display: flex; }
.continue { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; min-height: 200px; }
.continue h2 { font-size: clamp(22px, 4.6vw, 28px); max-width: 15em; letter-spacing: -.03em; }
.continue .foot { display: flex; align-items: flex-end; gap: 16px; margin-top: 24px; }
.when-grid { display: grid; grid-template-columns: repeat(3, auto); gap: 6px 22px; padding: 12px 14px; border-radius: 14px; background: var(--well); border: 1px solid var(--glass-edge); margin: 14px 0; }
.when-grid .tiny { color: var(--muted); }
.when-grid b { font-size: 14px; }
@media (max-width: 520px) { .when-grid { grid-template-columns: 1fr auto; } .when-grid .hide-xs { display: none; } }

.btn-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-pair .btn { width: 100%; padding: 0 10px; }
@media (min-width: 760px) { .btn-pair { display: flex; } .btn-pair .btn { width: auto; padding: 0 20px; } }
@media (max-width: 620px) {
  .kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
  .kpi .v { font-size: 18px; }
  .kpi .l { font-size: 11.5px; line-height: 1.25; }
  .hide-xs { display: none; }
}
