/* SmartHSK — design system đỏ/trắng (lấy cảm hứng brand trung tâm tiếng Trung). */

:root {
  --brand: #c8102e;
  --brand-700: #a10c24;
  --brand-600: #b50f29;
  --brand-50: #fdecec;
  --gold: #bd8a1a;
  --ink: #1b1420;
  --muted: #6c6470;
  --line: #f0e6e6;
  --paper: #ffffff;
  --cream: #fff7f3;
  --cream-2: #fdeee8;
  --ok: #15803d;
  --ok-bg: #e7f6ec;
  --bad: #b42318;
  --bad-bg: #fdeceb;

  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(27, 20, 32, .05), 0 2px 6px rgba(27, 20, 32, .04);
  --shadow: 0 8px 30px rgba(160, 12, 36, .10), 0 2px 8px rgba(27, 20, 32, .05);
  --shadow-lg: 0 24px 60px rgba(160, 12, 36, .16);
  --font: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --maxw: 1140px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.02em; font-weight: 800; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid transparent; border-radius: 999px;
  padding: 13px 24px; font-size: 15px; font-weight: 700;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, border-color .2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(200, 16, 46, .32); }
.btn-primary:hover { background: var(--brand-700); box-shadow: 0 10px 26px rgba(200, 16, 46, .40); }
.btn-ghost { background: #fff; color: var(--brand); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { border-color: var(--brand); background: var(--brand-50); }
.btn-lg { padding: 16px 30px; font-size: 16px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.brand .logo { width: 40px; height: 40px; flex: none; }
.brand .sub { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a { font-size: 15px; font-weight: 600; color: #463c4c; transition: color .15s; }
.nav-links a:hover { color: var(--brand); }
.nav-cta { display: flex; align-items: center; gap: 12px; }
#userChip { display: none; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; }
#userChip .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 14px; }
.linkbtn { background: none; border: none; color: var(--muted); font-weight: 600; font-size: 13px; }
.linkbtn:hover { color: var(--brand); }
.hamb { display: none; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; background:
    radial-gradient(1100px 480px at 88% -8%, var(--cream-2) 0%, rgba(253,238,232,0) 60%),
    linear-gradient(180deg, var(--cream) 0%, #fff 78%); }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; padding: 76px 0 88px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line); color: var(--brand-700);
  padding: 7px 15px; border-radius: 999px; font-size: 13px; font-weight: 700;
  box-shadow: var(--shadow-sm); margin-bottom: 22px;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }
.hero h1 { font-size: clamp(34px, 5vw, 54px); }
.hero h1 .hl { color: var(--brand); position: relative; }
.hero .lead { font-size: 18px; color: #4a414f; margin: 22px 0 30px; max-width: 540px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.trust { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 30px; }
.trust .ti { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: #54495a; }
.trust .ti svg { color: var(--brand); flex: none; }

/* Score card (hero visual, cũng là khung kết quả live) */
.score-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 26px; position: relative;
}
.score-card .sc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sc-exam { font-weight: 700; font-size: 14px; }
.sc-exam small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.badge { font-size: 12px; font-weight: 800; padding: 5px 12px; border-radius: 999px; letter-spacing: .03em; }
.badge.pass { color: var(--ok); background: var(--ok-bg); }
.badge.fail { color: var(--bad); background: var(--bad-bg); }
.badge.demo { color: var(--gold); background: #fbf2dd; }

.ring-row { display: flex; align-items: center; gap: 22px; margin: 14px 0 18px; }
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-bg { stroke: #f1e7e7; }
.ring .ring-fg { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.2,.8,.2,1); }
.ring .ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .rl-score { font-size: 30px; font-weight: 800; line-height: 1; }
.ring .rl-max { font-size: 12px; color: var(--muted); margin-top: 3px; }
.sc-meta { flex: 1; }
.sc-meta .row { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.sc-meta .row:last-child { border-bottom: none; }
.sc-meta .row b { font-weight: 700; }

.bars .bar-item { margin: 11px 0; }
.bars .bar-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.bars .bar-head .pct { color: var(--brand-700); font-weight: 700; }
.bar-track { height: 9px; background: #f3eaea; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand), #e23a52); border-radius: 999px; width: 0; transition: width 1s cubic-bezier(.2,.8,.2,1); }

/* ---------- Stats strip ---------- */
.stats { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat { padding: 30px 18px; text-align: center; border-left: 1px solid var(--line); }
.stat:first-child { border-left: none; }
.stat .num { font-size: 30px; font-weight: 800; color: var(--brand); letter-spacing: -.02em; }
.stat .lbl { font-size: 13.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }

/* ---------- Sections ---------- */
section.block { padding: 84px 0; }
.section-head { text-align: center; max-width: 660px; margin: 0 auto 52px; }
.section-head .kicker { color: var(--brand); font-weight: 800; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
.section-head h2 { font-size: clamp(28px, 3.4vw, 40px); margin: 12px 0 14px; }
.section-head p { font-size: 17px; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 24px; box-shadow: var(--shadow-sm); transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: #f4d9dd; }
.card .ic { width: 48px; height: 48px; border-radius: 12px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; margin-bottom: 16px; }
.card h3 { font-size: 19px; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 15px; }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; counter-reset: step; }
.step { position: relative; padding: 28px 24px 24px; background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius); }
.step .n { counter-increment: step; }
.step .n::before { content: counter(step); display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; font-size: 18px; margin-bottom: 14px; box-shadow: 0 6px 16px rgba(200,16,46,.3); }
.step h3 { font-size: 18px; margin-bottom: 7px; }
.step p { color: var(--muted); font-size: 14.5px; }

.models-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 38px; }
.model-chip { display: inline-flex; align-items: center; gap: 9px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 9px 18px; font-weight: 700; font-size: 14px; box-shadow: var(--shadow-sm); }
.model-chip .d { width: 9px; height: 9px; border-radius: 50%; }

/* ---------- Demo section ---------- */
.demo { background: linear-gradient(180deg, #fff, var(--cream)); }
.demo-panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); overflow: hidden;
}
.demo-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 20px 26px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--cream), #fff);
}
.demo-toolbar .dt-title { font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 9px; }
.demo-toolbar .dt-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.demo-body { padding: 28px 26px 32px; }

.demo-empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.demo-empty svg { color: #e8c9ce; margin-bottom: 14px; }

/* answer sheet (đề + bài làm học viên mẫu) */
.answer-sheet { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 22px; background: var(--cream); }
.as-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.as-head b { font-size: 15px; }
.as-head .muted { font-size: 13px; }
.as-note { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.as-section { margin: 12px 0; }
.as-section > .as-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; color: var(--ink); }
details.as-section { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 4px 12px; }
details.as-section > summary { cursor: pointer; color: var(--brand-700); font-weight: 700; font-size: 14px; padding: 8px 0; list-style: revert; }
details.as-section[open] > summary { border-bottom: 1px dashed var(--line); margin-bottom: 10px; }
.as-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.as-chip { font-size: 12.5px; padding: 4px 9px; border-radius: 8px; background: #fff; border: 1px solid var(--line); white-space: nowrap; }
details.as-section .as-chip { background: var(--cream); }
.as-chip b { font-weight: 800; }
.as-chip.ok { border-color: #bfe3ca; } .as-chip.ok b { color: var(--ok); }
.as-chip.no { border-color: #f2c8c4; } .as-chip.no b { color: var(--bad); }
.as-chip.blank b { color: var(--muted); }
.as-chip .want { color: var(--muted); font-size: 11px; }
.as-rearrange { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px; margin: 8px 0; }
.as-rearrange .as-q { font-weight: 800; margin-bottom: 6px; }
.as-pool { font-size: 13px; margin-bottom: 6px; }
.as-pool .word { display: inline-block; background: var(--brand-50); color: var(--brand-700); border-radius: 6px; padding: 2px 9px; margin: 2px; font-weight: 600; font-size: 13.5px; }
.as-line { font-size: 13.5px; margin-top: 4px; }
.as-line .lab { color: var(--muted); margin-right: 5px; }
.as-line .han { font-weight: 700; }

/* loading */
.loading { text-align: center; padding: 48px 20px; }
.spinner { width: 46px; height: 46px; border: 4px solid var(--brand-50); border-top-color: var(--brand); border-radius: 50%; margin: 0 auto 18px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading .dots span { animation: blink 1.4s infinite both; }
.loading .dots span:nth-child(2){ animation-delay:.2s } .loading .dots span:nth-child(3){ animation-delay:.4s }
@keyframes blink { 0%,80%,100%{opacity:.2} 40%{opacity:1} }

/* result */
.result-grid { display: grid; grid-template-columns: 320px 1fr; gap: 26px; }
.result-feedback { font-size: 15px; }
.result-feedback h2 { font-size: 19px; margin: 18px 0 8px; }
.result-feedback h3 { font-size: 16px; margin: 16px 0 6px; color: var(--brand-700); }
.result-feedback p { margin: 0 0 10px; color: #463c4c; }
.result-feedback ul { margin: 0 0 12px; padding-left: 20px; color: #463c4c; }
.result-feedback li { margin: 4px 0; }
.result-feedback strong { color: var(--ink); }

.verdicts { margin-top: 28px; }
.verdicts h3 { font-size: 17px; margin-bottom: 6px; }
.vq { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; background: #fff; }
.vq-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.vq-head .qid { font-weight: 800; }
.vq-ans { font-size: 14px; margin: 3px 0; }
.vq-ans .lab { color: var(--muted); font-weight: 600; margin-right: 6px; }
.vq-ans .han { font-weight: 600; }
.vote-pill { font-size: 12px; font-weight: 800; padding: 4px 11px; border-radius: 999px; }
.vote-pill.ok { color: var(--ok); background: var(--ok-bg); }
.vote-pill.no { color: var(--bad); background: var(--bad-bg); }
.verdict-models { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.vm { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; background: var(--cream); }
.vm .vm-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.vm .vm-name { font-weight: 700; font-size: 12px; }
.vm .tick { font-weight: 800; }
.vm .tick.ok { color: var(--ok); } .vm .tick.no { color: var(--bad); }
.vm .vm-reason { color: var(--muted); line-height: 1.45; }

.metrics-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.metric { background: var(--cream); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; }
.metric .mv { font-weight: 800; font-size: 17px; }
.metric .ml { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer { background: #fff; border-top: 1px solid var(--line); padding: 40px 0; }
.foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.foot .muted { font-size: 14px; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(27, 20, 32, .5); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 80; padding: 20px; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 420px; overflow: hidden; animation: pop .22s ease; }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.modal-head { padding: 24px 26px 0; display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 21px; }
.modal-head .x { background: none; border: none; font-size: 22px; color: var(--muted); line-height: 1; }
.tabs { display: flex; gap: 4px; padding: 16px 26px 0; }
.tab { flex: 1; padding: 10px; border: none; background: var(--cream); border-radius: 10px; font-weight: 700; color: var(--muted); font-size: 14px; }
.tab.active { background: var(--brand); color: #fff; }
.modal-body { padding: 20px 26px 26px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.field input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; font-family: inherit; transition: border-color .15s, box-shadow .15s; }
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.form-msg { font-size: 13.5px; padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; display: none; }
.form-msg.err { display: block; color: var(--bad); background: var(--bad-bg); }
.form-msg.ok { display: block; color: var(--ok); background: var(--ok-bg); }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 13px 22px; border-radius: 999px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: all .3s ease; z-index: 90; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* reveal animation */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; gap: 38px; padding: 50px 0 60px; }
  .cards, .steps { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: none; }
  .result-grid { grid-template-columns: 1fr; }
  .verdict-models { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}
@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .ring-row { flex-direction: column; align-items: stretch; }
  .ring { margin: 0 auto; }
}
