/* ── Design Tokens ─────────────────────────────── */
:root {
  --primary:        #87009B;
  --primary-hover:  #6a007a;
  --primary-light:  #87009B15;
  --secondary:      #ECB22E;
  --secondary-light:#ECB22E20;
  --border:         #e8e0f0;
  --bg:             #f4f1f8;
  --white:          #ffffff;
  --text:           #333333;
  --text-muted:     #999999;
  --sidebar-w:      200px;
  --ai-panel-w:     220px;
  --header-h:       56px;
}

/* ── Reset ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; }

/* ── Header ────────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0; right: 0; left: 0;
  height: var(--header-h);
  background: var(--primary);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(135,0,155,0.3);
}
.header-logo { display: flex; align-items: center; gap: 10px; }
.logo-badge {
  background: var(--secondary); color: var(--primary);
  font-weight: 700; border-radius: 6px; padding: 4px 12px; font-size: 15px;
}
.logo-title { color: rgba(255,255,255,0.92); font-size: 14px; font-weight: 500; }
.header-user {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 20px; padding: 5px 14px;
  color: white; font-size: 13px;
}

/* ── Main layout ───────────────────────────────── */
.app-body {
  display: flex;
  margin-top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0; overflow-y: auto;
}
.sidebar-user-card {
  padding: 16px;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-avatar {
  width: 40px; height: 40px; background: var(--primary);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px; flex-shrink: 0;
}
.sidebar-name { font-size: 13px; font-weight: 600; }
.sidebar-subtitle { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 8px 0; }
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; font-size: 13px; color: #666;
  border-right: 3px solid transparent;
  transition: all 0.15s; text-align: right;
}
.nav-item:hover { background: var(--primary-light); color: var(--primary); }
.nav-item.active {
  color: var(--primary); background: var(--primary-light);
  border-right-color: var(--primary); font-weight: 600;
}
.nav-icon { font-size: 16px; width: 22px; text-align: center; }
.nav-label { flex: 1; }
.nav-badge {
  background: var(--secondary); color: white;
  border-radius: 10px; padding: 1px 7px;
  font-size: 10px; font-weight: 600;
}
.sidebar-progress { padding: 14px 16px; border-top: 1px solid var(--border); background: #fafafa; }
.progress-label { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.progress-bar { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 3px; width: 0%;
  transition: width 0.4s ease;
}
.progress-text { font-size: 11px; color: var(--primary); margin-top: 5px; font-weight: 600; }

/* ── Content ───────────────────────────────────── */
.content { flex: 1; overflow-y: auto; display: flex; flex-direction: column; min-width: 0; }
.section-panel { display: flex; flex-direction: column; height: 100%; }
.content-header {
  background: var(--white); padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; flex-shrink: 0;
}
.content-title { font-size: 16px; font-weight: 700; color: var(--primary); }
.content-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 14px;
}
.search-box input { border: none; background: none; outline: none; font-size: 12px; width: 160px; direction: rtl; color: var(--text); }

/* ── Video player ──────────────────────────────── */
.video-player-container { background: #1a1a1a; flex-shrink: 0; }
.video-player-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; color: white; font-size: 13px;
}
.player-close { color: rgba(255,255,255,0.7); font-size: 16px; padding: 2px 8px; border-radius: 4px; }
.player-close:hover { background: rgba(255,255,255,0.1); color: white; }
.video-player-wrapper { position: relative; padding-bottom: 45%; height: 0; overflow: hidden; }
.video-player-wrapper video { position: absolute; top: 0; right: 0; width: 100%; height: 100%; }

/* ── Video list ────────────────────────────────── */
.video-list { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.video-item {
  background: var(--white); border-radius: 10px; padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  border: 1.5px solid transparent;
  box-shadow: 0 1px 4px rgba(135,0,155,0.06);
  cursor: pointer; transition: all 0.15s;
}
.video-item:hover { border-color: var(--primary); transform: translateX(-2px); }
.video-item.watched { border-color: rgba(135,0,155,0.25); }
.video-item.playing { border-color: var(--primary); background: rgba(135,0,155,0.04); box-shadow: 0 2px 12px rgba(135,0,155,0.15); }
.video-num {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.video-num.watched { background: var(--primary); color: white; }
.video-num.playing { background: var(--secondary); color: white; }
.video-num.pending { background: #eee; color: var(--text-muted); }
.video-thumb {
  width: 56px; height: 38px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.video-thumb.watched { background: rgba(135,0,155,0.12); }
.video-thumb.playing { background: var(--primary); color: white; }
.video-thumb.pending { background: #f0f0f0; }
.video-info { flex: 1; min-width: 0; }
.video-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-meta { font-size: 11px; color: var(--text-muted); }
.video-meta.watched { color: var(--primary); }
.video-meta.playing { color: var(--secondary); }
.video-duration { font-size: 11px; color: var(--text-muted); background: var(--bg); border-radius: 8px; padding: 2px 8px; flex-shrink: 0; }

/* ── AI Panel ──────────────────────────────────── */
.ai-panel {
  width: var(--ai-panel-w); background: var(--white);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
}
.ai-panel-header {
  background: var(--primary); padding: 11px 14px;
  color: white; font-size: 12px; font-weight: 500;
  display: flex; align-items: center; justify-content: space-between;
}
.ai-online-dot { width: 8px; height: 8px; background: #4CAF50; border-radius: 50%; }
.ai-context-strip { padding: 7px 12px; background: var(--primary-light); border-bottom: 1px solid var(--border); font-size: 10px; color: var(--primary); font-weight: 500; }
.ai-messages { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.msg-bot { background: var(--primary); color: white; border-radius: 12px 12px 4px 12px; padding: 8px 10px; font-size: 11px; line-height: 1.5; align-self: flex-start; max-width: 92%; }
.msg-user { background: #f0f0f0; color: var(--text); border-radius: 12px 12px 12px 4px; padding: 8px 10px; font-size: 11px; line-height: 1.5; align-self: flex-end; max-width: 88%; }
.msg-loading { background: var(--primary-light); border-radius: 12px; padding: 8px 10px; font-size: 11px; color: var(--primary); align-self: flex-start; }
.ai-input-area { padding: 8px 10px; border-top: 1px solid var(--border); display: flex; gap: 6px; align-items: center; }
.ai-input { flex: 1; border: 1.5px solid var(--border); border-radius: 16px; padding: 6px 12px; font-size: 11px; outline: none; direction: rtl; transition: border-color 0.15s; }
.ai-input:focus { border-color: var(--primary); }
.ai-send-btn { width: 30px; height: 30px; background: var(--primary); color: white; border-radius: 50%; font-size: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.15s; }
.ai-send-btn:hover { background: var(--primary-hover); }
.ai-drawer-btn { display: none; }

/* ── SMS Form ──────────────────────────────────── */
.sms-form-wrapper { flex: 1; overflow-y: auto; padding: 20px; display: flex; justify-content: center; }
.sms-card { background: var(--white); border-radius: 14px; padding: 24px; width: 100%; max-width: 600px; box-shadow: 0 2px 16px rgba(135,0,155,0.08); display: flex; flex-direction: column; gap: 20px; height: fit-content; }
.sms-field { display: flex; flex-direction: column; gap: 8px; }
.sms-label { font-size: 13px; font-weight: 600; }
.required { color: #e53935; }
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 14px; border-radius: 20px; border: 1.5px solid var(--border); font-size: 12px; color: #666; background: var(--white); transition: all 0.15s; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); color: white; border-color: var(--primary); }
.sms-textarea { border: 1.5px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 13px; resize: vertical; min-height: 72px; outline: none; direction: rtl; transition: border-color 0.15s; width: 100%; }
.sms-textarea:focus { border-color: var(--primary); }
.sms-generate-btn { background: var(--primary); color: white; border-radius: 10px; padding: 13px; font-size: 14px; font-weight: 600; transition: all 0.15s; width: 100%; }
.sms-generate-btn:hover:not(:disabled) { background: var(--primary-hover); }
.sms-generate-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.sms-output { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.sms-output-header { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.sms-char-count { background: var(--secondary-light); color: var(--secondary); border-radius: 10px; padding: 2px 8px; font-size: 11px; font-weight: 600; }
.sms-option { background: var(--bg); border: 1.5px solid var(--border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; transition: border-color 0.15s; }
.sms-option:hover { border-color: var(--primary); }
.sms-option-label { font-size: 11px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.5px; }
.sms-option-text { font-size: 14px; line-height: 1.9; color: var(--text-primary); direction: rtl; }
.sms-option-footer { display: flex; align-items: center; justify-content: space-between; }
.sms-copy-btn { background: var(--secondary); color: white; border-radius: 8px; padding: 7px 16px; font-size: 12px; font-weight: 600; transition: opacity 0.15s; }
.sms-copy-btn:hover { opacity: 0.88; }
.sms-regen-btn { background: var(--bg); border: 1.5px solid var(--border); border-radius: 8px; padding: 7px 14px; font-size: 12px; color: #666; transition: all 0.15s; }
.sms-regen-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ── SMS Enhancements ──────────────────────────── */
.sms-category-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 6px;
}
.chip.contact-active {
  background: #0ea5e9;
  color: white;
  border-color: #0ea5e9;
}
.chip.contact-active:hover { background: #0284c7; border-color: #0284c7; }
.contact-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.contact-input-label {
  font-size: 16px;
  min-width: 26px;
  text-align: center;
  flex-shrink: 0;
}
.sms-input {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  direction: rtl;
  transition: border-color 0.15s;
  width: 100%;
}
.sms-input:focus { border-color: var(--primary); }
.sms-optional { font-size: 11px; color: var(--text-muted); font-weight: 400; margin-right: 4px; }
.sms-offer-block {
  border: 1.5px dashed #c084fc;
  border-radius: 10px;
  padding: 12px 14px;
  background: #faf5ff;
  gap: 8px;
}
.sms-char-breakdown {
  font-size: 10px;
  color: var(--text-muted);
  margin-right: 8px;
}

/* ── Video nav bar (next / prev) ───────────────── */
.video-nav-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: #111; padding: 10px 16px; gap: 12px;
}
.video-nav-btn {
  background: var(--primary); color: white;
  border-radius: 8px; padding: 7px 16px;
  font-size: 13px; font-weight: 600;
  transition: background 0.15s; white-space: nowrap;
  font-family: inherit;
}
.video-nav-btn:hover { background: var(--primary-hover); }
.video-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.video-nav-counter { color: rgba(255,255,255,0.7); font-size: 12px; flex: 1; text-align: center; }

/* ── Lesson layout ─────────────────────────────── */
.lesson-layout { display: flex; flex: 1; overflow: hidden; min-height: 0; }

.lesson-sidebar {
  width: 240px; flex-shrink: 0;
  background: #13002b; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0;
}
.lesson-module { padding: 6px 0; }
.lesson-module-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px 6px;
  font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.4);
  text-transform: uppercase; letter-spacing: 0.8px;
}
.lesson-module-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.lesson-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: right; padding: 9px 16px;
  font-size: 12px; color: rgba(255,255,255,0.6);
  font-family: inherit; cursor: pointer;
  border-right: 3px solid transparent;
  transition: all 0.15s;
}
.lesson-item:hover { background: rgba(255,255,255,0.06); color: white; }
.lesson-item.active { color: white; background: rgba(135,0,155,0.4); border-right-color: var(--secondary); }
.lesson-item.done { color: rgba(255,255,255,0.5); }
.lesson-item.done .lesson-num { background: #059669; color: white; }
.lesson-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.5);
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.lesson-item.active .lesson-num { background: var(--secondary); color: var(--primary); }
.lesson-item-title { flex: 1; line-height: 1.4; }

.lesson-reader { flex: 1; overflow-y: auto; background: #f8f6fb; }

/* Welcome screen */
.lesson-welcome {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100%;
  padding: 40px 24px; text-align: center;
}
.welcome-emoji { font-size: 56px; margin-bottom: 16px; }
.lesson-welcome h2 { font-size: 22px; font-weight: 700; color: var(--primary); margin-bottom: 10px; }
.lesson-welcome p { font-size: 14px; color: #666; line-height: 1.7; max-width: 380px; }
.welcome-sub { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

/* Lesson page */
.lesson-page { max-width: 760px; margin: 0 auto; padding: 28px 24px 60px; }

.lesson-header {
  background: linear-gradient(135deg, #13002b, #87009B);
  border-radius: 16px; padding: 28px;
  margin-bottom: 24px; color: white;
}
.lesson-num-badge {
  display: inline-flex; align-items: center;
  background: rgba(236,178,46,0.25); color: var(--secondary);
  border: 1px solid rgba(236,178,46,0.4);
  border-radius: 20px; padding: 3px 12px;
  font-size: 11px; font-weight: 700; margin-bottom: 12px;
}
.lesson-header-icon { font-size: 32px; margin-bottom: 8px; }
.lesson-title { font-size: 22px; font-weight: 700; color: white; margin-bottom: 10px; line-height: 1.4; }
.lesson-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.lesson-duration { font-size: 12px; color: rgba(255,255,255,0.7); display: flex; align-items: center; gap: 4px; }
.lesson-video-btn {
  background: var(--secondary); color: var(--primary);
  border-radius: 20px; padding: 5px 14px;
  font-size: 12px; font-weight: 700; font-family: inherit;
  border: none; cursor: pointer; transition: opacity 0.15s;
}
.lesson-video-btn:hover { opacity: 0.85; }

.lesson-objective {
  display: flex; align-items: flex-start; gap: 12px;
  background: white; border-radius: 12px;
  padding: 16px 18px; margin-bottom: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(135,0,155,0.06);
}
.objective-icon { font-size: 22px; flex-shrink: 0; margin-top: 2px; }
.objective-label { font-size: 10px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.lesson-objective p { font-size: 13px; color: #555; line-height: 1.7; margin: 0; }

/* Lesson sections */
.lesson-section { border-radius: 14px; padding: 22px; margin-bottom: 20px; }
.section-tag {
  display: inline-block; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  border-radius: 20px; padding: 3px 10px; margin-bottom: 12px;
}
.why-section { background: linear-gradient(135deg, rgba(135,0,155,0.06), rgba(236,178,46,0.06)); border: 1px solid rgba(135,0,155,0.12); }
.why-section .section-tag { background: var(--primary-light); color: var(--primary); }
.why-section h2 { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.why-section p { font-size: 13.5px; color: #555; line-height: 1.85; }

.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.stat-card { background: white; border-radius: 10px; padding: 14px 12px; text-align: center; border: 1px solid var(--border); }
.stat-icon { font-size: 20px; margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.stat-label { font-size: 10px; color: #666; line-height: 1.5; }

.steps-section { background: white; border: 1px solid var(--border); }
.steps-section .section-tag { background: #f0e8ff; color: var(--primary); }
.steps { display: flex; flex-direction: column; gap: 0; }
.step {
  display: flex; gap: 16px; padding: 18px 0;
  border-bottom: 1px solid #f0eaf8;
}
.step:last-child { border-bottom: none; }
.step-num {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--secondary); color: #5a3000;
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px;
}
.step-content { flex: 1; }
.step-content h3 { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.step-content p { font-size: 13px; color: #555; line-height: 1.75; margin-bottom: 10px; }
.step-screenshot {
  background: linear-gradient(135deg, #f4f0ff, #fff8e7);
  border: 1.5px dashed #cbb8e8; border-radius: 8px;
  padding: 14px 16px; font-size: 12px; color: #888;
  display: flex; align-items: center; gap: 8px;
}

.pro-tip {
  display: flex; align-items: flex-start; gap: 12px;
  background: #fffbea; border: 1px solid #f5d060;
  border-radius: 12px; padding: 16px 18px; margin-bottom: 20px;
}
.pro-tip-icon { font-size: 22px; flex-shrink: 0; }
.pro-tip-label { font-size: 10px; font-weight: 700; color: #b45309; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.pro-tip p { font-size: 13px; color: #555; line-height: 1.7; margin: 0; }

.takeaways-section { background: #f4f0ff; border: 1px solid #d8c8f8; }
.takeaways-section .section-tag { background: var(--primary); color: white; }
.takeaways { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.takeaways li {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13.5px; color: #333; line-height: 1.6;
}
.takeaways li::before { content: '✓'; color: var(--primary); font-weight: 700; flex-shrink: 0; margin-top: 1px; }

.lesson-done-btn {
  width: 100%; background: var(--primary); color: white;
  border-radius: 12px; padding: 14px;
  font-size: 14px; font-weight: 700; font-family: inherit;
  border: none; cursor: pointer; margin-top: 24px;
  transition: background 0.15s;
}
.lesson-done-btn:hover { background: var(--primary-hover); }
.lesson-done-btn.done { background: #059669; }

/* Screenshot placeholder */
.screenshot-placeholder {
  background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
  border: 2px dashed var(--border); border-radius: 10px;
  padding: 28px; text-align: center;
  font-size: 13px; color: var(--text-muted);
}

/* ── AI Drawer backdrop ─────────────────────────── */
.ai-drawer-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 199;
}
.ai-drawer-backdrop.visible { display: block; }

/* ── Responsive: Tablet (768–1023px) ───────────── */
@media (max-width: 1023px) {
  :root { --sidebar-w: 60px; }
  .logo-title { display: none; }
  .header-user-name { display: none; }
  .sidebar-user-card { justify-content: center; padding: 14px 0; }
  .sidebar-user-info { display: none; }
  .nav-label, .nav-badge { display: none; }
  .nav-item { justify-content: center; padding: 14px 0; border-right-width: 0; border-bottom: 3px solid transparent; }
  .nav-item.active { border-bottom-color: var(--primary); border-right-color: transparent; }
  .sidebar-progress { display: none; }
  .ai-panel { display: none; }
  .ai-drawer-btn {
    display: flex; align-items: center; justify-content: center;
    position: fixed; bottom: 24px; left: 16px;
    width: 48px; height: 48px;
    background: var(--primary); color: white;
    border-radius: 50%; font-size: 20px;
    box-shadow: 0 4px 16px rgba(135,0,155,0.35);
    z-index: 50;
  }
  .lesson-sidebar { width: 180px; }
  .lesson-page { padding: 20px 16px 48px; }
}

/* ── Responsive: Mobile (<768px) ───────────────── */
@media (max-width: 767px) {
  :root { --header-h: 48px; }
  .sidebar { display: none; }
  .app-body { margin-bottom: 60px; height: calc(100vh - 48px - 60px); overflow: hidden; }
  .ai-panel { display: none; }
  .ai-drawer-btn { display: flex; bottom: 70px; left: 12px; width: 44px; height: 44px; font-size: 18px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; right: 0; left: 0;
    height: 60px; background: var(--white);
    border-top: 1px solid var(--border); z-index: 100;
  }
  .bottom-nav-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px;
    font-size: 9px; color: var(--text-muted); padding: 6px 2px;
    border-top: 2px solid transparent;
  }
  .bottom-nav-item.active { color: var(--primary); border-top-color: var(--primary); }
  .bottom-nav-icon { font-size: 17px; }
  .video-player-wrapper { padding-bottom: 56%; }
  .sms-card { padding: 16px; }
  .content-header { padding: 10px 14px; gap: 8px; }
  .content-title { font-size: 14px; }
  .search-box input { width: 100px; }
  .video-nav-btn { padding: 6px 10px; font-size: 12px; }
  .lesson-layout { flex-direction: column; }
  .lesson-sidebar { width: 100%; max-height: 200px; background: #1a0035; flex-direction: row; flex-wrap: wrap; gap: 4px; padding: 10px; overflow-x: auto; overflow-y: hidden; }
  .lesson-module { display: contents; }
  .lesson-module-header { display: none; }
  .lesson-item { width: auto; flex-shrink: 0; border-right: none; border-bottom: 2px solid transparent; border-radius: 20px; background: rgba(255,255,255,0.08); padding: 5px 10px; font-size: 11px; }
  .lesson-item.active { border-bottom-color: var(--secondary); background: rgba(135,0,155,0.5); }
  .lesson-num { display: none; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .lesson-title { font-size: 18px; }
  .lesson-page { padding: 16px 14px 48px; }
  .video-list { padding: 8px 10px; }
  .video-item { padding: 10px 10px; gap: 8px; }
  .video-title { font-size: 12px; }
  .video-thumb { width: 44px; height: 30px; }
}
@media (min-width: 768px) { .bottom-nav { display: none; } }

/* ── Touch: disable hover transform ────────────── */
@media (hover: none) {
  .video-item:hover { transform: none; }
}

/* ── AI Drawer overlay ─────────────────────────── */
.ai-panel.drawer-open {
  display: flex !important;
  position: fixed; top: var(--header-h); bottom: 0; left: 0;
  width: min(320px, 90vw); z-index: 200;
  box-shadow: 4px 0 24px rgba(0,0,0,0.2);
}
