:root {
  --dusk: #13293d;
  --dusk-2: #1c3a52;
  --pine: #1e5a4b;
  --pine-2: #2c7a66;
  --mist: #eaf0f2;
  --paper: #fbfcfc;
  --line: #d5dee3;
  --text: #17212b;
  --muted: #5a6b78;
  --brand: #1e7a2f;
  --brand-d: #17621f;
  --accent: #f28a2e;
  --marigold: #f4b942;
  --ok: #1e7b4f;
  --ok-bg: #e3f3ea;
  --bad: #b3261e;
  --bad-bg: #fbe9e7;
  --sans: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --r: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--mist);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 8px; padding: 12px 20px; font-weight: 600;
  background: var(--brand); color: #fff; transition: background .15s; text-decoration: none;
}
.btn:hover { background: var(--brand-d); }
.btn.ghost { background: transparent; color: var(--dusk); border: 1px solid var(--line); }
.btn.ghost:hover { background: #fff; }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn.danger { background: var(--dusk); }
.btn.danger:hover { background: #0c1c2b; }
.link { background: none; border: 0; padding: 0; color: var(--brand-d); text-decoration: underline; text-underline-offset: 3px; }

/* Brand */
/* Brand lockup: logo ngang + nhãn English Center */
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand .logo-w { height: 38px; width: auto; display: block; }
.brand .sub { padding-left: 12px; border-left: 2px solid var(--accent); font-size: 13px; font-weight: 600; line-height: 1.2; color: var(--accent); }
.brand .sub small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); }
.brand-text { font-weight: 800; letter-spacing: -.02em; font-size: 19px; color: #fff; }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.login-art {
  position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(180deg, #0f2236 0%, #1c3a52 55%, #2d5a6b 100%);
  padding: 48px clamp(28px, 5vw, 72px); display: flex; flex-direction: column;
}
.login-art h1 {
  position: relative; z-index: 3; margin: auto 0 0; padding-bottom: 28vh; font-size: clamp(40px, 5.6vw, 84px);
  line-height: 1.1; letter-spacing: -.04em; font-weight: 800; max-width: 10ch;
}
.login-art p.lead { position: relative; z-index: 2; margin: -20vh 0 0; max-width: 34ch; color: #cfdde6; }
.ridges { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 46%; }
.mist { position: absolute; left: -10%; width: 120%; height: 30%; bottom: 14%; background: radial-gradient(60% 100% at 30% 100%, rgba(255,255,255,.22), transparent 70%); animation: drift 26s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translateX(-4%); } to { transform: translateX(6%); } }

.login-form-wrap { display: grid; place-items: center; padding: 32px; background: var(--paper); }
.login-form { width: min(400px, 100%); }
.login-form h2 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.02em; }
.login-form .sub { margin: 0 0 24px; color: var(--muted); }
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.field input, .field select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.field input:focus, .field select:focus { border-color: var(--brand); outline: 3px solid rgba(30,122,47,.25); }
.err { color: var(--bad); font-size: 14px; min-height: 20px; margin: 0 0 8px; }
.login-form .btn { width: 100%; }
.switch { margin-top: 18px; font-size: 14px; color: var(--muted); text-align: center; }

/* App shell */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: #fff; color: var(--dusk); padding: 10px clamp(16px, 4vw, 40px); border-bottom: 1px solid var(--line);
}
.topbar .who { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.topbar .who span { opacity: .8; }
.topbar .btn.ghost { color: var(--dusk); border-color: var(--line); }
.topbar .btn.ghost:hover { background: var(--mist); }
.page { max-width: 1080px; margin: 0 auto; padding: 36px clamp(16px, 4vw, 40px) 64px; }
.page h1 { margin: 0 0 4px; font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -.03em; }
.page .sub { margin: 0 0 28px; color: var(--muted); }
.page h2 { font-size: 18px; margin: 36px 0 12px; letter-spacing: -.01em; }

/* Dashboard */
.reading-panel {
  background: var(--pine); color: #fff; border-radius: 14px; padding: 28px;
  display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center;
}
.reading-panel h3 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.02em; }
.reading-panel p { margin: 0; color: #cfe6dd; }
.reading-panel .meta { margin-top: 10px; font-size: 14px; color: #e5f3ed; }
.reading-panel .btn { background: #fff; color: var(--pine); }
.reading-panel .btn:hover { background: var(--mist); }
.skill-list { margin-top: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.skill-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 16px; align-items: center; padding: 16px 20px; }
.skill-row + .skill-row { border-top: 1px solid var(--line); }
.skill-row strong { font-weight: 600; }
.skill-row span.d { color: var(--muted); font-size: 14px; }
.tag { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--mist); color: var(--muted); }

.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 12px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 13px; color: var(--muted); font-weight: 600; background: #f6f9fa; }
tr:last-child td { border-bottom: 0; }
.empty { padding: 28px 20px; color: var(--muted); }
.band-chip { display: inline-block; min-width: 38px; text-align: center; padding: 2px 10px; border-radius: 6px; font-weight: 800; background: var(--dusk); color: #fff; }

/* Test screen */
.exam { height: 100vh; display: grid; grid-template-rows: auto auto 1fr auto; background: var(--paper); }
.exam-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px clamp(12px, 3vw, 28px); background: var(--dusk); color: #fff; }
.exam-bar .title { font-weight: 600; font-size: 15px; }
.exam-bar .title small { display: block; font-weight: 400; opacity: .7; font-size: 12px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 22px; padding: 4px 14px; border-radius: 8px; background: rgba(255,255,255,.1); }
.timer.low { background: var(--marigold); color: var(--dusk); }
.tabs { display: none; }
.split { display: grid; grid-template-columns: 1fr 1fr; min-height: 0; }
.pane { overflow-y: auto; padding: 28px clamp(16px, 3vw, 40px); }
.pane + .pane { border-left: 1px solid var(--line); background: #fff; }
.passage h2 { font-family: var(--serif); font-size: 24px; margin: 0 0 18px; letter-spacing: -.01em; }
.passage .para { display: grid; grid-template-columns: 28px 1fr; gap: 10px; margin-bottom: 18px; }
.passage .para b { font-family: var(--sans); font-weight: 800; color: var(--pine); }
.passage .para p { margin: 0; font-family: var(--serif); font-size: 18px; line-height: 1.7; max-width: 62ch; }
.group { margin-bottom: 36px; max-width: 62ch; }
.group h3 { margin: 0 0 4px; font-size: 17px; }
.group .ins { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.q { padding: 14px 0; border-top: 1px solid var(--line); scroll-margin-top: 16px; }
.q .qt { display: grid; grid-template-columns: 32px 1fr; gap: 6px; margin-bottom: 8px; }
.q .qn { font-weight: 800; color: var(--brand-d); }
.opts { display: grid; gap: 6px; margin-left: 38px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: #fff; }
.opt:hover { border-color: var(--brand); }
.opt input { margin-top: 5px; accent-color: var(--brand); }
.opt:has(input:checked) { border-color: var(--brand); background: #e8f4ea; }
.fill { margin-left: 38px; }
.fill input { width: min(280px, 100%); padding: 9px 12px; border: 1px solid var(--line); border-bottom: 2px solid var(--brand); border-radius: 6px 6px 0 0; }
.exam-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px clamp(12px, 3vw, 28px); border-top: 1px solid var(--line); background: #fff; }
.nav { display: flex; flex-wrap: wrap; gap: 6px; }
.nav button { width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 14px; }
.nav button.done { background: var(--dusk); color: #fff; border-color: var(--dusk); }
.count { font-size: 14px; color: var(--muted); white-space: nowrap; }

/* Result */
.score { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.score .big { font-size: clamp(64px, 10vw, 104px); font-weight: 800; letter-spacing: -.05em; line-height: .9; color: var(--dusk); }
.score .big small { display: block; font-size: 14px; letter-spacing: 0; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.score ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; color: var(--muted); }
.score ul b { color: var(--text); }
.review { display: grid; gap: 10px; margin-top: 12px; }
.rv { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--bad); border-radius: 8px; padding: 14px 18px; }
.rv.ok { border-left-color: var(--ok); }
.rv .h { display: flex; gap: 10px; align-items: baseline; font-weight: 600; }
.rv .st { font-size: 13px; padding: 1px 10px; border-radius: 99px; background: var(--bad-bg); color: var(--bad); }
.rv.ok .st { background: var(--ok-bg); color: var(--ok); }
.rv p { margin: 6px 0 0; font-size: 15px; }
.rv .why { color: var(--muted); }
.actions { display: flex; gap: 10px; margin-top: 28px; flex-wrap: wrap; }
.demo-note { margin-top: 24px; padding: 12px 16px; border-radius: 8px; background: #fff8e6; border: 1px solid #f1deaa; font-size: 14px; }

.modal-bg { position: fixed; inset: 0; background: rgba(10,20,30,.55); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal { background: #fff; border-radius: 14px; padding: 24px; max-width: 420px; width: 100%; }
.modal h3 { margin: 0 0 6px; }
.modal p { margin: 0 0 18px; color: var(--muted); }
.modal .row { display: flex; gap: 10px; justify-content: flex-end; }

@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-art { min-height: 280px; padding: 28px 24px; }
  .login-art h1 { padding-bottom: 90px; font-size: 44px; }
  .login-art p.lead { display: none; }
  .tabs { display: flex; border-bottom: 1px solid var(--line); background: #fff; }
  .tabs button { flex: 1; padding: 10px; border: 0; background: none; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; }
  .tabs button[aria-selected="true"] { color: var(--brand-d); border-bottom-color: var(--brand); }
  .split { grid-template-columns: 1fr; }
  .exam[data-pane="passage"] .pane.qs, .exam[data-pane="questions"] .pane.passage { display: none; }
  .pane + .pane { border-left: 0; }
  .reading-panel { grid-template-columns: 1fr; }
  .skill-row { grid-template-columns: 1fr auto; }
  .skill-row .d { grid-column: 1 / -1; order: 3; }
  .score { grid-template-columns: 1fr; }
  .count { display: none; }
}
@media (prefers-reduced-motion: reduce) { .mist { animation: none; } * { transition: none !important; } }

/* ---------- Đăng nhập, đăng ký ---------- */
.seg { display: flex; gap: 4px; padding: 4px; background: var(--mist); border-radius: 10px; margin-bottom: 24px; }
.seg a { flex: 1; text-align: center; padding: 9px; border-radius: 7px; font-weight: 600; font-size: 14px; color: var(--muted); text-decoration: none; }
.seg a[aria-selected="true"] { background: #fff; color: var(--dusk); box-shadow: 0 1px 2px rgba(19,41,61,.12); }
.notice { margin: 0 0 16px; padding: 10px 14px; border-radius: 8px; background: #fff8e6; border: 1px solid #f1deaa; font-size: 14px; }
.switch a.link { font-size: 14px; }

/* ---------- Phòng thi: nhóm câu hỏi và điều hướng theo Part ---------- */
.wm { position: fixed; inset: 0; pointer-events: none; z-index: 2; background-repeat: repeat; }
.nocopy { user-select: none; -webkit-user-select: none; }
.nocopy input, .nocopy select { user-select: text; -webkit-user-select: text; }
.fill select { padding: 9px 12px; border: 1px solid var(--line); border-bottom: 2px solid var(--brand); border-radius: 6px 6px 0 0; background: #fff; min-width: 120px; }
.mopts { margin: 0 0 14px; padding: 12px 14px; background: var(--mist); border-radius: 8px; font-size: 15px; }
.mopts div { display: grid; grid-template-columns: 28px 1fr; gap: 6px; padding: 3px 0; }
.mopts div span { font-weight: 800; color: var(--brand-d); }
.passage .para.nolabel { grid-template-columns: 1fr; }
.nav { align-items: center; gap: 10px; }
.pgrp { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pgrp .pl { font-weight: 800; font-size: 14px; margin-right: 4px; color: var(--dusk); }
.pbtn { display: inline-flex; gap: 8px; align-items: center; height: 34px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 14px; }
.pbtn small { font-size: 12px; color: var(--muted); font-weight: 500; }
@media print { .exam, .split, .wm { display: none !important; } body::before { content: "Nội dung đề thi không được in."; display: block; padding: 24px; } }

/* ---------- Trang công khai ---------- */
.site { background: var(--paper); }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px clamp(16px, 4vw, 40px); background: #fff; color: var(--dusk); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.site-header nav { display: flex; align-items: center; gap: clamp(12px, 2.4vw, 28px); font-size: 15px; }
.site-header nav a:not(.btn) { color: var(--dusk); text-decoration: none; font-weight: 500; }
.site-header nav a:not(.btn):hover { color: var(--brand); text-decoration: underline; text-underline-offset: 4px; }
.hero { position: relative; overflow: hidden; color: #fff; background: linear-gradient(180deg, #0f2236 0%, #1c3a52 60%, #2d5a6b 100%); padding: clamp(56px, 9vw, 120px) clamp(16px, 4vw, 40px) clamp(190px, 24vw, 300px); }
.hero .ridges { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 42%; }
.hero-in { position: relative; z-index: 2; max-width: 1080px; margin: 0 auto; }
.hero h1 { margin: 0 0 16px; max-width: 14ch; font-size: clamp(38px, 6vw, 76px); line-height: 1.08; letter-spacing: -.04em; font-weight: 800; }
.hero-sub { max-width: 46ch; margin: 0 0 22px; font-size: clamp(17px, 2vw, 20px); color: #d3e0e9; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.chips span { padding: 6px 14px; border: 1px solid rgba(255,255,255,.35); border-radius: 99px; font-size: 14px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn.light { background: var(--accent); color: #13293d; }
.btn.light:hover { background: #f59d4d; }
.btn.ghost-light { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.5); }
.btn.ghost-light:hover { background: rgba(255,255,255,.12); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 56px clamp(16px, 4vw, 40px); }
.band { background: var(--mist); }
.wrap h2, .page-pub h1 { margin: 0 0 8px; font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -.03em; }
.lead2 { max-width: 62ch; margin: 0 0 24px; color: var(--muted); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.more { margin: 20px 0 0; }
.why-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px 48px; margin-top: 24px; }
.why-grid > div { border-left: 4px solid var(--pine-2); padding-left: 18px; }
.why-grid h3 { margin: 0 0 6px; font-size: 18px; }
.why-grid p { margin: 0; color: var(--muted); max-width: 46ch; }
.contact dl { display: grid; gap: 14px; margin: 20px 0 0; }
.contact dl > div { display: grid; grid-template-columns: 190px 1fr; gap: 12px; }
.contact dt { color: var(--muted); font-weight: 600; }
.contact dd { margin: 0; }
.page-pub { min-height: 60vh; }
.site-footer { padding: 24px clamp(16px, 4vw, 40px); background: var(--dusk); color: #b9c9d6; font-size: 14px; }
@media (max-width: 900px) {
  .site-header { flex-wrap: wrap; }
  .why-grid { grid-template-columns: 1fr; }
  .contact dl > div { grid-template-columns: 1fr; gap: 2px; }
  .pbtn small { display: none; }
}

.login-logo { display: block; height: 46px; width: auto; margin-bottom: 28px; }
.mark { display: none; }

/* ---------- Phiếu trả lời ---------- */
.exam.sheetmode { grid-template-rows: auto 1fr auto; }
.sheet { overflow-y: auto; padding: 28px clamp(16px, 3vw, 40px); background: var(--paper); }
.sheet-in { max-width: 860px; margin: 0 auto; }
.sheet h2 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.02em; }
.sheet .ins { margin: 0 0 24px; color: var(--muted); max-width: 66ch; }
.spart { margin-bottom: 32px; }
.spart > h3 { margin: 0 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--brand); font-size: 18px; }
.sblock { margin-bottom: 18px; }
.sblock h4 { margin: 0 0 10px; font-size: 15px; color: var(--muted); font-weight: 600; }
.sgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 16px; }
.scell { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 8px; }
.scell label { font-weight: 800; color: var(--brand-d); text-align: right; }
.scell input, .scell select { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-bottom: 2px solid var(--brand); border-radius: 6px 6px 0 0; background: #fff; }
.scell input.letter { text-transform: uppercase; font-weight: 600; max-width: 80px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 14px; font-size: 14px; color: var(--muted); }
.check input { margin-top: 4px; accent-color: var(--brand); }
.policy { max-width: 70ch; }
.policy ol { padding-left: 22px; }
.policy li { margin-bottom: 14px; }
.policy li b { display: block; }
