/* Kyoik Course Engine - Shared Styles v1 */
/* Google Fonts loaded via <link> in CourseLayout.astro head (not @import, to avoid render-blocking chain) */

:root {
  /* Theme colors - override per-course */
  --green-dark: #1a5c3a;
  --green-mid: #2e7d52;
  --green-light: #4caf80;
  --green-pale: #e8f5ee;
  --green-accent: #00c472;

  /* RGB variants for rgba() usage */
  --green-dark-rgb: 26,92,58;
  --green-mid-rgb: 46,125,82;
  --green-light-rgb: 76,175,128;
  --green-accent-rgb: 0,196,114;

  /* Common colors (same across all courses) */
  --blue-soft: #e3f0ff;
  --text-dark: #1a2332;
  --text-mid: #3d5166;
  --text-light: #6b8099;
  --border: #d4e4d4;
  --white: #ffffff;
  --bg: #f5faf6;
  --gold: #f5a623;
  --gold-pale: #fff8ec;
  --red: #e05252;
  --red-pale: #fff0f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text-dark); min-height: 100vh; }

.header { background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-mid) 100%); color: white; padding: 0 32px; height: 64px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 12px rgba(0,0,0,0.18); }
.header-brand { display: flex; align-items: center; gap: 12px; cursor: pointer; text-decoration: none; color: white; }
.header-brand img { width: 36px; height: 36px; border-radius: 8px; object-fit: contain; }
.header-title { font-size: 17px; font-weight: 700; letter-spacing: 0.01em; font-family: 'IBM Plex Serif', serif; }
.header-subtitle { font-size: 11px; opacity: 0.75; letter-spacing: 0.03em; text-transform: uppercase; }
.header-right { display: flex; align-items: center; gap: 20px; }
.header-progress-wrap { display: none; }
.header-progress-label { font-size: 12px; opacity: 0.85; }
.header-progress-bar { width: 140px; height: 6px; background: rgba(255,255,255,0.2); border-radius: 99px; overflow: hidden; }
.header-progress-fill { height: 100%; background: var(--green-accent); border-radius: 99px; transition: width 0.8s cubic-bezier(0.34, 1.2, 0.64, 1); }

.page { display: none; }
.page.active { display: block; }

.home-hero { background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-mid) 60%, var(--green-light) 100%); color: white; padding: 40px 32px 52px; text-align: center; position: relative; overflow: hidden; }
.home-hero::before { content: ''; position: absolute; top: 0; right: 0; width: 100%; height: 100%; opacity: 0.25; display: block; }
.home-hero::after { content: ''; position: absolute; top: 0; right: 0; width: 100%; height: 100%; background: linear-gradient(to right, var(--green-dark) 0%, rgba(var(--green-dark-rgb),0.95) 45%, rgba(var(--green-mid-rgb),0.7) 70%, rgba(var(--green-light-rgb),0.4) 100%); }
.home-hero-badge { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25); border-radius: 99px; padding: 5px 14px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 20px; position: relative; z-index: 1; }
.home-hero h1 { font-size: 38px; font-weight: 800; line-height: 1.15; margin-bottom: 16px; position: relative; z-index: 1; font-family: 'IBM Plex Serif', serif; }
.home-hero p { font-size: 17px; opacity: 0.88; max-width: 560px; margin: 0 auto; line-height: 1.6; position: relative; z-index: 1; }

.progress-banner { background: white; margin: 0 32px; margin-top: -28px; border-radius: 16px; padding: 22px 28px; box-shadow: 0 4px 24px rgba(0,0,0,0.10); display: flex; flex-wrap: wrap; align-items: center; gap: 16px; position: relative; z-index: 2; }
.progress-banner-left { flex: 1 1 0%; min-width: 0; }
.progress-bar-row { display: flex; align-items: center; gap: 12px; }
.overall-bar { flex: 1; height: 10px; background: var(--green-pale); border-radius: 99px; overflow: hidden; }
.overall-bar-fill { height: 100%; background: linear-gradient(90deg, var(--green-light), var(--green-accent)); border-radius: 99px; transition: width 0.8s cubic-bezier(0.34, 1.2, 0.64, 1); }
#continue-btn-wrap { flex: 0 0 auto; }
.continue-course-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 28px; font-size: 15px; white-space: nowrap; justify-content: center; border-bottom: 4px solid var(--green-dark); box-shadow: 0 2px 0 rgba(0,0,0,0.1); transition: transform 0.08s ease, border-bottom-width 0.08s ease, box-shadow 0.08s ease, background 0.15s; }
.continue-course-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 rgba(0,0,0,0.1); }
.continue-course-btn:active { transform: translateY(3px); border-bottom-width: 1px; box-shadow: none; }
.continue-detail { font-size: 11px; font-weight: 500; opacity: 0.85; }
.progress-pct { font-size: 14px; font-weight: 700; color: var(--green-mid); white-space: nowrap; }

.course-footer { text-align: center; padding: 20px 28px; margin-bottom: 20px; border-top: 1px solid var(--border); }
.course-footer a { color: var(--text-light); text-decoration: none; font-size: 14px; line-height: 1.6; transition: color 0.2s ease; }
.course-footer a:hover { color: var(--green-mid); }
.course-footer a span { font-weight: 600; color: var(--text-mid); }

.modules-section { padding: 40px 32px; max-width: 1200px; margin: 0 auto 40px; }
.section-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-mid); margin-bottom: 16px; display: flex; align-items: center; gap: 12px; }
.section-title::before, .section-title::after { content: ''; flex: 1; height: 2px; background: var(--border); border-radius: 99px; }
.section-title::before { max-width: 20px; }
.section-title::after { flex: 1; }
.modules-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 40px; }

.module-card { background: #fff; border-radius: 16px; padding: 22px; border: 2px solid var(--border); border-bottom: 4px solid var(--border); cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease; position: relative; overflow: hidden; }
.module-card::after { content: none; }
.module-card:hover:not(.locked) { transform: translateY(-4px) scale(1.008); box-shadow: 0 8px 0 rgba(var(--green-mid-rgb),0.18), 0 4px 20px rgba(var(--green-mid-rgb),0.08); border-color: var(--green-light); border-bottom-color: var(--green-mid); }
.module-card.completed { border-color: var(--green-light); border-bottom-color: var(--green-dark); background: var(--green-pale); }
.module-card.locked { opacity: 0.5; cursor: default; }
.module-card.locked:hover { transform: none; box-shadow: none; border-color: var(--border); border-bottom-color: var(--border); }
.module-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.module-num-badge { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; flex-shrink: 0; background: var(--green-pale); border: 2px solid var(--green-light); }
.module-status-badge { font-size: 11px; font-weight: 800; padding: 4px 11px; border-radius: 99px; letter-spacing: 0.05em; text-transform: uppercase; border: 2px solid transparent; }
.status-not-started { background: #f0f4f8; color: var(--text-light); border-color: #d4dde6; }
.status-in-progress { background: #fff3cd; color: #946800; border-color: #f5d76e; }
.status-completed { background: var(--green-pale); color: var(--green-dark); border-color: var(--green-light); }
.status-locked { background: #e8edf2; color: #8896a7; border-color: #c8d3de; }
.module-card h3 { font-size: 17px; font-weight: 700; line-height: 1.3; color: var(--text-dark); margin-bottom: 8px; font-family: 'IBM Plex Serif', serif; }
.module-card p { font-size: 13px; color: var(--text-mid); line-height: 1.5; margin-bottom: 16px; }
.module-card-footer { display: flex; align-items: center; justify-content: space-between; }
.module-meta { display: flex; gap: 12px; font-size: 12px; color: var(--text-light); }
.module-meta-item { display: flex; align-items: center; gap: 4px; }
.module-progress-bar { height: 4px; background: #f0f4f8; border-radius: 99px; margin-top: 12px; overflow: hidden; }
.module-progress-fill { height: 100%; background: var(--green-light); border-radius: 99px; transition: width 0.6s cubic-bezier(0.34, 1.2, 0.64, 1); }
.module-cta-btn { background: var(--green-mid); color: white; border: none; border-bottom: 4px solid var(--green-dark); padding: 10px 22px; border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer; transition: transform 0.08s ease, border-bottom-width 0.08s ease, box-shadow 0.08s ease; box-shadow: 0 2px 0 rgba(0,0,0,0.1); }
.module-cta-btn:hover:not(.locked) { transform: translateY(-1px); box-shadow: 0 4px 0 rgba(0,0,0,0.1); }
.module-cta-btn:active:not(.locked) { transform: translateY(3px); border-bottom-width: 1px; box-shadow: none; }
.module-cta-btn.completed { background: var(--green-light); border-bottom-color: var(--green-mid); }
.module-cta-btn.locked { background: #c8d3de; border-bottom-color: #a0aebb; cursor: default; }

.coming-soon-card { background: linear-gradient(135deg, #f8fafb, var(--green-pale)); border: 1px dotted #a8c4d0; border-radius: 16px; padding: 28px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; min-height: 180px; }
.coming-soon-card .cs-icon { font-size: 32px; opacity: 0.5; margin-bottom: 4px; }
.coming-soon-card h4 { font-size: 15px; font-weight: 700; color: var(--text-mid); }
.coming-soon-card p { font-size: 12px; color: #6b7a88; }
.coming-soon-label { display: inline-block; background: var(--green-pale); color: var(--green-dark); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 10px; border-radius: 99px; margin-top: 4px; }

.module-detail { max-width: 900px; margin: 0 auto; padding: 32px 24px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-light); margin-bottom: 24px; }
.breadcrumb a { color: var(--green-mid); cursor: pointer; text-decoration: none; font-weight: 600; }
.breadcrumb a:hover { text-decoration: underline; }
.module-hero { background: linear-gradient(135deg, var(--green-dark), var(--green-mid)); border-radius: 20px; padding: 36px; color: white; margin-bottom: 28px; position: relative; overflow: hidden; }
.module-hero::after { content: ''; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; background: rgba(255,255,255,0.05); border-radius: 50%; }
.module-hero-num { font-size: 12px; font-weight: 700; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; }
.module-hero h2 { font-size: 28px; font-weight: 800; line-height: 1.2; margin-bottom: 12px; font-family: 'IBM Plex Serif', serif; }
.module-hero p { font-size: 15px; opacity: 0.88; line-height: 1.6; max-width: 600px; }
.module-hero-tags { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.module-tag { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25); border-radius: 99px; padding: 4px 12px; font-size: 12px; font-weight: 600; }

.module-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 28px; }
.module-tab { padding: 10px 20px; font-size: 14px; font-weight: 600; color: var(--text-light); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.15s; border-radius: 8px 8px 0 0; }
.module-tab:hover { color: var(--green-mid); background: var(--green-pale); }
.module-tab.active { color: var(--green-dark); border-bottom-color: var(--green-mid); background: transparent; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.content-section { background: #fff; border-radius: 16px; padding: 28px; margin-bottom: 20px; border: 2px solid var(--border); border-bottom: 4px solid var(--border); transition: transform 0.15s ease, border-color 0.15s ease; }
.content-section:hover { transform: translateY(-2px); border-color: var(--green-light); border-bottom-color: var(--green-mid); }
.content-section h3 { font-size: 18px; font-weight: 700; color: var(--text-dark); margin-bottom: 14px; display: flex; align-items: center; gap: 10px; font-family: 'IBM Plex Serif', serif; }
.content-section h3 .section-icon { width: 32px; height: 32px; background: var(--green-pale); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.content-section p { font-size: 15px; line-height: 1.75; color: var(--text-mid); margin-bottom: 14px; }
.content-section p:last-child { margin-bottom: 0; }
.key-points { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.key-points li { display: flex; align-items: flex-start; gap: 12px; font-size: 14px; color: var(--text-mid); line-height: 1.5; }
.key-points li::before { content: '\2713'; background: var(--green-pale); color: var(--green-dark); width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; margin-top: 1px; }
.highlight-box { background: var(--green-pale); border-left: 4px solid var(--green-mid); border-radius: 0 12px 12px 0; padding: 16px 20px; margin: 16px 0; }
.highlight-box-label { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--green-dark); margin-bottom: 10px; }
.highlight-box-label svg { width: 16px; height: 16px; fill: var(--green-dark); flex-shrink: 0; }
.example-box { background: var(--gold-pale); border-left-color: var(--gold); }
.example-box-label { color: #7a5200; }
.example-box-label svg { fill: #7a5200; }
.example-box p { color: #7a5200; }
.highlight-box p { font-size: 14px; color: var(--green-dark); margin-bottom: 0; font-weight: 500; }
.info-cards { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-top: 16px; }
.info-card { background: var(--bg); border-radius: 12px; padding: 16px; border: 1px solid var(--border); text-align: center; }
.info-card .info-icon { font-size: 24px; margin-bottom: 8px; }
.info-card .info-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-light); margin-bottom: 4px; }
.info-card .info-value { font-size: 14px; font-weight: 600; color: var(--text-dark); }
.objectives-list { list-style: none; counter-reset: obj; display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.objectives-list li { counter-increment: obj; display: flex; align-items: flex-start; gap: 14px; font-size: 14px; color: var(--text-mid); line-height: 1.55; }
.objectives-list li::before { content: counter(obj); background: var(--green-mid); color: white; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; margin-top: 1px; }

.quiz-wrap { max-width: 700px; }
.quiz-progress-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.quiz-q-counter { font-size: 13px; font-weight: 600; color: var(--text-light); }
.quiz-score-live { font-size: 13px; font-weight: 700; color: var(--green-mid); background: var(--green-pale); padding: 4px 12px; border-radius: 99px; }
.quiz-progress-track { height: 6px; background: #eef2f5; border-radius: 99px; margin-bottom: 24px; overflow: hidden; }
.quiz-progress-fill { height: 100%; background: linear-gradient(90deg, var(--green-light), var(--green-accent)); border-radius: 99px; transition: width 0.5s cubic-bezier(0.34, 1.2, 0.64, 1); }
.quiz-question-card { background: white; border-radius: 16px; padding: 28px; border: 1px solid var(--border); margin-bottom: 16px; }
.quiz-q-num { font-size: 11px; font-weight: 700; color: var(--green-mid); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }
.quiz-q-text { font-size: 17px; font-weight: 600; line-height: 1.4; color: var(--text-dark); margin-bottom: 24px; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-option { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--bg); border: 2px solid var(--border); border-radius: 12px; cursor: pointer; transition: all 0.15s; font-size: 14px; color: var(--text-mid); font-weight: 500; }
.quiz-option:hover:not(.disabled) { border-color: var(--green-light); background: var(--green-pale); color: var(--green-dark); }
.quiz-option.selected { border-color: var(--green-mid); background: var(--green-pale); color: var(--green-dark); }
.quiz-option.correct { border-color: #3ca86b; background: #eafaf2; color: #1a5c3a; }
.quiz-option.incorrect { border-color: var(--red); background: var(--red-pale); color: var(--red); }
.quiz-option.disabled { cursor: default; }
.quiz-option-letter { width: 30px; height: 30px; border-radius: 8px; background: rgba(0,0,0,0.06); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.quiz-option.correct .quiz-option-letter { background: #3ca86b; color: white; }
.quiz-option.incorrect .quiz-option-letter { background: var(--red); color: white; }
.quiz-feedback { padding: 14px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; line-height: 1.5; margin-top: 14px; display: none; }
.quiz-feedback.correct { background: #eafaf2; color: #1a5c3a; border: 1px solid #b6e8d0; display: block; }
.quiz-feedback.incorrect { background: var(--red-pale); color: #9b2020; border: 1px solid #f5c0c0; display: block; }
.quiz-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; }
.quiz-btn { padding: 12px 28px; border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer; transition: transform 0.08s ease, border-bottom-width 0.08s ease, box-shadow 0.08s ease, background 0.15s, color 0.15s, border-color 0.15s; border: none; }
.quiz-btn-primary { background: var(--green-mid); color: white; border-bottom: 4px solid var(--green-dark); box-shadow: 0 2px 0 rgba(0,0,0,0.1); }
.quiz-btn-primary:hover { background: var(--green-dark); transform: translateY(-1px); box-shadow: 0 4px 0 rgba(0,0,0,0.1); }
.quiz-btn-primary:active:not(:disabled) { transform: translateY(3px); border-bottom-width: 1px; box-shadow: none; }
.quiz-btn-primary:disabled { background: #c8d8c8; cursor: default; border-bottom-color: #a8b8a8; box-shadow: none; }
.quiz-btn-ghost { background: transparent; color: var(--text-light); border: 2px solid var(--border); border-bottom: 4px solid var(--border); box-shadow: 0 1px 0 rgba(0,0,0,0.05); }
.quiz-btn-ghost:hover { border-color: var(--green-light); color: var(--green-mid); transform: translateY(-1px); }
.quiz-btn-ghost:active { transform: translateY(2px); border-bottom-width: 2px; box-shadow: none; }

.quiz-results { background: white; border-radius: 20px; padding: 48px 36px; text-align: center; border: 1px solid var(--border); }
.result-icon { font-size: 56px; margin-bottom: 16px; }
.result-score-circle { width: 120px; height: 120px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 0 auto 24px; border: 6px solid; }
.result-score-circle.pass { border-color: var(--green-light); background: var(--green-pale); color: var(--green-dark); }
.result-score-circle.fail { border-color: var(--gold); background: var(--gold-pale); color: #7a5200; }
.result-score-num { font-size: 34px; font-weight: 900; line-height: 1; }
.result-score-denom { font-size: 13px; font-weight: 600; opacity: 0.7; }
.quiz-results h3 { font-size: 24px; font-weight: 800; margin-bottom: 10px; font-family: 'IBM Plex Serif', serif; }
.quiz-results p { font-size: 15px; color: var(--text-mid); line-height: 1.6; max-width: 440px; margin: 0 auto 28px; }
.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.result-bank-note { font-size: 12px; color: var(--text-light); margin-top: 12px; font-style: italic; }
.quiz-review { max-width: 700px; }
.review-item { background: white; border-radius: 14px; padding: 20px 24px; margin-bottom: 14px; border: 2px solid var(--border); }
.review-item.correct { border-color: #3ca86b; }
.review-item.incorrect { border-color: var(--red); }
.review-item.unanswered { border-color: var(--gold); }
.review-item-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.review-q-num { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-light); }
.review-verdict { font-size: 13px; font-weight: 700; }
.review-item.correct .review-verdict { color: #1a5c3a; }
.review-item.incorrect .review-verdict { color: var(--red); }
.review-item.unanswered .review-verdict { color: #946800; }
.review-question { font-size: 15px; font-weight: 600; color: var(--text-dark); margin-bottom: 14px; line-height: 1.4; }
.review-options { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.review-option { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; border-radius: 8px; font-size: 13px; color: var(--text-mid); background: var(--bg); line-height: 1.45; }
.review-opt-correct { background: #eafaf2; color: #1a5c3a; font-weight: 600; }
.review-opt-wrong { background: var(--red-pale); color: var(--red); text-decoration: line-through; }
.review-opt-letter { width: 24px; height: 24px; min-width: 24px; border-radius: 6px; background: rgba(0,0,0,0.06); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; margin-top: 1px; }
.review-opt-correct .review-opt-letter { background: #3ca86b; color: white; }
.review-opt-wrong .review-opt-letter { background: var(--red); color: white; }
.review-feedback { font-size: 13px; color: var(--text-mid); line-height: 1.55; padding: 10px 14px; background: var(--blue-soft); border-radius: 8px; }

.btn { padding: 12px 24px; border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer; border: none; transition: transform 0.08s ease, border-bottom-width 0.08s ease, box-shadow 0.08s ease, background 0.15s, color 0.15s, border-color 0.15s; display: inline-flex; align-items: center; gap: 8px; }
.btn-primary { background: var(--green-mid); color: white; border-bottom: 4px solid var(--green-dark); box-shadow: 0 2px 0 rgba(0,0,0,0.1); }
.btn-primary:hover { background: var(--green-dark); transform: translateY(-1px); box-shadow: 0 4px 0 rgba(0,0,0,0.1); }
.btn-primary:active { transform: translateY(3px); border-bottom-width: 1px; box-shadow: none; }
.btn-outline { background: white; color: var(--green-mid); border: 2px solid var(--green-mid); border-bottom: 4px solid var(--green-mid); box-shadow: 0 1px 0 rgba(0,0,0,0.05); }
.btn-outline:hover { background: var(--green-pale); transform: translateY(-1px); }
.btn-outline:active { transform: translateY(2px); border-bottom-width: 2px; box-shadow: none; }
.btn-ghost { background: transparent; color: var(--text-mid); border: 2px solid var(--border); border-bottom: 4px solid var(--border); box-shadow: 0 1px 0 rgba(0,0,0,0.03); }
.btn-ghost:hover { border-color: var(--green-light); color: var(--green-mid); transform: translateY(-1px); }
.btn-ghost:active { transform: translateY(2px); border-bottom-width: 2px; box-shadow: none; }

.diagram-wrap { margin: 24px 0; overflow-x: auto; }
.diagram-wrap svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.diagram-caption { text-align: center; font-size: 12px; color: var(--text-light); margin-top: 10px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }

.video-embed { margin: 24px 0; }
.video-embed-wrap { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: 12px; background: #000; }
.video-embed-wrap iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }
.video-embed-caption { text-align: center; font-size: 12px; color: var(--text-light); margin-top: 10px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }

.audio-player { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--border); background: white; margin-bottom: 20px; }
.audio-player-play { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--green-mid); background: white; color: var(--green-mid); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.2s; padding: 0; }
.audio-player-play:hover { background: var(--green-pale); border-color: var(--green-dark); color: var(--green-dark); }
.audio-player-play.playing { background: var(--green-mid); color: white; border-color: var(--green-mid); }
.audio-player-play.playing:hover { background: var(--green-dark); border-color: var(--green-dark); }
.audio-player-play.loading { border-color: var(--green-mid); color: var(--green-mid); cursor: wait; opacity: 0.7; }
.audio-player-play.paused { animation: pulse-border 1.5s ease-in-out infinite; }
.audio-player-play svg { width: 14px; height: 14px; fill: currentColor; flex-shrink: 0; }
.audio-player-track { flex: 1; height: 24px; display: flex; align-items: center; cursor: pointer; position: relative; }
.audio-player-track::before { content: ''; position: absolute; left: 0; right: 0; height: 4px; border-radius: 2px; background: #eef2f5; }
.audio-player-track.no-seek { cursor: default; }
.audio-player-fill { position: absolute; left: 0; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--green-mid), var(--green-dark)); width: 0%; transition: width 0.15s linear; z-index: 1; }
.audio-player-fill.indeterminate { width: 100% !important; background: linear-gradient(90deg, var(--green-pale), var(--green-mid), var(--green-pale)); background-size: 200% 100%; animation: shimmer 2s ease-in-out infinite; }
.audio-player-fill.shimmer { width: 100% !important; background: linear-gradient(90deg, #eef2f5 25%, var(--green-pale) 50%, #eef2f5 75%); background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite; }
.audio-player-fill.paused { transition: none; }
.audio-player-time { font-size: 12px; font-weight: 600; color: var(--text-light); white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 80px; text-align: center; }
.audio-player-stop { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border); background: white; color: var(--text-light); cursor: pointer; display: none; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.2s; padding: 0; }
.audio-player-stop.visible { display: flex; }
.audio-player-stop:hover { border-color: #d32f2f; color: #d32f2f; background: #fff5f5; }
.audio-player-stop svg { width: 14px; height: 14px; fill: currentColor; }
.tts-error-msg { font-size: 0.8rem; color: #c0392b; margin-top: 4px; padding: 5px 10px; background: #fdecea; border-radius: 6px; border: 1px solid #f5c6c6; }
@keyframes pulse-border { 0%, 100% { border-color: var(--green-mid); } 50% { border-color: var(--green-pale); } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Sticky bottom nav */
.content-step-nav-spacer { height: 72px; }
.content-step-nav-sticky { position: fixed; bottom: 0; left: 0; right: 0; z-index: 90; background: white; border-top: 1px solid var(--border); padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 -2px 8px rgba(0,0,0,0.06); }

/* Scroll-to-top button */
.scroll-to-top-btn { position: fixed; bottom: 132px; right: 18px; z-index: 91; width: 40px; height: 40px; border-radius: 50%; background: rgba(var(--green-mid-rgb), 0.55); color: white; border: none; border-bottom: 3px solid rgba(var(--green-dark-rgb), 0.65); cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.12); display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease; }
.scroll-to-top-btn.visible { pointer-events: auto; /* animation handled in Duolingo section */ }

/* Table of Contents */
.content-toc { background: white; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 18px; overflow: hidden; }
.content-toc-list { list-style: none; display: block; padding: 10px 18px 14px; margin: 0; }
.content-toc-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; font-size: 13px; color: var(--text-mid); line-height: 1.4; transition: background 0.15s; }
.content-toc-item .toc-num { width: 22px; height: 22px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; color: var(--text-light); }
.content-toc-item .toc-icon { font-size: 14px; flex-shrink: 0; }
.content-toc-item .toc-title { flex: 1; }
.content-toc-item.toc-current { background: var(--green-pale); color: var(--green-dark); font-weight: 600; }
.content-toc-item.toc-current .toc-num { background: var(--green-mid); color: white; }
.content-toc-item.toc-done { cursor: pointer; }
.content-toc-item.toc-done:hover { background: var(--green-pale); }
.content-toc-item.toc-done .toc-num { background: var(--green-light); color: white; }
.content-toc-item.toc-accessible { cursor: pointer; }
.content-toc-item.toc-accessible:hover { background: var(--bg); }
.content-toc-item.toc-locked { opacity: 0.45; }
.toc-check { font-size: 12px; color: var(--text-light); margin-left: auto; flex-shrink: 0; }
.toc-check-done { color: var(--green-mid); font-weight: 700; }
.toc-time { font-size: 11px; color: var(--text-light); flex-shrink: 0; white-space: nowrap; }

/* Module Navigation (Prev/Next) */
.module-nav { display: flex; align-items: stretch; justify-content: space-between; gap: 16px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
.module-nav-btn { display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; background: white; border: 2px solid var(--border); border-radius: 12px; cursor: pointer; transition: all 0.15s; text-align: left; flex: 1; max-width: 48%; font-family: 'Inter', sans-serif; }
.module-nav-btn:hover { border-color: var(--green-light); background: var(--green-pale); }
.module-nav-btn.module-nav-next { text-align: right; margin-left: auto; }
.module-nav-dir { font-size: 12px; font-weight: 700; color: var(--green-mid); text-transform: uppercase; letter-spacing: 0.04em; }
.module-nav-title { font-size: 13px; font-weight: 600; color: var(--text-dark); line-height: 1.35; }

.inline-check { background: var(--blue-soft, #f0f6ff); border: 2px solid #c5d8f0; border-radius: 14px; padding: 22px 24px; margin-top: 20px; }
.inline-check-label { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #1565c0; margin-bottom: 12px; }
.inline-check-label svg { width: 16px; height: 16px; fill: #1565c0; flex-shrink: 0; }
.inline-check-q { font-size: 15px; font-weight: 600; color: var(--text-dark); line-height: 1.45; margin-bottom: 14px; }
.inline-check-options { display: flex; flex-direction: column; gap: 8px; }
.inline-check-opt { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: white; border: 2px solid var(--border); border-radius: 10px; cursor: pointer; transition: all 0.15s; font-size: 14px; color: var(--text-mid); font-weight: 500; }
.inline-check-opt:hover:not(.ic-disabled) { border-color: #90b8e8; background: #f0f6ff; color: #0d47a1; }
.inline-check-opt.ic-correct { border-color: #3ca86b; background: #eafaf2; color: #1a5c3a; }
.inline-check-opt.ic-incorrect { border-color: var(--red); background: var(--red-pale); color: var(--red); }
.inline-check-opt.ic-disabled { cursor: default; opacity: 0.85; }
.inline-check-opt.ic-disabled.ic-show-correct { border-color: #3ca86b; background: #eafaf2; color: #1a5c3a; opacity: 1; }
.inline-check-letter { width: 28px; height: 28px; border-radius: 7px; background: rgba(0,0,0,0.06); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.inline-check-opt.ic-correct .inline-check-letter { background: #3ca86b; color: white; }
.inline-check-opt.ic-incorrect .inline-check-letter { background: var(--red); color: white; }
.inline-check-feedback { padding: 12px 16px; border-radius: 10px; font-size: 13px; font-weight: 500; line-height: 1.5; margin-top: 12px; display: none; }
.inline-check-feedback.ic-fb-correct { background: #eafaf2; color: #1a5c3a; border: 1px solid #b6e8d0; display: block; }
.inline-check-feedback.ic-fb-incorrect { background: var(--red-pale); color: #9b2020; border: 1px solid #f5c0c0; display: block; }

@keyframes ic-pulse { 0% { box-shadow: 0 0 0 0 rgba(21, 101, 192, 0.4); } 50% { box-shadow: 0 0 0 8px rgba(21, 101, 192, 0); } 100% { box-shadow: 0 0 0 0 rgba(21, 101, 192, 0); } }

/* AI Course Assistant Chat */
.chat-msg { display: flex; max-width: 85%; }
.chat-msg-ai { align-self: flex-start; }
.chat-msg-user { align-self: flex-end; }
.chat-msg-content { padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.55; word-wrap: break-word; white-space: pre-wrap; }
.chat-msg-ai .chat-msg-content { background: var(--green-pale); color: var(--green-dark); border-bottom-left-radius: 4px; white-space: normal; }
.chat-msg-ai .chat-msg-content p { margin: 0 0 8px 0; }
.chat-msg-ai .chat-msg-content p:last-child { margin-bottom: 0; }
.chat-msg-ai .chat-msg-content ul, .chat-msg-ai .chat-msg-content ol { margin: 6px 0; padding-left: 20px; }
.chat-msg-ai .chat-msg-content li { margin-bottom: 2px; }
.chat-msg-ai .chat-msg-content code { background: rgba(var(--green-mid-rgb),0.1); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.chat-msg-ai .chat-msg-content pre { background: rgba(var(--green-mid-rgb),0.08); padding: 8px 10px; border-radius: 6px; overflow-x: auto; margin: 6px 0; }
.chat-msg-ai .chat-msg-content pre code { background: none; padding: 0; }
.chat-msg-ai .chat-msg-content strong { font-weight: 700; }
.chat-msg-user .chat-msg-content { background: var(--green-mid); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.chat-error .chat-msg-content { background: #fff0f0; color: #9b2020; font-style: italic; }

.chat-input { flex: 1; resize: none; border: 2px solid rgba(var(--green-mid-rgb),0.3); border-radius: 10px; padding: 10px 14px; font-size: 14px; font-family: 'Inter', sans-serif; line-height: 1.4; color: var(--green-dark); background: #fff; outline: none; transition: border-color 0.15s; }
.chat-input:focus { border-color: var(--green-mid); }
.chat-input:disabled { opacity: 0.6; cursor: not-allowed; }
.chat-input::placeholder { color: rgba(var(--green-mid-rgb),0.5); }
.chat-send-btn { width: 40px; height: 40px; border-radius: 10px; border: none; background: var(--green-mid); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.15s; }
.chat-send-btn:hover { background: var(--green-dark); }
.chat-send-btn:disabled { background: rgba(var(--green-mid-rgb),0.4); cursor: not-allowed; }

.typing-dots { display: inline-flex; gap: 4px; align-items: center; height: 20px; }
.typing-dots span { width: 6px; height: 6px; border-radius: 50%; background: #8e5cb5; animation: typing-bounce 1.2s ease-in-out infinite; }
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

@keyframes enrol-pulse { 0%, 100% { transform: scale(1); box-shadow: 0 2px 8px rgba(0,0,0,0.15); } 50% { transform: scale(1.08); box-shadow: 0 4px 16px rgba(0,0,0,0.25); } }

@keyframes confetti-fall { 0% { transform: translateY(-10px) rotate(0deg); opacity: 1; } 100% { transform: translateY(100vh) rotate(720deg); opacity: 0; } }
.confetti-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9999; overflow: hidden; }
.confetti-piece { position: absolute; width: 10px; height: 10px; top: -10px; border-radius: 2px; animation: confetti-fall 3s ease-in forwards; }

@keyframes milestone-pop { 0% { transform: scale(0.5); opacity: 0; } 50% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }
.milestone-banner { background: linear-gradient(135deg, var(--green-mid), var(--green-accent)); color: white; border-radius: 16px; padding: 20px 28px; margin-bottom: 20px; display: flex; align-items: center; gap: 16px; animation: milestone-pop 0.5s ease-out; }
.milestone-banner-icon { font-size: 32px; flex-shrink: 0; }
.milestone-banner-text { font-size: 15px; font-weight: 600; line-height: 1.4; }
.milestone-banner-sub { font-size: 13px; font-weight: 400; opacity: 0.85; margin-top: 4px; }

@keyframes all-complete-glow { 0%, 100% { box-shadow: 0 0 20px rgba(var(--green-accent-rgb),0.3); } 50% { box-shadow: 0 0 40px rgba(var(--green-accent-rgb),0.6); } }
.all-complete-banner { background: linear-gradient(135deg, var(--green-dark), var(--green-mid), var(--green-accent)); color: white; border-radius: 20px; padding: 32px; text-align: center; margin-bottom: 24px; animation: milestone-pop 0.6s ease-out, all-complete-glow 2s ease-in-out infinite; }
.all-complete-banner h3 { font-size: 22px; font-weight: 800; margin-bottom: 8px; font-family: 'IBM Plex Serif', serif; }
.all-complete-banner p { font-size: 14px; opacity: 0.9; }

.site-footer { background: #1a2b4a; color: rgba(255,255,255,0.7); text-align: center; padding: 28px 20px; font-size: 13px; }
.site-footer a { color: var(--green-accent); text-decoration: none; font-weight: 600; }
.site-footer a:hover { color: white; }

@media (min-width: 768px) {
  .home-hero { padding: 56px 32px 64px; }
  .home-hero::before { width: 60%; left: auto; right: 0; opacity: 0.5; }
  .home-hero::after { background: linear-gradient(to right, var(--green-dark) 0%, var(--green-dark) 35%, rgba(var(--green-dark-rgb),0.92) 50%, rgba(var(--green-mid-rgb),0.5) 72%, rgba(var(--green-light-rgb),0.2) 100%); }
  .home-hero h1 { font-size: 42px; }
}

@media (min-width: 1024px) {
  .home-hero { padding: 72px 32px 80px; }
  .home-hero::before { opacity: 0.6; }
  .home-hero h1 { font-size: 48px; }
}

@media (max-width: 700px) {
  .audio-player { gap: 8px; padding: 6px 10px; }
  .audio-player-play { width: 30px; height: 30px; }
  .audio-player-time { font-size: 11px; min-width: 70px; }
  .audio-player-stop { width: 26px; height: 26px; }
  .header { padding: 0 16px; }
  .home-hero { padding: 32px 20px 40px; }
  .home-hero h1 { font-size: 26px; }
  .progress-banner { margin: 0 16px; margin-top: -28px; gap: 12px; flex-wrap: wrap; }
  .progress-banner-left { flex: 1 1 100%; }
  #continue-btn-wrap { flex: 1 1 100%; }
  .continue-course-btn { width: 100%; justify-content: center; }
  .modules-section { padding: 28px 16px; }
  .modules-grid { grid-template-columns: 1fr; }
  .info-cards { grid-template-columns: 1fr; }
  .module-detail { padding: 20px 16px; }
  .quiz-results { padding: 32px 20px; }
  .result-actions { flex-direction: column; align-items: stretch; }
  .result-actions .btn { justify-content: center; }
  .module-nav { flex-direction: column; gap: 10px; }
  .module-nav-btn { max-width: 100%; }
  .module-nav-btn.module-nav-next { text-align: left; }
}

/* ===================== ENROLLMENT OVERLAY ===================== */
#enroll-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.enroll-card {
  position: relative;
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  max-width: 420px;
  width: 100%;
  padding: 36px 32px 28px;
  text-align: center;
}
.enroll-close { position: absolute; top: 12px; right: 14px; background: none; border: none; font-size: 24px; color: #8a9ab5; cursor: pointer; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: background 0.15s, color 0.15s; }
.enroll-close:hover { background: rgba(0,0,0,0.06); color: #334155; }
.enroll-header { margin-bottom: 24px; }
.enroll-icon { font-size: 48px; margin-bottom: 8px; }
.enroll-title {
  font-family: 'IBM Plex Serif', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 6px;
}
.enroll-subtitle {
  font-size: 14px;
  color: var(--text-mid);
  margin: 0;
}
.enroll-field {
  text-align: left;
  margin-bottom: 14px;
}
.enroll-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 4px;
}
.enroll-field input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  color: var(--text-dark);
  background: var(--bg);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.enroll-field input:focus {
  outline: none;
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(var(--green-mid-rgb), 0.15);
}
.enroll-field input::placeholder {
  color: var(--text-light);
}
.enroll-btn {
  width: 100%;
  padding: 13px 20px;
  background: var(--green-mid);
  color: #fff;
  border: none;
  border-bottom: 4px solid var(--green-dark);
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: transform 0.08s ease, border-bottom-width 0.08s ease, box-shadow 0.08s ease, background 0.15s;
  margin-top: 4px;
  box-shadow: 0 2px 0 rgba(0,0,0,0.1);
}
.enroll-btn:hover { background: var(--green-dark); transform: translateY(-1px); box-shadow: 0 4px 0 rgba(0,0,0,0.1); }
.enroll-btn:active { transform: translateY(3px); border-bottom-width: 1px; box-shadow: none; }
.enroll-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.enroll-privacy {
  font-size: 11px;
  color: var(--text-light);
  margin: 12px 0 0;
  line-height: 1.5;
}
.enroll-skip {
  display: inline-block;
  margin-top: 12px;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s;
  padding: 4px 8px;
}
.enroll-skip:hover { color: var(--text-mid); }

@media (max-width: 480px) {
  .enroll-card { padding: 28px 20px 22px; }
  .enroll-title { font-size: 20px; }
}

/* ===================== POST-QUIZ CTA BANNER ===================== */
.quiz-cta-banner {
  background: linear-gradient(135deg, var(--green-pale) 0%, rgba(var(--green-light-rgb), 0.15) 100%);
  border: 1.5px solid rgba(var(--green-mid-rgb), 0.25);
  border-radius: 12px;
  padding: 20px 24px;
  margin-top: 20px;
  text-align: center;
}
.quiz-cta-banner h4 {
  font-family: 'IBM Plex Serif', serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 6px;
}
.quiz-cta-banner p {
  font-size: 13px;
  color: var(--text-mid);
  margin: 0 0 14px;
}
.quiz-cta-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.quiz-cta-buttons a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s;
}
.quiz-cta-buttons a:hover { opacity: 0.85; }

/* ===================== COURSE LEADER PROMO CARD ===================== */
.leader-promo-card {
  background: linear-gradient(135deg, #f8fafc 0%, var(--green-pale) 100%);
  border: 1.5px solid rgba(var(--green-mid-rgb), 0.2);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 24px 0;
  display: flex;
  align-items: center;
  gap: 16px;
}
.leader-promo-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--green-mid);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  flex-shrink: 0;
  font-family: 'IBM Plex Serif', serif;
}
.leader-promo-body { flex: 1; min-width: 0; }
.leader-promo-body h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 4px;
}
.leader-promo-body p {
  font-size: 13px;
  color: var(--text-mid);
  margin: 0 0 10px;
  line-height: 1.4;
}
.leader-promo-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.leader-promo-actions a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s;
}
.leader-promo-actions a:hover { opacity: 0.85; }
@media (max-width: 480px) {
  .leader-promo-card { flex-direction: column; text-align: center; }
  .leader-promo-actions { justify-content: center; }
}

/* ===================== CERTIFICATE CLAIM FORM ===================== */
.cert-form-wrap {
  background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
  border: 1.5px solid #f59e0b;
  border-radius: 12px;
  padding: 24px;
  margin-top: 20px;
  text-align: center;
}
.cert-form-header h4 {
  font-family: 'IBM Plex Serif', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 6px;
}
.cert-form-header p {
  font-size: 13px;
  color: var(--text-mid);
  margin: 0 0 16px;
  line-height: 1.5;
}
.cert-form-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.cert-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: var(--text-dark);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.cert-input:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}
.cert-input::placeholder { color: var(--text-light); }
.cert-submit-btn {
  width: 100%;
  max-width: 280px;
  padding: 12px 24px;
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.cert-submit-btn:hover { background: #d97706; }
.cert-submit-btn:active { transform: scale(0.98); }
.cert-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.cert-claimed-msg {
  background: #ecfdf5;
  border: 1.5px solid #10b981;
  border-radius: 10px;
  padding: 14px 20px;
  margin-top: 16px;
  font-size: 14px;
  font-weight: 600;
  color: #065f46;
  text-align: center;
}
@media (max-width: 480px) {
  .cert-form-wrap { padding: 18px 16px; }
  .cert-submit-btn { max-width: 100%; }
}

/* ===================== DUOLINGO-STYLE ANIMATIONS ===================== */

/* KC answer animations */
@keyframes ic-correct-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.05); background: #d4f5e2; border-color: #3ca86b; }
  100% { transform: scale(1); }
}
@keyframes ic-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}
.inline-check-opt.ic-anim-correct {
  animation: ic-correct-pop 0.35s ease-out forwards;
  border-color: #3ca86b !important;
  background: #eafaf2 !important;
}
.inline-check-opt.ic-anim-shake {
  animation: ic-shake 0.5s ease-out forwards;
  border-color: var(--red) !important;
  background: var(--red-pale) !important;
}

/* Quiz answer animations */
.quiz-option.quiz-anim-correct {
  animation: ic-correct-pop 0.35s ease-out forwards;
  border-color: #3ca86b !important;
  background: #eafaf2 !important;
}
.quiz-option.quiz-anim-shake {
  animation: ic-shake 0.5s ease-out forwards;
  border-color: var(--red) !important;
  background: var(--red-pale) !important;
}
@keyframes letter-pop {
  0%   { transform: scale(1) rotate(0deg); }
  50%  { transform: scale(1.3) rotate(10deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.quiz-option.correct .quiz-option-letter {
  animation: letter-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.quiz-option.incorrect .quiz-option-letter {
  animation: ic-shake 0.4s ease-out forwards;
}

/* Content step fade transitions */
@keyframes content-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
#detail-content-body.content-fade-out {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
#detail-content-body.content-fade-in {
  animation: content-fade-in 0.25s ease-out forwards;
}

/* Tab switch slide-in */
@keyframes tab-slide-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tab-pane.tab-animate-in {
  animation: tab-slide-in 0.2s ease-out forwards;
}

/* Module card hover enhancements (main rule in base section) */
.module-card:hover:not(.locked) .module-progress-fill { box-shadow: 0 0 6px rgba(var(--green-light-rgb), 0.5); }

/* Trophy bounce-in on completed cards */
@keyframes trophy-bounce {
  0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
  60%  { transform: scale(1.2) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.module-card.completed .module-trophy {
  animation: trophy-bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* TOC current item number pop */
@keyframes toc-num-pop {
  0%   { transform: scale(0.7); }
  60%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.content-toc-item.toc-current .toc-num {
  animation: toc-num-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* TOC checkmark pop */
@keyframes toc-check-pop {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.toc-check-done {
  animation: toc-check-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Scroll-to-top bounce-in */
@keyframes scroll-btn-bounce {
  0%   { transform: scale(0) translateY(8px); opacity: 0; }
  60%  { transform: scale(1.1) translateY(-2px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.scroll-to-top-btn.visible {
  animation: scroll-btn-bounce 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.scroll-to-top-btn:hover, .scroll-to-bottom-btn:hover { transform: scale(1.1); background: rgba(var(--green-mid-rgb), 0.95); }
.scroll-to-top-btn:active, .scroll-to-bottom-btn:active { transform: translateY(2px) scale(0.95); }
.scroll-to-bottom-btn { position: fixed; bottom: 84px; right: 18px; z-index: 91; width: 40px; height: 40px; border-radius: 50%; background: rgba(var(--green-mid-rgb), 0.55); color: white; border: none; border-bottom: 3px solid rgba(var(--green-dark-rgb), 0.65); cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.12); display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease; }
.scroll-to-bottom-btn.visible { animation: scroll-btn-bounce 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; pointer-events: auto; }

/* Confetti enhancements */
@keyframes confetti-fall-enhanced {
  0% { transform: translateY(-10px) translateX(0) rotate(0deg); opacity: 1; }
  25% { transform: translateY(25vh) translateX(var(--drift)) rotate(180deg); opacity: 1; }
  50% { transform: translateY(50vh) translateX(calc(var(--drift) * -0.5)) rotate(360deg); opacity: 0.9; }
  75% { transform: translateY(75vh) translateX(var(--drift)) rotate(540deg); opacity: 0.5; }
  100% { transform: translateY(100vh) translateX(calc(var(--drift) * -1)) rotate(720deg); opacity: 0; }
}
.confetti-piece-star { clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }

/* Confetti screen flash */
@keyframes confetti-flash {
  0%   { opacity: 0.3; }
  100% { opacity: 0; }
}
.confetti-flash { position: fixed; inset: 0; z-index: 9998; background: white; pointer-events: none; animation: confetti-flash 0.15s ease-out forwards; }

/* Quiz results score count-up circle */
@keyframes score-circle-pop {
  0%   { transform: scale(0.8); opacity: 0; }
  60%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.result-score-circle {
  animation: score-circle-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Focus ring improvements */
.btn:focus-visible, .quiz-btn:focus-visible, .module-cta-btn:focus-visible, .continue-course-btn:focus-visible {
  outline: 3px solid var(--green-accent);
  outline-offset: 2px;
}
.inline-check-opt:focus-visible, .quiz-option:focus-visible {
  outline: 3px solid var(--green-mid);
  outline-offset: 2px;
}
.enroll-btn:focus-visible, .cert-submit-btn:focus-visible {
  outline: 3px solid var(--green-accent);
  outline-offset: 2px;
}

/* ===================== REDUCED MOTION ===================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===================== COURSE TUTOR (FAB + DRAWER) ===================== */
.tutor-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--green-mid, #6a1b9a);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 1000;
}
body.tutor-hidden .tutor-fab,
body.tutor-hidden .tutor-drawer,
body.tutor-hidden .tutor-backdrop { display: none !important; }
.tutor-fab:hover { opacity: 1; transform: translateY(-1px); }
.tutor-fab:focus-visible { outline: 3px solid rgba(0,0,0,0.25); outline-offset: 2px; }
.tutor-fab svg { width: 22px; height: 22px; fill: currentColor; }
.tutor-fab.pulse { animation: tutor-pulse 0.9s ease 2; }
@keyframes tutor-pulse {
  0%   { transform: scale(1); box-shadow: 0 4px 14px rgba(0,0,0,0.18); }
  50%  { transform: scale(1.08); box-shadow: 0 6px 20px rgba(0,0,0,0.28); }
  100% { transform: scale(1); box-shadow: 0 4px 14px rgba(0,0,0,0.18); }
}

.tutor-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #d0342c;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  pointer-events: none;
}
.tutor-badge[hidden] { display: none; }
.tutor-drawer-badge {
  position: static;
  margin-left: 8px;
  box-shadow: none;
}

.tutor-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}
.tutor-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(360px, 90vw);
  background: #fff;
  box-shadow: -8px 0 24px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  transform: translateX(110%);
  transition: transform 0.22s ease;
  z-index: 1001;
}
.tutor-drawer.open { transform: translateX(0); }
.tutor-drawer.open ~ .tutor-backdrop,
.tutor-backdrop.open { opacity: 1; pointer-events: auto; }

.tutor-drawer-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(var(--green-mid-rgb), 0.15);
  background: var(--green-pale);
  flex-shrink: 0;
}
.tutor-drawer-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--green-dark);
  letter-spacing: 0.02em;
  flex: 1;
  display: flex;
  align-items: center;
}
.tutor-drawer-header-btn {
  background: none;
  border: 1px solid rgba(var(--green-mid-rgb), 0.3);
  border-radius: 6px;
  color: var(--green-mid);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.tutor-drawer-header-btn:hover { color: var(--green-dark); border-color: var(--green-mid); background: #fff; }
.tutor-drawer-close {
  padding: 4px 8px;
  line-height: 1;
  font-size: 18px;
}

.tutor-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.tutor-empty {
  color: var(--green-mid);
  font-size: 13px;
  text-align: center;
  padding: 24px 8px;
  line-height: 1.5;
}

.tutor-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(var(--green-mid-rgb), 0.15);
  background: #fff;
}
.tutor-disclaimer {
  font-size: 11px;
  color: var(--green-mid);
  text-align: center;
  padding: 0 12px 10px;
  line-height: 1.35;
}

@media (max-width: 640px) {
  .tutor-drawer { width: 100vw; }
}

@media (prefers-reduced-motion: reduce) {
  .tutor-drawer { transition: none; }
  .tutor-fab.pulse { animation: none; }
}
