/* ---------- Màu: sáng ---------- */
:root {
  color-scheme: light;
  --bg: #FFFFFF;
  --soft: #F8F9FA;
  --surface: #FFFFFF;
  --ink: #202124;
  --body: #3C4043;
  --muted: #5F6368;
  --line: #E3E5E8;
  --brand: #4B51C4;
  --brand-text: #4B51C4;
  --on-brand: #FFFFFF;
  --tint: #EEF0FC;
  --hover: #F1F3F4;
  --warn: #B54708;
  --warn-line: #F79009;
  --tip-line: #4B51C4;
  --brand-fill: #3E43A8;
  --brand-fill-hover: #33378C;
  --video-bg: #F1F3F4;
  --logo-bg: transparent;
  --gutter: 20px;
}
/* ---------- Màu: tối ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131417; --soft: #1A1B1F; --surface: #1A1B1F; --ink: #E8EAED; --body: #C4C7CC; --muted: #9AA0A6;
  --line: #34363B; --brand: #6C72E0; --brand-text: #AEB2F5; --tint: #242747; --hover: #23252A;
  --warn: #FDB022; --warn-line: #FDB022; --tip-line: #8E94E8; --video-bg: #202226; --logo-bg: #FFFFFF;
  --brand-fill: #5D63D6; --brand-fill-hover: #6C72E0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #131417; --soft: #1A1B1F; --surface: #1A1B1F; --ink: #E8EAED; --body: #C4C7CC; --muted: #9AA0A6;
    --line: #34363B; --brand: #6C72E0; --brand-text: #AEB2F5; --tint: #242747; --hover: #23252A;
    --warn: #FDB022; --warn-line: #FDB022; --tip-line: #8E94E8; --video-bg: #202226; --logo-bg: #FFFFFF;
    --brand-fill: #5D63D6; --brand-fill-hover: #6C72E0;
  }
}

/* ---------- Nền tảng ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html.big-text { font-size: 118%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--body);
  /* Noto Sans: dấu tiếng Việt chuẩn, có hinting nên nét chữ sắc trên Windows. Phông dự phòng là phông hệ thống cùng cỡ chữ */
  font-family: "Noto Sans", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 1.0625rem; line-height: 1.75; overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--brand-text); text-underline-offset: 3px; }
h1, h2, h3 { color: var(--ink); margin: 0; letter-spacing: 0; }
p { margin: 0; }
b, strong { color: var(--ink); font-weight: 600; }
svg.i { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 720px) { :root { --gutter: 32px; } }

/* ---------- Thanh đầu trang ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: stretch; gap: 8px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--muted); flex: none; }
.logo-chip { display: inline-flex; align-items: center; background: var(--logo-bg); border-radius: 10px; padding: 4px 8px; margin-left: -8px; text-decoration: none; }
.logo-chip img { height: 34px; width: auto; }
.brand-sep { width: 1px; height: 24px; background: var(--line); }
.brand-name { font-size: 1.1rem; font-weight: 500; color: var(--muted); }
@media (max-width: 400px) { .brand-sep, .brand-name { display: none; } }
.nav { display: none; gap: 4px; margin-left: auto; }
.nav a { display: flex; align-items: center; padding: 0 12px; margin-bottom: -1px; border-bottom: 3px solid transparent; color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; transition: color .15s, border-color .15s; }
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--brand-text); border-bottom-color: var(--brand); }
.tools { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.tool { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; min-width: 44px; padding: 0 10px; border: 0; border-radius: 22px; background: transparent; color: var(--muted); font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer; }
.tool:hover { background: var(--hover); color: var(--ink); }
.tool[aria-pressed="true"] { color: var(--brand-text); background: var(--tint); }
@media (min-width: 1080px) { .nav { display: flex; } .tools { margin-left: 12px; } }

/* ---------- Cột nội dung ---------- */
main { width: 100%; max-width: 1140px; margin: 0 auto; padding: 48px var(--gutter) 64px; }
@media (min-width: 720px) { main { padding-top: 72px; padding-bottom: 96px; } }
.eyebrow { font-size: .9rem; font-weight: 500; color: var(--muted); }
h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); font-weight: 600; line-height: 1.38; margin-top: 8px; }
.lead { font-size: 1.15rem; color: var(--body); margin-top: 16px; }
.toc { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.toc p { font-size: .9rem; font-weight: 600; color: var(--muted); }
.toc ol { margin: 8px 0 0; padding-left: 1.4em; }
.toc li { margin: 6px 0; }
.toc li::marker { color: var(--muted); }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

section.doc { padding-top: 64px; scroll-margin-top: 64px; }
@media (min-width: 720px) { section.doc { padding-top: 88px; } }
h2 { font-size: clamp(1.5rem, 3.6vw, 1.85rem); font-weight: 600; line-height: 1.42; margin-top: 6px; }
h3 { font-size: 1.15rem; font-weight: 600; line-height: 1.4; margin-top: 40px; scroll-margin-top: 80px; }
section.doc > p, .pane > p { margin-top: 12px; }

/* ---------- Thẻ chọn (giống trang trợ giúp) ---------- */
.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line); margin-top: 28px; }
.tabs button { position: relative; padding: 12px 2px; margin-bottom: -1px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); font: inherit; font-weight: 500; cursor: pointer; min-height: 48px; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--brand-text); border-bottom-color: var(--brand); }
.hint { font-size: .9rem; color: var(--muted); margin-top: 12px; }

/* ---------- Các bước ---------- */
ol.steps { margin: 24px 0 0; padding-left: 1.6em; }
ol.steps > li { padding-left: .4em; margin-top: 20px; }
ol.steps > li:first-child { margin-top: 0; }
ol.steps > li::marker { color: var(--muted); font-weight: 600; }
ol.steps p + p, ol.steps p + .note, ol.steps .note + p { margin-top: 8px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

.note { margin-top: 16px; padding: 2px 0 2px 16px; border-left: 3px solid var(--tip-line); color: var(--body); }
.note.warn { border-left-color: var(--warn-line); }
.note b:first-child { color: var(--ink); }

.btn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; border: 1px solid var(--line); border-radius: 22px; color: var(--brand-text); background: var(--bg); text-decoration: none; font-weight: 600; font-size: .95rem; }
.btn:hover { background: var(--hover); }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; }

/* ---------- Mở rộng (video, APK) ---------- */
details.expand { margin-top: 28px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
details.expand + details.expand { margin-top: 0; border-top: 0; }
details.expand > summary { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0; cursor: pointer; list-style: none; color: var(--ink); font-weight: 500; }
details.expand > summary::-webkit-details-marker { display: none; }
details.expand > summary .i:first-child { color: var(--muted); }
details.expand > summary .chev { margin-left: auto; color: var(--muted); transition: transform .2s; }
details.expand[open] > summary .chev { transform: rotate(180deg); }
details.expand .body { padding: 4px 0 24px; }

.video { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--video-bg); }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.video-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 16px; color: var(--muted); }
.video-empty .play { width: 56px; height: 56px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; margin-bottom: 6px; }
.video-empty .play svg { width: 22px; height: 22px; fill: var(--muted); stroke: none; margin-left: 3px; }
.video-empty b { color: var(--body); font-weight: 500; }
.video-empty span { font-size: .9rem; }

/* ---------- Khối tải ứng dụng ---------- */
.get { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 32px; }
@media (min-width: 560px) { .get { grid-template-columns: 1fr 1fr; } }
.get-card { border: 1px solid var(--line); border-radius: 14px; padding: 20px 18px 18px; text-align: center; background: var(--bg); }
.get-card > .i { display: block; width: 28px; height: 28px; margin: 0 auto; color: var(--brand-text); }
.get-card h2 { font-size: 1.05rem; font-weight: 600; line-height: 1.5; margin-top: 8px; }
.get-actions { display: grid; gap: 8px; margin-top: 14px; }
.btn-main, .btn-sub { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 16px; border-radius: 10px; font: inherit; font-size: .95rem; font-weight: 600; text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s; }
.btn-main { background: var(--brand-fill); color: #fff; border: 1px solid var(--brand-fill); }
.btn-main:hover { background: var(--brand-fill-hover); border-color: var(--brand-fill-hover); }
.btn-sub { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.btn-sub:hover { background: var(--hover); }
.btn-main .i, .btn-sub .i { width: 18px; height: 18px; }
.btn-main[aria-disabled="true"] { background: var(--hover); border-color: var(--line); color: var(--muted); cursor: default; }
.btn-row .btn-main, .btn-row .btn-sub { display: inline-flex; }

dialog.qr { width: min(92vw, 360px); border: 0; border-radius: 16px; padding: 24px 24px 20px; background: var(--bg); color: var(--body); text-align: center; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45); }
dialog.qr::backdrop { background: rgba(15, 17, 24, .55); }
dialog.qr h2 { font-size: 1.15rem; font-weight: 600; }
dialog.qr p { font-size: .95rem; margin-top: 6px; }
.qr-box { width: 232px; height: 232px; margin: 18px auto 12px; padding: 12px; border-radius: 12px; background: #fff; border: 1px solid #E3E5E8; display: grid; place-items: center; color: #3C4043; font-size: .85rem; }
.qr-box svg { width: 100%; height: 100%; display: block; }
dialog.qr .btn-sub { width: 100%; margin-top: 16px; }

/* ---------- Video YouTube trong từng tab thiết bị ---------- */
.pane-video { margin: 24px 0 8px; }
.pane-video figcaption { margin-top: 10px; font-size: .9rem; color: var(--muted); text-align: center; font-style: italic; }

/* ---------- Chức năng trong ứng dụng ---------- */
.features { margin: 24px 0 0; padding: 0; list-style: none; }
.features li { display: grid; grid-template-columns: 28px 1fr; gap: 4px 16px; padding: 18px 0; border-top: 1px solid var(--line); }
.features li:first-child { border-top: 0; padding-top: 4px; }
.features li:last-child { border-bottom: 1px solid var(--line); }
.features .i { width: 24px; height: 24px; color: var(--muted); margin-top: 3px; }
.features b { display: block; }
.features p { grid-column: 2; margin-top: 2px; }

/* ---------- Hỏi đáp ---------- */
.faq { margin-top: 24px; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { display: flex; align-items: center; gap: 16px; min-height: 60px; padding: 12px 0; cursor: pointer; list-style: none; color: var(--ink); font-weight: 500; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .chev { margin-left: auto; color: var(--muted); transition: transform .2s; }
.faq details[open] summary .chev { transform: rotate(180deg); }
.faq .a { padding: 0 40px 20px 0; }
.faq .a ol, .faq .a ul { margin: 8px 0 0; padding-left: 1.4em; }
.faq .a li { margin-top: 4px; }

/* ---------- Liên hệ ---------- */
.contact { margin: 20px 0 0; padding: 0; list-style: none; }
.contact li { display: flex; align-items: center; gap: 14px; padding: 10px 0; }
.contact .i { color: var(--muted); }
.contact small { display: block; font-size: .85rem; color: var(--muted); line-height: 1.45; }

/* Theo thiết kế footer của re-khaothi-student (MainFooter) */
.site-footer { background: var(--soft); border-top: 1px solid var(--line); color: var(--ink); font-size: 1rem; line-height: 1.5; }
.site-footer .wrap { padding-top: 48px; padding-bottom: 24px; }
@media (min-width: 1024px) { .site-footer .wrap { padding-top: 56px; padding-bottom: 28px; } }
.f-head { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 32px; border-bottom: 1px solid var(--line); padding-bottom: 40px; margin-bottom: 48px; }
@media (min-width: 1024px) { .f-head { flex-direction: row; align-items: center; } }
.f-brand { display: flex; flex-direction: column; gap: 16px; max-width: 42rem; }
.f-brand .logo-chip { margin-left: -8px; align-self: flex-start; }
.f-brand .logo-chip img { height: 44px; }
.f-brand h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.42; letter-spacing: 0; color: var(--ink); }
@media (min-width: 640px) { .f-brand h2 { font-size: 1.875rem; } }
@media (min-width: 1024px) { .f-brand h2 { font-size: 1.75rem; } }
.f-social { display: flex; align-items: center; gap: 14px; }
.f-social a { width: 44px; height: 44px; border-radius: 50%; background: #2A2F7A; color: #fff; display: grid; place-items: center; box-shadow: 0 1px 2px rgba(16, 24, 40, .08); transition: transform .15s, background-color .15s, box-shadow .15s; }
.f-social a:hover { transform: scale(1.05); background: #1F235C; box-shadow: 0 4px 10px -2px rgba(16, 24, 40, .2); }
:root[data-theme="dark"] .f-social a { background: var(--brand); }
:root[data-theme="dark"] .f-social a:hover { background: #6C72E0; }
.f-social svg { width: 20px; height: 20px; fill: currentColor; }
.f-grid { display: grid; grid-template-columns: 1fr; gap: 48px; }
@media (min-width: 768px) { .f-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .f-grid { grid-template-columns: repeat(3, 1fr); } }
.f-col > * + * { margin-top: 24px; }
.f-col.wide > * + * { margin-top: 32px; }
.f-title { font-size: 1rem; font-weight: 700; color: var(--muted); }
.f-offices { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 20px; }
.f-offices li { display: flex; align-items: flex-start; gap: 12px; }
.f-pin { margin-top: 4px; width: 24px; height: 24px; flex: none; border-radius: 6px; background: var(--tint); color: var(--brand-text); display: grid; place-items: center; }
.f-pin svg.i { width: 16px; height: 16px; }
.f-offices b { display: block; font-size: 1rem; line-height: 1.5; color: var(--ink); }
.f-offices span { display: block; margin-top: 4px; font-size: .875rem; line-height: 1.6; color: var(--body); }
@media (min-width: 640px) { .f-offices span { font-size: 1rem; } }
/* Số điện thoại và email nằm cạnh nhau khi đủ chỗ; thiếu chỗ thì email xuống nguyên một dòng, không bị ngắt giữa chữ */
.f-contact { display: flex; flex-wrap: wrap; gap: 24px 40px; border-top: 1px solid var(--line); padding-top: 24px; margin-top: 32px !important; }
.f-contact > div { flex: 0 1 auto; min-width: 0; }
.f-contact p { font-size: .875rem; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.f-contact a { display: flex; align-items: center; gap: 10px; font-size: 1rem; color: var(--ink); text-decoration: none; white-space: nowrap; transition: color .15s; }
.f-contact a:hover { color: var(--brand-text); }
.f-contact .dot { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--tint); color: var(--brand-text); display: grid; place-items: center; transition: background-color .15s, color .15s; }
.f-contact .dot svg.i { width: 14px; height: 14px; }
.f-contact a:hover .dot { background: var(--brand); color: #fff; }
.f-group h3, .f-group h4 { font-size: 1rem; font-weight: 700; color: var(--ink); }
@media (min-width: 640px) { .f-group h3, .f-group h4 { font-size: 1.125rem; } }
.f-group ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.f-group li { font-size: .875rem; line-height: 1.6; color: var(--body); transition: color .15s; cursor: default; }
@media (min-width: 640px) { .f-group li { font-size: 1rem; } }
.f-group li:hover { color: var(--brand-text); }
.f-group li a { color: inherit; text-decoration: none; cursor: pointer; }
.f-bottom { margin-top: 40px; border-top: 1px solid var(--line); padding-top: 24px; text-align: center; font-size: .875rem; font-weight: 500; color: var(--muted); }

/* ---------- Thanh menu dưới đáy cho điện thoại / máy tính bảng ---------- */
.tabnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--bg); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 62px; padding: 6px 2px; margin-top: -1px; border-top: 3px solid transparent; color: var(--muted); text-decoration: none; font-size: clamp(12px, .75rem, 13px); white-space: nowrap; font-weight: 500; line-height: 1.3; transition: color .15s, border-color .15s; }
.tabnav a svg.i { width: 22px; height: 22px; }
.tabnav a.active { color: var(--brand-text); border-top-color: var(--brand); }
@media (max-width: 1079px) { body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); } }
@media (min-width: 1080px) { .tabnav { display: none; } }

.to-top { position: fixed; right: 16px; bottom: 20px; z-index: 30; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--ink); display: grid; place-items: center; box-shadow: 0 4px 14px -6px rgba(0, 0, 0, .25); cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .2s; }
.to-top.show { opacity: 1; pointer-events: auto; }
@media (max-width: 1079px) { .to-top { bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* ---------- Chuyển trang theo vai trò ---------- */
.switch { margin-top: 20px; font-size: .95rem; color: var(--muted); }
.switch a { font-weight: 600; }
.roles { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 36px; }
@media (min-width: 640px) { .roles { grid-template-columns: 1fr 1fr; } }
.role-card { display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line); border-radius: 16px; padding: 24px 22px; background: var(--bg); color: var(--body); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.role-card:hover { border-color: var(--brand); box-shadow: 0 6px 24px rgba(75, 81, 196, .12); }
.role-card > .i { width: 32px; height: 32px; color: var(--brand-text); }
.role-card h2 { font-size: 1.3rem; margin-top: 0; color: var(--ink); }
.role-card ul { margin: 0; padding-left: 1.2em; }
.role-card li { margin: 4px 0; }
.role-card .go { margin-top: auto; padding-top: 8px; font-weight: 600; color: var(--brand-text); }
.role-card.last { border-color: var(--brand); }
.role-card .last-tag { align-self: flex-start; font-size: .8rem; font-weight: 600; color: var(--brand-text); background: var(--tint); border-radius: 999px; padding: 2px 10px; }
