/* ============================================================
   Ochiq Kurs — Design System
   ============================================================ */

/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: -0.018em;
  color: var(--text);
  margin: 0 0 0.5em;
  line-height: 1.2;
}
h1 { font-size: clamp(1.75rem, 2.4vw + 1rem, 2.6rem); letter-spacing: -0.025em; }
h2 { font-size: clamp(1.4rem, 1.4vw + 0.8rem, 1.85rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1rem; }
a { color: var(--brand-600); text-decoration: none; transition: color .12s; }
a:hover { color: var(--brand-700); }

img, svg { display: block; max-width: 100%; }

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 1rem; }

/* ── Design tokens ────────────────────────────────────────── */
:root {
  /* Typography */
  --font-ui:   'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-head: 'Bricolage Grotesque', var(--font-ui);
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', 'Fira Code', monospace;

  /* Brand — emerald */
  --brand-50:  #ECFDF5;
  --brand-100: #D1FAE5;
  --brand-200: #A7F3D0;
  --brand-300: #6EE7B7;
  --brand-400: #34D399;
  --brand-500: #10B981;
  --brand-600: #059669;
  --brand-700: #047857;
  --brand-800: #065F46;
  --brand-900: #064E3B;

  /* Accent — warm amber for rating/highlight */
  --accent-300: #FCD34D;
  --accent-400: #FBBF24;
  --accent-500: #F59E0B;
  --accent-600: #D97706;

  /* Neutrals */
  --gray-25:  #FCFCFD;
  --gray-50:  #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --gray-950: #0B1220;

  /* States */
  --success: #10B981;
  --warning: #F59E0B;
  --danger:  #EF4444;
  --info:    #3B82F6;

  /* Semantic */
  --bg:        var(--gray-50);
  --bg-soft:   var(--gray-100);
  --surface:   #FFFFFF;
  --surface-2: var(--gray-50);
  --surface-3: var(--gray-100);
  --text:      var(--gray-900);
  --text-soft: var(--gray-700);
  --muted:     var(--gray-500);
  --text-muted: var(--gray-500);
  --border:    var(--gray-200);
  --border-light: var(--gray-100);
  --border-strong: var(--gray-300);

  /* Brand semantic */
  --color-primary: var(--brand-600);
  --color-primary-dark: var(--brand-700);
  --color-primary-soft: var(--brand-50);

  /* Radii */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-2xl: 28px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 8px rgba(16, 24, 40, 0.07), 0 2px 4px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 10px 20px rgba(16, 24, 40, 0.09), 0 4px 6px rgba(16, 24, 40, 0.05);
  --shadow-xl: 0 24px 48px rgba(16, 24, 40, 0.18);
  --shadow-lift: 0 14px 32px -8px rgba(16, 185, 129, 0.18), 0 6px 12px -4px rgba(16, 24, 40, 0.10);

  --container: 1280px;
  --container-wide: 1440px;
  --nav-h: 68px;

  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --t-fast: .12s;
  --t-base: .2s;
  --t-slow: .35s;
}

html[data-theme="dark"] {
  /* Emerald-toned charcoal (warm green-black), not blue slate */
  --bg:        #0A1411;
  --bg-soft:   #0E1B16;
  --surface:   #10211B;
  --surface-2: #0E1B16;
  --surface-3: #1A312A;
  --text:      #E7F0EC;
  --text-soft: #B9C9C2;
  --muted:     #87998F;
  --border:    #20382E;
  --border-light: #18302A;
  --border-strong: #2E4C3E;
  --text-muted: #87998F;
  --color-primary-soft: rgba(16, 185, 129, 0.12);
}

/* ── Container ────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}
@media (max-width: 640px) { .container { padding: 0 16px; } }

/* ── Navbar ───────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.navbar-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 100%;
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 24px;
}
.navbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.navbar-logo .logo-mark {
  width: 30px; height: 30px;
  display: inline-grid; place-items: center;
  background: var(--brand-600);
  color: #fff;
  border-radius: 8px;
  font-weight: 900;
  font-size: .95rem;
}
.navbar-logo:hover { color: var(--brand-600); }

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.navbar-link {
  padding: 8px 14px;
  color: var(--text-soft);
  font-weight: 500;
  font-size: .95rem;
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: color var(--t-fast), background var(--t-fast);
  white-space: nowrap;
}
.navbar-link:hover { color: var(--brand-700); background: var(--color-primary-soft); }
.navbar-link.active { color: var(--brand-700); }

.navbar-search {
  flex: 1;
  max-width: 460px;
  margin: 0 12px;
  position: relative;
}
.navbar-search input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--text);
  font-size: .92rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.navbar-search input[type="search"] {
  padding: 0 14px 0 40px;
}
.navbar-search input::placeholder { color: var(--muted); }
.navbar-search input:focus {
  outline: none;
  border-color: var(--brand-500);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--color-primary-soft);
}
.navbar-search .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  max-height: 380px;
  overflow-y: auto;
  display: none;
  z-index: 200;
}
.search-suggest.open { display: block; }
.search-suggest .ss-group { padding: 4px 8px 2px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.search-suggest a.ss-item {
  display: flex; gap: 10px; align-items: center;
  padding: 8px 8px;
  color: var(--text);
  border-radius: var(--r-sm);
  font-size: .92rem;
  text-decoration: none;
}
.search-suggest a.ss-item:hover { background: var(--surface-2); }
.search-suggest .ss-thumb {
  width: 38px; height: 38px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--surface-3);
  flex-shrink: 0;
}
.search-suggest .ss-meta { font-size: .76rem; color: var(--muted); }
.search-suggest .ss-empty { padding: 14px; text-align: center; color: var(--muted); font-size: .9rem; }

.navbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.navbar-icon-btn {
  width: 40px; height: 40px;
  display: inline-grid; place-items: center;
  background: transparent;
  color: var(--text-soft);
  border: 1px solid transparent;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.navbar-icon-btn:hover { background: var(--surface-2); color: var(--text); }

.navbar-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: .92rem;
  border-radius: var(--r-full);
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  cursor: pointer;
}
.navbar-btn-outline {
  border-color: var(--border-strong);
  color: var(--text);
  background: transparent;
}
.navbar-btn-outline:hover {
  border-color: var(--brand-500);
  color: var(--brand-700);
  background: var(--color-primary-soft);
}
.navbar-btn-primary {
  background: var(--brand-600);
  color: #fff !important;
  border-color: var(--brand-600);
}
.navbar-btn-primary:hover {
  background: var(--brand-700);
  border-color: var(--brand-700);
  transform: translateY(-1px);
}

.navbar-logout-form { margin: 0; display: inline-block; }

/* User dropdown */
.nav-user { position: relative; }
.nav-user-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid transparent;
  border-radius: var(--r-full);
  background: transparent;
  cursor: pointer;
  color: var(--text);
}
.nav-user-trigger:hover { background: var(--surface-2); border-color: var(--border); }
.nav-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  display: none;
  z-index: 200;
}
.nav-user.open .nav-user-menu { display: block; }
.nav-user-menu a, .nav-user-menu button {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 9px 10px;
  background: transparent;
  border: none;
  color: var(--text);
  text-align: left;
  font-size: .93rem;
  border-radius: var(--r-sm);
  text-decoration: none;
  cursor: pointer;
}
.nav-user-menu a:hover, .nav-user-menu button:hover {
  background: var(--surface-2);
  color: var(--brand-700);
}
.nav-user-menu .divider { height: 1px; background: var(--border); margin: 6px 4px; }
.nav-user-menu .uname { padding: 6px 10px 0; font-weight: 700; font-size: .9rem; color: var(--text); }
.nav-user-menu .umail { padding: 0 10px 6px; font-size: .78rem; color: var(--muted); }

.avatar {
  width: 36px; height: 36px;
  border-radius: var(--r-full);
  background: var(--brand-600);
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  font-size: .85rem;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.avatar-lg { width: 64px; height: 64px; font-size: 1.2rem; }
.avatar.avatar-xl { width: 88px; height: 88px; font-size: 1.6rem; }
.avatar.avatar-sm { width: 28px; height: 28px; font-size: .7rem; }

.nav-mobile-toggle { display: none; }
@media (max-width: 900px) {
  .nav-only-desktop { display: none; }
  .navbar-search { display: none; }
  .nav-mobile-toggle { display: inline-grid; }
  .navbar-inner { gap: 10px; padding: 0 14px; }
  .navbar-right { gap: 6px; }
}

.mobile-drawer {
  position: fixed; top: var(--nav-h); left: 0; right: 0; bottom: 0;
  background: var(--surface);
  z-index: 90;
  padding: 20px;
  transform: translateY(-12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base), transform var(--t-base);
  overflow-y: auto;
}
.mobile-drawer.open { opacity: 1; transform: none; pointer-events: auto; }
.mobile-drawer a {
  display: block;
  padding: 12px 8px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
}
.mobile-drawer .mobile-search input {
  width: 100%; height: 44px; padding: 0 16px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--surface-2);
  margin-bottom: 14px;
}

/* ── Layout ───────────────────────────────────────────────── */
.layout { display: block; min-height: calc(100vh - var(--nav-h)); }
.layout-with-sidebar {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 0;
  max-width: var(--container-wide);
  margin: 0 auto;
}
.layout-with-sidebar > * { min-width: 0; }
@media (max-width: 1024px) {
  .layout-with-sidebar { grid-template-columns: minmax(0, 1fr); }
}

main.content {
  padding: 32px 28px 64px;
  max-width: 100%;
  width: 100%;
}
main.content-full {
  max-width: var(--container-wide);
  margin: 0 auto;
}
@media (max-width: 640px) {
  main.content { padding: 20px 16px 40px; }
}

/* ── Sidebar (lesson sidebar) ─────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 20px;
  position: sticky;
  top: var(--nav-h);
  align-self: start;
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}
@media (max-width: 1024px) {
  .sidebar {
    position: relative; top: 0; height: auto;
    border-right: none; border-bottom: 1px solid var(--border);
  }
}
.sidebar-skill-title, .subskill-summary, .sidebar-lesson-item span { overflow-wrap: anywhere; }
.sidebar-lesson-item a { min-width: 0; }
.sidebar-header { margin-bottom: 18px; }
.sidebar-back {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--muted); font-size: .82rem; text-decoration: none; margin-bottom: 8px;
}
.sidebar-back:hover { color: var(--brand-700); }
.sidebar-skill-title {
  display: block;
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.subskill-accordion { list-style: none; padding: 0; margin: 0; }
.subskill-dropdown { border-radius: var(--r-sm); margin-bottom: 4px; }
.subskill-summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-size: .92rem;
  font-weight: 600;
  color: var(--text-soft);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background var(--t-fast), color var(--t-fast);
}
.subskill-summary::-webkit-details-marker { display: none; }
.subskill-summary::after {
  content: ''; width: 8px; height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--t-fast);
}
details[open] > .subskill-summary::after { transform: rotate(45deg); }
.subskill-summary:hover { background: var(--surface-2); color: var(--text); }
.subskill-summary.active { color: var(--brand-700); background: var(--color-primary-soft); }

.sidebar-lesson-list {
  list-style: none; padding: 4px 0 8px 8px; margin: 0;
  border-left: 1px dashed var(--border);
  margin-left: 14px;
}
.sidebar-lesson-item { position: relative; }
.sidebar-lesson-item a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 8px 14px;
  font-size: .86rem;
  color: var(--text-soft);
  text-decoration: none;
  border-radius: var(--r-sm);
  transition: background var(--t-fast), color var(--t-fast);
}
.sidebar-lesson-item a:hover { background: var(--surface-2); color: var(--text); }
.sidebar-lesson-item.active a {
  background: var(--color-primary-soft);
  color: var(--brand-700);
  font-weight: 600;
}
.sidebar-lesson-item .ll-check { color: var(--brand-600); flex-shrink: 0; }
.sidebar-lesson-item.empty {
  padding: 8px 14px; color: var(--muted); font-style: italic; font-size: .82rem;
}
.sidebar-empty { padding: 12px; color: var(--muted); font-style: italic; }

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 48px 0 28px;
  margin-top: 64px;
}
.site-footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}
.footer-cols {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 40px;
  margin-bottom: 36px;
}
@media (max-width: 768px) { .footer-cols { grid-template-columns: 1fr 1fr; gap: 28px; } }
@media (max-width: 480px) { .footer-cols { grid-template-columns: 1fr; } }
.footer-brand .brand-line {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-head);
  font-weight: 800; font-size: 1.2rem;
  margin-bottom: 12px;
}
.footer-brand p { color: var(--muted); font-size: .9rem; max-width: 320px; }
.footer-col h4 {
  font-size: .82rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin-bottom: 14px; font-weight: 700;
}
.footer-col a,
.footer-logout button {
  display: block; padding: 5px 0;
  color: var(--text-soft); font-size: .93rem; text-decoration: none;
}
.footer-col a:hover,
.footer-logout button:hover { color: var(--brand-700); }
.footer-logout { margin: 0; }
.footer-logout button {
  background: none; border: none; cursor: pointer;
  font-family: inherit; text-align: left;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-copy { color: var(--muted); font-size: .85rem; margin: 0; }
.footer-social { display: flex; gap: 10px; }
.footer-social a {
  width: 36px; height: 36px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  color: var(--muted);
  transition: color var(--t-fast), border-color var(--t-fast);
}
.footer-social a:hover {
  color: var(--brand-600);
  border-color: var(--brand-500);
  background: var(--color-primary-soft);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: -0.005em;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  user-select: none;
  white-space: nowrap;
}
.btn:focus-visible { outline: 3px solid var(--color-primary-soft); outline-offset: 2px; }
.btn-sm { height: 36px; padding: 0 14px; font-size: .85rem; border-radius: var(--r-sm); }
.btn-lg { height: 52px; padding: 0 28px; font-size: 1.02rem; }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--brand-600);
  color: #fff;
  border-color: var(--brand-600);
  box-shadow: 0 1px 2px rgba(6, 95, 70, .25);
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-700);
  border-color: var(--brand-700);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -2px rgba(6, 95, 70, .35);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--text-soft);
  color: var(--text);
}

.btn-ghost { background: transparent; color: var(--text); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-dark { background: var(--gray-900); color: #fff; border-color: var(--gray-900); }
.btn-dark:hover { background: var(--gray-950); border-color: var(--gray-950); color: #fff; }

.btn-outline-primary {
  background: transparent;
  color: var(--brand-700);
  border-color: var(--brand-500);
}
.btn-outline-primary:hover {
  background: var(--brand-50);
  color: var(--brand-800);
}

.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: var(--r-full); }

/* ── Forms ────────────────────────────────────────────────── */
input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input[type="url"], textarea, select {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: .95rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px var(--color-primary-soft);
}
textarea { min-height: 100px; resize: vertical; line-height: 1.55; }
label { display: block; font-weight: 600; font-size: .9rem; color: var(--text); margin-bottom: 6px; }
.form-row { margin-bottom: 16px; }
.help-text, .form-help { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.form-errors, ul.errorlist { color: var(--danger); list-style: none; padding: 0; margin: 6px 0 0; font-size: .85rem; }

form p { margin: 0 0 14px; }
form p label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: 6px; }

/* ── Messages ─────────────────────────────────────────────── */
.messages { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.message {
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: .92rem;
  border: 1px solid var(--border);
  background: var(--surface);
}
.message.success { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-800); }
.message.error   { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.message.warning { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.message.info    { background: #EFF6FF; border-color: #BFDBFE; color: #1E40AF; }
html[data-theme="dark"] .message.error   { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.3); color: #FCA5A5; }
html[data-theme="dark"] .message.warning { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.3); color: #FCD34D; }
html[data-theme="dark"] .message.info    { background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.3); color: #93C5FD; }

/* ── Badge / chip ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  font-size: .73rem;
  font-weight: 600;
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--text-soft);
  letter-spacing: .01em;
  border: 1px solid var(--border);
}
.badge-primary { background: var(--brand-50); color: var(--brand-800); border-color: var(--brand-200); }
.badge-amber { background: #FFFBEB; color: #92400E; border-color: #FDE68A; }
.badge-rose { background: #FEF2F2; color: #9F1239; border-color: #FECDD3; }
.badge-sky { background: #EFF6FF; color: #1E40AF; border-color: #BFDBFE; }
.badge-success { background: var(--brand-50); color: var(--brand-800); border-color: var(--brand-200); }
.badge-dark { background: var(--gray-900); color: #fff; border-color: var(--gray-900); }
.badge-lg { padding: 5px 14px; font-size: .82rem; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-soft);
  border-radius: var(--r-full);
  font-size: .85rem;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  cursor: pointer;
}
.chip:hover { background: var(--surface); border-color: var(--brand-300); color: var(--brand-700); }
.chip.active { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  transition: box-shadow var(--t-base), transform var(--t-base), border-color var(--t-base);
}
.card-elev { box-shadow: var(--shadow-md); border-color: transparent; }
.card-hover:hover { box-shadow: var(--shadow-md); }

/* Course card */
.course-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: transform var(--t-base) var(--ease), box-shadow var(--t-base);
  position: relative;
}
.course-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
  border-color: var(--brand-200);
}
.course-card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--brand-100);
  overflow: hidden;
  flex-shrink: 0;
}
.course-card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .35s var(--ease);
}
.course-card:hover .course-card-thumb img { transform: scale(1.04); }
.course-card-thumb-placeholder {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  font-family: var(--font-head);
  font-size: 3.4rem;
  color: #fff;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: -.04em;
}
.course-card-thumb .play-icon {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(.85);
  opacity: 0;
  width: 56px; height: 56px;
  background: rgba(255,255,255,.95);
  color: var(--brand-700);
  border-radius: 50%;
  display: grid; place-items: center;
  transition: opacity var(--t-base), transform var(--t-base);
}
.course-card:hover .play-icon { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.course-card-badge {
  position: absolute;
  top: 12px; left: 12px;
  background: var(--gray-900);
  color: #fff;
  padding: 4px 10px;
  font-size: .72rem;
  font-weight: 700;
  border-radius: var(--r-sm);
  letter-spacing: .01em;
}
.course-card-badge.featured { background: linear-gradient(135deg, var(--accent-500), var(--accent-600)); }

.course-card-body {
  padding: 16px 16px 18px;
  display: flex; flex-direction: column; gap: 6px;
  flex: 1;
}
.course-card-cat {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  font-weight: 700;
}
.course-card-title {
  font-family: var(--font-head);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.course-card-instructor { font-size: .8rem; color: var(--muted); }
.course-card-rating {
  display: flex; align-items: center; gap: 6px;
  font-size: .82rem;
  color: var(--text);
  font-weight: 600;
}
.course-card-rating .stars-glyphs {
  color: var(--accent-500);
  letter-spacing: 0;
  font-size: .92rem;
}
.course-card-rating .rcount { color: var(--muted); font-weight: 500; }
.course-card-meta {
  display: flex; gap: 10px; align-items: center;
  font-size: .77rem; color: var(--muted);
  margin-top: 2px;
}
.course-card-meta .dot { width: 3px; height: 3px; background: currentColor; border-radius: 50%; opacity: .5; }
.course-card-bottom {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 8px;
}
.course-card-level {
  font-size: .72rem; padding: 2px 8px; border-radius: var(--r-full);
  background: var(--surface-2); color: var(--text-soft);
  font-weight: 600;
}

/* Stars */
.stars-glyphs { color: var(--accent-500); font-size: 1rem; letter-spacing: 1px; }

.star-input { display: inline-flex; flex-direction: row-reverse; gap: 2px; position: relative; }
.star-input input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.star-input label {
  cursor: pointer; font-size: 1.8rem; color: var(--gray-300);
  transition: color var(--t-fast); margin: 0; padding: 0 2px;
}
.star-input label:hover,
.star-input label:hover ~ label,
.star-input input:checked ~ label {
  color: var(--accent-500);
}
.star-input input:focus-visible + label {
  outline: 2px solid var(--brand-500);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Grids */
.card-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card-grid-sm { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card-grid-3 { display: grid; gap: 24px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.home-card-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* Shared entrance animation (tab panels) */
@keyframes rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ── Sections ─────────────────────────────────────────────── */
.section { padding: 64px 0; }
.section-tight { padding: 36px 0; }
.section-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; margin-bottom: 28px;
}
.section-head h2 { font-size: clamp(1.4rem, 1.6vw + .8rem, 2rem); margin: 0; }
.section-head .section-sub { color: var(--muted); font-size: .95rem; margin: 6px 0 0; }
.section-link {
  color: var(--brand-700); font-weight: 600; font-size: .92rem; text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.section-link:hover { gap: 8px; color: var(--brand-800); }

.feature-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}
.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.feature:hover { box-shadow: var(--shadow-md); }
.feature .f-icon {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  background: var(--brand-50);
  color: var(--brand-700);
  border-radius: var(--r-md);
  margin-bottom: 16px;
}
.feature h3 { font-size: 1.1rem; margin-bottom: 8px; }
.feature p { color: var(--text-soft); font-size: .92rem; margin: 0; }

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.cat-card {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 10px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  transition: transform var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}
.cat-card::after {
  content: ''; position: absolute; right: -28px; bottom: -28px;
  width: 100px; height: 100px;
  background: var(--brand-100);
  border-radius: 50%;
  opacity: .35;
  transition: transform var(--t-base);
}
.cat-card:hover { border-color: var(--brand-300); box-shadow: var(--shadow-md); }
.cat-card:hover::after { transform: scale(1.4); }
/* Per-category accent so the cards read as distinct, not identical. The card
   carries a cat-<color> class (from Category.color); the icon tint derives from
   one --cat-color var, with a translucent chip that works in light and dark. */
.cat-card { --cat-color: var(--brand-600); }
.cat-card.cat-emerald { --cat-color: #059669; }
.cat-card.cat-sky     { --cat-color: #0284C7; }
.cat-card.cat-violet  { --cat-color: #7C3AED; }
.cat-card.cat-amber   { --cat-color: #D97706; }
.cat-card.cat-slate   { --cat-color: #475569; }
.cat-card.cat-rose    { --cat-color: #E11D48; }
.cat-card.cat-indigo  { --cat-color: #4F46E5; }
.cat-card .c-icon {
  width: 44px; height: 44px;
  background: color-mix(in srgb, var(--cat-color) 14%, transparent);
  color: var(--cat-color);
  border-radius: var(--r-md);
  display: grid; place-items: center;
  position: relative; z-index: 1;
}
.cat-card .c-name {
  font-family: var(--font-head);
  font-weight: 700; font-size: 1rem; line-height: 1.2;
  position: relative; z-index: 1;
}
.cat-card .c-meta { font-size: .8rem; color: var(--muted); position: relative; z-index: 1; }

.cta-banner {
  background: var(--brand-700);
  color: #fff;
  border-radius: var(--r-xl);
  padding: 56px 48px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 28px;
  align-items: center;
  overflow: hidden;
  position: relative;
}
.cta-banner h2 { color: #fff; font-size: clamp(1.4rem, 1.6vw + .8rem, 2rem); margin: 0 0 8px; }
.cta-banner p { color: rgba(255,255,255,.85); margin: 0; max-width: 520px; }
.cta-banner .cta-actions { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; position: relative; }
.cta-banner .btn-white { background: #fff; color: var(--brand-800); border-color: #fff; }
.cta-banner .btn-white:hover { background: var(--brand-50); color: var(--brand-900); }
@media (max-width: 768px) {
  .cta-banner { grid-template-columns: 1fr; padding: 36px 24px; }
  .cta-banner .cta-actions { justify-content: flex-start; }
}

.testi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
}
.testi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
}
.testi-quote { font-size: .94rem; color: var(--text-soft); line-height: 1.6; margin-bottom: 14px; }
.testi-rating { color: var(--accent-500); font-size: .9rem; margin-bottom: 8px; }
.testi-user { display: flex; gap: 10px; align-items: center; }
.testi-user .name { font-weight: 600; font-size: .9rem; }
.testi-user .course { font-size: .78rem; color: var(--muted); }

/* ── Breadcrumb ───────────────────────────────────────────── */
.breadcrumb {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-soft); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand-700); }
.breadcrumb .sep { opacity: .5; }

/* ── Filter bar ───────────────────────────────────────────── */
.filter-toolbar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.filter-toolbar .filter-label {
  font-size: .82rem;
  color: var(--muted);
  font-weight: 600;
  margin-right: 4px;
}
.filter-toolbar .chip { padding: 6px 12px; font-size: .85rem; }
.filter-toolbar .sort-select {
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: .85rem;
  cursor: pointer;
  min-width: 150px;
  margin-left: auto;
}

/* ── Course Detail ─────────────────────────────────────────── */
.course-hero {
  /* Theme-adaptive hero: light by default (daytime), dark overridden below.
     All hero text reads from these --ch-* vars so both modes stay legible. */
  --ch-bg: var(--brand-100);
  --ch-text: var(--gray-900);
  --ch-text-soft: var(--gray-700);
  --ch-mute: var(--gray-500);
  --ch-link: var(--brand-700);
  --ch-stars: var(--accent-500);
  background: var(--ch-bg);
  color: var(--ch-text-soft);
  padding: 48px 0 56px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}
html[data-theme="dark"] .course-hero {
  --ch-bg: #0F1E18;
  --ch-text: #fff;
  --ch-text-soft: rgba(255,255,255,.78);
  --ch-mute: rgba(255,255,255,.65);
  --ch-link: #fff;
  --ch-stars: var(--accent-300);
}
.course-hero-inner {
  position: relative;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 40px;
  align-items: flex-start;
}
@media (max-width: 960px) { .course-hero-inner { grid-template-columns: 1fr; } }
.course-hero h1 {
  color: var(--ch-text);
  font-size: clamp(1.6rem, 1.9vw + 1rem, 2.5rem);
  margin-bottom: 12px;
}
.course-hero .ch-subtitle {
  color: var(--ch-text-soft);
  font-size: 1.05rem;
  line-height: 1.55;
  margin-bottom: 18px;
  max-width: 640px;
}
.course-hero .breadcrumb { color: var(--ch-mute); margin-bottom: 12px; }
.course-hero .breadcrumb a { color: var(--ch-text-soft); }
.course-hero .ch-meta {
  display: flex; gap: 20px; flex-wrap: wrap; align-items: center;
  color: var(--ch-text-soft); font-size: .9rem;
}
.course-hero .ch-meta .meta-num { color: var(--ch-text); font-weight: 700; margin-right: 4px; }
.course-hero .ch-meta .stars-glyphs { color: var(--ch-stars); margin-right: 4px; }
.course-hero .ch-meta .meta-soft { color: var(--ch-mute); }
.course-hero .ch-instructor {
  display: flex; gap: 10px; align-items: center;
  color: var(--ch-text-soft);
  font-size: .92rem;
  margin-top: 14px;
}
.course-hero .ch-instructor strong { color: var(--ch-text); }
.course-hero .ch-instructor a { color: var(--ch-link); }

.enroll-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: calc(var(--nav-h) + 20px);
  color: var(--text);
}
.enroll-card .ec-thumb { aspect-ratio: 16 / 9; background: var(--gray-200); overflow: hidden; }
.enroll-card .ec-thumb img { width: 100%; height: 100%; object-fit: cover; }
.enroll-card .ec-body { padding: 22px; }
.enroll-card .ec-cta { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.enroll-card .ec-features { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.enroll-card .ec-features li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 0;
  color: var(--text-soft);
}
.enroll-card .ec-features li svg, .enroll-card .ec-features li .ec-i { color: var(--brand-600); flex-shrink: 0; }
.enroll-card .ec-share {
  display: flex; justify-content: center; gap: 10px;
  border-top: 1px solid var(--border-light);
  padding-top: 14px; margin-top: 14px;
}
.enroll-card .ec-share a {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
}
.enroll-card .ec-share a:hover { color: var(--brand-700); border-color: var(--brand-500); }

@media (max-width: 960px) {
  .enroll-card { position: relative; top: auto; }
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}
.tabs button, .tabs a {
  position: relative;
  background: transparent;
  border: none;
  padding: 14px 18px;
  font-weight: 600;
  font-size: .95rem;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: color var(--t-fast);
}
.tabs button:hover, .tabs a:hover { color: var(--text); }
.tabs button.active, .tabs a.active { color: var(--text); }
.tabs button.active::after, .tabs a.active::after {
  content: '';
  position: absolute;
  left: 14px; right: 14px;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--brand-600);
}

.tab-panel { display: none; animation: rise .25s var(--ease-out); }
.tab-panel.active { display: block; }
[data-tabs] .tab-panel:not(.active) { display: none; }

.learn-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 32px;
}
.learn-card h2 { font-size: 1.2rem; margin-bottom: 16px; }
.learn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px 24px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.learn-grid li {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: .92rem;
  color: var(--text-soft);
  line-height: 1.5;
}
.learn-grid li::before {
  content: '';
  width: 18px; height: 18px;
  background: var(--brand-100) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23047857' d='M13.485 4.515a1 1 0 010 1.415l-6.5 6.5a1 1 0 01-1.415 0l-3-3a1 1 0 011.415-1.415L6.28 10.32l5.79-5.805a1 1 0 011.415 0z'/%3E%3C/svg%3E") center / 12px no-repeat;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}

.req-list { list-style: none; padding: 0; margin: 0; }
.req-list li {
  padding: 6px 0 6px 24px;
  position: relative;
  color: var(--text-soft);
}
.req-list li::before {
  content: '•';
  position: absolute;
  left: 8px;
  color: var(--brand-600);
  font-weight: 700;
}

/* Reviews */
.review-summary {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  padding: 20px 0;
}
@media (max-width: 640px) { .review-summary { grid-template-columns: 1fr; } }
.review-score .big {
  font-family: var(--font-head);
  font-size: 3.4rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.review-score .stars-glyphs { font-size: 1.2rem; }
.review-score .rscount { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.review-bars { display: flex; flex-direction: column; gap: 6px; }
.review-bar { display: flex; align-items: center; gap: 10px; font-size: .82rem; color: var(--muted); }
.review-bar .label { width: 28px; }
.review-bar .stars-glyphs { font-size: .8rem; min-width: 80px; }
.review-bar .track {
  flex: 1; height: 6px; border-radius: 3px;
  background: var(--surface-3); overflow: hidden;
}
.review-bar .fill { height: 100%; background: var(--accent-500); border-radius: 3px; }

.review-list { display: flex; flex-direction: column; gap: 18px; }
.review {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border-light);
}
.review:last-child { border-bottom: none; }
.review-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.review-name { font-weight: 700; font-size: .95rem; color: var(--text); }
.review-date { font-size: .8rem; color: var(--muted); }
.review .stars-glyphs { font-size: .92rem; }
.review-text { color: var(--text-soft); font-size: .94rem; line-height: 1.55; margin-top: 4px; }

.review-form-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  margin-bottom: 18px;
}
.review-form-wrap h3 { font-size: 1rem; margin-bottom: 12px; }
.review-form-wrap .review-textarea { min-height: 90px; }

/* ── Module accordion ─────────────────────────────────────── */
.curriculum { margin-bottom: 32px; }
.curriculum-summary {
  display: flex; gap: 14px; align-items: center;
  color: var(--muted); font-size: .9rem;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.module-accordion { display: flex; flex-direction: column; gap: 10px; }
.module-block {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--t-fast);
}
.module-block[open] { border-color: var(--brand-200); }
.module-summary {
  cursor: pointer;
  list-style: none;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  transition: background var(--t-fast);
}
.module-summary::-webkit-details-marker { display: none; }
.module-summary::before {
  content: '';
  width: 10px; height: 10px;
  border-right: 2px solid var(--text-soft);
  border-bottom: 2px solid var(--text-soft);
  transform: rotate(-45deg);
  transition: transform var(--t-fast);
  flex-shrink: 0;
}
details[open] > .module-summary::before { transform: rotate(45deg); }
.module-summary:hover { background: var(--surface-2); }
.module-summary-left { flex: 1; min-width: 0; }
.module-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  display: block;
}
.module-desc { display: block; color: var(--muted); font-size: .85rem; margin-top: 4px; }
.module-summary-right {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
  font-size: .82rem; color: var(--muted);
  flex-shrink: 0;
}
.module-progress-row { display: flex; gap: 10px; align-items: center; }
.module-progress-bar {
  width: 110px; height: 6px;
  background: var(--surface-3);
  border-radius: 3px; overflow: hidden;
}
.module-progress-fill { height: 100%; background: var(--brand-500); border-radius: 3px; transition: width .3s ease; }
.module-percent { font-weight: 700; color: var(--text); font-size: .82rem; min-width: 38px; text-align: right; }
.module-duration { font-size: .8rem; color: var(--muted); }
@media (max-width: 600px) {
  .module-progress-bar { width: 70px; }
  .module-summary { padding: 14px 16px; gap: 12px; }
}

.module-lesson-list { list-style: none; padding: 6px 16px 18px; margin: 0; }
.module-lesson-item { border-radius: var(--r-sm); transition: background var(--t-fast); }
.module-lesson-item a {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--r-sm);
}
.module-lesson-item a:hover { background: var(--surface-2); }
.lesson-status {
  display: inline-grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
}
.module-lesson-item.completed .lesson-status {
  background: var(--brand-600);
  color: #fff;
  border-color: var(--brand-600);
}
.lesson-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lesson-title { font-weight: 500; font-size: .93rem; line-height: 1.3; }
.lesson-duration { font-size: .78rem; color: var(--muted); }
.module-lesson-item.completed .lesson-title { color: var(--muted); }

/* ── Lesson Detail ────────────────────────────────────────── */
.lesson-main {
  max-width: 960px;
  margin: 0 auto;
  min-width: 0;
}
.video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.video-wrapper iframe, #yt-player {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}

/* ── Custom video player chrome (.vp) ─────────────────────
   The iframe never receives pointer events and loads with controls=0, so
   YouTube's own chrome (title/channel/gradient) stays asleep; every control
   below talks to the player through the IFrame API instead. */
.vp iframe { pointer-events: none; }
.vp svg[hidden] { display: none; }  /* base `svg{display:block}` must not beat [hidden] */
.vp-gesture { position: absolute; inset: 0; z-index: 1; }
.vp.vp-idle { cursor: none; }

.vp-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  padding: 4px 12px 8px;
  display: flex; flex-direction: column; gap: 2px;
  background: rgba(8, 15, 13, .82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity .18s ease;
}
.vp.vp-idle .vp-bar { opacity: 0; pointer-events: none; }

.vp-controls { display: flex; align-items: center; gap: 8px; }
.vp-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: #fff; flex: none;
  transition: background .12s;
}
.vp-btn:hover { background: rgba(255, 255, 255, .14); }
.vp-btn svg { width: 19px; height: 19px; }
.vp-rate {
  width: auto; min-width: 34px; padding: 0 9px;
  font-family: var(--font-mono); font-size: .84rem; font-weight: 600;
}
.vp-time {
  color: rgba(255, 255, 255, .85);
  font-family: var(--font-mono); font-size: .8rem;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.vp-spacer { flex: 1; }

.vp-seek, .vp-vol {
  -webkit-appearance: none; appearance: none;
  height: 14px; margin: 0; background: transparent; cursor: pointer;
}
.vp-seek { width: 100%; }
.vp-vol { width: 68px; flex: none; }
.vp-seek::-webkit-slider-runnable-track, .vp-vol::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right,
    var(--brand-500) var(--vp-progress, 0%),
    rgba(255, 255, 255, .28) var(--vp-progress, 0%));
}
.vp-seek::-webkit-slider-thumb, .vp-vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px; margin-top: -4px;
  border: 0; border-radius: 50%; background: var(--brand-400);
}
.vp-seek::-moz-range-track, .vp-vol::-moz-range-track {
  height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .28);
}
.vp-seek::-moz-range-progress, .vp-vol::-moz-range-progress {
  height: 4px; border-radius: 2px; background: var(--brand-500);
}
.vp-seek::-moz-range-thumb, .vp-vol::-moz-range-thumb {
  width: 12px; height: 12px; border: 0; border-radius: 50%;
  background: var(--brand-400);
}

.vp-poster { position: absolute; inset: 0; z-index: 4; padding: 0; border: 0; background: #000; cursor: pointer; }
.vp-poster img { width: 100%; height: 100%; object-fit: cover; }
.vp-bigplay {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 76px; height: 76px; border: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-600); color: #fff;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
  transition: background .15s ease, transform .15s ease;
}
.vp-poster:hover .vp-bigplay { background: var(--brand-500); transform: translate(-50%, -50%) scale(1.06); }
.vp-bigplay svg { width: 30px; height: 30px; margin-left: 4px; }

.vp-end {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 15, 13, .92);
}
.vp-end[hidden] { display: none; }
.vp-end-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; padding: 16px; }

.vp-spinner {
  position: absolute; inset: 0; z-index: 6;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.vp-spinner[hidden] { display: none; }
.vp-spinner-ring {
  width: 46px; height: 46px; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, .25);
  border-top-color: var(--brand-400);
  animation: vp-spin .8s linear infinite;
}
@keyframes vp-spin { to { transform: rotate(360deg); } }
.vp.vp-loading .vp-bigplay { opacity: 0; }

.vp:fullscreen { border-radius: 0; }
.vp-fs-fallback {
  position: fixed !important; inset: 0; z-index: 1200;
  border-radius: 0; aspect-ratio: auto;
}

@media (max-width: 640px) {
  .vp-vol { display: none; }
  .vp-bar { padding: 2px 8px 6px; }
  .vp-btn { width: 30px; height: 30px; }
  .vp-bigplay { width: 60px; height: 60px; }
  .vp-bigplay svg { width: 24px; height: 24px; }
}

.lesson-title-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 22px 0 10px;
}
.lesson-title-row h1 {
  font-size: clamp(1.3rem, 1vw + 1rem, 1.7rem);
  margin: 0;
}

.complete-section {
  margin-top: 18px;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.completed-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  background: var(--brand-50);
  color: var(--brand-800);
  border-radius: var(--r-full);
  font-weight: 600;
  font-size: .9rem;
  border: 1px solid var(--brand-200);
  margin: 0;
}

.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.lesson-nav .ln-btn {
  flex: 1;
  min-width: 240px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: auto;
  padding: 12px 16px;
  align-items: flex-start;
}
.lesson-nav .ln-btn.ln-next { text-align: right; align-items: flex-end; }
.lesson-nav .ln-btn .ln-meta { font-size: .72rem; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.lesson-nav .ln-btn .ln-title { font-weight: 700; font-size: .95rem; color: var(--text); white-space: normal; overflow-wrap: anywhere; }

/* Notes (now lives inside a tab panel) */
.note-textarea {
  width: 100%;
  min-height: 220px;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: .9rem;
  color: var(--text);
  resize: vertical;
  line-height: 1.5;
}
.note-textarea:focus {
  outline: none; border-color: var(--brand-500);
  box-shadow: 0 0 0 4px var(--color-primary-soft);
  background: var(--surface);
}
.note-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.note-status { font-size: .82rem; color: var(--muted); }
.note-status.note-status-ok { color: var(--brand-700); }
.note-status.note-status-error { color: var(--danger); }
.note-preview { margin-bottom: 14px; }
.note-hidden { display: none !important; }

.ld-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  margin-top: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.ld-tabs::-webkit-scrollbar { display: none; }
.ld-tabs button {
  background: transparent;
  border: none;
  padding: 12px 16px;
  font-weight: 600;
  font-size: .92rem;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  white-space: nowrap;
}
.ld-tabs button.active { color: var(--text); }
.ld-tabs button.active::after {
  content: '';
  position: absolute; left: 12px; right: 12px; bottom: -1px;
  height: 2px; background: var(--brand-600); border-radius: 2px;
}
.ld-panel { padding: 20px 0; display: none; }
.ld-panel.active { display: block; }

/* ── Markdown ─────────────────────────────────────────────── */
.md-content { line-height: 1.65; color: var(--text-soft); }
.md-content h1, .md-content h2, .md-content h3, .md-content h4 { color: var(--text); margin-top: 1.4em; }
.md-content h2 { font-size: 1.4rem; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.md-content h3 { font-size: 1.15rem; }
.md-content p { margin: 0 0 1em; }
.md-content a { color: var(--brand-700); text-decoration: underline; text-underline-offset: 3px; }
.md-content ul, .md-content ol { padding-left: 1.4em; margin: 0 0 1em; }
.md-content li { margin-bottom: .35em; }
.md-content blockquote {
  border-left: 3px solid var(--brand-400);
  padding: .4em 1em;
  margin: 1em 0;
  background: var(--brand-50);
  color: var(--text-soft);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.md-content code {
  font-family: var(--font-mono);
  background: var(--surface-3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .9em;
  color: var(--text);
}
.md-content pre {
  background: var(--gray-950);
  color: #F3F4F6;
  padding: 16px 18px;
  border-radius: var(--r-md);
  overflow-x: auto;
  margin: 1em 0;
  font-size: .88em;
  line-height: 1.55;
}
.md-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}
.md-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  font-size: .92em;
  display: block;
  overflow-x: auto;
}
.md-content { overflow-wrap: anywhere; }
.md-content th, .md-content td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}
.md-content th { background: var(--surface-2); font-weight: 600; }
.md-content img { border-radius: var(--r-md); margin: 1em 0; }

/* ── Dashboard ────────────────────────────────────────────── */
.dashboard-hero {
  background: var(--brand-700);
  color: #fff;
  border-radius: var(--r-xl);
  padding: 32px;
  margin-bottom: 28px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.dashboard-hero .welcome {
  font-family: var(--font-head);
  font-size: 1.7rem; font-weight: 800; line-height: 1.1;
  margin: 0 0 4px;
  color: #fff;
}
.dashboard-hero .welcome-sub { color: rgba(255,255,255,.85); font-size: .95rem; }
.dashboard-hero .avatar { box-shadow: 0 0 0 4px rgba(255,255,255,.2); }
.dashboard-hero .dh-stats { display: flex; gap: 32px; position: relative; }
.dashboard-hero .dh-stat .num { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.dashboard-hero .dh-stat .lab { font-size: .78rem; color: rgba(255,255,255,.8); margin-top: 3px; }
@media (max-width: 768px) {
  .dashboard-hero { grid-template-columns: 1fr; padding: 24px; }
  .dashboard-hero .dh-stats { gap: 18px; flex-wrap: wrap; }
}

.profile-container { max-width: 1100px; margin: 0 auto; }

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
}
.stat-tile .stat-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-700);
  border-radius: var(--r-md);
  margin-bottom: 12px;
}
.stat-tile .stat-num {
  font-family: var(--font-head);
  font-size: 1.7rem; font-weight: 800; color: var(--text);
  line-height: 1;
}
.stat-tile .stat-lab { font-size: .85rem; color: var(--muted); margin-top: 4px; }

.profile-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  margin-bottom: 22px;
}
.profile-section > h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 10px;
}
.profile-section > h2 svg { color: var(--brand-600); }
@media (max-width: 640px) { .profile-section { padding: 22px 18px; } }

.streak-banner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 12px;
  margin-bottom: 24px;
}
@media (max-width: 640px) {
  .streak-banner { grid-template-columns: 1fr 1fr; gap: 8px; padding: 16px 8px; }
}
.streak-item {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 14px;
  border-right: 1px solid var(--border-light);
  justify-content: center;
}
.streak-item:last-child { border-right: none; }
@media (max-width: 640px) { .streak-item { border-right: none; justify-content: flex-start; } }
.streak-number { font-size: 1.45rem; font-weight: 800; color: var(--text); line-height: 1; font-family: var(--font-head); }
.streak-label { font-size: .76rem; color: var(--muted); margin-top: 3px; }
.streak-divider { display: none; }

.activity-graph { overflow-x: auto; padding-bottom: .5rem; }
.activity-weeks { display: flex; gap: 3px; }
.activity-week { display: flex; flex-direction: column; gap: 3px; }
.activity-cell {
  width: 13px; height: 13px;
  border-radius: 2px;
  cursor: pointer;
  transition: opacity .15s;
}
.activity-cell:hover { opacity: .75; }
.activity-empty { background: transparent; cursor: default; }
.level-0 { background: var(--surface-3); }
.level-1 { background: var(--brand-200); }
.level-2 { background: var(--brand-400); }
.level-3 { background: var(--brand-600); }
.level-4 { background: var(--brand-800); }
.activity-legend {
  display: flex; align-items: center; gap: 4px;
  margin-top: .8rem;
  justify-content: flex-end;
}
.legend-label { font-size: .75rem; color: var(--muted); }
.legend-cell { width: 13px; height: 13px; border-radius: 2px; }
.activity-tooltip {
  position: fixed;
  background: var(--gray-950); color: #fff;
  font-size: .78rem;
  padding: .4rem .7rem;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 1000;
  white-space: nowrap;
}
.activity-tooltip.visible { opacity: 1; }

.continue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.continue-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  gap: 10px;
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.continue-card:hover { box-shadow: var(--shadow-md); border-color: var(--brand-200); }
.continue-card .cc-title {
  font-family: var(--font-head);
  font-weight: 700; font-size: 1rem; color: var(--text);
  text-decoration: none;
}
.continue-card .cc-meta { font-size: .8rem; color: var(--muted); }
.progress-bar-track {
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--brand-500);
  border-radius: 3px;
  transition: width .3s ease;
  min-width: 2%;
}

.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.cert-card {
  background: var(--color-primary-soft);
  border: 1px solid var(--brand-200);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex; flex-direction: column; gap: 6px;
  position: relative;
  text-decoration: none;
  color: var(--text);
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.cert-card:hover { box-shadow: var(--shadow-md); }
.cert-card .cert-medal {
  width: 36px; height: 36px;
  background: var(--brand-600); color: #fff;
  border-radius: 50%;
  display: grid; place-items: center;
  margin-bottom: 4px;
}
.cert-card .cert-course { font-weight: 700; font-size: .98rem; color: var(--text); }
.cert-card .cert-meta { font-size: .8rem; color: var(--muted); }

/* ── Login ────────────────────────────────────────────────── */
.login-box {
  max-width: 440px;
  margin: 40px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 36px 32px;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.login-box .login-logo {
  display: inline-grid; place-items: center;
  width: 56px; height: 56px;
  background: var(--brand-600);
  color: #fff;
  border-radius: var(--r-lg);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.login-box h1 { font-size: 1.5rem; margin-bottom: 8px; }
.login-box .login-sub { color: var(--muted); font-size: .92rem; margin-bottom: 24px; }
.login-box .tg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: #0088CC;
  color: white;
  padding: 13px 16px;
  text-decoration: none;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 1rem;
  box-sizing: border-box;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.login-box .tg-btn:hover { background: #0077B5; color: #fff; transform: translateY(-1px); box-shadow: 0 6px 14px -4px rgba(0,136,204,.5); }
.tg-note { font-size: .85em; color: var(--muted); margin-top: 14px; }
.tg-spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--brand-600);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 14px auto 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Alternative login methods — collapsed by default behind <details> */
.login-alt {
  margin-top: 22px;
  text-align: center;
}
.login-alt > summary {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer;
  font-size: .85rem; font-weight: 600;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: var(--r-md);
  list-style: none;
  transition: color var(--t-fast);
}
.login-alt > summary::-webkit-details-marker { display: none; }
.login-alt > summary:hover { color: var(--brand-600); }
.login-alt > summary::after {
  content: '';
  width: 8px; height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--t-fast);
}
.login-alt[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.login-alt-body { margin-top: 18px; text-align: left; }
.login-alt-label {
  font-size: .8rem; font-weight: 600; color: var(--text-soft);
  margin-bottom: 8px; letter-spacing: .02em;
}
.login-alt-hint {
  font-size: .82rem; color: var(--muted);
  margin-bottom: 12px; line-height: 1.5;
}
.login-alt-hint a { color: var(--brand-600); font-weight: 600; }
.login-code-form {
  display: flex; gap: 8px; align-items: stretch;
}
.login-code-input {
  flex: 1;
  font-family: var(--font-mono, monospace);
  font-size: 1.4rem; font-weight: 700; letter-spacing: .18em; text-align: center;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  transition: border-color var(--t-fast);
  min-width: 0;
}
.login-code-input:focus { outline: none; border-color: var(--brand-500); }
.login-code-input::placeholder { color: var(--text-soft); letter-spacing: .18em; font-weight: 500; }
.login-code-submit { flex: 0 0 auto; padding-left: 18px; padding-right: 18px; }
.login-code-error { margin-top: 10px; text-align: left; }
.login-alt-sep {
  border: none; border-top: 1px solid var(--border);
  margin: 22px 0 18px;
}
.login-pwd-form { display: flex; flex-direction: column; gap: 8px; }
.login-pwd-form .form-input { width: 100%; }
.login-pwd-submit { margin-top: 2px; }
.login-forgot { margin-top: 14px; margin-bottom: 0; }
.login-form { text-align: left; margin-top: 8px; }
.ps-text { color: var(--text-soft); font-size: .92rem; margin-bottom: 14px; }

/* ── Certificate ─────────────────────────────────────────── */
.certificate-page { background: var(--gray-100); padding: 40px 16px; min-height: calc(100vh - var(--nav-h)); }
.cert-paper {
  max-width: 900px;
  margin: 0 auto;
  background:
    radial-gradient(130% 90% at 50% -10%, rgba(16, 185, 129, .07), transparent 55%),
    #fff;
  border: 1px solid var(--brand-100);
  box-shadow: var(--shadow-xl);
  padding: 54px 64px 46px;
  border-radius: var(--r-lg);
  position: relative;
  text-align: center;
  color: var(--gray-900);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
/* double frame: emerald line + amber hairline */
.cert-paper::before {
  content: '';
  position: absolute;
  inset: 14px;
  border: 2px solid var(--brand-500);
  border-radius: 13px;
  pointer-events: none;
}
.cert-paper::after {
  content: '';
  position: absolute;
  inset: 19px;
  border: 1px solid var(--accent-500);
  border-radius: 9px;
  opacity: .5;
  pointer-events: none;
}
/* corner ticks on the inner frame */
.cert-corner {
  position: absolute;
  width: 17px; height: 17px;
  border: 2.5px solid var(--brand-600);
  z-index: 1;
  pointer-events: none;
}
.cert-corner.cc-tl { top: 24px; left: 24px; border-right: 0; border-bottom: 0; }
.cert-corner.cc-tr { top: 24px; right: 24px; border-left: 0; border-bottom: 0; }
.cert-corner.cc-bl { bottom: 24px; left: 24px; border-right: 0; border-top: 0; }
.cert-corner.cc-br { bottom: 24px; right: 24px; border-left: 0; border-top: 0; }
/* medallion seal */
.cert-seal {
  position: relative; z-index: 1;
  width: 78px; height: 78px; margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--brand-600);
  border: 3px solid var(--accent-400, #FBBF24);
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 10px 22px rgba(5, 150, 105, .32);
}
.cert-seal svg { width: 38px; height: 38px; }
.cert-paper .cert-eyebrow {
  position: relative; z-index: 1;
  font-size: .76rem; text-transform: uppercase; letter-spacing: .22em;
  color: var(--brand-700); font-weight: 700;
  margin-bottom: 10px;
}
.cert-paper .cert-h1 {
  position: relative; z-index: 1;
  font-family: var(--font-head);
  font-size: clamp(1.9rem, 3.4vw, 2.7rem);
  letter-spacing: -.01em;
  margin-bottom: 14px;
  color: var(--gray-900);
}
.cert-divider {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 0 auto 22px;
}
.cert-divider i { display: block; height: 1.5px; width: 64px; background: var(--brand-300); }
.cert-divider span { width: 8px; height: 8px; transform: rotate(45deg); background: var(--accent-500); border-radius: 1px; }
.cert-paper .cert-body {
  position: relative; z-index: 1;
  font-size: 1.04rem; color: var(--gray-600);
  max-width: 600px; margin: 0 auto 16px; line-height: 1.6;
}
.cert-paper .cert-name {
  position: relative; z-index: 1;
  font-family: var(--font-head);
  font-size: clamp(2rem, 4.2vw, 3rem);
  font-weight: 800; letter-spacing: -.01em;
  color: var(--brand-700);
  margin: 6px 0 12px;
}
.cert-paper .cert-name::after {
  content: ''; display: block;
  width: 96px; height: 3px; margin: 12px auto 0;
  background: var(--accent-500); border-radius: 2px;
}
.cert-paper .cert-course-line { margin-bottom: 30px; }
.cert-paper .cert-course-name { font-weight: 700; color: var(--brand-800); }
@media (max-width: 640px) {
  .certificate-page { padding: 20px 10px; }
  .cert-paper { padding: 36px 22px 30px; }
  .cert-paper::before { inset: 8px; }
  .cert-paper::after { inset: 12px; }
  .cert-paper .cert-h1, .cert-paper .cert-name, .cert-paper .cert-course-name { overflow-wrap: anywhere; }
  .cert-paper .cert-h1 { font-size: 1.6rem; }
  .cert-paper .cert-name { font-size: 1.5rem; }
}
.cert-meta-row {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-top: 28px; gap: 20px; flex-wrap: wrap; text-align: left;
}
.cert-sig { min-width: 170px; }
.cert-sig-line { width: 190px; border-top: 1.5px solid var(--gray-400); margin-bottom: 6px; }
.cert-sig-name { font-family: var(--font-head); font-weight: 700; color: var(--gray-800); font-size: .98rem; }
.cert-sig-role { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; margin-top: 2px; }
.cert-rosette { display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--brand-700); }
.cert-rosette svg { width: 38px; height: 38px; }
.cert-rosette span { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; }
.cert-verify { text-align: right; min-width: 170px; }
.cert-verify .cert-code { font-family: var(--font-mono, ui-monospace), monospace; font-size: .9rem; color: var(--gray-700); font-weight: 600; }
.cert-verify .cert-date { font-size: .76rem; color: var(--muted); margin-top: 3px; }
.cert-actions {
  max-width: 980px; margin: 24px auto 0;
  display: flex; gap: 12px; justify-content: center;
  flex-wrap: wrap;
}
@media print {
  .navbar, .site-footer, .cert-actions, .mobile-drawer { display: none !important; }
  /* The screen layout forces wrappers to ~full viewport height
     (min-height: 100vh - nav). When printing, 100vh is a whole sheet, so that
     forced height pushed the certificate's bottom row (signature/code/date) onto
     a 2nd page. Collapse those heights and keep the certificate on one page. */
  html, body { height: auto !important; background: #fff !important; }
  .layout, main.content, main.content-full {
    min-height: 0 !important; height: auto !important; padding: 0 !important; animation: none !important;
    background: #fff !important;
  }
  .certificate-page { background: #fff !important; padding: 0; min-height: 0 !important; }
  .cert-paper, .cert-card {
    box-shadow: none !important;
    margin: 0 auto; max-width: 100%;
    break-inside: avoid; page-break-inside: avoid;
    print-color-adjust: exact; -webkit-print-color-adjust: exact;
  }
  .cert-paper { padding: 40px 56px 34px; }
  .cert-seal { margin-bottom: 12px; box-shadow: none !important; }
  .cert-paper .cert-h1 { margin-bottom: 12px; }
  .cert-paper .cert-body { margin-bottom: 14px; }
  .cert-divider { margin-bottom: 18px; }
  .cert-paper .cert-course-line { margin-bottom: 24px; }
  .cert-meta-row { margin-top: 24px; break-inside: avoid; }
  @page { margin: 12mm; }
}

/* ── Empty states ─────────────────────────────────────────── */
.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
}
.empty-state .es-icon {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  background: var(--surface-2);
  color: var(--muted);
  border-radius: var(--r-md);
  display: grid; place-items: center;
}
.empty-state h3 { color: var(--text); margin-bottom: 8px; }
.empty-state p { color: var(--muted); margin-bottom: 16px; }
.empty-message { color: var(--muted); padding: 32px 0; text-align: center; }

/* ── Search results ───────────────────────────────────────── */
.search-page h1 { margin-bottom: 6px; }
.search-page .sr-meta { color: var(--muted); margin-bottom: 22px; }
.search-section { margin-top: 22px; }
.search-section h2 { font-size: 1.1rem; margin-bottom: 12px; }
.search-lesson-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-bottom: 8px;
  text-decoration: none;
  color: var(--text);
  gap: 16px;
}
.search-lesson-row:hover { border-color: var(--brand-300); background: var(--surface-2); }
.search-lesson-row .sl-course { font-size: .8rem; color: var(--muted); }

/* ── Toast ────────────────────────────────────────────────── */
.lesson-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 12px 22px;
  border-radius: var(--r-md);
  color: #fff; font-size: .9rem;
  z-index: 9999;
  animation: toast-in .3s ease;
  box-shadow: var(--shadow-lg);
}
.lesson-toast-error   { background: var(--danger); }
.lesson-toast-warning { background: var(--warning); }
.lesson-toast-info    { background: var(--info); }
.lesson-toast-success { background: var(--brand-600); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Admin panel ──────────────────────────────────────────── */
.admin-shell { display: grid; gap: 24px; max-width: 1100px; margin: 0 auto; }
.admin-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.admin-tab {
  padding: 12px 18px;
  background: transparent;
  border: none;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.admin-tab.active, .admin-tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--brand-600);
}
.admin-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
}
.admin-section h2 { font-size: 1.1rem; margin-bottom: 14px; }

/* ── Utility classes ──────────────────────────────────────── */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.hidden { display: none !important; }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mt-5 { margin-top: 48px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .75rem; }
.font-bold { font-weight: 700; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ── Course list / category description (shared) ───────────── */
.lesson-list { list-style: none; padding: 0; margin: 0; }
.description { color: var(--muted); margin-bottom: 24px; }

/* Print */
@media print {
  .no-print { display: none !important; }
}

/* ============================================================
   Ochiq Kurs — v2.1 polish: pro hero, catalog page,
   wishlist, my-learning, leaderboard, Q&A, resources
   ============================================================ */

/* ── Hero Pro ─────────────────────────────────────────────── */
.hero-pro {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  padding: 56px 24px 64px;
}
.hero-pro-inner {
  position: relative;
  max-width: var(--container-wide);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 48px;
  align-items: center;
}
.hero-pro-left { min-width: 0; }
.hero-pro-title {
  font-size: clamp(2rem, 3.2vw + 1rem, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.06;
  margin: 14px 0 18px;
}
.hero-pro-title .accent {
  color: var(--brand-600);
}
.hero-pro-sub {
  font-size: 1.1rem;
  color: var(--text-soft);
  max-width: 560px;
  margin: 0 0 28px;
}

.hero-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 6px 6px 6px 18px;
  max-width: 580px;
  box-shadow: var(--shadow-lg);
}
.hero-search .hs-icon { color: var(--muted); flex-shrink: 0; }
.hero-search input {
  flex: 1; min-width: 0;
  border: 0; background: transparent;
  padding: 14px 0;
  color: var(--text);
  outline: none;
  font-size: 1rem;
}
.hero-search input::placeholder { color: var(--muted); }
.hero-search .btn { border-radius: var(--r-full); padding: 12px 22px; }

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 18px 0 28px;
}
.hp-label { color: var(--muted); font-size: .9rem; margin-right: 4px; }
.chip-soft {
  display: inline-flex; align-items: center;
  padding: 6px 14px;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: .85rem;
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  text-decoration: none;
}
.chip-soft:hover {
  background: var(--brand-50);
  border-color: var(--brand-300);
  color: var(--brand-700);
}
html[data-theme="dark"] .chip-soft:hover { background: rgba(16,185,129,.12); }

.hero-trust-row {
  display: flex; flex-wrap: wrap;
  gap: 32px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  margin-top: 8px;
}
.trust-stat .num {
  font-family: var(--font-head);
  font-size: 1.75rem; font-weight: 800;
  color: var(--brand-600);
  line-height: 1;
}
.trust-stat .lab { color: var(--muted); font-size: .8rem; margin-top: 4px; }

.hero-pro-right {
  position: relative;
  min-height: 380px;
}
.hp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}
.hp-card-main {
  width: 100%; max-width: 380px;
  margin-left: auto;
  transform: rotate(-2deg);
}
.hp-thumb {
  aspect-ratio: 16/9;
  background: var(--brand-600);
}
.hp-body { padding: 16px 18px 20px; }
.hp-cat { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--brand-700); font-weight: 700; }
.hp-title { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; margin: 4px 0 8px; }
.hp-meta { color: var(--muted); font-size: .82rem; display:flex; align-items:center; gap:8px; margin-bottom: 10px; }
.hp-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .5; }
.hp-progress {
  height: 8px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden;
}
.hp-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--brand-500), var(--brand-700));
  border-radius: var(--r-full);
}
.hp-foot { font-size: .78rem; color: var(--muted); margin-top: 6px; }

.hp-mini {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-lg);
}
.hp-mini-emoji { font-size: 1.6rem; display: inline-flex; color: var(--brand-600); }
.hp-mini-emoji svg { display: block; }
.dashboard-hero .dh-stat .num svg { vertical-align: -3px; }
.ai-pin { display: inline-flex; vertical-align: -2px; color: var(--brand-600); }
.hp-mini-num { font-weight: 800; font-size: .95rem; }
.hp-mini-lab { color: var(--muted); font-size: .75rem; }
.hp-mini-1 { bottom: 12%; left: 6%; transform: rotate(-4deg); }
.hp-mini-2 { top: 8%; left: 18%; transform: rotate(3deg); }

@media (max-width: 900px) {
  .hero-pro-inner { grid-template-columns: 1fr; gap: 32px; }
  .hero-pro-right { display: none; }
}

/* ── Trust strip ─────────────────────────────────────────── */
.trust-strip {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
}
.trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}
.trust-item {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-soft);
  font-size: .92rem;
}
.trust-item svg { color: var(--brand-600); flex-shrink: 0; }
.trust-item strong { color: var(--text); }

/* ── Announce bar (home) & item (course/lesson) ──────────── */
.announce-bar {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--accent-300);
  background: linear-gradient(180deg, #FFFBEB, #FEF3C7);
  color: var(--gray-900);
  margin-bottom: 10px;
}
html[data-theme="dark"] .announce-bar {
  background: rgba(245, 158, 11, .08);
  color: #FCD34D;
  border-color: rgba(245, 158, 11, .35);
}
.announce-bar .ab-tag {
  font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  padding: 4px 8px; border-radius: var(--r-full);
  background: var(--accent-500); color: #1F1604;
}
.announce-bar .ab-body { color: inherit; opacity: .85; }
.announce-card { background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--accent-500) 4%, var(--surface))); }
.announce-list { display: grid; gap: 10px; }
.announce-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}
.announce-item .ai-title { font-weight: 700; margin-bottom: 4px; }
.announce-item .ai-body { color: var(--text-soft); font-size: .94rem; }
.announce-item .ai-meta { color: var(--muted); font-size: .8rem; margin-top: 6px; }

/* ── Card row (horizontal scrollable on small screens) ───── */
.card-row {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* ── Course card heart + price ───────────────────────────── */
.course-card { position: relative; }
.course-card-link { display: flex; flex-direction: column; flex: 1; color: inherit; text-decoration: none; }
.course-card-heart {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px;
  display: inline-grid; place-items: center;
  border: 0;
  background: rgba(17, 24, 39, .75);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  z-index: 4;
}
.course-card-heart:hover { background: rgba(239, 68, 68, .9); }
.course-card-heart.active { background: var(--danger); color: #fff; }
.course-card-heart.active svg { fill: currentColor; }
.course-card-price {
  font-weight: 800;
  color: var(--brand-700);
  font-size: 1rem;
}
html[data-theme="dark"] .course-card-price { color: var(--brand-300); }

/* List view variant */
.card-grid.view-list { grid-template-columns: 1fr !important; gap: 16px; }
.card-grid.view-list .course-card { display: block; }
.card-grid.view-list .course-card-link {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
}
.card-grid.view-list .course-card-thumb { aspect-ratio: auto; height: 100%; min-width: 0; }
.card-grid.view-list .course-card-body { padding: 18px 20px; }
@media (max-width: 720px) {
  .card-grid.view-list .course-card-link { grid-template-columns: 1fr; }
}

/* ── Catalog page (course list) ──────────────────────────── */
.catalog-page { max-width: var(--container-wide); margin: 0 auto; padding: 0 24px; }
.catalog-head {
  padding: 24px 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.catalog-head h1 { margin-bottom: 6px; }
.catalog-head em { color: var(--brand-700); font-style: normal; }
.catalog-sub { color: var(--muted); margin: 0; }

.catalog-body {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  padding-bottom: 48px;
}
.catalog-side {
  position: sticky; top: calc(var(--nav-h) + 16px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px;
  display: grid; gap: 18px;
}
.cs-title { font-weight: 700; font-size: .9rem; color: var(--text); margin-bottom: 8px; letter-spacing: -.01em; }
.cs-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.cs-list a {
  display: block;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--text-soft);
  font-size: .92rem;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.cs-list a:hover { background: var(--surface-2); color: var(--text); }
.cs-list a.active { background: var(--brand-50); color: var(--brand-800); font-weight: 600; }
html[data-theme="dark"] .cs-list a.active { background: rgba(16,185,129,.15); color: var(--brand-300); }
.cs-block + .cs-block { border-top: 1px solid var(--border-light); padding-top: 16px; }

.catalog-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.toolbar-tabs { display: inline-flex; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 4px; }
.toolbar-tabs button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 0;
  background: transparent;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-weight: 600;
  font-size: .85rem;
}
.toolbar-tabs button.active { background: var(--brand-600); color: #fff; }
.toolbar-results { color: var(--muted); font-size: .9rem; }

@media (max-width: 900px) {
  .catalog-body { grid-template-columns: 1fr; }
  .catalog-side { position: static; }
}

/* ── Page head shared (wishlist / my-learning / leaderboard) ─ */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin: 12px 0 22px;
}
.page-head h1 { margin-bottom: 4px; }

/* ── Learn tabs (filter chips at top of page) ────────────── */
.learn-tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  border-bottom: 1px solid var(--border);
  margin: 12px 0 22px;
}
.learn-tabs a {
  padding: 10px 16px;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
  position: relative;
  top: 1px;
}
.learn-tabs a:hover { color: var(--text); }
.learn-tabs a.active { color: var(--brand-700); border-bottom-color: var(--brand-600); }
.learn-tabs .lt-c {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 8px;
  background: var(--surface-3);
  color: var(--text-soft);
  border-radius: var(--r-full);
  font-size: .75rem;
}

/* ── My Learning grid ────────────────────────────────────── */
.my-learn-grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.ml-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.ml-card:hover { box-shadow: var(--shadow-md); }
.ml-thumb {
  position: relative; aspect-ratio: 16/9;
  background: var(--surface-3);
  display: block;
  overflow: hidden;
}
.ml-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ml-overlay {
  position: absolute; bottom: 8px; left: 8px;
  background: rgba(17,24,39,.78); color: #fff;
  border-radius: var(--r-sm);
  padding: 4px 10px;
  font-weight: 700;
  font-size: .85rem;
}
.ml-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.ml-cat { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--brand-700); font-weight: 700; }
.ml-title { font-family: var(--font-head); font-size: 1.02rem; margin: 0; line-height: 1.3; }
.ml-title a { color: inherit; text-decoration: none; }
.ml-title a:hover { color: var(--brand-700); }
.ml-meta { color: var(--muted); font-size: .82rem; }
.ml-actions { margin-top: auto; padding-top: 4px; }
.progress-bar-track { height: 6px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--brand-500); border-radius: inherit; }

/* ── Leaderboard ─────────────────────────────────────────── */
.podium {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  align-items: end;
  max-width: 720px;
  margin: 18px auto 28px;
  gap: 18px;
}
.podium-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 14px 22px;
  text-align: center;
  position: relative;
}
.podium-col.gold { box-shadow: 0 16px 32px -12px rgba(245, 158, 11, .35); border-color: rgba(245, 158, 11, .35); padding-top: 28px; }
.podium-col .medal {
  position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; color: #1F1604;
  background: var(--accent-300);
  box-shadow: var(--shadow-md);
}
.podium-col.gold .medal { background: linear-gradient(135deg, #FBBF24, #F59E0B); width: 44px; height: 44px; top: -22px; font-size: 1.1rem; }
.podium-col.silver .medal { background: linear-gradient(135deg, #E5E7EB, #9CA3AF); color: #fff; }
.podium-col.bronze .medal { background: linear-gradient(135deg, #FCD8B5, #B45309); color: #fff; }
.podium-col .p-name { font-weight: 700; margin-top: 8px; }
.podium-col .p-score { color: var(--muted); font-size: .88rem; }

.leader-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.lt-head, .lt-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1.5fr) repeat(3, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
}
.lt-head {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: .85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.lt-row + .lt-row { border-top: 1px solid var(--border-light); }
.lt-row.top { background: linear-gradient(180deg, color-mix(in srgb, var(--accent-500) 5%, var(--surface)), var(--surface)); }
.lt-rank { font-weight: 800; font-size: 1.1rem; color: var(--text); }
.lt-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lt-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lt-head .num, .lt-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.streak-cell { display: inline-flex; align-items: center; gap: 5px; }
.streak-cell svg { color: var(--accent-600); flex-shrink: 0; }
@media (max-width: 720px) {
  .lt-head, .lt-row { grid-template-columns: 44px minmax(0, 1.4fr) 1fr 1fr; }
  .lt-head > div:nth-child(4), .lt-row > div:nth-child(4) { display: none; }
}

/* ── Course detail extras (preview, wishlist button) ─────── */
.ec-thumb { position: relative; }
.ec-preview-btn {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  /* Darker scrim so the label reads over any (busy/light) thumbnail. */
  background: rgba(10, 20, 16, .55);
  text-decoration: none;
  opacity: 0; transition: opacity .15s;
}
.ec-thumb:hover .ec-preview-btn,
.ec-preview-btn:focus-visible { opacity: 1; }
/* Solid brand pill keeps the play icon + text legible regardless of the image. */
.ec-preview-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand-600);
  color: #fff;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.ec-preview-btn:hover .ec-preview-pill { background: var(--brand-700); }
.ec-preview-pill svg { width: 18px; height: 18px; }
.ec-wishlist {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border);
}
.ec-wishlist.is-on, .ec-wishlist.active {
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  border-color: var(--danger);
  color: var(--danger);
}
.ec-wishlist.is-on svg, .ec-wishlist.active svg { fill: currentColor; }

/* ── Course progress strip on lesson page ────────────────── */
.course-progress-strip {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 16px;
  margin: 4px 0 18px;
  font-size: .9rem;
}
.cps-bar { flex: 1; height: 8px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; }
.cps-fill { height: 100%; background: var(--brand-500); border-radius: inherit; }
.cps-percent { font-weight: 800; color: var(--brand-700); min-width: 44px; text-align: right; }
@media (max-width: 720px) {
  .course-progress-strip { flex-wrap: wrap; }
  .cps-bar { order: 3; flex-basis: 100%; }
}

/* ── Lesson title row (with actions) ─────────────────────── */
.lesson-title-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px;
  margin: 18px 0 16px;
}
.lesson-sub-meta {
  color: var(--muted); font-size: .9rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 4px;
}
.lesson-sub-meta .dot { width: 3px; height: 3px; background: currentColor; opacity: .5; border-radius: 50%; }
.ltr-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ld-tabs .tab-count {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--text-soft);
  font-size: .72rem;
  font-weight: 700;
}
.ld-tabs button.active .tab-count { background: var(--brand-100); color: var(--brand-800); }
html[data-theme="dark"] .ld-tabs button.active .tab-count { background: rgba(16,185,129,.2); color: var(--brand-300); }

/* ── Resources list ──────────────────────────────────────── */
.resource-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.resource-item {
  display: grid; grid-template-columns: 40px 1fr 18px; align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.resource-item:hover { border-color: var(--brand-300); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.ri-ico {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-700);
  border-radius: var(--r-sm);
}
html[data-theme="dark"] .ri-ico { background: rgba(16,185,129,.15); color: var(--brand-300); }
.ri-link { color: var(--text); text-decoration: none; display: grid; gap: 2px; min-width: 0; }
.ri-title { font-weight: 600; }
.ri-kind { font-size: .78rem; color: var(--muted); }
.ri-go { color: var(--muted); }
.resource-kind-code .ri-ico { background: color-mix(in srgb, var(--info) 12%, var(--surface)); color: var(--info); }
.resource-kind-file .ri-ico { background: color-mix(in srgb, var(--accent-500) 12%, var(--surface)); color: var(--accent-600); }

/* ── Q&A ─────────────────────────────────────────────────── */
.qa-ask {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  margin: 16px 0 22px;
  display: grid; gap: 10px;
}
.qa-ask input[type="text"], .qa-ask textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  color: var(--text);
  font: inherit;
  outline: none;
}
.qa-ask input[type="text"]:focus, .qa-ask textarea:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }
html[data-theme="dark"] .qa-ask input[type="text"]:focus,
html[data-theme="dark"] .qa-ask textarea:focus { box-shadow: 0 0 0 3px rgba(16,185,129,.25); }
.qa-ask-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.qa-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.qa-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
}
.qa-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.qa-meta { line-height: 1.2; }
.qa-author { font-weight: 700; font-size: .92rem; }
.qa-time { font-size: .78rem; color: var(--muted); }
.qa-title { font-weight: 700; font-size: 1.02rem; margin-bottom: 6px; }
.qa-body { color: var(--text-soft); font-size: .94rem; }
.qa-resolved {
  margin-left: auto;
  font-size: .75rem; font-weight: 700;
  color: var(--brand-700);
  background: var(--brand-50);
  padding: 4px 8px; border-radius: var(--r-full);
}
.qa-answers { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.qa-answers summary { cursor: pointer; color: var(--muted); font-size: .85rem; font-weight: 600; }
.qa-answers > ul { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.qa-answer { padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-sm); }
.qa-instructor {
  margin-left: 6px;
  font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  color: #fff; background: var(--brand-600);
  padding: 2px 6px; border-radius: var(--r-full);
}
.qa-reply { display: grid; gap: 8px; margin-top: 12px; }
.qa-reply textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font: inherit;
  color: var(--text);
  resize: vertical;
}
.qa-reply button { justify-self: end; }

/* ── Course detail share/preview hover (minor) ───────────── */
.course-card-bottom { display: flex; align-items: center; justify-content: space-between; }

/* ── Footer cleanup (very minor) ──────────────────────────── */
.section { padding-top: 56px; padding-bottom: 56px; }
.section-tight { padding-top: 36px; padding-bottom: 36px; }


/* ═══════════════════════════════════════════════════════════════
   NEW: Platform Upgrade Styles
   ═══════════════════════════════════════════════════════════════ */

/* ── Pagination ───────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.page-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.page-btn:hover { background: var(--surface-2); border-color: var(--brand-300); }
.page-info {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Card animations ──────────────────────────────────────────── */
.card-grid .course-card {
  opacity: 0;
  animation: card-fade-in 0.35s ease forwards;
}
.card-grid .course-card:nth-child(1) { animation-delay: 0ms; }
.card-grid .course-card:nth-child(2) { animation-delay: 40ms; }
.card-grid .course-card:nth-child(3) { animation-delay: 80ms; }
.card-grid .course-card:nth-child(4) { animation-delay: 120ms; }
.card-grid .course-card:nth-child(5) { animation-delay: 160ms; }
.card-grid .course-card:nth-child(6) { animation-delay: 200ms; }
.card-grid .course-card:nth-child(7) { animation-delay: 240ms; }
.card-grid .course-card:nth-child(8) { animation-delay: 280ms; }
@keyframes card-fade-in {
  to { opacity: 1; }
}

/* ── Tab panel transitions ────────────────────────────────────── */
.ld-panel {
  display: none;
  opacity: 0;
  padding: 20px 0;
}
.ld-panel.active {
  display: block;
  opacity: 1;
  padding: 20px 0;
  animation: panel-slide-in 0.25s ease forwards;
}
@keyframes panel-slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Content fade-in ──────────────────────────────────────────── */
.content { animation: content-fade-in 0.3s ease; }
@keyframes content-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Form inputs ──────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 0.92rem;
}
.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-50);
}
.form-error { color: #ef4444; font-size: 0.85rem; margin-top: 4px; }

/* ── Article wrapper ──────────────────────────────────────────── */
.article-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px;
  max-width: 820px;
  margin: 0 auto;
  margin-bottom: 24px;
}
.article-content {
  font-size: 1.02rem;
  line-height: 1.75;
}

/* ── Status badges ────────────────────────────────────────────── */
.badge-soft {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-muted);
}
.badge-green {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #d1fae5;
  color: #065f46;
}
.badge-red {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #fee2e2;
  color: #991b1b;
}

/* ── Quiz components ──────────────────────────────────────────── */
.quiz-page, .quiz-take-page, .quiz-result-page {
  max-width: 800px;
  margin: 0 auto;
  padding-bottom: 48px;
}
.quiz-hero {
  text-align: center;
  padding: 40px 24px;
  margin-bottom: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.quiz-hero-icon { margin-bottom: 16px; color: var(--brand-500); }
.quiz-hero h1 { font-size: 1.5rem; margin-bottom: 8px; }
.quiz-hero-desc { color: var(--text-muted); margin-bottom: 12px; }
.quiz-hero-meta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 0.9rem; color: var(--text-muted);
}
.quiz-start-btn { margin: 0 auto; display: flex; }
.quiz-limit-warn {
  text-align: center; padding: 16px; background: #fef3c7; border-radius: var(--r-sm);
  color: #92400e; margin-bottom: 16px;
}

.quiz-history { margin-top: 32px; }
.quiz-history h3 { font-size: 1.1rem; margin-bottom: 12px; }
.quiz-history-table-wrap { overflow-x: auto; }
.quiz-history-table { width: 100%; border-collapse: collapse; }
.quiz-history-table th, .quiz-history-table td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  white-space: nowrap;
}
.quiz-history-table th { font-weight: 600; color: var(--text-muted); }

.quiz-list { display: grid; gap: 12px; }
.quiz-card {
  display: flex; align-items: center; gap: 16px;
  padding: 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.quiz-card-icon { color: var(--brand-500); flex-shrink: 0; }
.quiz-card-body { flex: 1; }
.quiz-card-body h3 { font-size: 0.95rem; margin-bottom: 4px; }
.quiz-card-body p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; }
.quiz-card-meta { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text-muted); }

/* Quiz take page */
.quiz-take-header { margin-bottom: 24px; }
.quiz-take-header h1 { font-size: 1.3rem; }
.quiz-question-block {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 24px; margin-bottom: 12px;
}
.quiz-question-block[hidden] { display: none; }
.qq-num {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-100); color: var(--brand-700);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; flex-shrink: 0;
}
.qq-body { flex: 1; }
.qq-text { font-weight: 600; margin-bottom: 12px; line-height: 1.4; }
.qq-choices { display: grid; gap: 8px; }
.qq-choice {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--r-sm); cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
}
.qq-choice:hover { border-color: var(--brand-300); background: var(--brand-50); }
.qq-choice.qq-selected { border-color: var(--brand-500); background: var(--brand-50); }
.qq-choice input[type="radio"]:focus-visible { outline: none; }
.qq-choice:has(input[type="radio"]:focus-visible) {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
.qq-choice input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.qq-radio {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border);
  flex-shrink: 0; transition: border-color .15s, background .15s;
}
.qq-choice.qq-selected .qq-radio {
  border-color: var(--brand-500); background: var(--brand-500);
  box-shadow: inset 0 0 0 3px #fff;
}
.qq-label { font-size: 0.95rem; }

/* Multi-select (checkbox) variant: hide native box, square indicator + hint */
.qq-choice input[type="checkbox"] {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.qq-choice:has(input[type="checkbox"]:focus-visible) {
  outline: 2px solid var(--brand-500); outline-offset: 2px; border-radius: var(--r-sm);
}
.qq-choice--multi .qq-radio { border-radius: 5px; }
.qq-hint { font-size: 0.85rem; color: var(--muted); margin: -4px 0 12px; }

/* Graded answer states (one-question-at-a-time flow) */
.qq-choice input[type="radio"]:disabled,
.qq-choice input[type="checkbox"]:disabled { cursor: default; }
.qq-choice.qq-correct {
  border-color: var(--success);
  background: color-mix(in srgb, var(--success) 12%, transparent);
}
.qq-choice.qq-correct .qq-radio {
  border-color: var(--success); background: var(--success); box-shadow: inset 0 0 0 3px #fff;
}
.qq-choice.qq-wrong {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}
.qq-choice.qq-wrong .qq-radio {
  border-color: var(--danger); background: var(--danger); box-shadow: inset 0 0 0 3px #fff;
}
.qq-mark { margin-left: auto; font-weight: 700; font-size: 0.95rem; }
.qq-choice.qq-correct .qq-mark::after { content: "\2713"; color: var(--success); }
.qq-choice.qq-wrong .qq-mark::after { content: "\2717"; color: var(--danger); }
.qq-explanation {
  margin-top: 14px; padding: 12px 14px;
  background: var(--brand-50);
  border-radius: var(--r-sm); font-size: 0.9rem; line-height: 1.5;
}

/* Progress + action bar */
.quiz-progress { margin-top: 10px; }
.quiz-progress-text { font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.quiz-progress-bar { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.quiz-progress-fill { height: 100%; width: 0; background: var(--brand-500); border-radius: 999px; transition: width .25s ease; }

.quiz-action-area {
  margin-top: 24px; display: flex; align-items: center; gap: 16px;
}
.quiz-action-area .btn:disabled { opacity: .5; cursor: not-allowed; }

/* Inline result (shown in place after the last question) */
.quiz-inline-result {
  text-align: center; padding: 32px 24px;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface);
}
.quiz-inline-result.qir-passed { border-color: var(--success); }
.quiz-inline-result.qir-failed { border-color: var(--danger); }
.qir-badge {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 700; color: #fff;
}
.qir-passed .qir-badge { background: var(--success); }
.qir-failed .qir-badge { background: var(--danger); }
.quiz-inline-result h2 { font-size: 1.25rem; margin-bottom: 8px; }
.qir-score { font-size: 1.5rem; font-weight: 800; margin-bottom: 20px; }
.qir-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Quiz result */
.qr-hero {
  text-align: center;
  padding: 48px 24px;
  border-radius: var(--r-lg);
  margin-bottom: 32px;
}
.qr-passed { background: #d1fae5; border: 1px solid #6ee7b7; }
.qr-failed { background: #fee2e2; border: 1px solid #fca5a5; }
.qr-badge { margin-bottom: 16px; }
.qr-passed .qr-badge { color: #065f46; }
.qr-failed .qr-badge { color: #991b1b; }
.qr-hero h1 { font-size: 1.4rem; margin-bottom: 12px; }
.qr-score { margin-bottom: 8px; }
.qr-score-num { font-size: 2.2rem; font-weight: 700; }
.qr-score-pct { font-size: 1.2rem; color: var(--text-muted); margin-left: 12px; }
.qr-pass-info { color: var(--text-muted); font-size: 0.9rem; }
.qr-questions { margin-bottom: 24px; }
.qr-questions h2 { font-size: 1.2rem; margin-bottom: 16px; }
.qr-q-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 16px; margin-bottom: 12px;
}
.qr-q-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.qr-q-icon { font-weight: 700; font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.qr-correct .qr-q-icon { color: #10b981; }
.qr-wrong .qr-q-icon { color: #ef4444; }
.qr-q-text { font-weight: 600; line-height: 1.4; min-width: 0; overflow-wrap: anywhere; }
.qr-q-explanation {
  font-size: 0.88rem; color: var(--text-muted); margin-bottom: 8px;
  padding: 8px 12px; background: var(--surface-2); border-radius: var(--r-sm);
  overflow-wrap: anywhere;
}
.qr-q-choices { display: grid; gap: 6px; }
.qr-q-choice {
  padding: 8px 12px; border-radius: var(--r-sm); font-size: 0.9rem;
  border: 1px solid var(--border); display: flex; align-items: center; gap: 8px;
  overflow-wrap: anywhere; min-width: 0;
}
.qr-choice-correct { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.qr-choice-selected-wrong { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.qr-choice-selected { background: #d1fae5; border-color: #6ee7b7; }
.qr-correct-mark { margin-left: auto; font-weight: 700; color: #065f46; font-size: 0.82rem; }
.qr-wrong-mark { margin-left: auto; font-weight: 600; color: #991b1b; font-size: 0.78rem; }
.qr-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Bookmark components ──────────────────────────────────────── */
.bm-add-bar { margin-bottom: 16px; }
.bm-note-form {
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
  flex-wrap: wrap;
}
.bm-note-form input {
  flex: 1; min-width: 200px;
  padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--surface);
  color: var(--text); font: inherit;
}
.bm-note-form input:focus { outline: none; border-color: var(--brand-500); }
.hidden { display: none !important; }
.bm-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.bm-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.bm-timestamp {
  background: var(--brand-100); color: var(--brand-700);
  border: none; border-radius: 6px; padding: 4px 10px;
  font-weight: 600; font-size: 0.85rem; cursor: pointer;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  transition: background .15s;
}
.bm-timestamp:hover { background: var(--brand-200); }
.bm-note { flex: 1; font-size: 0.88rem; color: var(--text-muted); }
.bm-delete {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  padding: 4px; border-radius: 4px; transition: color .15s, background .15s;
}
.bm-delete:hover { color: #ef4444; background: #fee2e2; }
.bm-empty { color: var(--text-muted); font-size: 0.9rem; padding: 8px 0; }

/* ── Learning Path components ─────────────────────────────────── */
.path-list-page { max-width: 1000px; margin: 0 auto; padding-bottom: 48px; }
.path-head { margin-bottom: 32px; }
.path-head h1 { font-size: 1.6rem; }
.path-head p { color: var(--text-muted); max-width: 600px; }
.path-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.path-card {
  display: flex; flex-direction: column;
  padding: 24px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); text-decoration: none; color: inherit;
  transition: box-shadow .2s, transform .2s;
}
.path-card:hover { box-shadow: var(--shadow-lift); }
.path-card-body { flex: 1; }
.path-card-body h3 { font-size: 1.05rem; margin-bottom: 8px; }
.path-card-body p { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 12px; }
.path-card-meta { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text-muted); }
.path-card-action { margin-top: 16px; }
.path-card-icon { color: var(--brand-500); margin-bottom: 12px; }

/* Path detail */
.path-detail-page { max-width: 900px; margin: 0 auto; padding-bottom: 48px; }
.path-hero {
  padding: 32px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); margin-bottom: 24px;
}
.path-hero h1 { font-size: 1.5rem; }
.path-hero-desc { color: var(--text-muted); margin-bottom: 12px; }
.path-hero-meta { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--text-muted); }
.path-progress-bar {
  height: 6px; background: var(--surface-2); border-radius: 3px; margin-bottom: 24px; overflow: hidden;
}
.path-progress-fill {
  height: 100%; background: var(--brand-500); border-radius: 3px; transition: width .5s ease;
}
.path-courses { display: grid; gap: 12px; }
.path-course-item {
  display: flex; align-items: center; gap: 16px;
  padding: 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.pci-order {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface-2); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; flex-shrink: 0; color: var(--text-muted);
}
.pci-check { color: #10b981; font-size: 1.1rem; }
.pci-body { flex: 1; }
.pci-title { font-weight: 600; color: var(--text); text-decoration: none; }
.pci-title:hover { color: var(--brand-600); }
.pci-meta { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }
.pci-bar { height: 4px; background: var(--surface-2); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.pci-fill { height: 100%; background: var(--brand-400); border-radius: 2px; transition: width .3s ease; }
.pci-action { flex-shrink: 0; }

/* ── Instructor profile ───────────────────────────────────────── */
.instructor-page { max-width: 1000px; margin: 0 auto; padding-bottom: 48px; }
.instructor-hero {
  text-align: center; padding: 48px 24px; margin-bottom: 32px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
}
.instructor-hero .avatar-xl {
  width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-100); color: var(--brand-700);
  font-size: 1.8rem; font-weight: 700; overflow: hidden;
}
.instructor-hero h1 { font-size: 1.5rem; margin-bottom: 8px; }
.instructor-bio { color: var(--text-muted); max-width: 500px; margin: 0 auto 16px; }
.instructor-stats {
  display: flex; justify-content: center; gap: 32px; font-size: 0.9rem;
}
.instat { text-align: center; }
.instat strong { display: block; font-size: 1.2rem; color: var(--text); }
.instat span { color: var(--text-muted); font-size: 0.82rem; }

/* ── Certificate verification ─────────────────────────────────── */
.cert-verify-page { padding-top: 24px; }
.cert-verify-badge {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  max-width: 500px; margin: 0 auto 16px;
  padding: 10px 16px; background: #d1fae5; color: #065f46;
  border-radius: 99px; font-weight: 600; font-size: 0.9rem;
}

/* ── Continue learning cards ──────────────────────────────────── */
.continue-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.continue-card-mini {
  display: flex; gap: 14px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); text-decoration: none; color: inherit;
  transition: box-shadow .2s, transform .2s;
}
.continue-card-mini:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.ccm-thumb-wrap {
  width: 80px; height: 56px; border-radius: 8px; overflow: hidden;
  background: var(--surface-2); flex-shrink: 0;
}
.ccm-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.ccm-body { flex: 1; min-width: 0; }
.ccm-body h4 { font-size: 0.9rem; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Status badges ────────────────────────────────────────────── */
.status-badge-draft {
  background: #fef3c7; color: #92400e; padding: 3px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600;
}

/* ── Dark mode overrides ──────────────────────────────────────── */
html[data-theme="dark"] .badge-green { background: #064e3b; color: #6ee7b7; }
html[data-theme="dark"] .badge-red { background: #7f1d1d; color: #fca5a5; }
html[data-theme="dark"] .qr-passed { background: #064e3b; border-color: #065f46; }
html[data-theme="dark"] .qr-passed .qr-badge { color: #6ee7b7; }
html[data-theme="dark"] .qr-failed { background: #7f1d1d; border-color: #991b1b; }
html[data-theme="dark"] .qr-failed .qr-badge { color: #fca5a5; }
html[data-theme="dark"] .qr-choice-correct { background: #064e3b; border-color: #065f46; color: #6ee7b7; }
html[data-theme="dark"] .qr-choice-selected-wrong { background: #7f1d1d; border-color: #991b1b; color: #fca5a5; }
html[data-theme="dark"] .qr-choice-selected { background: #064e3b; border-color: #065f46; }
html[data-theme="dark"] .qr-correct-mark { color: #6ee7b7; }
html[data-theme="dark"] .qr-wrong-mark { color: #fca5a5; }
html[data-theme="dark"] .quiz-limit-warn { background: #422006; color: #fde68a; }
html[data-theme="dark"] .cert-verify-badge { background: #064e3b; color: #6ee7b7; }
html[data-theme="dark"] .quiz-card-icon { color: var(--brand-400); }
html[data-theme="dark"] .bm-timestamp { background: var(--brand-900); color: var(--brand-300); }

/* Dark-mode fixes — components that hardcode light (brand-50 / amber / rose / sky)
   backgrounds need explicit overrides so they don't render as bright islands. */
html[data-theme="dark"] .message.success { background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.3); color: var(--brand-300); }
html[data-theme="dark"] .badge-primary,
html[data-theme="dark"] .badge-success { background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.3); color: var(--brand-300); }
html[data-theme="dark"] .badge-amber { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.3); color: #FCD34D; }
html[data-theme="dark"] .badge-rose  { background: rgba(244,63,94,.12);  border-color: rgba(244,63,94,.3);  color: #FDA4AF; }
html[data-theme="dark"] .badge-sky   { background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.3); color: #93C5FD; }
html[data-theme="dark"] .completed-badge { background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.3); color: var(--brand-300); }
html[data-theme="dark"] .qa-resolved { background: rgba(16,185,129,.12); color: var(--brand-300); }
html[data-theme="dark"] .qq-choice:hover { background: rgba(16,185,129,.10); }
html[data-theme="dark"] .qq-choice.qq-selected { background: rgba(16,185,129,.14); }
html[data-theme="dark"] .qq-explanation { background: rgba(16,185,129,.10); }
html[data-theme="dark"] .certificate-page { background: var(--bg-soft); }

