/* TCT funnel: trang vở ô ly, bút đỏ chấm bài.
   Mực xanh = hành động và chữ chính. Mực đỏ = chỉ dấu của thầy cô, lề vở, cảnh báo. */
:root {
  color-scheme: light;
  --paper: #fbfcff;
  --sheet: #ffffff;
  --grid: #e0e9f7;
  --line: #c6d3ea;
  --ink: #1b2f7a;
  --ink-deep: #122058;
  --ink-wash: #e7edfb;
  --text: #18203a;
  --muted: #566080;
  --red: #d7352b;
  --red-wash: #fdecea;
  --red-margin: rgba(215, 53, 43, 0.42);
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --hand: 'Patrick Hand', 'Bradley Hand', 'Segoe Print', cursive;
  --margin-x: 8px;
  --pad-x: 22px;
  --pad-r: 16px;
  --cell: 28px;
}

@media (min-width: 720px) {
  :root { --margin-x: 56px; --pad-x: 96px; --pad-r: 40px; }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Hai nét đỏ đôi bên lề, như vở học sinh */
body::before {
  content: '';
  position: fixed;
  top: 0;
  bottom: 0;
  left: var(--margin-x);
  width: 4px;
  border-left: 1px solid var(--red-margin);
  border-right: 1px solid var(--red-margin);
  pointer-events: none;
  z-index: 0;
}

img { max-width: 100%; height: auto; }
sup { font-size: 0.7em; line-height: 0; }
[hidden] { display: none !important; }

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: var(--pad-x) var(--pad-r);
}

/* Đầu trang */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 20px 8px;
}

.brand {
  display: inline-flex;
  flex-direction: column;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.1;
  white-space: nowrap;
}

.brand svg { display: block; width: 126px; height: 11px; margin-top: 3px; }

.top-note { color: var(--muted); font-size: 14px; text-align: right; }

/* Nút */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px 24px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 17px;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.btn:hover { background: var(--ink-deep); border-color: var(--ink-deep); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink-wash); border-color: var(--ink); }
.btn.small { min-height: 44px; padding: 8px 16px; font-size: 15px; }
.btn.block { width: 100%; }

:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }

/* Biểu mẫu */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 16px; }
.field label, .field .lbl { font-weight: 600; font-size: 15px; }
.field .opt-tag { font-weight: 400; color: var(--muted); }

.field input[type='text'],
.field input[type='tel'],
.field input[type='email'],
.field select {
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.field input:focus, .field select:focus { border-color: var(--ink); outline: 3px solid var(--ink-wash); outline-offset: 0; }
.field[data-bad] input, .field[data-bad] select { border-color: var(--red); background: var(--red-wash); }
.err { color: var(--red); font-size: 14px; font-weight: 600; min-height: 0; }
.err:empty { display: none; }
.row2 { display: grid; gap: 16px; }
.row2 > .field + .field { margin-top: 0; }

@media (min-width: 520px) {
  .row2 { grid-template-columns: 1fr 1fr; }
}

.consent { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; font-size: 15px; line-height: 1.5; }
.consent input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--ink); }
.consent[data-bad] { color: var(--red); }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.fine { color: var(--muted); font-size: 14px; line-height: 1.5; }
.form-err { margin-top: 14px; padding: 12px 14px; border-radius: 8px; background: var(--red-wash); color: #8f1d15; font-size: 15px; font-weight: 600; }

/* Trang 1 */
.hero { display: grid; gap: 28px; padding-block: 20px 56px; }

.hero-text h1 { font-size: clamp(30px, 6.2vw, 48px); font-weight: 800; color: var(--ink); max-width: 16em; }
.hero-text p { margin-top: 16px; max-width: 34em; font-size: 18px; }

.card {
  background: var(--sheet);
  border: 1.5px solid var(--line);
  border-radius: 6px;
  padding: 24px 20px;
}

.card h2 { font-size: 22px; color: var(--ink); font-weight: 800; }
.card .lead { margin-top: 6px; color: var(--muted); font-size: 15px; }
.card form { margin-top: 20px; }
.card .btn { margin-top: 22px; }
.card .fine { margin-top: 12px; }

@media (min-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
    grid-template-areas: 'text form' 'sheet form' 'steps form';
    column-gap: 56px;
    row-gap: 32px;
    align-items: start;
    padding-block: 36px 72px;
  }
  .hero-text { grid-area: text; }
  .hero-form { grid-area: form; position: sticky; top: 20px; }
  .sheet { grid-area: sheet; }
  .steps { grid-area: steps; }
  .card { padding: 28px 26px; }
}

/* Phiếu nhận xét mẫu: nét bút đỏ của thầy cô */
.sheet {
  position: relative;
  max-width: 460px;
  margin-top: 8px;
  padding: 18px 20px 20px 34px;
  background-color: var(--sheet);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, var(--grid) 31px, var(--grid) 32px);
  border: 1.5px solid var(--line);
  border-radius: 3px;
  transform: rotate(-1.1deg);
}

.sheet::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 18px;
  width: 3px;
  border-left: 1px solid var(--red-margin);
  border-right: 1px solid var(--red-margin);
}

.sheet-tag { font-size: 13px; color: var(--muted); line-height: 1.3; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 10px; }
.sheet-name { font-family: var(--hand); font-size: 22px; line-height: 1; color: var(--ink); }

.score {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 84px;
  height: 56px;
  padding: 0 12px;
  font-family: var(--hand);
  font-size: 30px;
  line-height: 1;
  color: var(--red);
}

.score svg { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); overflow: visible; }

.notes { list-style: none; margin: 14px 0 0; padding: 0; font-family: var(--hand); font-size: 21px; line-height: 32px; color: var(--red); }
.notes li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; align-items: start; }
.notes svg { width: 22px; height: 22px; margin-top: 5px; }
.notes .ink { color: var(--ink); }

.pen { fill: none; stroke: var(--red); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

@media (prefers-reduced-motion: no-preference) {
  .sheet .pen {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: ink 0.7s ease-out forwards;
  }
  .sheet .score .pen { animation-delay: 0.25s; }
  .sheet .notes li:nth-child(1) .pen { animation-delay: 0.9s; }
  .sheet .notes li:nth-child(2) .pen { animation-delay: 1.4s; }
  .sheet .notes li:nth-child(3) .pen { animation-delay: 1.9s; }
  @keyframes ink { to { stroke-dashoffset: 0; } }
}

/* Các bước: đây là một chuỗi thật nên đánh số */
.steps { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 14px; counter-reset: step; max-width: 34em; }
.steps li { position: relative; padding-left: 52px; counter-increment: step; }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 2px solid var(--red);
  border-radius: 50%;
  color: var(--red);
  background: var(--paper);
  font-family: var(--hand);
  font-size: 22px;
  line-height: 1;
}

.steps strong { display: block; color: var(--ink); }

.foot { position: relative; z-index: 1; padding: 24px var(--pad-x) 40px; color: var(--muted); font-size: 14px; max-width: 1120px; margin-inline: auto; }

/* Trang 2: làm bài */
.exam { max-width: 780px; margin-inline: auto; padding-bottom: 120px; }
.exam .top { padding-bottom: 12px; }

.intro { padding-block: 16px 40px; }
.intro h1 { font-size: clamp(28px, 5.6vw, 40px); color: var(--ink); font-weight: 800; }
.intro .lead { margin-top: 12px; font-size: 18px; }

.rules { margin: 24px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.rules li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
.rules svg { width: 26px; height: 26px; margin-top: 2px; color: var(--ink); }
.intro .btn { margin-top: 28px; }
.intro .note { margin-top: 20px; padding: 14px 16px; background: var(--sheet); border-left: 4px solid var(--red); border-radius: 4px; font-size: 15px; }

.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  margin-inline: calc(var(--pad-x) * -1) calc(var(--pad-r) * -1);
  padding: calc(8px + env(safe-area-inset-top, 0px)) var(--pad-r) 10px var(--pad-x);
  background: var(--paper);
  border-bottom: 1.5px solid var(--line);
}

.bar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bar .cnt { font-weight: 700; color: var(--ink); }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 26px; letter-spacing: 0.01em; color: var(--ink); }
.timer[data-low] { color: var(--red); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.chip {
  appearance: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--sheet);
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.chip[data-done] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip[aria-current='step'] { border: 3px solid var(--red); font-weight: 800; }

.qcard { margin-top: 20px; padding: 24px 20px; background: var(--sheet); border: 1.5px solid var(--line); border-radius: 6px; }
.qnum { font-family: var(--hand); font-size: 26px; line-height: 1; color: var(--red); }
.qtext { margin-top: 10px; font-size: 19px; line-height: 1.7; }
.qfig { display: block; margin: 16px auto 0; max-width: 340px; width: 100%; }

.fr { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 0.15em; line-height: 1.15; }
.fr > span { display: block; padding: 0 0.28em; }
.fr > span:first-child { border-bottom: 1.6px solid currentColor; }

.opts { margin-top: 18px; display: grid; gap: 10px; }

.opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 10px 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-size: 19px;
}

.opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.opt:focus-within { outline: 3px solid var(--red); outline-offset: 2px; }

.opt .ltr {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  font-weight: 700;
  color: var(--ink);
  background: var(--paper);
}

.opt[data-sel] { border-color: var(--ink); background: var(--ink-wash); }
.opt[data-sel] .ltr { background: var(--ink); border-color: var(--ink); color: #fff; }

.fillrow { margin-top: 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fillrow label { font-weight: 600; }

.fillrow input {
  width: min(240px, 100%);
  min-height: 56px;
  padding: 8px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}

.fillrow input:focus { border-color: var(--ink); outline: 3px solid var(--ink-wash); }
.fillrow .unit { color: var(--muted); }
.hint { margin-top: 10px; font-size: 14px; color: var(--muted); }

.nav {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  gap: 10px;
  margin: 24px calc(var(--pad-r) * -1) 0 calc(var(--pad-x) * -1);
  padding: 12px var(--pad-r) calc(12px + env(safe-area-inset-bottom, 0px)) var(--pad-x);
  background: var(--paper);
  border-top: 1.5px solid var(--line);
}

.nav .btn { flex: 1; }
.nav .btn.submit { flex: 1.3; }

.overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(18, 32, 88, 0.5); }
.dialog { width: 100%; max-width: 440px; padding: 24px; background: var(--sheet); border-radius: 10px; border: 1.5px solid var(--line); }
.dialog h2 { font-size: 22px; color: var(--ink); }
.dialog p { margin-top: 10px; }
.dialog .acts { display: grid; gap: 10px; margin-top: 22px; }

@media (min-width: 480px) {
  .dialog .acts { grid-template-columns: 1fr 1fr; }
}

.banner { margin-top: 20px; padding: 14px 16px; border-radius: 8px; background: var(--red-wash); border-left: 4px solid var(--red); font-weight: 600; }
.banner .btn { margin-top: 12px; }

.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Trang 3: hoàn thành */
.done { padding-block: 32px 48px; max-width: 720px; }
.stamp { display: block; width: 96px; height: 96px; }
.stamp .pen { stroke-width: 4.5; }
.done h1 { margin-top: 18px; font-size: clamp(30px, 6vw, 44px); font-weight: 800; color: var(--ink); }
.done .lead { margin-top: 14px; font-size: 19px; max-width: 32em; }
.done h2 { margin-top: 40px; font-size: 22px; color: var(--ink); }
.done .steps { margin-top: 18px; max-width: none; }

.gift {
  margin-top: 40px;
  padding: 24px 22px;
  background: var(--sheet);
  border: 1.5px solid var(--line);
  border-left: 6px solid var(--red);
  border-radius: 6px;
}

.gift h2 { margin-top: 0; }
.gift p { margin-top: 8px; }
.gift .btn { margin-top: 18px; }
.gift .fine { margin-top: 10px; }

@media (prefers-reduced-motion: no-preference) {
  .stamp .pen { stroke-dasharray: 1; stroke-dashoffset: 1; animation: ink 0.8s ease-out forwards; }
  .stamp .pen + .pen { animation-delay: 0.55s; }
  @keyframes ink { to { stroke-dashoffset: 0; } }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ===== Funnel đặt lịch tư vấn (thêm vào bộ kiểu dùng chung) ===== */
.field textarea {
  width: 100%;
  min-height: 92px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  resize: vertical;
}

.field textarea:focus { border-color: var(--ink); outline: 3px solid var(--ink-wash); outline-offset: 0; }
.field .count { color: var(--muted); font-size: 13px; text-align: right; }

/* Hình nhấn duy nhất của trang 1: mục tiêu 9+ khoanh bút đỏ */
.goalbox { margin-top: 4px; }

.goal {
  position: relative;
  display: inline-grid;
  place-items: center;
  padding: 6px 34px 14px;
  font-weight: 800;
  font-size: clamp(92px, 17vw, 140px);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.goal svg { position: absolute; inset: -6px -4px 0; width: calc(100% + 8px); height: calc(100% + 6px); overflow: visible; }
.goal-note { margin-top: 4px; font-family: var(--hand); font-size: 26px; line-height: 1.2; color: var(--red); max-width: 16em; }

@media (min-width: 900px) {
  .goalbox { grid-area: sheet; }
  /* Form cao hơn cột trái: dồn phần thừa xuống hàng cuối thay vì giãn khoảng trống giữa các khối. */
  .hero { grid-template-rows: auto auto 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .goal .pen { stroke-dasharray: 1; stroke-dashoffset: 1; animation: ink 0.9s ease-out 0.2s forwards; }
}

/* Trang 2: chọn lịch */
.sched { max-width: 920px; margin-inline: auto; padding-block: 12px 56px; }
.sched h1 { font-size: clamp(28px, 5.6vw, 40px); font-weight: 800; color: var(--ink); }
.sched .lead { margin-top: 12px; font-size: 18px; max-width: 36em; }

.hint-steps { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 10px; max-width: 36em; counter-reset: hs; }
.hint-steps li { position: relative; padding-left: 40px; counter-increment: hs; }
.hint-steps li::before {
  content: counter(hs);
  position: absolute;
  left: 0;
  top: -1px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--red);
  border-radius: 50%;
  color: var(--red);
  background: var(--paper);
  font-family: var(--hand);
  font-size: 18px;
  line-height: 1;
}

.calwrap { margin-top: 24px; background: var(--sheet); border: 1.5px solid var(--line); border-radius: 6px; overflow: hidden; }
.cal { min-width: 320px; height: 900px; }
.cal-msg { padding: 28px 20px; }
.cal-msg p + p { margin-top: 10px; }
.cal-open { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; font-size: 15px; color: var(--muted); }
.cal-open a { color: var(--ink); font-weight: 600; }

@media (min-width: 720px) {
  .cal { height: 760px; }
}

.booked {
  margin-top: 20px;
  padding: 20px 20px 22px;
  background: var(--sheet);
  border: 1.5px solid var(--line);
  border-left: 6px solid var(--red);
  border-radius: 6px;
}

.booked h2 { font-size: 22px; color: var(--ink); font-weight: 800; }
.booked p { margin-top: 8px; }
.booked .tick { display: block; width: 44px; height: 44px; margin-bottom: 8px; }

/* ===== Phiếu 18 câu, 5 bước (bk-*) =====
   Điện thoại: một cột, thanh tiến độ dính trên, thanh nút dính dưới. Máy tính (từ 960px): cột trái dính (tiêu đề + danh sách bước), cột phải là phiếu. */
html.bkp { scroll-padding: 92px 0 118px; }

.hero.bk {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: none;
  grid-template-rows: none;
  gap: 20px;
  padding-block: 12px 56px;
}

.hero.bk .hero-text h1 { font-size: clamp(24px, 6.4vw, 32px); max-width: none; }
.hero.bk .hero-text p { margin-top: 10px; max-width: 36em; font-size: 16px; }
.hero.bk .bk-card { grid-area: auto; position: relative; padding: 0; }
.bk-card form { margin-top: 0; }

/* Điện thoại: đưa ô điền lên sớm. "Khoảng 5 phút" đã có ở thanh tiến độ trong phiếu nên bỏ đoạn mô tả và ghi chú đầu trang. */
@media (max-width: 599px) {
  .hero.bk .hero-text p { display: none; }
  .bkp .top-note { display: none; }
}

/* Danh sách bước ở cột trái: chỉ hiện trên máy tính */
.bk-rail { display: none; list-style: none; margin: 0; padding: 0; }

.bk-rail li {
  position: relative;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.3;
}

.bk-rail li:not(:last-child)::after { content: ''; position: absolute; left: 15px; top: calc(50% + 16px); width: 2px; height: 20px; background: var(--line); }
.bk-rail li[data-state='done']:not(:last-child)::after { background: var(--red-margin); }

.bk-rn {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  font-family: var(--hand);
  font-size: 18px;
  line-height: 1;
}

.bk-rtick { display: none; width: 18px; height: 18px; }
.bk-rail li[data-state='current'] { color: var(--ink); font-weight: 700; }
.bk-rail li[data-state='current'] .bk-rn { border-color: var(--red); color: var(--red); }
.bk-rail li[data-state='done'] { color: var(--ink); }
.bk-rail li[data-state='done'] .bk-rn { border-color: var(--red); }
.bk-rail li[data-state='done'] .bk-num { display: none; }
.bk-rail li[data-state='done'] .bk-rtick { display: block; }

/* Tiến độ: dính trên cùng khi cuộn (điện thoại) */
.bk-progress {
  position: sticky;
  top: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: 'now left' 'bar bar';
  align-items: baseline;
  gap: 4px 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 20px 12px;
  background: var(--sheet);
  border-bottom: 1.5px solid var(--line);
  border-radius: 5px 5px 0 0;
}

.bk-pnow { grid-area: now; margin: 0; font-weight: 700; font-size: 15px; color: var(--ink); }
.bk-pleft { grid-area: left; margin: 0; font-size: 13px; color: var(--muted); white-space: nowrap; }
.bk-bar { grid-area: bar; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; margin-top: 4px; }
.bk-bar i { display: block; height: 6px; border-radius: 3px; background: var(--line); }
.bk-bar i[data-state='done'] { background: var(--ink); }
.bk-bar i[data-state='current'] { background: var(--red); }

.bk-restore { margin: 0; padding: 10px 20px; background: var(--ink-wash); font-size: 14px; line-height: 1.5; }

.bk-link {
  appearance: none;
  margin-left: 4px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.bk-steps { padding: 22px 20px 6px; }
.bk-h { font-size: 22px; font-weight: 800; color: var(--ink); }
.bk-h:focus { outline: none; }
.bk-lead { margin-top: 6px; color: var(--muted); font-size: 15px; }
.bk-contact { margin-top: 20px; }
.bk-qs { display: grid; gap: 30px; margin-top: 22px; }

/* Một câu hỏi */
.bk-q { margin: 0; padding: 0; border: 0; min-width: 0; }
.bk-q:focus { outline: none; }

.bk-ql {
  position: relative;
  display: block;
  width: 100%;
  padding: 0 0 0 38px;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.45;
  color: var(--text);
}

.bk-qn { position: absolute; left: 0; top: -3px; font-family: var(--hand); font-weight: 400; font-size: 28px; line-height: 1.2; color: var(--red); }
.bk-qh { margin: 6px 0 0 38px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.bk-opts { display: grid; gap: 10px; margin-top: 14px; }

.bk-opt { min-height: 54px; padding: 10px 14px 10px 12px; gap: 12px; font-size: 17px; line-height: 1.4; }
.bk-opt .ltr { width: 32px; height: 32px; font-size: 15px; }
.bk-ot { flex: 1; min-width: 0; }
.bk-tick { flex: none; width: 22px; height: 22px; margin-left: auto; visibility: hidden; }
.bk-tick .pen { stroke-width: 3; }
.bk-opt[data-sel] { box-shadow: inset 0 0 0 1px var(--ink); }
.bk-opt[data-sel] .bk-tick { visibility: visible; }

@media (hover: hover) {
  .bk-opt:hover { border-color: var(--ink); }
}

/* Vòng tiêu điểm: chỉ khi dùng bàn phím (trình duyệt cũ không có :has thì giữ vòng cho cả chuột) */
.bk-opt:focus-within { outline: 3px solid var(--red); outline-offset: 2px; }

@supports selector(:has(a)) {
  .bk-opt:focus-within { outline: none; }
  .bk-opt:has(input:focus-visible) { outline: 3px solid var(--red); outline-offset: 2px; }
}

@media (prefers-reduced-motion: no-preference) {
  .bk-opt[data-sel] .bk-tick .pen { stroke-dasharray: 1; animation: bkink 0.35s ease-out both; }
  @keyframes bkink { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
}

/* Câu chọn trường: thẻ có danh sách tên trường */
.bk-opts--school .bk-opt { align-items: flex-start; }
.bk-opts--school .ltr { margin-top: 1px; }
.bk-opts--school .bk-tick { margin-top: 4px; }
.bk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bk-chip { padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--text); font-size: 14.5px; line-height: 1.5; }
.bk-opt[data-sel] .bk-chip { border-color: var(--ink); background: #fff; }
.bk-school { margin-top: 14px; }

/* Thiếu đáp án: gạch chân đỏ + chữ (không chỉ báo bằng màu) */
.bk-qerr { margin: 10px 0 0; color: var(--red); font-size: 14px; font-weight: 600; }
.bk-qerr:empty { display: none; }
.bk-q[data-bad] .bk-qt { text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.bk-q[data-bad] .bk-opt:not([data-sel]) { border-color: var(--red-margin); }

.bk-last { display: grid; gap: 18px; margin-top: 4px; padding-top: 24px; border-top: 1.5px dashed var(--line); }
.bk-last .field + .field { margin-top: 0; }

/* Thanh hành động: dính dưới cùng */
.bk-formerr { margin: 14px 20px 0; }
.bk-card .fine.bk-fine { margin: 18px 20px 14px; }

.bk-actions {
  position: sticky;
  bottom: 0;
  z-index: 6;
  display: grid;
  gap: 6px;
  padding: 10px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--sheet);
  border-top: 1.5px solid var(--line);
  border-radius: 0 0 5px 5px;
}

.bk-count { margin: 0; color: var(--muted); font-size: 14px; text-align: center; }
.bk-count:empty { display: none; }
.bk-btns { display: flex; gap: 10px; }
.bk-actions .btn { margin-top: 0; }
.bk-btns .btn:not(.ghost) { flex: 1; }
.bk-btns .btn.ghost { flex: 0 0 auto; padding-inline: 20px; }

/* Khối mở đầu nằm TRÊN phiếu: tiêu đề, mục tiêu 9+ và 3 bước, để ba mẹ biết mình sẽ làm gì trước khi điền.
   .hero-text, .goalbox, .steps còn grid-area của bố cục cũ nên đặt lại ở đây. */
.bk-intro { display: grid; gap: 14px; }
.bk-intro .hero-text, .bk-intro .goalbox, .bk-intro .steps { grid-area: auto; }
.bk-intro .goalbox { display: flex; align-items: center; gap: 16px; margin: 6px 0 0; }
.bk-intro .goal { font-size: 60px; padding: 4px 22px 10px; }
.bk-intro .goal-note { margin: 0; max-width: 9em; font-size: 22px; line-height: 1.15; }
.bk-intro .steps { margin: 2px 0 0; gap: 12px; max-width: none; }
.bk-intro .steps li { padding-left: 44px; font-size: 15px; line-height: 1.45; }
.bk-intro .steps li::before { top: 0; width: 30px; height: 30px; font-size: 18px; }

@media (min-width: 640px) {
  .bk-intro {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'text goal' 'steps steps';
    column-gap: 40px;
    row-gap: 22px;
    align-items: center;
  }

  .bk-intro .hero-text { grid-area: text; }
  .bk-intro .goalbox { grid-area: goal; flex-direction: column; align-items: flex-start; gap: 4px; }
  .bk-intro .goal { font-size: 92px; padding: 6px 30px 12px; }
  .bk-intro .goal-note { font-size: 24px; }
  .bk-intro .steps { grid-area: steps; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .bk-intro .steps li { padding-left: 50px; font-size: 16px; }
  .bk-intro .steps li::before { width: 34px; height: 34px; font-size: 21px; }
}

/* Máy tính: hai cột */
@media (min-width: 960px) {
  html.bkp { scroll-padding: 24px 0 100px; }
  /* Phiếu có nhiều chữ hơn form cũ: nới khung để thẻ phiếu rộng khoảng 670px */
  html.bkp .wrap, html.bkp .foot { max-width: 1240px; }

  /* Hàng 1: khối mở đầu (chữ, 9+, 3 bước) trải hết chiều ngang. Hàng 2: danh sách 5 bước (dính) bên trái, phiếu bên phải. */
  .hero.bk {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    grid-template-areas: 'intro intro' 'rail card';
    grid-template-rows: auto 1fr;
    column-gap: 56px;
    row-gap: 36px;
    align-items: start;
    padding-block: 28px 72px;
  }

  .hero.bk .bk-intro { grid-area: intro; column-gap: 64px; }
  .hero.bk .bk-rail { grid-area: rail; position: sticky; top: 24px; display: grid; margin: 0; }
  .hero.bk .bk-card { grid-area: card; max-width: 780px; }
  .hero.bk .hero-text h1 { font-size: clamp(30px, 3vw, 40px); max-width: 20em; }
  .hero.bk .hero-text p { font-size: 17px; }
  .bk-intro .goal { font-size: 108px; }

  /* Tiến độ đã có ở cột trái: giữ dòng "Bước x/5" cho trình đọc màn hình, ẩn phần còn lại */
  .bk-progress { position: static; display: block; height: 0; padding: 0; border: 0; }
  .bk-bar, .bk-pleft { display: none; }
  .bk-pnow { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  .bk-restore { padding: 12px 36px; }
  .bk-steps { padding: 32px 36px 8px; }
  .bk-h { font-size: 26px; }
  .bk-formerr { margin: 14px 36px 0; }
  .bk-card .fine.bk-fine { margin: 20px 36px 16px; }
  .bk-actions { grid-template-columns: 1fr auto; align-items: center; gap: 16px; padding: 14px 36px 16px; }
  .bk-count { text-align: left; }
  .bk-btns .btn:not(.ghost) { flex: 0 1 240px; margin-left: auto; }
  .bk-opts--2 { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 720px) and (max-width: 959px) {
  .bk-opts--2 { grid-template-columns: 1fr 1fr; }
  .bk-steps { padding-inline: 32px; }
  .bk-progress, .bk-actions, .bk-restore { padding-inline: 32px; }
  .bk-formerr, .bk-card .fine.bk-fine { margin-inline: 32px; }
}
