/* Khóa học của Khoa · một file CSS cho mọi trang. Màu đổi ở :root. */
:root {
  --ink: #14213D;
  --muted: #4A5568;
  --line: #DDE3EC;
  --bg: #FFFFFF;
  --alt: #F3F5F9;
  --accent: #2F5BEA;
  --accent-ink: #1E3FAF;
  --accent-soft: #E7EDFD;
  --accent-bg: #F7F9FF;
  --cta: #F2A541;
  --cta-ink: #8A5200;
  --cta-soft: #FFF1DA;
  --ok: #1F7A45;
  --no: #B4441C;
  --r: 14px;
  --r-sm: 10px;
  --wrap: 1120px;
  --font: "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font); }
img, video, iframe { max-width: 100%; display: block; }
a { color: var(--accent-ink); }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: clamp(34px, 6vw, 56px); line-height: 1.1; font-weight: 800; max-width: 860px; }
h2 { font-size: clamp(26px, 4vw, 36px); font-weight: 800; }
h3 { font-size: 18px; font-weight: 700; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
section { padding: 80px 0; }
section.alt { background: var(--alt); }
.stack { display: flex; flex-direction: column; gap: 28px; }
.stack-sm { display: flex; flex-direction: column; gap: 12px; }
.center { text-align: center; align-items: center; }
.narrow { max-width: 820px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.mono { font-family: var(--mono); font-weight: 500; color: var(--accent); }
.eyebrow { font-family: var(--mono); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.lead { font-size: clamp(17px, 2.2vw, 20px); color: var(--muted); max-width: 760px; }
.sec-head { display: flex; flex-direction: column; gap: 10px; }
.sec-head .eyebrow { color: var(--accent); }
.sec-head .lead { font-size: 18px; }
mark.todo { background: #FFE58A; color: var(--ink); padding: 0 3px; border-radius: 4px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 50; background: var(--bg); padding: 8px 12px; }

/* Nút */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 26px;
  border-radius: var(--r-sm); border: 2px solid transparent; font: 700 16px/1.2 var(--font); text-decoration: none; cursor: pointer;
  text-align: center; transition: transform .12s ease, background-color .12s ease; }
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 44px; padding: 0 18px; font-size: 15px; }
.btn-cta { background: var(--cta); color: var(--ink); font-weight: 800; }
.btn-cta:hover { background: #E8952A; }
.btn-ink { background: var(--ink); color: #FFF; }
.btn-ink:hover { background: #22325A; }
.btn-accent { background: var(--accent); color: #FFF; }
.btn-accent:hover { background: var(--accent-ink); }
.btn-line { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-line:hover { background: var(--ink); color: #FFF; }
.btn[disabled] { opacity: .6; cursor: progress; }
.ctas { display: flex; flex-wrap: wrap; gap: 12px; }
.center .ctas { justify-content: center; }
.link { font-weight: 600; color: var(--accent-ink); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* Thanh trên */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { font-weight: 800; font-size: 18px; color: var(--ink); text-decoration: none; }
.nav { display: flex; gap: 22px; margin-left: auto; font-size: 15px; }
.nav a { color: var(--ink); text-decoration: none; }
.nav a:hover { color: var(--accent-ink); }

/* Thẻ */
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.alt .card { border-color: transparent; }
.card-accent, .alt .card-accent { border: 2px solid var(--accent); }
.card-accent .eyebrow { color: var(--accent); }
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid.tight { gap: 14px; }
.num { font-family: var(--mono); font-weight: 500; font-size: 20px; color: var(--accent); }
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); vertical-align: 2px; white-space: nowrap; }

/* Mở đầu */
.hero { padding: 72px 0 72px; }
.hero .stack { gap: 22px; }
.trust { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 14px; color: var(--muted); }
.trust li { display: inline-flex; align-items: center; gap: 6px; }
.trust svg { width: 16px; height: 16px; color: var(--ok); }
.ba { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 20px; margin-top: 12px; }
.alt .ba .card { border: 1px solid var(--line); }
.alt .ba .card-accent { border: 2px solid var(--accent); }

/* Học thử */
.trial { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.trial-video { display: flex; flex-direction: column; gap: 12px; }
.video { aspect-ratio: 16 / 9; border-radius: var(--r); overflow: hidden; background: var(--ink); color: #FFF; }
.video iframe, .video video { width: 100%; height: 100%; border: 0; }
.video.ph { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; text-align: center; font-size: 15px; }
.video.ph svg { width: 64px; height: 64px; }
.cap { font-weight: 700; font-size: 17px; }
.lessons { display: flex; flex-direction: column; gap: 8px; }
.lesson { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; line-height: 1.4; }
.lesson:hover { border-color: var(--accent); }
.lesson svg { flex: 0 0 20px; width: 20px; height: 20px; color: var(--muted); }
.lesson span { display: flex; flex-direction: column; gap: 2px; }
.lesson small { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.lesson.open { background: var(--accent-soft); border-color: transparent; }
.lesson.open svg, .lesson.open small { color: var(--accent-ink); }

/* Form */
.form { display: flex; flex-direction: column; gap: 14px; position: relative; }
.form-accent { border: 2px solid var(--accent); border-radius: var(--r); padding: 24px; background: var(--accent-bg); }
.form-reg { border: 1px solid var(--line); border-radius: var(--r); padding: 24px; background: var(--bg); }
.form .row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form .row .fld { flex: 1 1 280px; }
.fld { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; min-width: 0; }
.fld input, .fld select, .fld textarea { font: 400 16px/1.4 var(--font); color: var(--ink); background: #FFF; border: 1.5px solid #C5CEDB; border-radius: var(--r-sm); padding: 13px 14px; width: 100%; min-height: 52px; }
.fld textarea { resize: vertical; min-height: 96px; }
.fld input:focus, .fld select:focus, .fld textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,91,234,.2); }
.fld input[aria-invalid="true"], .fld textarea[aria-invalid="true"] { border-color: var(--no); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-msg:empty { display: none; }
.form-msg { font-size: 14px; color: var(--no); }
.form-msg.warn { color: var(--cta-ink); }
.form-ok { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-sm); background: #E6F4EC; color: #14532D; font-weight: 600; }
.form-ok[hidden] { display: none; }
.form-ok svg { flex: 0 0 22px; width: 22px; height: 22px; color: var(--ok); margin-top: 1px; }
.form.sent > :not(.form-ok):not(.form-msg):not(h3) { display: none; }

/* Dải hoàn tiền */
.band { background: var(--ink); color: #FFF; padding: 48px 0; }
.band-in { display: flex; flex-wrap: wrap; gap: 20px 32px; align-items: center; justify-content: space-between; }
.band-in > div { flex: 1 1 480px; display: flex; flex-direction: column; gap: 8px; }
.band h2 { font-size: clamp(24px, 3.4vw, 30px); }
.band p { color: #D5DCEA; max-width: 680px; }

/* Đầu ra */
.card-out { flex-direction: row; gap: 14px; align-items: flex-start; }
.card-out svg { flex: 0 0 24px; width: 24px; height: 24px; color: var(--accent); margin-top: 2px; }

/* Máy chấm câu lệnh */
.grader { gap: 16px; }
.grader-out { display: flex; flex-direction: column; gap: 14px; border-top: 1px solid var(--line); padding-top: 16px; }
.grader-out[hidden] { display: none; }
.score { display: flex; align-items: baseline; gap: 10px; font-weight: 800; font-size: 22px; }
.score b { font-family: var(--mono); font-size: 32px; color: var(--accent); }
.crit { display: grid; gap: 8px; }
.crit li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; }
.crit svg { width: 20px; height: 20px; margin-top: 2px; }
.crit .y svg { color: var(--ok); }
.crit .n svg { color: var(--no); }
.crit strong { margin-right: 6px; }
.tpl { display: flex; flex-direction: column; gap: 8px; }
.tpl pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: 500 14px/1.6 var(--mono); background: var(--alt); border-radius: var(--r-sm); padding: 14px 16px; }
.tpl .btn { align-self: flex-start; }

/* Giáo trình */
.chap h3 { display: flex; gap: 10px; align-items: baseline; }
.chap ul { display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.chap li { padding-left: 16px; position: relative; }
.chap li::before { content: ""; position: absolute; left: 0; top: .7em; width: 6px; height: 6px; border-radius: 50%; background: #B7C2D3; }

/* Người dạy */
.teacher { display: flex; flex-wrap: wrap; gap: 32px; align-items: center; }
.teacher > .stack-sm { flex: 1 1 420px; }
.photo { flex: 0 0 240px; width: 240px; height: 280px; border-radius: 16px; object-fit: cover; }
.photo.ph { background: var(--accent-soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font-weight: 600; }
.dots { display: flex; flex-direction: column; gap: 4px; }
.dots li { padding-left: 16px; position: relative; }
.dots li::before { content: ""; position: absolute; left: 0; top: .7em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* Danh sách nên / không */
.checks { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.checks li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; }
.checks svg { width: 20px; height: 20px; color: var(--ok); margin-top: 3px; }
.checks.neg svg { color: var(--no); }

/* Học phí */
.banner { background: var(--cta-soft); border: 1px solid #F4D39E; border-radius: var(--r-sm); padding: 14px 18px; font-weight: 600; }
.tier { gap: 10px; position: relative; }
.tier-hot, .alt .tier-hot { border: 2px solid var(--cta); }
.tier .btn { margin-top: auto; }
.tier .muted { flex: 1; }
.price { font-size: 30px; font-weight: 800; line-height: 1.1; }
.tier-hot .badge { position: absolute; top: -13px; left: 22px; }
.badge { align-self: flex-start; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; background: var(--cta); color: var(--ink); padding: 4px 10px; border-radius: 999px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px 24px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
#dang-ky { scroll-margin-top: 90px; }
section[id] { scroll-margin-top: 60px; }

/* Học bổng */
.scholar { gap: 12px; padding: 28px; }
.reveal summary { list-style: none; align-self: flex-start; display: inline-flex; }
.reveal summary::-webkit-details-marker { display: none; }
.reveal[open] summary { display: none; }
.reveal .form { margin-top: 8px; }

/* Hỏi đáp */
.qas { display: flex; flex-direction: column; }
.qa { border-top: 1px solid var(--line); }
.qa:last-child { border-bottom: 1px solid var(--line); }
.qa summary { cursor: pointer; list-style: none; padding: 18px 40px 18px 0; font-weight: 700; position: relative; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after { content: "+"; position: absolute; right: 4px; top: 14px; font: 500 24px/1 var(--mono); color: var(--accent); }
.qa[open] summary::after { content: "–"; }
.qa p { padding: 0 0 18px; color: var(--muted); max-width: 720px; }

/* Trang chủ */
.courses { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.course { text-decoration: none; color: var(--ink); padding: 0; overflow: hidden; border: 1px solid var(--line); }
.course img { width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; }
.course.soon { background: var(--bg); border-style: dashed; }
.course.soon h3 { color: var(--muted); }
.course-body { padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.course:hover { border-color: var(--accent); }

/* Cuối trang */
.end-cta { gap: 18px; }
.foot { background: var(--ink); color: #C9D2E3; padding: 40px 0 48px; font-size: 14px; }
.foot-in { display: flex; flex-wrap: wrap; gap: 16px 40px; justify-content: space-between; align-items: flex-end; }
.foot-in > div { display: flex; flex-direction: column; gap: 6px; max-width: 640px; }
.foot .brand { color: #FFF; }
.foot-copy { color: #9AA6BD; }

/* Khối thêm theo khuôn trang sách (bằng chứng, so sánh, thẻ, P.S.) */
.eyebrow.hook { font-family: var(--font); text-transform: none; letter-spacing: 0; font-size: 16px; font-weight: 700; color: var(--accent-ink); }
.goc-xem { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 12px; border: 1.5px dashed var(--cta); border-radius: var(--r-sm); background: var(--cta-soft); font-size: 13px; color: var(--cta-ink); font-weight: 700; }
.goc-xem button { font: inherit; font-size: 13px; font-weight: 600; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.goc-xem button.on { background: var(--ink); color: #FFF; border-color: var(--ink); }
.hero-video { display: flex; flex-direction: column; gap: 8px; max-width: 760px; width: 100%; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 12px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.alt .stat { border-color: transparent; }
.stat-n { font-size: clamp(24px, 4vw, 34px); font-weight: 800; line-height: 1.1; }
.proof-img { width: 100%; border-radius: var(--r); border: 1px solid var(--line); }
.proof-img.ph { min-height: 180px; display: flex; align-items: center; justify-content: center; padding: 20px; text-align: center; background: var(--alt); border-style: dashed; color: var(--muted); }
.card-hot, .alt .card-hot { border: 2px solid var(--accent); }
.card .btn { margin-top: auto; align-self: flex-start; }
.checks.big { gap: 14px; }
.checks.big li { font-size: 17px; }
.trial.solo { grid-template-columns: 1fr; max-width: 760px; }
.lesson.paid { margin-top: 8px; background: var(--cta-soft); border-color: transparent; }
.lesson.paid svg, .lesson.paid small { color: var(--cta-ink); }
section.cta-sec { padding: 8px 0 40px; }
.cta-mid { align-items: center; gap: 8px; }
.ps-box { max-width: 680px; display: flex; flex-direction: column; gap: 10px; text-align: left; border-top: 1px solid var(--line); padding-top: 18px; }
.story p { font-size: 17px; }

/* Thanh đăng ký trên điện thoại */
.mbar { display: none; }
@media (max-width: 760px) {
  section { padding: 56px 0; }
  .wrap { padding: 0 16px; }
  .nav { display: none; }
  .hero { padding: 48px 0 56px; }
  .trial { grid-template-columns: 1fr; }
  .card, .form-accent, .form-reg { padding: 20px; }
  .photo { flex-basis: 100%; width: 100%; max-width: 320px; height: 300px; }
  .mbar { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); border-top: 1px solid var(--line);
    transform: translateY(110%); transition: transform .2s ease; }
  .mbar .btn { min-height: 46px; padding: 0 12px; }
  .mbar.show { transform: none; }
  body:has(.mbar) .foot { padding-bottom: 96px; }
  .form .row .btn { width: 100%; }
}

/* Trang học */
.top-tag { margin-right: auto; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); }
.learn { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 36px; align-items: start; padding-top: 32px; padding-bottom: 72px; }
.side { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; }
.side-box summary { list-style: none; font-weight: 800; font-size: 15px; padding: 4px 0 8px; cursor: default; }
.side-box summary::-webkit-details-marker { display: none; }
.side-ch { margin: 14px 0 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.side ol { display: flex; flex-direction: column; gap: 2px; }
.sl { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 10px; border-radius: var(--r-sm); font-size: 14px; line-height: 1.4; color: var(--ink); text-decoration: none; }
a.sl:hover { background: var(--alt); }
.sl.on { background: var(--accent-soft); font-weight: 700; }
.sl.off { color: #8792A6; }
.sl.off svg { width: 16px; height: 16px; margin: 2px 0 0 4px; }
.sl small { display: block; font-size: 11px; color: #8792A6; }
.sl-n { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; font: 500 13px/1 var(--mono); background: var(--alt); color: var(--accent-ink); flex: 0 0 26px; }
.sl.on .sl-n { background: var(--accent); color: #FFF; }
.done .sl-n { background: var(--ok); color: #FFF; font-size: 0; }
.done .sl-n::before { content: "✓"; font-size: 14px; }
.learn-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.learn-main h1 { font-size: clamp(28px, 4.4vw, 40px); }
.learn-main h2 { font-size: 22px; }
.learn-body { display: flex; flex-direction: column; gap: 20px; }
.gated .learn-body, .gated .learn-cta { display: none; }
.kc-mo .gated .learn-body, .kc-mo .gated .learn-cta { display: flex; }
.kc-mo .gate { display: none; }
.gate h2 { display: flex; gap: 10px; align-items: center; }
.gate h2 svg { width: 22px; height: 22px; color: var(--accent); }
.gate .form { margin-top: 6px; }
.prose { display: flex; flex-direction: column; gap: 10px; }
.hint summary { cursor: pointer; font-weight: 700; color: var(--accent-ink); margin-top: 6px; }
.hint .prose { margin-top: 10px; padding: 14px 16px; border-radius: var(--r-sm); background: var(--alt); }
.quiz { gap: 14px; }
.q { border-top: 1px solid var(--line); padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.q-hoi { font-weight: 700; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; }
.q-opts { display: grid; gap: 8px; }
.opt { text-align: left; font: 500 15px/1.45 var(--font); color: var(--ink); background: #FFF; border: 1.5px solid #C5CEDB; border-radius: var(--r-sm); padding: 12px 14px; cursor: pointer; min-height: 48px; }
.opt:hover:not([disabled]) { border-color: var(--accent); }
.opt[disabled] { cursor: default; }
.opt.right { border-color: var(--ok); background: #E6F4EC; font-weight: 700; }
.opt.wrong { border-color: var(--no); background: #FCEBE4; }
.q-exp { padding: 12px 14px; border-radius: var(--r-sm); background: var(--alt); display: flex; flex-direction: column; gap: 6px; }
.q-exp[hidden] { display: none; }
.q-verdict { font-weight: 800; }
.q-verdict.y { color: var(--ok); }
.q-verdict.n { color: var(--no); }
.quiz-score { font-weight: 800; font-size: 18px; color: var(--accent-ink); }
.quiz-score[hidden] { display: none; }
.wait { background: var(--cta-soft); border-color: #F4D39E; }
.learn-nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.learn-cta { background: var(--alt); border-color: transparent; gap: 10px; }
.lcards { display: flex; flex-direction: column; gap: 10px; }
.lcard { flex-direction: row; gap: 14px; align-items: flex-start; text-decoration: none; color: var(--ink); padding: 18px 20px; }
.lcard:hover { border-color: var(--accent); }
.lcard .eyebrow { font-size: 11px; }
.lesson.unlocked svg { color: var(--accent); }
@media (max-width: 900px) {
  .learn { grid-template-columns: 1fr; gap: 20px; padding-top: 16px; }
  .side { position: static; max-height: none; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 14px; }
  .side-box summary { cursor: pointer; padding: 8px 0; }
  .side-box summary::after { content: " ▾"; color: var(--accent); }
  .side-box[open] summary::after { content: " ▴"; }
}

/* Phần "Cách học" (3 tiêu chí) và học phí 2 gói */
.khung { gap: 10px; }
.khung-ten { font-size: 22px; font-weight: 800; color: var(--accent-ink); }
/* Thẻ lẻ cuối lưới 2 cột trải hết hàng, cho cân hai bên */
.g2 > .card:last-child:nth-child(odd) { grid-column: 1 / -1; }

.card > .chip, .stack > .chip { align-self: flex-start; }

/* ---------- Menu chung (trang chủ, thư viện, phần mềm) ---------- */
.site-nav { display: flex; gap: 22px; margin-left: auto; margin-right: 8px; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; padding: 6px 0; border-bottom: 2px solid transparent; }
.site-nav a:hover, .site-nav a[aria-current="page"] { border-bottom-color: var(--cta); }
@media (max-width: 860px) {
  .top-in { flex-wrap: wrap; min-height: 0; padding-top: 10px; padding-bottom: 10px; row-gap: 6px; }
  .site-nav { order: 3; width: 100%; margin: 0; gap: 18px; overflow-x: auto; scrollbar-width: none; }
  .site-nav a { font-size: 14px; white-space: nowrap; }
}

/* ---------- Thư viện trợ lý ---------- */
.seg { display: inline-grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--alt); border-radius: 12px; padding: 4px; max-width: 420px; width: 100%; }
.seg button { font: inherit; font-size: 15px; font-weight: 600; min-height: 44px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; transition: background .2s, color .2s, box-shadow .2s; }
.seg button.on { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px rgba(20,33,61,.16); }
.tv { display: flex; flex-direction: column; gap: 22px; }
.tv-set { display: flex; flex-direction: column; gap: 22px; }
.tv-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tv-chip { font: inherit; font-size: 14px; font-weight: 600; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; transition: background .2s, color .2s, border-color .2s, transform .15s; }
.tv-chip:hover { border-color: var(--ink); }
.tv-chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tv-grp h3 { margin-bottom: 14px; }
.g-ag { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 12px; }
@media (max-width: 560px) { .g-ag { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.ag { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 8px; transition: border-color .2s, box-shadow .2s, transform .2s; }
.ag:hover { box-shadow: 0 6px 18px rgba(20,33,61,.08); transform: translateY(-2px); }
.ag.picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.agt { font-weight: 700; font-size: 15px; line-height: 1.3; margin: 0; }
.io { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.45; }
.lv { align-self: flex-start; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.lA { background: #DDF1E4; color: #155C33; }
.lB { background: #FFF1DA; color: #8A5200; }
.lC { background: #E7EDFD; color: #1E3FAF; }
.ag .add { margin-top: auto; font: inherit; font-size: 13px; font-weight: 700; min-height: 38px; border-radius: 8px; border: 1px dashed #8A94A6; background: var(--bg); color: var(--ink); cursor: pointer; transition: background .2s, color .2s, border-color .2s; }
.ag .add[aria-pressed="true"] { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.tray { position: fixed; left: 50%; bottom: 16px; z-index: 30; width: min(560px, calc(100% - 24px)); transform: translateX(-50%); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--ink); color: #fff; border-radius: 14px; padding: 10px 12px 10px 16px; box-shadow: 0 10px 30px rgba(20,33,61,.3); }
.tray[hidden] { display: none; }
.tray-n { font-weight: 700; }
.tray-btns { display: flex; gap: 8px; }
.tray .btn-line { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }
.tv-picked { margin: 0; }

/* ---------- Phần mềm may đo ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.cmp-tbl { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 520px; }
.cmp-tbl th, .cmp-tbl td { padding: 14px 16px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
.cmp-tbl thead th { border-top: 0; font-size: 13px; color: var(--muted); }
.cmp-tbl thead th:last-child { color: var(--accent-ink); }
.cmp-tbl td:last-child { background: var(--accent-bg); font-weight: 600; }
.cmp-tbl td:nth-child(2) { color: var(--muted); }
.flow { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; max-width: 680px; }
.flow li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; align-items: start; padding-bottom: 22px; position: relative; font-size: 17px; }
.flow li:not(:last-child)::before { content: ""; position: absolute; left: 19px; top: 40px; bottom: 2px; width: 2px; background: var(--line); }
.step-n { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.form-card { max-width: 640px; }
.form-card textarea { font: inherit; font-size: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); color: var(--ink); resize: vertical; width: 100%; }

/* ---------- Chuyển động: hiện dần khi cuộn, nút nhún nhẹ. Tắt hết khi máy người xem dặn giảm chuyển động ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero .stack > * { animation: kc-up .7s cubic-bezier(.2,.7,.2,1) both; }
  .hero .stack > *:nth-child(2) { animation-delay: .08s; }
  .hero .stack > *:nth-child(3) { animation-delay: .16s; }
  .hero .stack > *:nth-child(4) { animation-delay: .24s; }
  .hero .stack > *:nth-child(5) { animation-delay: .32s; }
  .hero .stack > *:nth-child(6) { animation-delay: .40s; }
  .js-rv .rv { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0s); }
  .js-rv .rv.in { opacity: 1; transform: none; }
  .btn { transition: transform .18s ease, box-shadow .18s ease, background .2s; }
  .btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(20,33,61,.14); }
  .btn:active { transform: translateY(0); }
  .card, .lesson { transition: transform .2s ease, box-shadow .2s ease, border-color .2s; }
  .card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(20,33,61,.08); }
  .tv-grp:not([hidden]) .ag { animation: kc-pop .35s ease both; }
  .ag .add[aria-pressed="true"] { animation: kc-tick .3s ease; }
  .tray:not([hidden]) { animation: kc-tray .35s cubic-bezier(.2,.7,.2,1) both; }
  .btn-cta.pulse { animation: kc-pulse 2.4s ease-in-out 1.2s 2; }
}
@keyframes kc-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes kc-pop { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes kc-tick { 50% { transform: scale(1.06); } }
@keyframes kc-tray { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes kc-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(242,165,65,.0); } 50% { box-shadow: 0 0 0 10px rgba(242,165,65,.28); } }
@media (max-width: 600px) {
  .cmp-tbl { min-width: 0; }
  .cmp-tbl thead { display: none; }
  .cmp-tbl tr { display: block; padding: 12px 14px; border-top: 1px solid var(--line); }
  .cmp-tbl tbody tr:first-child { border-top: 0; }
  .cmp-tbl th, .cmp-tbl td { display: block; border: 0; padding: 4px 0; }
  .cmp-tbl th { font-size: 16px; }
  .cmp-tbl td::before { content: attr(data-l) ": "; font-weight: 700; color: var(--muted); }
  .cmp-tbl td:last-child { background: var(--accent-bg); padding: 6px 8px; border-radius: 8px; margin-top: 4px; }
  .cmp-tbl td:last-child::before { color: var(--accent-ink); }
}

/* =================== Hình minh hoạ & icon voxel =================== */
.vox { display: block; width: 100%; height: 100%; }
.ic { display: block; width: 64px; height: 56px; margin-bottom: 4px; }
.ic .vox { width: auto; max-width: 64px; height: 56px; }
.course .ic { width: 56px; height: 48px; }
.course .ic .vox { height: 48px; }

/* Nền đầu trang: lưới chấm rất nhạt */
.hero.alt { background-image: radial-gradient(rgba(20,33,61,.07) 1px, transparent 1px); background-size: 22px 22px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 48px; align-items: center; }
.hero-grid > .stack { min-width: 0; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; gap: 32px; } }

/* Tác giả cạnh nút */
.author { display: flex; align-items: center; gap: 12px; }
.author-av { width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: 0 0 44px; box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--line); }
.author strong { display: block; font-size: 15px; }
.author small { display: block; font-size: 13px; color: var(--muted); line-height: 1.4; }

/* Khung giả lập (cửa sổ) */
.mock { margin: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 50px rgba(20,33,61,.12), 0 2px 6px rgba(20,33,61,.06); overflow: hidden; position: relative; }
.mock figcaption { position: absolute; right: 10px; bottom: 8px; font-size: 11px; color: var(--muted); background: rgba(255,255,255,.85); padding: 2px 8px; border-radius: 999px; }
.mock-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--alt); }
.mock-bar .dot { width: 9px; height: 9px; border-radius: 50%; background: #D5DBE6; }
.mock-title { display: flex; align-items: center; gap: 8px; margin-left: 8px; font-size: 13px; font-weight: 700; }
.mock-title .vox { width: 22px; height: 20px; }
.chat-body { padding: 16px 14px 34px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; }
.msg-ban { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg-ai { align-self: flex-start; background: var(--alt); color: var(--ink); border-bottom-left-radius: 4px; }
.msg-typing { align-self: flex-start; background: var(--alt); display: none; gap: 4px; padding: 12px 14px; }
.msg-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); display: block; }

/* Trang chủ: khung chat + 3 chip nổi */
.home-visual { position: relative; padding: 28px 18px 40px; }
.hv-chat { max-width: 400px; margin: 48px auto 64px; }
.hv-chip { position: absolute; display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px 8px 8px; box-shadow: 0 10px 26px rgba(20,33,61,.12); }
.hv-chip .vox { width: 44px; height: 38px; }
.hv-chip b { display: block; font-size: 13px; }
.hv-chip small { display: block; font-size: 11px; color: var(--muted); }
.hv-1 { left: 0; top: 0; }
.home-visual .hv-chip { z-index: 2; }
.hv-2 { right: 0; bottom: 0; }
.hv-3 { left: 4%; bottom: 0; }
@media (max-width: 560px) { .home-visual { padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } .hv-chip { position: static; flex-direction: column; text-align: center; padding: 8px 6px; gap: 4px; } .hv-chip small { display: none; } .hv-chat { order: -1; grid-column: 1 / -1; max-width: none; margin: 0 0 4px; } }

/* Khung chờ video */
.poster { background: radial-gradient(circle at 70% 20%, #24345C, var(--ink) 60%); display: flex; align-items: flex-end; justify-content: flex-start; position: relative; overflow: hidden; }
.poster-art { position: absolute; inset: 0; }
.poster-vox { position: absolute; }
.poster-vox.a { width: 22%; right: 7%; top: 10%; }
.poster-vox.b { width: 20%; left: 7%; top: 12%; opacity: .9; }
.poster-vox.c { width: 15%; right: 36%; top: 22%; opacity: .75; }
.poster-play { position: relative; display: flex; align-items: center; gap: 14px; margin: 18px; background: rgba(20,33,61,.72); backdrop-filter: blur(6px); color: #fff; padding: 12px 16px 12px 12px; border-radius: 14px; }
.poster-play svg { width: 52px; height: 52px; flex: 0 0 52px; }
.poster-play strong { display: block; font-size: 15px; }
.poster-play small { display: block; font-size: 12px; opacity: .8; }

/* Thư viện: tường robot */
.robot-wall { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; max-width: 460px; margin: 0 auto; }
.rw-cell { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12% 6% 8%; box-shadow: 0 6px 16px rgba(20,33,61,.06); }
.rw-cell .vox { height: 58%; width: auto; }
.rw-cell span { font-size: 11px; font-weight: 600; line-height: 1.2; text-align: center; color: var(--ink); }
@media (max-width: 560px) { .robot-wall { gap: 8px; } .rw-cell span { font-size: 10px; } }

/* Phần mềm: Telegram → bảng */
.ts { display: grid; grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1.15fr); align-items: center; gap: 8px; padding: 14px; background: var(--alt); }
.ts > div:not(.ts-arrow) { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ts .chat-body { padding: 12px 10px 14px; }
.ts-arrow { font-size: 22px; font-weight: 800; color: var(--accent); text-align: center; }
.rcpt { display: flex; flex-direction: column; gap: 4px; background: #fff; color: var(--ink); border-radius: 6px; padding: 8px 10px; width: 120px; font-size: 11px; }
.rcpt i { display: block; height: 4px; background: #DDE3EC; border-radius: 2px; }
.rcpt em { font-style: normal; font-weight: 800; }
.ts-photo { padding: 6px; }
.ts-reply { display: flex; gap: 8px; align-items: center; font-size: 12px; }
.ts-reply .vox { width: 26px; height: 22px; flex: 0 0 26px; }
.ts-sheet table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ts-sheet th, .ts-sheet td { padding: 7px 8px; text-align: left; border-top: 1px solid var(--line); }
.ts-sheet th { color: var(--muted); font-weight: 600; border-top: 0; }
.ts-sheet td:last-child, .ts-sheet th:last-child { text-align: right; }
@media (max-width: 560px) { .ts { grid-template-columns: 1fr; } .ts-arrow { transform: rotate(90deg); } }

/* Thẻ sách trên trang chủ */
.split-row { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 32px; align-items: center; }
.split-ic .vox { max-width: 160px; }
@media (max-width: 600px) { .split-row { grid-template-columns: 1fr; gap: 16px; } .split-ic .vox { max-width: 110px; } }

/* =================== Chọn gói (kiểu findskill, đã sửa) =================== */
.narrow-wide { max-width: 760px; }
.plan-box { background: var(--bg); border: 1px solid var(--line); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 16px 40px rgba(20,33,61,.08); }
.plan-list { display: flex; flex-direction: column; gap: 10px; }
.plan { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; transition: border-color .2s, background .2s, box-shadow .2s; }
.plan:hover { border-color: #9AA6BA; }
.plan.on { border: 2px solid var(--accent); background: var(--accent-bg); box-shadow: 0 0 0 4px var(--accent-soft); }
.plan input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.plan-txt strong { display: block; font-size: 16px; }
.plan-txt small { display: block; font-size: 13px; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.plan-gia { font-size: 19px; font-weight: 800; white-space: nowrap; }
.plan .badge { position: static; display: inline-block; vertical-align: 2px; margin-left: 4px; font-size: 11px; }
.plan-neo { margin: 0; font-size: 13px; color: var(--muted); background: var(--alt); padding: 8px 12px; border-radius: 8px; }
.plan-tbl-wrap { overflow-x: auto; }
.plan-tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.plan-tbl th, .plan-tbl td { padding: 10px 8px; border-top: 1px solid var(--line); text-align: center; }
.plan-tbl tbody th { text-align: left; font-weight: 500; color: var(--ink); }
.plan-tbl thead th { border-top: 0; font-size: 12px; color: var(--muted); }
.plan-tbl .on { background: var(--accent-bg); font-weight: 700; color: var(--ink); }
.plan-tbl td svg { width: 18px; height: 18px; color: var(--ok); }
.no-dash { color: #B4BCCB; }
.btn-block { width: 100%; justify-content: center; }
.center-txt { text-align: center; margin: 0; }
@media (max-width: 560px) { .plan { padding: 12px; gap: 10px; } .plan-gia { font-size: 16px; } .plan-tbl { font-size: 12px; } .plan-tbl th, .plan-tbl td { padding: 8px 4px; } }

/* =================== Chuyển động của hình =================== */
@media (prefers-reduced-motion: no-preference) {
  .js-rv .mock .msg { opacity: 0; transform: translateY(8px); }
  .js-rv .mock.in .msg:not(.msg-typing) { animation: kc-up .45s ease forwards; animation-delay: calc(var(--i) * .9s + .2s); }
  .js-rv .mock.in .msg-typing { display: flex; animation: kc-typing 1.6s ease forwards; animation-delay: calc(var(--i) * .9s); }
  .msg-typing i { animation: kc-dot 1s infinite; }
  .msg-typing i:nth-child(2) { animation-delay: .15s; }
  .msg-typing i:nth-child(3) { animation-delay: .3s; }
  .hv-chip { animation: kc-float 5s ease-in-out infinite; }
  .hv-2 { animation-delay: -1.6s; }
  .hv-3 { animation-delay: -3.2s; }
  .poster-vox { animation: kc-float 6s ease-in-out infinite; }
  .poster-vox.b { animation-delay: -2s; }
  .poster-vox.c { animation-delay: -4s; }
  .rw-cell { animation: kc-pop .5s ease both; animation-delay: calc(var(--i) * .06s); }
  .rw-cell .vox { animation: kc-float 4s ease-in-out infinite; animation-delay: calc(var(--i) * -.37s); }
  .ts-photo { animation: kc-ts-a 7s ease infinite; }
  .ts-reply { animation: kc-ts-b 7s ease infinite; }
  .ts-new { animation: kc-ts-row 7s ease infinite; }
  .card:hover .ic .vox { animation: kc-tick .4s ease; }
}
@keyframes kc-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes kc-typing { 0%, 99% { opacity: 1; transform: none; } 100% { opacity: 0; height: 0; padding: 0; margin: -5px 0; } }
@keyframes kc-dot { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
@keyframes kc-ts-a { 0%, 8% { opacity: 0; transform: translateY(10px); } 14%, 92% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes kc-ts-b { 0%, 26% { opacity: 0; transform: translateY(10px); } 32%, 92% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes kc-ts-row { 0%, 44% { opacity: 0; background: transparent; } 50% { opacity: 1; background: #FFE9C2; } 70%, 92% { opacity: 1; background: var(--accent-bg); } 100% { opacity: 0; } }
