/* ═══════════════════════════════════════════════════════════
   Speed Reading Course — warm, readable, playful UI
   Video LEFT · Curriculum sidebar RIGHT
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Warm paper palette — easier on the eyes than pure black/white */
  --bg-app: #eef2f7;
  --bg-main: #f6f3ee;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-soft: #f0ebe3;
  --bg-hover: #f3efe8;
  --bg-active: #e6f7f0;
  --bg-header: rgba(255, 255, 255, 0.86);

  --text: #1c1917;
  --text-secondary: #44403c;
  --text-muted: #78716c;
  --text-dim: #a8a29e;

  --accent: #0d9488;
  --accent-2: #f97316;
  --accent-3: #8b5cf6;
  --accent-soft: rgba(13, 148, 136, 0.12);
  --accent-2-soft: rgba(249, 115, 22, 0.12);
  --accent-glow: rgba(13, 148, 136, 0.22);

  --border: rgba(28, 25, 23, 0.08);
  --border-strong: rgba(28, 25, 23, 0.14);
  --danger: #e11d48;
  --ok: #059669;

  --sidebar-w: min(390px, 36vw);
  --header-h: 60px;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow: 0 8px 28px rgba(28, 25, 23, 0.08);
  --shadow-lg: 0 18px 50px rgba(28, 25, 23, 0.12);
  --font: "Heebo", "Rubik", "Segoe UI", Tahoma, Arial, sans-serif;
  --ease: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --read-size: 1.05rem;
  --read-line: 1.8;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg-app);
  color: var(--text);
  min-height: 100%;
  height: 100%;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--ease);
}
a:hover {
  color: #0f766e;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ─── Shell ─── */
/* ═══════════════════════════════════════════════════════════
   Password gate
   ═══════════════════════════════════════════════════════════ */

.app[hidden] {
  display: none !important;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  direction: rtl;
  background:
    radial-gradient(ellipse 55% 45% at 20% 0%, rgba(13, 148, 136, 0.16), transparent 60%),
    radial-gradient(ellipse 45% 40% at 85% 15%, rgba(249, 115, 22, 0.12), transparent 55%),
    radial-gradient(ellipse 40% 35% at 65% 100%, rgba(139, 92, 246, 0.1), transparent 50%),
    var(--bg-app);
}

.gate-card {
  width: min(400px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  padding: 2.4rem 2rem 2rem;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow-lg);
}

.gate-orb {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  box-shadow: 0 10px 26px var(--accent-glow);
  animation: gate-float 3.2s ease-in-out infinite;
}

@keyframes gate-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

.gate-card h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.gate-sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}

.gate-input {
  width: 100%;
  padding: 0.8rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg-soft);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition:
    border-color var(--ease),
    box-shadow var(--ease);
}
.gate-input::placeholder {
  color: var(--text-dim);
}
.gate-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.gate-btn {
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: var(--radius-sm);
  transition:
    background var(--ease),
    transform var(--ease),
    opacity var(--ease);
}
.gate-btn:hover:not(:disabled) {
  background: #0f766e;
}
.gate-btn:active:not(:disabled) {
  transform: translateY(1px);
}
.gate-btn:disabled {
  opacity: 0.65;
  cursor: default;
}

.gate-remember {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.gate-remember input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.gate-error {
  min-height: 1.2em;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--danger);
}

.gate-card.shake {
  animation: gate-shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes gate-shake {
  10%,
  90% {
    transform: translateX(-2px);
  }
  20%,
  80% {
    transform: translateX(4px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-7px);
  }
  40%,
  60% {
    transform: translateX(7px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gate-orb,
  .gate-card.shake {
    animation: none;
  }
}

.app {
  display: grid;
  direction: ltr;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-w);
  grid-template-rows: var(--header-h) minmax(0, 1fr);
  grid-template-areas:
    "header header"
    "main   sidebar";
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 50% 40% at 15% 0%, rgba(13, 148, 136, 0.09), transparent 55%),
    radial-gradient(ellipse 40% 35% at 85% 10%, rgba(249, 115, 22, 0.07), transparent 50%),
    radial-gradient(ellipse 35% 30% at 70% 100%, rgba(139, 92, 246, 0.06), transparent 45%),
    var(--bg-app);
}

.header {
  grid-area: header;
  direction: rtl;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0 1.1rem 0 1.25rem;
  background: var(--bg-header);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--border);
  z-index: 40;
  box-shadow: var(--shadow-sm);
}

.main {
  grid-area: main;
  direction: rtl;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: transparent;
}

.sidebar {
  grid-area: sidebar;
  direction: rtl;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  z-index: 30;
  box-shadow: -8px 0 32px rgba(28, 25, 23, 0.04);
}

/* ─── Header ─── */
.header-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  flex: 1;
}

.header-logo-wrap {
  flex-shrink: 0;
  padding: 2px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 14px var(--accent-glow);
}

.header-logo {
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  object-fit: cover;
  background: #fff;
}

.header-titles {
  min-width: 0;
}

.header-titles h1 {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.header-titles p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.progress-pill {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.progress-pill strong {
  color: var(--accent);
  font-weight: 700;
}

.progress-bar-mini {
  width: 60px;
  height: 6px;
  background: rgba(28, 25, 23, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-mini span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #2dd4bf);
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1.05rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background var(--ease), color var(--ease), border-color var(--ease),
    box-shadow var(--ease), transform 0.12s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

.btn-primary {
  background: linear-gradient(135deg, #0f9f92 0%, #0d9488 50%, #0f766e 100%);
  color: #fff;
  box-shadow: 0 6px 18px var(--accent-glow);
}

.btn-primary:hover {
  box-shadow: 0 8px 22px rgba(13, 148, 136, 0.35);
  filter: brightness(1.05);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-soft {
  background: var(--bg-soft);
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.btn-soft:hover {
  background: #e7e0d6;
  color: var(--text);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  color: var(--text-muted);
  background: var(--bg-soft);
}

.btn-icon:hover {
  background: #e7e0d6;
  color: var(--text);
}

.menu-toggle {
  display: none;
}

.mark-done-active {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  border: 1px solid rgba(13, 148, 136, 0.3) !important;
  box-shadow: none !important;
}

/* ─── Sidebar ─── */
.sidebar-top {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fff 0%, #faf8f5 100%);
}

.sidebar-course {
  padding: 1.1rem 1.1rem 0.55rem;
}

.sidebar-course .label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.55rem;
}

.sidebar-course h2 {
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text);
  letter-spacing: -0.02em;
}

.sidebar-progress {
  padding: 0.35rem 1.1rem 0.9rem;
}

.sidebar-progress-track {
  height: 8px;
  background: rgba(28, 25, 23, 0.06);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.45rem;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.sidebar-progress-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #5eead4, var(--accent-2));
  background-size: 200% 100%;
  border-radius: 999px;
  transition: width 0.45s ease;
}

.sidebar-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.sidebar-tabs {
  display: flex;
  gap: 0.3rem;
  padding: 0 0.85rem 0.65rem;
}

.sidebar-tab {
  flex: 1;
  padding: 0.55rem 0.35rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: background var(--ease), color var(--ease), box-shadow var(--ease);
}

.sidebar-tab:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.sidebar-tab.active {
  background: linear-gradient(135deg, #0f9f92, #0d9488);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.sidebar-search {
  padding: 0 0.85rem 0.9rem;
}

.search-shell {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  right: 0.85rem;
  color: var(--text-dim);
  font-size: 0.95rem;
  pointer-events: none;
}

.sidebar-search input {
  width: 100%;
  padding: 0.65rem 2.2rem 0.65rem 0.9rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-family: inherit;
  font-size: 0.86rem;
  outline: none;
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}

.sidebar-search input:focus {
  border-color: rgba(13, 148, 136, 0.45);
  background: #fff;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.sidebar-search input::placeholder {
  color: var(--text-dim);
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(28, 25, 23, 0.15) transparent;
}

.sidebar-body::-webkit-scrollbar {
  width: 7px;
}
.sidebar-body::-webkit-scrollbar-thumb {
  background: rgba(28, 25, 23, 0.14);
  border-radius: 999px;
}

/* Sections */
.section-block {
  margin: 0.2rem 0.55rem;
}

.section-header {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: 100%;
  padding: 0.75rem 0.7rem;
  border-radius: var(--radius-sm);
  text-align: right;
  transition: background var(--ease);
}

.section-header:hover {
  background: var(--bg-hover);
}

.section-num {
  flex-shrink: 0;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--bg-soft);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  margin-top: 1px;
}

.section-block.open .section-num {
  background: linear-gradient(135deg, var(--accent), #14b8a6);
  color: #fff;
  box-shadow: 0 3px 10px var(--accent-glow);
}

.section-title {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
}

.section-meta {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-weight: 500;
  margin-top: 0.22rem;
}

.chevron {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  transition: transform var(--ease), color var(--ease);
  margin-top: 3px;
  font-size: 1.1rem;
  line-height: 1;
  font-weight: 700;
}

.section-block.open .chevron {
  transform: rotate(-90deg);
  color: var(--accent);
}

.section-lessons {
  display: none;
  padding: 0 0.1rem 0.5rem;
  flex-direction: column;
  gap: 3px;
}

.section-block.open .section-lessons {
  display: flex;
}

/* Lessons */
.lesson-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  width: 100%;
  padding: 0.6rem 0.65rem;
  border-radius: var(--radius-sm);
  text-align: right;
  font-size: 0.84rem;
  color: var(--text-muted);
  border: 1.5px solid transparent;
  transition: background var(--ease), color var(--ease), border-color var(--ease),
    box-shadow var(--ease);
}

.lesson-item:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.lesson-item.active {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.12), rgba(45, 212, 191, 0.08));
  border-color: rgba(13, 148, 136, 0.28);
  color: var(--text);
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.1);
}

.lesson-item.active .lesson-name {
  color: #0f766e;
  font-weight: 700;
}

.lesson-item.done .lesson-check {
  background: linear-gradient(135deg, var(--accent), #14b8a6);
  border-color: transparent;
  color: #fff;
}

.lesson-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(28, 25, 23, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 800;
  margin-top: 2px;
  transition: background var(--ease), border-color var(--ease);
}

.lesson-item.active .lesson-check {
  border-color: var(--accent);
  color: var(--accent);
}

.lesson-info {
  flex: 1;
  min-width: 0;
}

.lesson-name {
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lesson-time {
  display: inline-flex;
  margin-top: 0.22rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* ─── Main content ─── */
.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(28, 25, 23, 0.15) transparent;
}

.player-layout {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.player-stage-wrap {
  flex: 0 0 auto;
  padding: 1rem 1.15rem 0;
}

.video-stage {
  position: relative;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  background: #0c0a09;
  overflow: hidden;
  border-radius: 20px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(28, 25, 23, 0.06);
}

.video-stage iframe,
.video-stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.5rem;
  text-align: center;
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(13, 148, 136, 0.2), transparent),
    linear-gradient(160deg, #1c1917 0%, #0c0a09 100%);
}

.video-placeholder.loading .play-circle {
  animation: pulse 1.15s ease-in-out infinite;
}

.video-placeholder.error .play-circle {
  border-color: #fb7185;
  color: #fb7185;
  background: rgba(251, 113, 133, 0.12);
  box-shadow: none;
}

.play-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(13, 148, 136, 0.2);
  border: 3px solid #2dd4bf;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5eead4;
  font-size: 1.7rem;
  transition: transform 0.15s, background 0.15s;
  box-shadow: 0 0 40px rgba(45, 212, 191, 0.3);
}

button.play-circle:hover {
  transform: scale(1.07);
  background: rgba(13, 148, 136, 0.35);
}

.video-placeholder p {
  color: #d6d3d1;
  font-size: 1rem;
  font-weight: 600;
}

.video-placeholder .note {
  font-size: 0.82rem;
  color: #a8a29e;
  max-width: 400px;
  line-height: 1.6;
  font-weight: 400;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(0.96);
  }
}

/* Meta under video — reading-friendly */
.player-meta {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  padding: 1.4rem 1.35rem 3rem;
}

.player-meta .breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.7rem;
}

.player-meta .breadcrumb span {
  color: var(--text-muted);
  font-weight: 500;
}

.player-meta h2 {
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.03em;
  margin-bottom: 0.85rem;
  color: var(--text);
}

.lesson-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 1.1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
}

.badge-accent {
  background: var(--accent-soft);
  border-color: rgba(13, 148, 136, 0.2);
  color: #0f766e;
}

.lesson-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.35rem;
}

.nav-lessons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-top: 0.25rem;
}

.nav-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  text-align: right;
  transition: border-color var(--ease), box-shadow var(--ease), transform 0.12s;
  box-shadow: var(--shadow-sm);
}

.nav-card:hover:not(:disabled) {
  border-color: rgba(13, 148, 136, 0.4);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.nav-card:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.nav-card .label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.nav-card .title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.nav-card.next {
  text-align: left;
}

.nav-card.next .label {
  color: var(--accent-2);
}

/* Overview */
.overview {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.75rem 1.35rem 3rem;
}

.hero {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding: 1.35rem;
  background: var(--bg-card);
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

@media (min-width: 720px) {
  .hero {
    grid-template-columns: 168px 1fr;
    align-items: start;
  }
}

.hero-image {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--bg-soft);
  box-shadow: var(--shadow);
}

.hero-body h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.75rem);
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0.65rem;
  letter-spacing: -0.03em;
}

.hero-body .lead {
  color: var(--text-secondary);
  font-size: 0.98rem;
  line-height: 1.7;
  white-space: pre-line;
  margin-bottom: 1.15rem;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.15rem;
}

.stat {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat strong {
  color: var(--text);
  font-weight: 800;
  display: block;
  font-size: 1.15rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

/* Cards — reading surface */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  padding: 1.35rem 1.45rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.card h3 {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.card h3 .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--accent-soft);
  font-size: 0.95rem;
}

/* Readable HTML content */
.about-html,
.lesson-summary {
  font-size: var(--read-size);
  color: var(--text-secondary);
  line-height: var(--read-line);
  letter-spacing: 0.01em;
}

.about-html p,
.lesson-summary p {
  margin-bottom: 0.85rem;
}

.about-html strong,
.about-html b,
.lesson-summary strong,
.lesson-summary b {
  color: var(--text);
  font-weight: 700;
}

.about-html a,
.lesson-summary a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

.about-html ul,
.lesson-summary ul,
.about-html ol,
.lesson-summary ol {
  margin: 0.5rem 1.2rem 0.9rem 0;
  padding: 0;
}

.about-html li,
.lesson-summary li {
  margin-bottom: 0.35rem;
}

.about-html meta,
.about-html style,
.about-html title,
.lesson-summary meta,
.lesson-summary style,
.lesson-summary title {
  display: none !important;
}

.summary-card {
  background: linear-gradient(180deg, #fffefb 0%, #faf7f2 100%);
  border-color: rgba(249, 115, 22, 0.12);
}

.summary-card h3 .icon {
  background: var(--accent-2-soft);
}

.materials-card h3 .icon {
  background: rgba(139, 92, 246, 0.12);
}

/* Materials */
.materials-intro {
  padding: 0.7rem 1rem 0.45rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  font-weight: 500;
}

.materials-group-title {
  padding: 0.85rem 1rem 0.4rem;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.resources-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.resource-card {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.9rem 0.95rem;
  background: var(--bg-soft);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 0 0.65rem 0.5rem;
  transition: border-color var(--ease), box-shadow var(--ease), transform 0.12s;
}

.resource-card:hover {
  border-color: rgba(13, 148, 136, 0.3);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.card .resource-card {
  margin: 0;
  background: #faf8f5;
}

.resource-card.kind-pdf {
  border-color: rgba(225, 29, 72, 0.2);
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.06), #faf8f5 55%);
}

.resource-card.kind-audio {
  border-color: rgba(59, 130, 246, 0.22);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.07), #faf8f5 55%);
}

.resource-icon {
  font-size: 1.35rem;
  line-height: 1;
  margin-top: 0.1rem;
}

.resource-body {
  flex: 1;
  min-width: 0;
}

.resource-kind {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.18rem;
}

.resource-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}

.resource-meta {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
  font-weight: 500;
}

.resource-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.6rem;
}

.inline-audio {
  width: min(100%, 280px);
  height: 36px;
}

/* Curriculum list on overview */
.curriculum-grid {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.curriculum-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-soft);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease), box-shadow var(--ease);
  text-align: right;
  width: 100%;
}

.curriculum-row:hover {
  border-color: rgba(13, 148, 136, 0.35);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.curriculum-row .num {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #14b8a6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 3px 10px var(--accent-glow);
}

.curriculum-row .info {
  flex: 1;
  min-width: 0;
}

.curriculum-row .info strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.curriculum-row .info span {
  font-size: 0.76rem;
  color: var(--text-dim);
  font-weight: 500;
}

/* Q&A */
.qa-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.qa-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.qa-question {
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.qa-question h4 {
  font-size: 1.02rem;
  font-weight: 800;
  margin-bottom: 0.45rem;
  letter-spacing: -0.02em;
}

.qa-meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 0.55rem;
  font-weight: 500;
}

.qa-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.75;
}

.qa-text p {
  margin-bottom: 0.4rem;
}

.qa-replies {
  padding: 1rem 1.25rem;
  background: var(--bg-soft);
}

.qa-reply {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
}

.qa-reply:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.qa-reply:first-child {
  padding-top: 0;
}

.reply-author {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1.25rem;
  color: var(--text-muted);
  font-weight: 500;
}

.empty-state .big-icon {
  font-size: 2.4rem;
  margin-bottom: 0.65rem;
  opacity: 0.7;
}

.loading-splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  gap: 1rem;
}

.splash-orb {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  animation: pulse 1.2s ease-in-out infinite;
  box-shadow: 0 8px 28px var(--accent-glow);
}

/* PDF modal */
.pdf-modal {
  width: min(960px, 96vw);
  height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.pdf-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: #fff;
}

.pdf-modal-header h3 {
  font-size: 1rem;
  margin: 0;
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex-shrink: 0;
}

.pdf-frame-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #e7e5e4;
}

.pdf-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #e7e5e4;
}

.pdf-fallback {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.6rem 0.9rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.92);
  text-align: center;
  font-weight: 500;
  border-top: 1px solid var(--border);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.45);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  direction: rtl;
}

.modal {
  width: min(520px, 100%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow-lg);
  padding: 1.4rem 1.45rem 1.3rem;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 0.55rem;
  letter-spacing: -0.02em;
}

.modal .hint {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.65;
}

.modal .hint ol {
  margin: 0.5rem 1.15rem 0 0;
  padding: 0;
}

.modal .hint li {
  margin-bottom: 0.4rem;
}

.modal label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.modal input,
.modal textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-soft);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  margin-bottom: 0.85rem;
}

.modal input:focus,
.modal textarea:focus {
  border-color: rgba(13, 148, 136, 0.5);
  box-shadow: 0 0 0 4px var(--accent-soft);
  background: #fff;
}

.modal textarea {
  min-height: 90px;
  resize: vertical;
  direction: ltr;
  text-align: left;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.modal .status-msg {
  font-size: 0.84rem;
  margin-top: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.modal .status-msg.ok {
  color: var(--ok);
}

.modal .status-msg.err {
  color: var(--danger);
}

/* Mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: var(--header-h) 0 0 0;
  background: rgba(28, 25, 23, 0.4);
  backdrop-filter: blur(3px);
  z-index: 35;
}

@media (max-width: 960px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main";
  }

  .menu-toggle {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    top: var(--header-h);
    right: 0;
    bottom: 0;
    width: min(380px, 92vw);
    transform: translateX(105%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop.open {
    display: block;
  }

  .progress-pill .progress-bar-mini {
    display: none;
  }

  .player-stage-wrap {
    padding: 0.65rem 0.65rem 0;
  }

  .video-stage {
    border-radius: 14px;
  }

  .player-meta {
    padding: 1.1rem 1rem 2.5rem;
  }

  .nav-lessons {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 1rem;
  }
}

@media (min-width: 1400px) {
  :root {
    --sidebar-w: 410px;
    --read-size: 1.08rem;
  }
}

/* Course picker */
.picker-page {
  max-width: 980px;
  margin: 0 auto;
  padding: 2rem 1.35rem 3rem;
}

.picker-hero {
  text-align: center;
  margin-bottom: 1.75rem;
}

.picker-hero h1 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.45rem;
}

.picker-hero p {
  color: var(--text-muted);
  font-size: 1.02rem;
  font-weight: 500;
}

.picker-grid {
  display: grid;
  gap: 1.1rem;
}

@media (min-width: 800px) {
  .picker-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.picker-card {
  display: flex;
  flex-direction: column;
  text-align: right;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow var(--ease), border-color var(--ease);
  width: 100%;
  cursor: pointer;
}

.picker-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(13, 148, 136, 0.35);
}

.picker-card.hybrid:hover {
  border-color: rgba(249, 115, 22, 0.4);
}

.picker-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--bg-soft);
}

.picker-body {
  padding: 1.15rem 1.2rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}

.picker-badge {
  display: inline-flex;
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
}

.picker-card.hybrid .picker-badge {
  color: #c2410c;
  background: var(--accent-2-soft);
}

.picker-card.waves20 .picker-badge {
  color: #6d28d9;
  background: rgba(139, 92, 246, 0.14);
}

.picker-card.waves20:hover {
  border-color: rgba(139, 92, 246, 0.4);
}

.picker-card.waves20 .picker-cta {
  color: #6d28d9;
}

.picker-card.timekeys .picker-badge {
  color: #0f766e;
  background: rgba(20, 184, 166, 0.14);
}

.picker-card.timekeys:hover {
  border-color: rgba(20, 184, 166, 0.4);
}

.picker-card.timekeys .picker-cta {
  color: #0f766e;
}

.picker-card.graph2u .picker-badge {
  color: #b45309;
  background: rgba(245, 158, 11, 0.14);
}

.picker-card.graph2u:hover {
  border-color: rgba(245, 158, 11, 0.4);
}

.picker-card.graph2u .picker-cta {
  color: #b45309;
}

.notice-card {
  border-color: rgba(245, 158, 11, 0.35);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), #fffefb 60%);
  margin-bottom: 1rem;
}

.notice-card h3 .icon {
  background: rgba(245, 158, 11, 0.18);
}

.teachers-row {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.teacher-card {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
}

.teacher-img {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  border: 2px solid #fff;
}

.teacher-desc {
  margin-top: 0.35rem;
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
  font-weight: 500;
}

.picker-body h2 {
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.picker-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
}

.picker-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.picker-stats span {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.28rem 0.6rem;
}

.picker-stats strong {
  color: var(--text);
  font-weight: 800;
}

.picker-progress {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.picker-progress .sidebar-progress-track {
  flex: 1;
  margin: 0;
}

.picker-cta {
  margin-top: 0.35rem;
  font-weight: 800;
  color: var(--accent);
  font-size: 0.95rem;
}

.picker-card.hybrid .picker-cta {
  color: #c2410c;
}

.picker-sidebar-hint {
  padding: 1.5rem 1.1rem;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.6;
}

.picker-sidebar-hint .muted {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dim);
}

.linkish {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
}

body.picker-mode .sidebar-search {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
