:root {
  --primary: #0f6fff;
  --primary-dark: #0b52b8;
  --primary-soft: #eaf3ff;
  --secondary: #0d1b2a;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-alt: #edf3ff;
  --text: #18212f;
  --muted: #5d6b82;
  --border: #dfe8f5;
  --success: #1f9d6a;
  --success-soft: #eafaf3;
  --warning: #f3a723;
  --warning-soft: #fff7e5;
  --danger: #dc4d4d;
  --danger-soft: #fdecec;
  --shadow: 0 18px 44px rgba(15, 38, 80, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --header-h: 84px;
}

body.dark-mode {
  --bg: #0f172a;
  --surface: #111b2c;
  --surface-alt: #172338;
  --text: #e5edf7;
  --muted: #9fb3c8;
  --border: #23334d;
  --primary-soft: rgba(79, 140, 255, 0.18);
  --success-soft: rgba(31, 157, 106, 0.12);
  --warning-soft: rgba(243, 167, 35, 0.12);
  --danger-soft: rgba(220, 77, 77, 0.12);
  --shadow: 0 20px 50px rgba(2, 8, 18, 0.45);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Noto Sans Khmer", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }
.container { width: min(1200px, calc(100% - 32px)); margin: 0 auto; }
.section { padding: 92px 0; }
.section-sm { padding: 56px 0; }
.section-title {
  font-size: clamp(1.8rem, 2vw + 1rem, 3rem);
  margin: 0 0 12px;
  color: var(--secondary);
}
.section-subtitle {
  margin: 0 auto 32px;
  max-width: 720px;
  color: var(--muted);
  text-align: center;
  font-size: 1.02rem;
}

.topbar { background: rgba(255,255,255,0.7); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
body.dark-mode .topbar { background: rgba(17,27,44,0.8); }
.navbar {
  min-height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.brand {
  display: inline-flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.25rem; color: var(--secondary);
}
.brand-mark {
  width: 46px; height: 46px; border-radius: 14px; background: linear-gradient(135deg, var(--primary), #59a7ff);
  display: grid; place-items: center; color: white; font-size: 1.3rem; box-shadow: var(--shadow);
}
.brand-text small { display: block; font-size: .68rem; color: var(--muted); font-weight: 600; }
.nav-links { display: flex; align-items: center; gap: 18px; }
.nav-links a {
  color: var(--muted); font-weight: 600; padding: 10px 12px; border-radius: 10px; transition: 0.2s ease;
}
.nav-links a:hover, .nav-links a.active { background: var(--primary-soft); color: var(--primary-dark); }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.search-wrap { position: relative; }
.search-wrap input {
  width: min(280px, 42vw); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 12px 42px;
  color: var(--text); outline: none;
}
.search-wrap .fa-search { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-results {
  position: absolute; top: calc(100% + 8px); right: 0; width: min(360px, 60vw); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 8px; display: none; z-index: 60;
}
.search-results.visible { display: block; }
.search-results a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--text); }
.search-results a:hover { background: var(--primary-soft); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: var(--primary); color: white; padding: 12px 18px; border-radius: 12px; font-weight: 700; cursor: pointer; transition: 0.2s ease; box-shadow: 0 12px 28px rgba(15, 111, 255, 0.22);
}
.btn:hover { transform: translateY(-1px); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.btn-success { background: var(--success); box-shadow: none; }
.btn-warning { background: var(--warning); color: #1e1a17; box-shadow: none; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); box-shadow: none; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text);
}

.hero {
  background: linear-gradient(135deg, #f4f9ff 0%, #edf3ff 48%, #f9fbff 100%); padding: 72px 0 40px; position: relative; overflow: hidden;
}
body.dark-mode .hero { background: linear-gradient(135deg, #0d172a 0%, #101d33 42%, #11213d 100%); }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(79, 140, 255, 0.08); }
.hero::before { width: 420px; height: 420px; right: -80px; top: -100px; }
.hero::after { width: 300px; height: 300px; left: -60px; bottom: -100px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 30px; align-items: center; position: relative; z-index: 1; }
.kicker { display: inline-block; padding: 8px 12px; background: var(--primary-soft); color: var(--primary-dark); border-radius: 999px; font-weight: 700; margin-bottom: 22px; }
.hero h1 { font-size: clamp(2.4rem, 3.3vw, 4.3rem); margin: 0 0 22px; line-height: 1.15; }
.hero p { font-size: 1.08rem; color: var(--muted); max-width: 640px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 28px; }
.hero-card {
  background: rgba(255,255,255,0.42); border: 1px solid var(--border); border-radius: 24px; padding: 24px; backdrop-filter: blur(10px); box-shadow: var(--shadow);
}
body.dark-mode .hero-card { background: rgba(17,27,44,0.7); }
.hero-visual {
  position: relative; padding: 26px; min-height: 460px; display: flex; align-items: center; justify-content: center;
}
.hero-image {
  width: min(100%, 560px);
  height: auto;
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.illustration {
  width: min(100%, 480px); min-height: 340px; background: linear-gradient(180deg, #f1f7ff 0%, #dfeeff 100%); border-radius: 28px; position: relative; border: 1px solid rgba(15,111,255,0.1); box-shadow: var(--shadow); overflow: hidden;
}
body.dark-mode .illustration { background: linear-gradient(180deg, #111f35 0%, #0f1a2f 100%); }
.monitor { position: absolute; left: 50%; top: 24%; transform: translateX(-50%); width: 70%; height: 54%; border-radius: 16px; background: linear-gradient(180deg, #101523, #213454); border: 8px solid #dfe8f5; box-shadow: 0 12px 28px rgba(15, 38, 80, 0.18); }
body.dark-mode .monitor { border-color: #2e425d; }
.monitor::before { content: ""; position: absolute; inset: 12px; border-radius: 8px; background: linear-gradient(135deg, #f0f5ff, #dfeeff); }
.monitor::after { content: "Word Excel PowerPoint"; position: absolute; inset: 18px 24px auto 24px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--primary-dark);}
.stand { position: absolute; left: 50%; bottom: 18%; transform: translateX(-50%); width: 12%; height: 18%; background: linear-gradient(180deg, #e3ebf8, #c7d8ef); border-radius: 10px; }
.base { position: absolute; left: 50%; bottom: 10%; transform: translateX(-50%); width: 36%; height: 14%; background: #bccfe8; border-radius: 18px; }
.badge { position: absolute; display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px; font-weight: 700; border-radius: 12px; background: rgba(255,255,255,0.9); border: 1px solid rgba(15,111,255,0.15); box-shadow: var(--shadow); }
.badge-1 { left: 10%; top: 16%; }
.badge-2 { right: 8%; bottom: 16%; }
.badge-3 { left: 14%; bottom: 26%; }

.grid-3, .grid-4, .grid-5 { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-body { padding: 22px; }
.icon-box {
  width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; font-size: 1.5rem; color: var(--primary-dark); background: var(--primary-soft); margin-bottom: 16px;
}
.course-card { position: relative; }
.course-card .card-body { padding: 24px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 12px; }
.meta-pill { display: inline-flex; padding: 6px 10px; border-radius: 999px; background: var(--surface-alt); color: var(--muted); font-size: .78rem; font-weight: 700; }
.progress-bar { height: 10px; background: var(--surface-alt); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #68b1ff); }

.how-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px; }
.step-card { padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.step-no { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(135deg, var(--primary-soft), #dfeeff); color: var(--primary-dark); font-weight: 800; }
.step-icon { color: var(--primary); font-size: 1.5rem; margin-top: 16px; }
.stats-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
.stat-box { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow); text-align: center; padding: 26px 18px; }
.stat-box strong { display: block; font-size: clamp(1.8rem, 2vw, 2.4rem); margin-bottom: 10px; }

.page-hero {
  padding: 36px 0 24px; background: linear-gradient(180deg, rgba(15,111,255,0.08), rgba(15,111,255,0.02)); border-bottom: 1px solid var(--border);
}
.page-hero h1 { margin: 0 0 10px; font-size: clamp(2rem, 3vw, 2.8rem); }
.breadcrumbs { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-weight: 600; align-items: center; }

.layout-two { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 28px; }
.sidebar-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); position: sticky; top: 110px; align-self: start;
}
.lesson-list { margin-top: 16px; display: grid; gap: 10px; }
.lesson-item {
  display: block; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-alt); color: var(--text); font-weight: 600; transition: 0.2s ease;
}
.lesson-item:hover, .lesson-item.active { background: var(--primary-soft); border-color: rgba(15,111,255,0.2); color: var(--primary-dark); }
.lesson-item.completed { border-color: rgba(31,157,106,0.25); background: var(--success-soft); }
.lesson-item.locked { opacity: 0.7; }

.content-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow);
}
.lesson-header { margin-bottom: 22px; }
.lesson-header h2 { margin: 8px 0 10px; font-size: clamp(1.8rem, 2vw, 2.6rem); }
.lesson-section { margin-top: 26px; }
.lesson-section h3 { font-size: 1.2rem; margin-bottom: 12px; }
.lesson-section p, .lesson-section li { color: var(--text); }
.lesson-steps { margin: 0; padding-left: 20px; }
.lesson-steps li { margin-bottom: 10px; }
.callout {
  border-left: 4px solid var(--primary); padding: 16px 18px; border-radius: 12px; background: var(--primary-soft); margin: 16px 0;
}
.checklist, .tips, .mistakes, .exercise-list { margin: 0; padding-left: 20px; }
.quiz-box, .practice-box, .achievement-box { background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }

.lesson-actions { display: flex; justify-content: space-between; gap: 16px; margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--border); }

.course-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.course-card .course-cover { height: 180px; background: linear-gradient(135deg, #dfeeff, #f5faff); display: grid; place-items: center; font-size: 3.2rem; color: var(--primary-dark); }
body.dark-mode .course-card .course-cover { background: linear-gradient(135deg, #162742, #0e1d34); }
.course-card .meta-row { margin-top: 14px; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.filter-pill {
  padding: 10px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 700; color: var(--muted);
}
.filter-pill.active { background: var(--primary); color: white; border-color: transparent; }

.page-shell { padding: 40px 0 80px; }
.empty-state { text-align: center; padding: 36px 18px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface-alt); color: var(--muted); }

.progress-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.progress-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; text-align: center;
}
.progress-card strong { display: block; font-size: 2rem; }
.progress-summary { margin-top: 30px; }
.achievement-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.achievement-item { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 18px; }
.achievement-item.unlocked { border-color: rgba(31,157,106,0.3); background: var(--success-soft); }

.quiz-card { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow); padding: 30px; max-width: 820px; margin: 0 auto; }
.quiz-progress { margin-bottom: 24px; }
.option-list { display: grid; gap: 12px; margin-top: 18px; }
.option-item { display: flex; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-alt); padding: 14px 16px; cursor: pointer; }
.option-item.selected { border-color: var(--primary); background: var(--primary-soft); }
.option-item.correct { border-color: var(--success); background: var(--success-soft); }
.option-item.incorrect { border-color: var(--danger); background: var(--danger-soft); }

.practice-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.practice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.practice-card { border: 1px solid var(--border); border-radius: 16px; background: var(--surface-alt); padding: 18px; }
.keyboard-demo { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 20px; }
.keyboard-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.key { min-width: 40px; height: 40px; border-radius: 10px; background: white; border: 1px solid var(--border); display: grid; place-items: center; font-weight: 700; }
.key.active { background: var(--primary); color: white; }
.mini-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
textarea, input[type="text"], select {
  width: 100%; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); padding: 12px 14px; outline: none;
}
textarea { min-height: 110px; resize: vertical; }

.footer { background: linear-gradient(180deg, #0f1d32 0%, #0c1729 100%); color: rgba(255,255,255,0.82); padding: 42px 0 18px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 22px; }
.footer a { color: rgba(255,255,255,0.8); }
.footer h4 { color: white; margin-bottom: 16px; }
.footer small { color: rgba(255,255,255,0.7); }

.hidden { display:none !important; }

.alert { border-radius: 12px; padding: 12px 16px; margin-top: 14px; }
.alert-success { background: var(--success-soft); color: var(--success); border: 1px solid rgba(31,157,106,0.2); }
.alert-error { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(220,77,77,0.2); }
.alert-warning { background: var(--warning-soft); color: #9c6c00; border: 1px solid rgba(243,167,35,0.2); }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto; } }
