/* ==========================================================================
   Trợ Lý Toán — Stylesheet giao diện người dùng
   ==========================================================================
   Đồng bộ font & màu với toolcmb.com (Inter tự host, cyan #06B6D4, navy #0F172A)

   01. Fonts            02. Tokens          03. Reset & base     04. Layout
   05. Buttons & chips  06. Header & nav    07. Search           08. Footer & tabbar
   09. Hero & home      10. Cards & tiles   11. Forms & alerts   12. Tables & tabs
   13. Learn (grade)    14. Lesson & prose  15. Simulations      16. Exam
   17. Result           18. Dashboard       19. Pricing & wallet 20. Teacher
   21. Modal & toasts   22. Utilities       23. Responsive       24. Motion / print
   ========================================================================== */

/* ---------- 01. Fonts (tự host, có subset tiếng Việt) ------------------- */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/inter-vietnamese-wght-normal.woff2") format("woff2");
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }

/* ---------- 02. Design tokens ------------------------------------------- */
:root {
    --navy: #0F172A; --primary: #06B6D4; --primary-dark: #0891B2; --primary-light: #22D3EE;
    --violet: #8B5CF6; --amber: #F59E0B; --rose: #F43F5E; --green: #10B981;
    --bg: #F8FAFC; --surface: #FFFFFF; --surface-2: #F1F5F9; --surface-3: #E2E8F0;
    --text: #0F172A; --text-2: #334155; --muted: #64748B; --border: #E2E8F0; --border-strong: #CBD5E1;
    --link: #0891B2; --primary-soft: rgba(6, 182, 212, .10); --primary-ring: rgba(6, 182, 212, .35);
    --success: #059669; --success-soft: rgba(5, 150, 105, .1); --danger: #DC2626; --danger-soft: rgba(220, 38, 38, .09);
    --warn: #B45309; --warn-soft: rgba(245, 158, 11, .14);
    --header-bg: rgba(248, 250, 252, .8);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px -8px rgba(15, 23, 42, .10);
    --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, .2);
    --grid-line: rgba(15, 23, 42, .045);
    --radius-sm: 8px; --radius: 12px; --radius-lg: 18px; --radius-xl: 26px;
    --container: 1200px; --header-h: 66px; --tabbar-h: 0px;
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --ease: cubic-bezier(.2, .7, .2, 1);
}
[data-theme="dark"] {
    --bg: #0B1120; --surface: #111A2E; --surface-2: #16213A; --surface-3: #1E2A46;
    --text: #E2E8F0; --text-2: #CBD5E1; --muted: #94A3B8; --border: #1E293B; --border-strong: #334155;
    --link: #22D3EE; --primary-soft: rgba(34, 211, 238, .12); --primary-ring: rgba(34, 211, 238, .35);
    --success: #34D399; --success-soft: rgba(52, 211, 153, .12); --danger: #F87171; --danger-soft: rgba(248, 113, 113, .12);
    --warn: #FBBF24; --warn-soft: rgba(251, 191, 36, .12);
    --header-bg: rgba(11, 17, 32, .78);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 1px 3px rgba(0, 0, 0, .35), 0 8px 24px -8px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6); --grid-line: rgba(148, 163, 184, .06);
    color-scheme: dark;
}

/* ---------- 03. Reset & base -------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.65; color: var(--text); background: var(--bg);
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; padding-bottom: var(--tabbar-h); }
html { overflow-x: clip; }
img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.22; letter-spacing: -.02em; margin: 0 0 .5em; color: var(--text); }
h1 { font-size: clamp(1.85rem, 4.2vw, 2.8rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 2.8vw, 1.9rem); font-weight: 750; }
h3 { font-size: 1.12rem; font-weight: 680; }
p { margin: 0 0 1rem; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--primary); color: #fff; }
.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: -.2em; }
main { min-height: 60vh; }
main:focus { outline: none; }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }

/* ---------- 04. Layout helpers ------------------------------------------ */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 860px; }
.section { padding: 80px 0; }
.section-sm { padding: 40px 0; }
.section-alt { background: var(--surface); border-block: 1px solid var(--border); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head p { margin: 4px 0 0; color: var(--muted); max-width: 620px; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--link); margin-bottom: 8px; }
.page-head { padding: 32px 0 24px; }
.page-head h1 { margin-bottom: 6px; font-size: clamp(1.6rem, 3.5vw, 2.3rem); }
.page-head p { color: var(--muted); margin: 0; max-width: 720px; }
.page-head .actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.stack { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .xs { font-size: .78rem; }
.strong { font-weight: 650; } .center { text-align: center; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 1000; background: var(--primary); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 600; }
.skip-link:focus { top: 12px; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; } .mt { margin-top: 20px; } .mb { margin-bottom: 20px; }
[hidden] { display: none !important; }

/* ---------- 05. Buttons, chips, pills, badges ---------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; height: 44px; padding: 0 20px; border-radius: 999px;
    border: 1px solid transparent; font-weight: 620; font-size: .95rem; white-space: nowrap; text-decoration: none !important; cursor: pointer;
    transition: transform .15s var(--ease), background-color .2s, box-shadow .2s, border-color .2s, color .2s; background: none; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 20px -8px rgba(6, 182, 212, .7); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-dark { background: var(--navy); color: #fff; }
[data-theme="dark"] .btn-dark { background: #fff; color: var(--navy); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--link); }
.btn-soft { background: var(--primary-soft); color: var(--link); }
.btn-soft:hover { background: rgba(6, 182, 212, .18); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-light { background: #fff; color: var(--navy); }
.btn-sm { height: 36px; padding: 0 14px; font-size: .86rem; }
.btn-lg { height: 52px; padding: 0 28px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn.is-loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text-2); transition: all .2s var(--ease); text-decoration: none !important; cursor: pointer; }
.icon-btn:hover { color: var(--link); border-color: var(--primary); }
.icon-btn.sm { width: 34px; height: 34px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--link); font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
    color: var(--text-2); font-size: .875rem; font-weight: 550; transition: all .2s var(--ease); text-decoration: none !important; cursor: pointer; }
.chip:hover, .chip.is-active { border-color: var(--primary); color: var(--link); background: var(--primary-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--link);
    font-size: .74rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.pill-violet { background: rgba(139, 92, 246, .12); color: #7C3AED; } [data-theme="dark"] .pill-violet { color: #C4B5FD; }
.pill-amber { background: var(--warn-soft); color: var(--warn); }
.pill-green { background: var(--success-soft); color: var(--success); }
.pill-rose { background: var(--danger-soft); color: var(--danger); }
.pill-gray { background: var(--surface-2); color: var(--muted); }
.pro-tag { display: inline-block; padding: 0 6px; border-radius: 6px; background: linear-gradient(135deg, #F59E0B, #F97316); color: #fff; font-size: .66rem; font-weight: 800; letter-spacing: .05em; vertical-align: 1px; }
.dot-badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--rose); color: #fff;
    font-size: .66rem; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--surface); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: .76rem; font-weight: 650; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-approved, .st-success, .st-published, .st-live { background: var(--success-soft); color: var(--success); }
.st-pending, .st-draft, .st-scheduled, .st-waiting { background: var(--warn-soft); color: var(--warn); }
.st-flagged, .st-failed, .st-rejected, .st-cancelled, .st-kicked { background: var(--danger-soft); color: var(--danger); }
.st-private, .st-ended, .st-left, .st-closed, .st-refunded { background: var(--surface-2); color: var(--muted); }

/* ---------- 06. Header & navigation ------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 100; height: var(--header-h); border-bottom: 1px solid transparent; transition: border-color .2s, box-shadow .2s; }
/* Nền mờ đặt ở lớp giả: backdrop-filter trên chính header sẽ biến header thành khung chứa
   của phần tử position:fixed => menu mobile bị "kẹt" trong chiều cao header. */
.site-header::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--header-bg);
    backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px); }
.site-header.is-scrolled { border-bottom-color: var(--border); box-shadow: var(--shadow-sm); }
.header-inner { display: flex; align-items: center; gap: 20px; height: 100%; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; flex: none; }
.brand img { border-radius: 10px; }
.brand-text { font-size: 1.16rem; font-weight: 700; letter-spacing: -.02em; }
.brand-text strong { color: var(--primary); font-weight: 800; }
.main-nav { margin-right: auto; }
.main-nav > ul { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav-link { display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 999px; color: var(--text-2); font-weight: 560; font-size: .94rem; text-decoration: none !important; transition: all .2s; }
.nav-link .icon { width: 17px; height: 17px; opacity: .7; }
.nav-link:hover, .nav-link.is-active { color: var(--text); background: var(--surface-2); }
.nav-link.is-active { color: var(--link); }
.nav-link.is-active .icon { opacity: 1; }
.nav-auth { display: none; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.nav-toggle { display: none; }
.only-dark, [data-theme="dark"] .only-light { display: none; }
[data-theme="dark"] .only-dark { display: inline-block; }
.when-open, .nav-open .when-closed { display: none; }
.nav-open .when-open { display: inline-block; }
.dropdown-wrap { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); cursor: pointer; }
.user-btn:hover { border-color: var(--primary); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--primary-light), var(--primary-dark)); color: #fff; font-weight: 750; font-size: .9rem; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.3rem; }
.user-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-meta b { font-size: .86rem; font-weight: 650; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { font-size: .72rem; color: var(--muted); }
.caret { width: 14px; height: 14px; color: var(--muted); }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; padding: 6px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transform: translateY(6px); transition: all .18s var(--ease); z-index: 120; }
.dropdown-wrap.is-open .dropdown { opacity: 1; visibility: visible; transform: none; }
.dropdown a, .dropdown button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px;
    color: var(--text); text-align: left; font-size: .9rem; text-decoration: none !important; cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); }
.dropdown form { margin: 0; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
.dd-tail { margin-left: auto; font-size: .75rem; color: var(--muted); }
.dropdown-notif { width: 330px; max-height: 420px; overflow-y: auto; }
.dropdown-title { margin: 4px 8px 6px; font-weight: 700; font-size: .85rem; }
.pad { padding: 8px 10px; margin: 0; }
.notif { flex-direction: column; align-items: flex-start !important; gap: 1px !important; }
.notif strong { font-size: .86rem; } .notif span { font-size: .8rem; color: var(--muted); } .notif small { font-size: .7rem; color: var(--muted); }
.notif.unread { background: var(--primary-soft); }

/* ---------- 07. Search dialog ------------------------------------------- */
.search-modal { position: fixed; inset: 0; z-index: 500; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.search-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); backdrop-filter: blur(4px); animation: fade .2s; }
.search-panel { position: relative; width: 100%; max-width: 620px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .22s var(--ease); }
.search-field { display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--border); margin: 0; }
.search-field .icon { color: var(--muted); }
.search-field input { flex: 1; height: 58px; border: 0; background: transparent; outline: none; font-size: 1.04rem; min-width: 0; }
.search-field kbd { font: 600 .7rem var(--font); padding: 3px 7px; border-radius: 6px; border: 1px solid var(--border); color: var(--muted); }
.search-results { max-height: 60vh; overflow-y: auto; padding: 8px; }
.search-hint { margin: 0; padding: 22px; text-align: center; color: var(--muted); font-size: .9rem; }
.sr-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius); color: var(--text); text-decoration: none !important; }
.sr-item:hover, .sr-item.is-active { background: var(--primary-soft); }
.sr-item small { display: block; color: var(--muted); font-size: .78rem; }

/* ---------- 08. Footer & tab bar ---------------------------------------- */
.site-footer { margin-top: 64px; padding: 56px 0 28px; background: var(--surface); border-top: 1px solid var(--border); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; }
.footer-about p { color: var(--muted); font-size: .92rem; margin-top: 14px; max-width: 360px; }
.footer-badges { display: flex; flex-wrap: wrap; gap: 14px; font-size: .82rem; color: var(--text-2) !important; }
.footer-badges span { display: inline-flex; align-items: center; gap: 5px; }
.footer-badges .icon { color: var(--primary); }
.footer-title { font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 14px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer nav a { color: var(--text-2); font-size: .93rem; }
.site-footer nav a:hover { color: var(--link); }
.footer-bottom { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); font-size: .85rem; }
.footer-bottom p { margin: 0; color: var(--muted); }
.tabbar { display: none; }
.to-top { position: fixed; right: 18px; bottom: calc(18px + var(--tabbar-h)); z-index: 90; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border);
    background: var(--surface); color: var(--text-2); box-shadow: var(--shadow); display: grid; place-items: center; opacity: 0; visibility: hidden; transform: translateY(8px); transition: all .25s var(--ease); cursor: pointer; }
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }

/* ---------- 09. Hero & homepage ----------------------------------------- */
.hero { position: relative; padding: 72px 0 40px; overflow: hidden; isolation: isolate; }
.hero-bg { position: absolute; inset: 0; z-index: -1;
    background: radial-gradient(700px 380px at 12% -5%, rgba(34, 211, 238, .2), transparent 70%), radial-gradient(640px 360px at 95% 10%, rgba(139, 92, 246, .14), transparent 70%),
                linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: auto, auto, 40px 40px, 40px 40px; mask-image: linear-gradient(to bottom, #000 55%, transparent); }
.hero-inner { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 48px; align-items: center; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); font-size: .84rem; font-weight: 600; color: var(--text-2); box-shadow: var(--shadow-sm); }
.hero-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(16, 185, 129, .18); }
.hero-title { margin: 18px 0 16px; font-size: clamp(2.1rem, 5.2vw, 3.6rem); line-height: 1.08; letter-spacing: -.035em; }
.gradient-text { background: linear-gradient(100deg, var(--primary-dark), var(--primary-light) 45%, var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { font-size: 1.12rem; color: var(--text-2); max-width: 560px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 18px; }
.hero-trust { display: flex; flex-wrap: wrap; gap: 18px; font-size: .88rem; color: var(--muted); }
.hero-trust span { display: inline-flex; align-items: center; gap: 6px; }
.hero-trust .icon { color: var(--success); }
.hero-visual { position: relative; }
.hero-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 18px; }
.hero-float { position: absolute; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); font-size: .85rem; animation: float 6s ease-in-out infinite; }
.hero-float b { display: block; font-size: .92rem; }
.hero-float small { color: var(--muted); }
.hero-float.f1 { left: -26px; bottom: 36px; }
.hero-float.f2 { right: -16px; top: -18px; animation-delay: -3s; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 44px 0 0; }
.stat { padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); text-align: center; }
.stat dt { font-size: .82rem; color: var(--muted); order: 2; }
.stat dd { margin: 0 0 2px; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.stat { display: flex; flex-direction: column-reverse; }
.level-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 99px; }
.level-tabs button { border: 0; background: none; padding: 8px 16px; border-radius: 99px; font-weight: 600; color: var(--muted); cursor: pointer; }
.level-tabs button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.grade-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.grade-card { --c: var(--primary); position: relative; display: flex; flex-direction: column; gap: 4px; padding: 18px 16px; border-radius: var(--radius-lg); background: var(--surface);
    border: 1px solid var(--border); color: var(--text); text-decoration: none !important; overflow: hidden; transition: transform .2s var(--ease), border-color .2s, box-shadow .2s; }
.grade-card::after { content: ""; position: absolute; right: -24px; top: -24px; width: 90px; height: 90px; border-radius: 50%; background: var(--c); opacity: .12; transition: transform .3s var(--ease); }
.grade-card:hover { transform: translateY(-3px); border-color: var(--c); box-shadow: var(--shadow); }
.grade-card:hover::after { transform: scale(1.4); }
.grade-num { font-size: 2rem; font-weight: 850; line-height: 1; color: var(--c); letter-spacing: -.04em; }
.grade-card strong { font-size: .95rem; }
.grade-card small { font-size: .78rem; color: var(--muted); line-height: 1.35; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature { padding: 26px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); }
.feature h3 { margin: 16px 0 6px; }
.feature p { color: var(--muted); margin: 0; font-size: .95rem; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; counter-reset: step; }
.step { position: relative; padding: 24px 24px 24px 72px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); }
.step::before { counter-increment: step; content: counter(step); position: absolute; left: 22px; top: 22px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
    background: var(--navy); color: #fff; font-weight: 800; }
[data-theme="dark"] .step::before { background: var(--primary); color: var(--navy); }
.step h3 { margin-bottom: 4px; } .step p { margin: 0; color: var(--muted); font-size: .94rem; }
.ai-demo { display: grid; gap: 10px; }
.bubble { max-width: 92%; padding: 12px 16px; border-radius: 16px; background: var(--surface-2); font-size: .93rem; }
.bubble.me { justify-self: end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.bubble.ai { border-bottom-left-radius: 4px; }
.bubble b { display: block; font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; opacity: .8; margin-bottom: 2px; }
.cta-band { position: relative; padding: 48px; border-radius: var(--radius-xl); background: linear-gradient(120deg, #0F172A, #0E3A4A 60%, #0891B2); color: #E2E8F0; overflow: hidden; }
.cta-band h2 { color: #fff; }
.cta-band p { color: #CBD5E1; max-width: 560px; }
.cta-band::after { content: "∑ π √ ∫ Δ θ"; position: absolute; right: 24px; bottom: -14px; font-size: 6rem; font-weight: 800; color: rgba(255, 255, 255, .06); letter-spacing: .1em; white-space: nowrap; }
.faq-list { display: grid; gap: 10px; max-width: 860px; margin: 0 auto; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.faq-item summary { list-style: none; cursor: pointer; padding: 16px 48px 16px 18px; font-weight: 620; position: relative; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 1.3rem; color: var(--muted); transition: transform .2s; }
.faq-item[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq-item .faq-a { padding: 0 18px 16px; color: var(--text-2); }
.faq-a p:last-child { margin: 0; }

/* ---------- 10. Cards & tiles ------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.card-link { display: block; color: var(--text); text-decoration: none !important; transition: transform .2s var(--ease), border-color .2s, box-shadow .2s; }
.card-link:hover { transform: translateY(-2px); border-color: var(--primary); box-shadow: var(--shadow); }
.card-flat { box-shadow: none; }
.card-hl { border-color: rgba(6, 182, 212, .4); background: linear-gradient(180deg, var(--primary-soft), transparent 60%), var(--surface); }
.tile { display: inline-grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 14px; background: var(--primary-soft); color: var(--primary-dark); box-shadow: inset 0 0 0 1px rgba(6, 182, 212, .18); }
[data-theme="dark"] .tile { color: var(--primary-light); }
.tile .icon { width: 22px; height: 22px; }
.tile-sm { width: 36px; height: 36px; border-radius: 10px; } .tile-sm .icon { width: 18px; height: 18px; }
.tile-violet { background: rgba(139, 92, 246, .12); color: #7C3AED; box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .2); }
.tile-amber { background: rgba(245, 158, 11, .14); color: #D97706; box-shadow: inset 0 0 0 1px rgba(245, 158, 11, .22); }
.tile-green { background: rgba(16, 185, 129, .12); color: #059669; box-shadow: inset 0 0 0 1px rgba(16, 185, 129, .2); }
.tile-rose { background: rgba(244, 63, 94, .1); color: #E11D48; box-shadow: inset 0 0 0 1px rgba(244, 63, 94, .18); }
[data-theme="dark"] .tile-violet { color: #C4B5FD; } [data-theme="dark"] .tile-amber { color: #FCD34D; } [data-theme="dark"] .tile-green { color: #6EE7B7; } [data-theme="dark"] .tile-rose { color: #FDA4AF; }
.list-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none !important; }
a.list-card:hover { border-color: var(--primary); background: var(--primary-soft); }
.list-card .grow { flex: 1; min-width: 0; }
.list-card .grow strong { display: block; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; }
.list-card .grow small { color: var(--muted); font-size: .8rem; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.empty .icon { width: 38px; height: 38px; margin: 0 auto 10px; color: var(--primary); stroke-width: 1.5; }
.empty p { margin: 0 0 12px; }
.post-card { display: flex; flex-direction: column; gap: 8px; padding: 22px; }
.post-card h3 { margin: 0; font-size: 1.08rem; }
.post-card p { margin: 0; color: var(--muted); font-size: .93rem; }

/* ---------- 11. Forms & alerts ------------------------------------------ */
.form { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-weight: 620; font-size: .88rem; }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=range]), .field select, .field textarea {
    width: 100%; padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; font-size: .95rem; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.field textarea { resize: vertical; min-height: 90px; }
.field .help { color: var(--muted); font-size: .8rem; }
.field .error { color: var(--danger); font-size: .82rem; font-weight: 550; }
.field .error:empty { display: none; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.input-ic { position: relative; }
.input-ic > .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-ic input { padding-left: 40px !important; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); padding: 8px; cursor: pointer; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: .92rem; }
.check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--primary); flex: none; }
.switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 560; cursor: pointer; user-select: none; font-size: .92rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { position: relative; width: 40px; height: 23px; border-radius: 99px; background: var(--border-strong); transition: background .2s; flex: none; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch input:checked + .switch-ui { background: var(--primary); }
.switch input:checked + .switch-ui::after { transform: translateX(17px); }
.switch input:focus-visible + .switch-ui { box-shadow: 0 0 0 3px var(--primary-ring); }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 14px; background: var(--surface-2); }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: .92rem; color: var(--muted); }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-ring); }
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 12px; font-weight: 550; font-size: .93rem; margin: 16px 0; }
.alert .icon { margin-top: 2px; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-info { background: var(--primary-soft); color: var(--text-2); }
.alert-info .icon { color: var(--primary-dark); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.auth-wrap { min-height: calc(100vh - var(--header-h) - 80px); display: grid; place-items: center; padding: 40px 0; }
.auth-card { width: 100%; max-width: 460px; padding: 34px; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow-lg); }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 4px; }
.auth-card > p { color: var(--muted); }
.auth-alt { text-align: center; margin: 18px 0 0; font-size: .92rem; color: var(--muted); }
.page-auth .site-footer { margin-top: 0; }
.demo-box { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: .82rem; color: var(--muted); }
.demo-box code { font-family: var(--mono); color: var(--text); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- 12. Tables, tabs, progress, pagination ----------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { padding: 11px 14px; font-size: .74rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); text-align: left; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 11px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-weight: 620; white-space: nowrap; cursor: pointer; text-decoration: none !important; font-size: .93rem; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--link); border-bottom-color: var(--primary); }
.tab .count { min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--surface-2); font-size: .72rem; text-align: center; }
.tab.is-active .count { background: var(--primary-soft); }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width .6s var(--ease); }
.bar.lv-good > span { background: var(--green); } .bar.lv-mid > span { background: var(--amber); } .bar.lv-weak > span { background: var(--rose); }
.lv-good { --lv: var(--green); } .lv-mid { --lv: var(--amber); } .lv-weak { --lv: var(--rose); }
.ring { --p: 0; --c: var(--primary); width: 116px; height: 116px; border-radius: 50%; display: grid; place-items: center;
    background: radial-gradient(closest-side, var(--surface) 78%, transparent 79% 100%), conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-2) 0); }
.ring b { font-size: 1.7rem; font-weight: 850; letter-spacing: -.03em; }
.ring small { display: block; text-align: center; font-size: .72rem; color: var(--muted); margin-top: -4px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; font-size: .85rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin-right: 6px; color: var(--border-strong); }
.breadcrumbs a { color: var(--muted); }
.pagination { display: flex; justify-content: center; gap: 6px; margin: 32px 0 0; }
.pg { min-width: 40px; height: 40px; padding: 0 12px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 600; text-decoration: none !important; }
.pg.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pg.gap { border: 0; background: none; }

/* ---------- 13. Learn: grade & chapters ---------------------------------- */
.grade-hero { --c: var(--primary); position: relative; padding: 34px 0 26px; overflow: hidden; }
.grade-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(600px 260px at 0% 0%, color-mix(in srgb, var(--c) 22%, transparent), transparent 70%); }
.grade-switch { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: thin; }
.grade-switch a { flex: none; min-width: 44px; height: 40px; display: grid; place-items: center; padding: 0 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 700; text-decoration: none !important; }
.grade-switch a.is-active { background: var(--navy); color: #fff; border-color: var(--navy); }
[data-theme="dark"] .grade-switch a.is-active { background: var(--primary); color: var(--navy); border-color: var(--primary); }
.chapter { margin-bottom: 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.chapter-head { display: flex; align-items: center; gap: 14px; padding: 18px 20px; }
.chapter-head h2 { font-size: 1.12rem; margin: 0 0 2px; }
.chapter-head p { margin: 0; font-size: .87rem; color: var(--muted); }
.chapter-head .grow { flex: 1; min-width: 0; }
.chapter-meter { width: 120px; text-align: right; font-size: .78rem; color: var(--muted); }
.chapter-meter .bar { margin-top: 5px; }
.lesson-list { list-style: none; margin: 0; padding: 0 12px 12px; display: grid; gap: 4px; }
.lesson-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--text); text-decoration: none !important; }
.lesson-row:hover { background: var(--surface-2); }
.lesson-row .num { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); font-size: .82rem; font-weight: 750; color: var(--muted); flex: none; }
.lesson-row.done .num { background: var(--success-soft); color: var(--success); }
.lesson-row.started .num { background: var(--primary-soft); color: var(--link); }
.lesson-row .grow { flex: 1; min-width: 0; }
.lesson-row .grow strong { display: block; font-weight: 600; font-size: .95rem; }
.lesson-row .grow small { display: block; color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapter-foot { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px dashed var(--border); background: var(--surface-2); }
.side-sticky { position: sticky; top: calc(var(--header-h) + 16px); display: grid; gap: 16px; }

/* ---------- 14. Lesson & prose ------------------------------------------ */
.lesson-wrap { display: grid; grid-template-columns: 250px minmax(0, 1fr) 300px; gap: 28px; align-items: start; padding-top: 22px; }
.lesson-toc { position: sticky; top: calc(var(--header-h) + 16px); font-size: .88rem; }
.lesson-toc h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.lesson-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.lesson-toc a { display: flex; gap: 8px; padding: 7px 10px; border-radius: 9px; color: var(--text-2); text-decoration: none !important; line-height: 1.35; }
.lesson-toc a:hover { background: var(--surface-2); }
.lesson-toc a.is-current { background: var(--primary-soft); color: var(--link); font-weight: 650; }
.lesson-toc a .icon { width: 15px; height: 15px; margin-top: 2px; }
.lesson-main { min-width: 0; }
.lesson-title { margin: 10px 0 10px; font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: .86rem; color: var(--muted); margin-bottom: 22px; }
.lesson-meta span { display: inline-flex; align-items: center; gap: 5px; }
.prose { font-size: 1.04rem; line-height: 1.78; color: var(--text-2); }
.prose h2 { font-size: 1.36rem; margin: 2em 0 .6em; color: var(--text); padding-top: .2em; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1.12rem; margin: 1.6em 0 .5em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.1em; }
.prose li { margin: .25em 0; }
.prose li::marker { color: var(--primary); }
.prose strong { color: var(--text); }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .95rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.prose th { background: var(--surface-2); }
.prose blockquote { margin: 1.2em 0; padding: 4px 18px; border-left: 4px solid var(--primary); color: var(--text-2); background: var(--surface-2); border-radius: 0 10px 10px 0; }
.prose img { border-radius: 12px; }
.prose code { font-family: var(--mono); font-size: .88em; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); }
.prose .callout { position: relative; margin: 1.3em 0; padding: 16px 20px 16px 56px; border-radius: 16px; background: linear-gradient(135deg, var(--primary-soft), rgba(139, 92, 246, .07)); border: 1px solid rgba(6, 182, 212, .25); color: var(--text); }
.prose .callout::before { content: "★"; position: absolute; left: 18px; top: 14px; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--primary); color: #fff; font-size: .85rem; }
.prose .callout p:last-child, .prose .callout ul:last-child { margin-bottom: 0; }
.prose ol.opts { list-style: upper-alpha; }
.katex { font-size: 1.06em; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 6px 0; }
.lesson-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 36px 0 10px; }
.lesson-nav a { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none !important; }
.lesson-nav a:hover { border-color: var(--primary); }
.lesson-nav a.next { text-align: right; grid-column: 2; }
.lesson-nav small { color: var(--muted); font-size: .78rem; }
.complete-box { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 18px 20px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); margin-top: 26px; }
.complete-box .grow { flex: 1; min-width: 220px; }
.complete-box strong { display: block; }
.locked-box { text-align: center; padding: 40px 24px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); }
.locked-box .tile { margin: 0 auto 12px; }
.is-protected .prose, .is-protected .q-body, .is-protected .rv-body { -webkit-user-select: none; user-select: none; }
.watermark { position: fixed; inset: 0; z-index: 80; pointer-events: none; opacity: .045; background-repeat: repeat; }
[data-theme="dark"] .watermark { opacity: .06; filter: invert(1); }
/* Ô hỏi AI trong bài học */
.ask-ai { padding: 18px; }
.ask-ai .chat-log { display: grid; gap: 8px; max-height: 360px; overflow-y: auto; margin: 10px 0; font-size: .9rem; }
.ask-ai .chat-log:empty { display: none; }
.chat-msg { padding: 9px 12px; border-radius: 12px; background: var(--surface-2); }
.chat-msg.me { background: var(--primary-soft); justify-self: end; max-width: 90%; }
.chat-msg p { margin: 0 0 .4em; } .chat-msg p:last-child { margin: 0; }
.ask-form { display: flex; gap: 8px; }
.ask-form input { flex: 1; min-width: 0; padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: 99px; background: var(--surface); outline: none; }
.ask-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }

/* ---------- 15. Simulations --------------------------------------------- */
.sim { margin: 1.6em 0; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); overflow: hidden; box-shadow: var(--shadow-sm); }
.sim-stage { position: relative; width: 100%; min-height: 220px; background: var(--surface); }
.sim-stage canvas { width: 100%; height: auto; touch-action: none; cursor: crosshair; }
.sim figcaption { display: flex; align-items: center; gap: 6px; padding: 9px 14px; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--border); background: var(--surface-2); }
.sim-ui { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 12px 14px; border-top: 1px solid var(--border); font-size: .88rem; }
.sim-ui label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.sim-ui input[type=range] { width: 120px; accent-color: var(--primary); }
.sim-ui output { min-width: 34px; font-family: var(--mono); font-weight: 700; color: var(--link); }
.sim-ui .btn { height: 34px; padding: 0 14px; font-size: .84rem; }
.sim-readout { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 14px; font-family: var(--mono); font-size: .86rem; color: var(--text-2); border-top: 1px dashed var(--border); }
.sim-readout b { color: var(--text); }

/* ---------- 16. Exam taking --------------------------------------------- */
.page-exam .site-footer, .page-exam .tabbar { display: none; }
.page-exam { --tabbar-h: 0px !important; }
.exam-bar { position: sticky; top: var(--header-h); z-index: 60; background: var(--header-bg); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.exam-bar .container { display: flex; align-items: center; gap: 14px; height: 58px; }
.exam-bar h1 { font-size: 1rem; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--surface-2); font-family: var(--mono); font-weight: 750; font-size: .95rem; }
.timer.is-low { background: var(--danger-soft); color: var(--danger); animation: pulse 1s infinite; }
.save-state { font-size: .78rem; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.exam-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 26px; align-items: start; padding: 24px 0 60px; }
.q-card { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); margin-bottom: 18px; scroll-margin-top: calc(var(--header-h) + 74px); }
.q-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.q-no { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 10px; background: var(--navy); color: #fff; font-weight: 800; font-size: .9rem; }
[data-theme="dark"] .q-no { background: var(--primary); color: var(--navy); }
.q-body { font-size: 1.06rem; line-height: 1.7; margin-bottom: 16px; }
.q-shared { font-size: .76rem; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.opts { display: grid; gap: 10px; }
.opt { position: relative; display: flex; align-items: center; gap: 12px; padding: 13px 16px; border: 1.5px solid var(--border); border-radius: 14px; cursor: pointer; transition: border-color .15s, background .15s; background: var(--surface); }
.opt:hover { border-color: var(--primary); }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt .key { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 9px; background: var(--surface-2); font-weight: 750; font-size: .85rem; color: var(--muted); transition: all .15s; }
.opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.opt:has(input:checked) .key { background: var(--primary); color: #fff; }
.opt:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--primary-ring); }
.opts-tf { grid-template-columns: 1fr 1fr; }
.num-answer { display: flex; gap: 10px; align-items: center; max-width: 360px; }
.num-answer input { flex: 1; padding: 12px 14px; border: 1.5px solid var(--border-strong); border-radius: 12px; background: var(--surface); font-size: 1.05rem; font-family: var(--mono); outline: none; }
.num-answer input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.q-tools { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); flex-wrap: wrap; }
.q-tools .grow { flex: 1; }
.flag-btn.is-on { color: var(--amber); border-color: var(--amber); }
.hint-box { margin-top: 14px; display: grid; gap: 10px; }
.hint-msg { position: relative; padding: 14px 16px 12px; border-radius: 14px; background: linear-gradient(135deg, rgba(139, 92, 246, .08), var(--primary-soft)); border: 1px solid rgba(139, 92, 246, .2); font-size: .95rem; animation: pop .25s var(--ease); }
.hint-msg p { margin: 0 0 .5em; } .hint-msg p:last-child { margin: 0; }
.hint-msg.is-answer { background: var(--success-soft); border-color: rgba(5, 150, 105, .3); }
.hint-lv { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 6px; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #7C3AED; }
[data-theme="dark"] .hint-lv { color: #C4B5FD; }
.hint-msg.is-answer .hint-lv { color: var(--success); }
.hint-steps { display: inline-flex; gap: 4px; }
.hint-steps i { width: 18px; height: 6px; border-radius: 99px; background: var(--surface-3); }
.hint-steps i.on { background: var(--violet); }
.reveal-ask { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--border-strong); font-size: .92rem; }
.ai-btn { background: linear-gradient(135deg, #8B5CF6, #06B6D4); color: #fff; border: 0; }
.ai-btn:hover { filter: brightness(1.08); }
.robot { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: linear-gradient(135deg, #8B5CF6, #06B6D4); color: #fff; }
.robot .icon { width: 17px; height: 17px; }
.qnav { position: sticky; top: calc(var(--header-h) + 74px); }
.qnav-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin: 12px 0 16px; }
.qnav-grid a { aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 700; font-size: .86rem; text-decoration: none !important; position: relative; }
.qnav-grid a.answered { background: var(--primary); border-color: var(--primary); color: #fff; }
.qnav-grid a.flagged::after { content: ""; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.qnav-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: .76rem; color: var(--muted); margin-bottom: 14px; }
.qnav-legend span { display: inline-flex; align-items: center; gap: 5px; }
.qnav-legend i { width: 11px; height: 11px; border-radius: 4px; border: 1px solid var(--border); display: inline-block; }
.qnav-legend i.a { background: var(--primary); border-color: var(--primary); } .qnav-legend i.f { background: var(--amber); border-color: var(--amber); border-radius: 50%; }

/* ---------- 17. Result -------------------------------------------------- */
.result-hero { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; padding: 28px; border-radius: var(--radius-xl); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); margin: 26px 0; }
.result-hero h1 { font-size: 1.6rem; margin-bottom: 6px; }
.result-stats { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 12px; }
.result-stats div { font-size: .85rem; color: var(--muted); }
.result-stats b { display: block; font-size: 1.25rem; color: var(--text); }
.rv { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); margin-bottom: 14px; border-left: 4px solid var(--rose); }
.rv.ok { border-left-color: var(--green); }
.rv-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.rv-body { margin-bottom: 12px; }
.rv-opt { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); margin-bottom: 6px; font-size: .95rem; }
.rv-opt.correct { border-color: var(--green); background: var(--success-soft); }
.rv-opt.wrong { border-color: var(--rose); background: var(--danger-soft); }
.rv-opt .key { font-weight: 800; width: 22px; color: var(--muted); }
.rv-expl { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: .94rem; }
.rv-expl b { display: block; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }

/* ---------- 18. Dashboard & report -------------------------------------- */
.dash-hello { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 28px 0 22px; }
.dash-hello h1 { font-size: clamp(1.45rem, 3vw, 1.9rem); margin: 0; }
.dash-hello p { margin: 2px 0 0; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi { display: flex; align-items: center; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.kpi b { display: block; font-size: 1.45rem; font-weight: 820; letter-spacing: -.02em; line-height: 1.1; }
.kpi small { color: var(--muted); font-size: .8rem; }
.continue-card { display: flex; gap: 18px; align-items: center; padding: 22px; border-radius: var(--radius-lg); color: #fff; text-decoration: none !important;
    background: linear-gradient(120deg, #0F172A, #0E3A4A 55%, #0891B2); box-shadow: var(--shadow); }
.continue-card small { color: #A5F3FC; font-weight: 650; font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; }
.continue-card strong { display: block; font-size: 1.15rem; margin: 2px 0; }
.continue-card p { margin: 0; color: #CBD5E1; font-size: .9rem; }
.continue-card .btn { margin-left: auto; }
.skill-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px 46px; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.skill-row:last-child { border-bottom: 0; }
.skill-row a { color: var(--text); font-weight: 580; font-size: .93rem; }
.skill-row .pct { text-align: right; font-weight: 800; font-family: var(--mono); font-size: .9rem; color: var(--lv, var(--muted)); }
.chart { width: 100%; height: 180px; }
.chart .ln { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .ar { fill: url(#chartFill); }
.chart .dt { fill: var(--surface); stroke: var(--primary); stroke-width: 2; }
.chart .gl { stroke: var(--border); stroke-dasharray: 3 4; }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.reco { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; background: var(--surface-2); }
.reco + .reco { margin-top: 10px; }
.reco strong { display: block; font-size: .94rem; }
.reco p { margin: 2px 0 8px; font-size: .86rem; color: var(--muted); }
.limits { display: grid; gap: 10px; }
.limit-row { display: flex; justify-content: space-between; font-size: .86rem; }

/* ---------- 19. Pricing, wallet, checkout -------------------------------- */
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: stretch; }
.price { position: relative; display: flex; flex-direction: column; padding: 28px; border-radius: var(--radius-xl); background: var(--surface); border: 1px solid var(--border); }
.price.is-popular { border: 2px solid var(--primary); box-shadow: 0 20px 40px -20px rgba(6, 182, 212, .5); }
.price .ribbon { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); padding: 3px 12px; border-radius: 99px; background: var(--primary); color: #fff; font-size: .74rem; font-weight: 800; white-space: nowrap; }
.price h3 { margin: 0 0 4px; }
.price .amount { font-size: 2.3rem; font-weight: 850; letter-spacing: -.03em; margin: 10px 0 0; line-height: 1; }
.price .amount small { font-size: .9rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.price ul { list-style: none; margin: 18px 0 22px; padding: 0; display: grid; gap: 9px; font-size: .93rem; flex: 1; }
.price li { display: flex; gap: 8px; align-items: flex-start; }
.price li .icon { color: var(--success); margin-top: 3px; }
.coin-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.coin-pack { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px 14px; border-radius: var(--radius-lg); border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; text-align: center; transition: all .15s; }
.coin-pack:hover { border-color: var(--primary); }
.coin-pack input { position: absolute; opacity: 0; }
.coin-pack:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-ring); }
.coin-pack .c { font-size: 1.5rem; font-weight: 850; }
.coin-pack .bonus { font-size: .75rem; font-weight: 700; color: var(--success); }
.coin-pack .p { font-size: .9rem; color: var(--muted); }
.coin-ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #FDE68A, #F59E0B 60%, #B45309); color: #78350F; font-weight: 900; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15); }
.wallet-hero { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 24px; border-radius: var(--radius-xl); background: linear-gradient(120deg, #0F172A, #1E293B 60%, #0E7490); color: #fff; margin-bottom: 22px; }
.wallet-hero .bal { font-size: 2.2rem; font-weight: 850; letter-spacing: -.03em; line-height: 1; }
.wallet-hero small { color: #94A3B8; }
.wallet-hero .grow { flex: 1; }
.gw-list { display: grid; gap: 10px; }
.gw { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: 14px; cursor: pointer; background: var(--surface); }
.gw input { accent-color: var(--primary); width: 18px; height: 18px; }
.gw:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.gw .logo { width: 44px; height: 30px; border-radius: 7px; display: grid; place-items: center; font-size: .7rem; font-weight: 900; color: #fff; letter-spacing: .02em; }
.logo-bank { background: #0F766E; } .logo-vnpay { background: #005BAA; } .logo-momo { background: #A50064; } .logo-wallet { background: linear-gradient(135deg, #F59E0B, #B45309); }
.checkout { display: grid; grid-template-columns: 320px 1fr; gap: 30px; align-items: start; }
.qr-box { padding: 18px; border-radius: 20px; background: #fff; border: 1px solid var(--border); text-align: center; }
.qr-box canvas, .qr-box svg { width: 100%; height: auto; image-rendering: pixelated; }
.qr-box .bank { margin-top: 10px; font-size: .8rem; color: #475569; font-weight: 650; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.kv dt, .kv dd { margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: .93rem; }
.kv dt { color: var(--muted); background: var(--surface-2); }
.kv dd { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 650; word-break: break-all; }
.kv dt:nth-last-child(2), .kv dd:last-child { border-bottom: 0; }
.copy { border: 0; background: var(--surface-2); color: var(--link); border-radius: 8px; padding: 4px 9px; font-size: .76rem; font-weight: 700; cursor: pointer; flex: none; }
.pay-wait { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 14px; background: var(--warn-soft); color: var(--warn); font-weight: 600; margin-top: 16px; }
.pay-wait .spin { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
.pay-ok { background: var(--success-soft); color: var(--success); }

/* ---------- 20. Teacher area ------------------------------------------- */
.class-card { display: flex; flex-direction: column; gap: 12px; }
.class-card h3 { margin: 0; }
.class-code { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 10px; background: var(--surface-2); font-family: var(--mono); font-weight: 800; font-size: 1.05rem; letter-spacing: .12em; }
.class-stats { display: flex; gap: 16px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.class-stats b { color: var(--text); }
.live-dot { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; background: var(--danger-soft); color: var(--danger); font-size: .74rem; font-weight: 800; }
.live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.2s infinite; }
.code-big { font-family: var(--mono); font-size: 2rem; font-weight: 850; letter-spacing: .2em; color: var(--text); }
.heat { border-collapse: separate; border-spacing: 3px; font-size: .8rem; }
.heat th { font-weight: 650; color: var(--muted); padding: 4px 6px; text-align: left; white-space: nowrap; }
.heat th.vt { writing-mode: vertical-rl; transform: rotate(180deg); text-align: left; max-height: 140px; font-size: .74rem; }
.heat td { min-width: 42px; height: 32px; text-align: center; border-radius: 6px; font-weight: 700; font-family: var(--mono); background: var(--surface-2); color: var(--muted); }
.heat td.lv-good { background: rgba(16, 185, 129, .18); color: var(--success); }
.heat td.lv-mid { background: rgba(245, 158, 11, .18); color: var(--warn); }
.heat td.lv-weak { background: rgba(244, 63, 94, .16); color: var(--danger); }
.heat td.name { text-align: left; background: none; color: var(--text); font-family: var(--font); font-weight: 600; white-space: nowrap; }
.qrow { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.qrow + .qrow { margin-top: 10px; }
.qrow .grow { flex: 1; min-width: 0; }
.qrow .q-text { font-size: .97rem; margin-bottom: 8px; }
.qrow .q-opts { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .86rem; color: var(--muted); margin-bottom: 8px; }
.qrow .q-opts .ok { color: var(--success); font-weight: 700; }
.qrow .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-note { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: .84rem; }
.ai-note ul { margin: 4px 0 0; padding-left: 18px; }
.enc-badge { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; color: var(--success); font-weight: 650; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filters select, .filters input { height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); }
.opt-edit { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.opt-edit .key { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); font-weight: 800; color: var(--muted); }
.opt-edit input[type=text] { flex: 1; }
.opt-edit label.mark { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--muted); white-space: nowrap; cursor: pointer; }
.tex-preview { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); min-height: 46px; font-size: .97rem; }
.picker { max-height: 420px; overflow-y: auto; display: grid; gap: 8px; }
.pick { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; font-size: .9rem; background: var(--surface); }
.pick:hover { border-color: var(--primary); }
.pick.is-on { border-color: var(--primary); background: var(--primary-soft); }
.pick small { display: block; color: var(--muted); font-size: .76rem; margin-top: 2px; }
.sel-list { display: grid; gap: 6px; counter-reset: q; }
.sel-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: .88rem; }
.sel-item::before { counter-increment: q; content: counter(q); width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-2); font-weight: 800; font-size: .75rem; flex: none; }
.sel-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 21. Modal & toasts ----------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 600; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px); animation: fade .2s; }
.modal-dialog { position: relative; width: 100%; max-width: 680px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); animation: pop .22s var(--ease); }
.modal.is-wide .modal-dialog { max-width: 960px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 1.08rem; margin: 0; }
.modal-body { padding: 20px; }
.modal-body.is-loading { min-height: 160px; display: grid; place-items: center; }
.modal-body.is-loading::after { content: ""; width: 28px; height: 28px; border: 3px solid var(--primary); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.toasts { position: fixed; right: 18px; bottom: calc(18px + var(--tabbar-h)); z-index: 900; display: grid; gap: 10px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 380px; padding: 12px 16px; border-radius: 14px; background: var(--navy); color: #fff; font-weight: 550; font-size: .92rem; box-shadow: var(--shadow-lg); animation: pop .22s; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary-light); flex: none; }
.toast.error::before { background: #F87171; }
[data-theme="dark"] .toast { background: #1E293B; border: 1px solid #334155; }

/* ---------- 22. Utilities ---------------------------------------------- */
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.kbd { font: 600 .74rem var(--mono); padding: 2px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); }
.badge-num { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--rose); color: #fff; font-size: .72rem; font-weight: 800; }
.w-full { width: 100%; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

/* ---------- 23. Responsive ---------------------------------------------- */
@media (max-width: 1180px) {
    .lesson-wrap { grid-template-columns: minmax(0, 1fr) 290px; }
    .lesson-toc { display: none; }
    .grade-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1024px) {
    .hero-inner, .split, .exam-layout, .checkout { grid-template-columns: 1fr; }
    .hero-visual { max-width: 560px; }
    .qnav { position: static; }
    .feature-grid, .steps, .price-grid { grid-template-columns: 1fr 1fr; }
    .kpis { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .side-sticky { position: static; }
}
@media (max-width: 900px) {
    :root { --header-h: 60px; }
    .lesson-wrap { grid-template-columns: 1fr; }
    .nav-toggle { display: inline-grid; }
    .header-actions { margin-left: auto; }
    .main-nav { position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0; height: calc(100vh - var(--header-h)); height: calc(100dvh - var(--header-h));
        z-index: 99; background: var(--bg); padding: 16px 20px calc(32px + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain;
        opacity: 0; transform: translateY(-10px); visibility: hidden; pointer-events: none;
        transition: opacity .22s var(--ease), transform .22s var(--ease), visibility 0s linear .22s; margin: 0; }
    .nav-open .main-nav { opacity: 1; transform: none; visibility: visible; pointer-events: auto; transition: opacity .22s var(--ease), transform .22s var(--ease), visibility 0s; }
    .nav-open { overflow: hidden; }
    .main-nav > ul { flex-direction: column; align-items: stretch; gap: 4px; }
    .nav-link { padding: 14px 16px; font-size: 1.02rem; border-radius: 14px; }
    .nav-auth { display: grid; gap: 10px; margin-top: 20px; }
    .user-meta, .caret { display: none; }
    .user-btn { padding: 3px; }
    .hide-sm { display: none !important; }
    .grade-grid { grid-template-columns: repeat(3, 1fr); }
    .hero-float { display: none; }
    .stats { grid-template-columns: 1fr 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .coin-grid { grid-template-columns: 1fr 1fr; }
    .is-auth { --tabbar-h: 64px; }
    .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 95; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
        background: var(--header-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border); }
    .tab-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: .68rem; font-weight: 650; color: var(--muted); text-decoration: none !important; }
    .tab-item .icon { width: 22px; height: 22px; }
    .tab-item.is-active { color: var(--link); }
    .dropdown-notif { width: min(330px, calc(100vw - 32px)); right: -60px; }
}
@media (max-width: 640px) {
    .container { padding: 0 16px; }
    .section { padding: 56px 0; }
    .hero { padding: 40px 0 20px; }
    .grade-grid { grid-template-columns: repeat(2, 1fr); }
    .feature-grid, .steps, .price-grid, .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
    .kpi { padding: 14px; }
    .kpi b { font-size: 1.2rem; }
    .chapter-meter { display: none; }
    .q-card { padding: 18px; }
    .opts-tf { grid-template-columns: 1fr; }
    .result-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
    .result-stats { justify-content: center; }
    .cta-band { padding: 30px 22px; }
    .lesson-nav { grid-template-columns: 1fr; }
    .lesson-nav a.next { grid-column: auto; }
    .kv { grid-template-columns: 1fr; }
    .kv dt { border-bottom: 0; padding-bottom: 2px; }
    .skill-row { grid-template-columns: minmax(0, 1fr) 70px 40px; }
    .continue-card { flex-wrap: wrap; }
    .continue-card .btn { margin-left: 0; }
    .header-actions .icon-btn[data-search-open] { display: none; }
    .auth-card { padding: 26px 20px; border-radius: 20px; }
    .exam-bar .save-state { display: none; }
}

/* ---------- 24. Motion & print ----------------------------------------- */
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .55; } }
@keyframes float { 50% { transform: translateY(-8px); } }
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
    .js .reveal { opacity: 1; transform: none; }
}
@media print {
    .site-header, .site-footer, .tabbar, .to-top, .toasts, .lesson-toc, .exam-bar, .qnav { display: none !important; }
    body { background: #fff; }
    .is-protected main { display: none; }
}

/* ---------- 25. Nút chia sẻ nổi (góc dưới trái) ------------------------- */
/* Nằm trong .site-footer nhưng position:fixed; đối xứng nút .to-top bên phải. */
.icon-brand { fill: currentColor; stroke: none; }
.share-dock {
    position: fixed; left: 18px; bottom: calc(18px + var(--tabbar-h)); z-index: 90;
    display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
    font-size: 16px; line-height: 1.4; text-align: left;
}
.share-fab {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; min-width: 44px; padding: 0 18px 0 14px;
    border-radius: 999px; border: 0; background: var(--navy); color: #fff; font-weight: 650; font-size: .92rem;
    box-shadow: var(--shadow); cursor: pointer; transition: transform .2s var(--ease), background-color .2s, box-shadow .2s;
}
.share-fab:hover { transform: translateY(-2px); background: var(--primary-dark); box-shadow: var(--shadow-lg); }
.share-fab .icon { width: 20px; height: 20px; }
[data-theme="dark"] .share-fab { background: var(--primary-dark); color: #fff; }
[data-theme="dark"] .share-fab:hover { background: var(--primary); color: var(--navy); }
.share-ic-open, .share-dock.is-open .share-ic-closed { display: none; }
.share-dock.is-open .share-ic-open { display: inline-block; }
.share-dock.is-open .share-fab { background: var(--primary-dark); color: #fff; }
.share-pop {
    width: 316px; max-width: calc(100vw - 32px); padding: 16px;
    background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); transform-origin: bottom left; animation: share-pop .2s var(--ease);
}
.share-pop[hidden] { display: none; }
.share-pop-title { margin: 0 0 12px; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.share-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.share-btn {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 2px; min-height: 44px;
    border: 0; border-radius: var(--radius); background: transparent; color: var(--text-2); cursor: pointer; transition: background-color .15s;
}
.share-btn:hover, .share-btn:focus-visible { background: var(--surface-2); }
.share-btn[hidden] { display: none; }
.share-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--brand, var(--navy)); color: #fff; transition: transform .2s var(--ease); }
.share-btn:hover .share-ic { transform: scale(1.08); }
.share-ic .icon { width: 20px; height: 20px; }
.share-lbl { font-size: .72rem; font-weight: 550; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.share-x { --brand: #000; } .share-facebook { --brand: #1877F2; } .share-linkedin { --brand: #0A66C2; }
.share-whatsapp { --brand: #25D366; } .share-telegram { --brand: #26A5E4; } .share-reddit { --brand: #FF4500; }
.share-pinterest { --brand: #BD081C; } .share-threads { --brand: #000; } .share-bluesky { --brand: #0085FF; }
.share-email { --brand: #64748B; } .share-native { --brand: var(--primary-dark); }
[data-theme="dark"] .share-x .share-ic, [data-theme="dark"] .share-threads .share-ic { box-shadow: inset 0 0 0 1px #475569; }
.share-copy {
    display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 12px; padding: 0 6px 0 12px; height: 46px;
    border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--muted); cursor: pointer; text-align: left; transition: border-color .2s;
}
.share-copy:hover { border-color: var(--primary); }
.share-copy .icon { flex: none; }
.share-copy-url { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.share-copy-cta { flex: none; padding: 6px 14px; border-radius: 999px; background: var(--primary); color: #fff; font-size: .8rem; font-weight: 700; }
.share-copy.is-done .share-copy-cta { background: var(--success); }
@keyframes share-pop { from { opacity: 0; transform: translateY(8px) scale(.96); } }
/* Máy tính bảng & điện thoại: nút tròn chỉ có icon, cùng cỡ nút "lên đầu trang" */
@media (max-width: 900px) {
    .share-fab { width: 44px; padding: 0; }
    .share-fab-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
@media (max-width: 600px) {
    .share-dock { left: 14px; bottom: calc(14px + var(--tabbar-h)); }
    .share-pop { width: calc(100vw - 28px); }
    .share-ic { width: 48px; height: 48px; }
}
@media (prefers-reduced-motion: reduce) { .share-pop { animation: none; } }
@media print { .share-dock { display: none !important; } }
