/* Giao diện phiếu khảo sát. Thiết kế cho điện thoại trước, vì người nhận thường
   mở phiếu từ Zalo. Màu là vai trò, đổi sáng tối ở một chỗ. Đổ bóng tạo chiều
   sâu cho bề mặt; viền chỉ dùng cho cấu trúc và trạng thái (ô lựa chọn, lỗi). */
:root {
  color-scheme: light;
  --page: #f4f6fa; --surface: #ffffff; --surface-2: #eff2f7; --surface-3: #e4e8f0;
  --ink: #0c1322; --ink-2: #47506a; --mute: #6b7488; --line: #dde2eb; --line-2: #c3cad8;
  --brand: #0a2c7c; --brand-hover: #0d379a; --on-brand: #ffffff; --accent: #ff6a00; --link: #06419e;
  --pick-bg: #edf2fd; --pick-line: #0a2c7c;
  --err: #b3261e; --err-bg: #fdecea;
  --good: #0a6e4e; --good-bg: #e2f4eb; --warn: #7a4e00; --warn-bg: #fff1d6;
  --info: #06419e; --info-bg: #e3edfb; --stop: #8c1d2c; --stop-bg: #fbe3e6;
  --shadow-card: 0 0 0 1px oklch(0 0 0 / 0.06), 0 1px 2px oklch(0 0 0 / 0.04), 0 12px 32px -12px oklch(0 0 0 / 0.1);
  --shadow-bar: 0 -1px 0 oklch(0 0 0 / 0.06), 0 -12px 24px -16px oklch(0 0 0 / 0.12);
  --ease-icon: cubic-bezier(0.2, 0, 0, 1);
  --r-card: 20px; --r-ctl: 12px;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0b0f16; --surface: #131925; --surface-2: #1a2230; --surface-3: #252f41;
    --ink: #f3f5f9; --ink-2: #c3c9d6; --mute: #8f98aa; --line: #283244; --line-2: #3a4558;
    --brand: #9fb7f0; --brand-hover: #b6c8f4; --on-brand: #0b0f16; --link: #8db4f5;
    --pick-bg: #16264a; --pick-line: #9fb7f0;
    --err: #f2b8b5; --err-bg: #3d1820;
    --good: #7fd9ad; --good-bg: #12352a; --warn: #f3c46b; --warn-bg: #3a2c0c;
    --info: #9cc2f7; --info-bg: #15294a; --stop: #f39aa6; --stop-bg: #3d1820;
    --shadow-card: 0 0 0 1px oklch(1 0 0 / 0.08), 0 12px 32px -12px oklch(0 0 0 / 0.5);
    --shadow-bar: 0 -1px 0 oklch(1 0 0 / 0.08), 0 -12px 24px -16px oklch(0 0 0 / 0.6);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-underline-offset: 2px; }
[hidden] { display: none !important; }
.wrap { max-width: 680px; margin: 0 auto; padding: 0 16px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.bt { flex: none; }

.masthead { background: var(--surface); box-shadow: 0 1px 0 var(--line); }
.masthead .wrap { padding-top: 14px; padding-bottom: 14px; }
.masthead img { height: 24px; width: auto; display: block; }
.masthead img.logo-toi { display: none; }
@media (prefers-color-scheme: dark) { .masthead img.logo-sang { display: none; } .masthead img.logo-toi { display: block; } }

main { padding: 16px 0 40px; }
h1 { font-size: clamp(26px, 6.4vw, 34px); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 12px; color: var(--brand); text-wrap: balance; }
h2 { font-size: 21px; line-height: 1.3; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
h3 { font-size: 16px; line-height: 1.4; margin: 0 0 6px; }
p { margin: 0 0 12px; text-wrap: pretty; }
ul, ol { margin: 0 0 12px; padding-left: 20px; }
li { margin-bottom: 6px; }
.small { font-size: 14px; color: var(--ink-2); }
.eyebrow { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); font-weight: 700; margin: 0 0 8px; }

/* Bề mặt: trên điện thoại thẻ tràn mép như nhóm ô của iOS; từ 640 px thành thẻ nổi.
   Lề trong 32 px nên bán kính thẻ và bán kính ô bên trong chọn độc lập. */
.card { background: var(--surface); margin: 0 -16px 8px; padding: 24px 16px; }
@media (min-width: 640px) {
  main { padding-top: 32px; }
  .card { margin: 0 0 16px; padding: 32px; border-radius: var(--r-card); box-shadow: var(--shadow-card); }
}

/* Nút: nhấn thì thu về 0,96 để tay biết máy đã nhận. */
.btn { font: inherit; font-size: 16px; font-weight: 600; min-height: 52px; padding: 0 20px; border-radius: var(--r-ctl); border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; transition-property: scale, background-color, box-shadow; transition-duration: 150ms; transition-timing-function: ease-out; }
.btn:active { scale: 0.96; }
.btn:disabled { opacity: .6; cursor: progress; scale: 1; }
.btn-chinh { background: var(--brand); color: var(--on-brand); }
.btn-chinh.co-mui-ten { padding-inline: 20px 18px; }
.btn-phu { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn-chu { background: none; color: var(--ink-2); min-height: 44px; padding: 0 12px; text-decoration: underline; text-underline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  .btn-chinh:hover { background: var(--brand-hover); }
  .btn-phu:hover { background: var(--surface-2); }
}

/* Trang mở đầu */
.lede { font-size: 17px; color: var(--ink-2); }
.chip-hang { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 20px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); background: var(--surface-2); border-radius: 999px; padding: 6px 12px 6px 10px; }
.dau-tich { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 10px; }
.dau-tich li { display: flex; gap: 10px; margin: 0; }
.dau-tich .bt { color: var(--good); margin-top: 3px; }
.cac-phan { list-style: none; padding: 0; margin: 8px 0 24px; display: grid; gap: 2px; }
.cac-phan li { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; margin: 0; padding: 10px 0; box-shadow: 0 1px 0 var(--line); }
.cac-phan li:last-child { box-shadow: none; }
.cac-phan .so-thu-tu { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); color: var(--ink); font-size: 13px; font-weight: 700; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.cac-phan .ten { font-weight: 600; font-size: 15px; display: block; line-height: 1.35; }
.cac-phan .mo { font-size: 13.5px; color: var(--mute); display: block; }
.cac-phan .dem { font-size: 13px; color: var(--mute); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hang-bat-dau { display: grid; gap: 8px; margin: 0 0 16px; }
.hang-bat-dau .btn-chinh { width: 100%; }
@media (min-width: 640px) { .hang-bat-dau { grid-template-columns: auto auto; justify-content: start; align-items: center; } .hang-bat-dau .btn-chinh { width: auto; min-width: 220px; } }

/* Tiến độ: năm đoạn, đoạn đang làm tô màu nhấn */
.tien-do { margin-bottom: 16px; }
.tien-do .nhan { font-size: 13px; color: var(--mute); font-weight: 600; margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.doan { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.doan span { height: 4px; border-radius: 99px; background: var(--surface-3); transition: background-color 150ms ease-out; }
.doan .xong { background: var(--brand); }
.doan .dang { background: var(--accent); }
.mo-phan { color: var(--mute); font-size: 14.5px; margin: 4px 0 24px; }

/* Câu hỏi */
fieldset.cau, div.cau { border: 0; padding: 0; margin: 0 0 32px; min-width: 0; }
.cau legend, .cau > label.nhan { font-size: 17px; font-weight: 600; line-height: 1.4; padding: 0; margin-bottom: 4px; display: block; color: var(--ink); }
.cach-chon { font-size: 13.5px; font-weight: 500; color: var(--mute); margin: 0 0 4px; }
.goi-y { font-size: 14px; color: var(--ink-2); margin: 0 0 4px; }
.lua-chon, .o-nhap { margin-top: 12px; }
.lua-chon { display: grid; gap: 8px; }
.lua-chon.luoi { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.lua-chon.luoi .lc { padding: 12px; gap: 10px; }
.lc { position: relative; display: flex; gap: 12px; align-items: center; min-height: 52px; padding: 13px 16px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); cursor: pointer; font-size: 15.5px; line-height: 1.4; transition-property: background-color, border-color, box-shadow; transition-duration: 150ms; transition-timing-function: ease-out; -webkit-tap-highlight-color: transparent; }
.lc:has(input:checked) { background: var(--pick-bg); border-color: var(--pick-line); box-shadow: inset 0 0 0 1px var(--pick-line); }
.lc:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .lc:hover { border-color: var(--line-2); } }
.lc input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.tach { height: 1px; background: var(--line); margin: 4px 0; grid-column: 1 / -1; }

/* Dấu chọn: tròn cho câu chọn một, vuông cho câu chọn nhiều. Dấu bên trong hiện
   bằng scale 0,25 → 1, opacity và blur 4 px → 0, đường cong cubic-bezier(0.2, 0, 0, 1). */
.dau { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border: 1.5px solid var(--line-2); background: var(--surface); color: var(--on-brand); transition-property: background-color, border-color; transition-duration: 150ms; transition-timing-function: ease-out; }
.dau.tron { border-radius: 50%; }
.dau.vuong { border-radius: 6px; }
.dau.tron::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.dau.tron::after, .dau .bt { opacity: 0; scale: 0.25; filter: blur(4px); transition-property: opacity, scale, filter; transition-duration: 300ms; transition-timing-function: var(--ease-icon); }
.lc:has(input:checked) .dau { background: var(--brand); border-color: var(--brand); }
.lc:has(input:checked) .dau.tron::after, .lc:has(input:checked) .dau .bt { opacity: 1; scale: 1; filter: blur(0); }

.o-nhap { display: flex; align-items: center; gap: 10px; }
.o-nhap input, .o-nhap textarea, .lien-he input[type="text"], .lien-he input[type="email"], .lien-he input[type="tel"] {
  font: inherit; font-size: 16px; width: 100%; min-height: 52px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--r-ctl); background: var(--surface); color: var(--ink);
  transition-property: border-color, box-shadow; transition-duration: 150ms; transition-timing-function: ease-out;
}
.o-nhap textarea { min-height: 112px; resize: vertical; line-height: 1.5; }
.o-nhap input:focus, .o-nhap textarea:focus, .lien-he input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in oklch, var(--brand) 22%, transparent); }
.o-nhap .don-vi { color: var(--ink-2); white-space: nowrap; font-weight: 500; }
.o-nhap input[inputmode="numeric"] { max-width: 220px; font-variant-numeric: tabular-nums; }
.loi { color: var(--err); background: var(--err-bg); border-radius: 8px; padding: 6px 10px; font-size: 14px; margin: 8px 0 0; }
.cau.co-loi .lc, .cau.co-loi input, .cau.co-loi textarea { border-color: var(--err); }

.lien-he-khoi { padding-top: 8px; }
.lien-he { display: grid; gap: 14px; margin: 16px 0; }
.lien-he label { font-weight: 600; font-size: 15px; display: grid; gap: 6px; }
.dong-y { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; line-height: 1.5; padding: 12px 14px; border-radius: var(--r-ctl); background: var(--surface-2); cursor: pointer; }
.dong-y input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--brand); }
.o-bay { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Thanh nút ghim ở đáy: nút "Tiếp" luôn trong tầm ngón cái. */
.thanh-nut { position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; margin: 8px -16px -24px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: color-mix(in oklch, var(--surface) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow-bar); }
.thanh-nut .btn-chinh { flex: 1; }
.thanh-nut .nut-lui { width: 52px; padding: 0; flex: none; }
.thong-bao-thanh { flex-basis: 100%; margin: 0; font-size: 14px; color: var(--err); }
@media (min-width: 640px) { .thanh-nut { margin: 16px -32px -32px; padding: 16px 32px; border-radius: 0 0 var(--r-card) var(--r-card); } }

/* Vào phần mới: tách đầu phần và nhóm câu hỏi, so le 100 ms. */
@keyframes vao { from { opacity: 0; transform: translateY(12px); filter: blur(4px); } to { opacity: 1; transform: none; filter: blur(0); } }
.vao { animation: vao 400ms ease-out both; }
.vao-2 { animation-delay: 100ms; }
.vao-3 { animation-delay: 200ms; }
.vao-4 { animation-delay: 300ms; }
@media (prefers-reduced-motion: reduce) {
  @keyframes vao-nhe { from { opacity: 0; } to { opacity: 1; } }
  .vao { animation-name: vao-nhe; }
  .dau.tron::after, .dau .bt { scale: 1; filter: none; }
  .btn:active { scale: 1; }
}

.thong-bao { border-left: 4px solid var(--accent); background: var(--surface-2); border-radius: 0 10px 10px 0; padding: 10px 14px; margin: 12px 0; font-size: 14.5px; }
.thong-bao.loi-gui { border-left-color: var(--err); }
footer.chan { padding: 20px 0 40px; font-size: 13.5px; color: var(--mute); }
footer.chan p { margin: 0 0 4px; }
