/* Giao diện "Phát triển tư duy và bản lĩnh cảm xúc": chữ to, nút to (từ 48px), một câu một màn, nền sáng.
   Một cột giữa trang (tối đa 760px): điện thoại 360 đến 430px, máy tính 1280 đến 1920px, không tràn ngang. */
:root {
  --nen: #fff7ea;
  --giay: #ffffff;
  --chu: #2a2540;
  --nhat: #625b7d;
  --vien: #ece4f7;
  --muc: #5b3fb8;
  --muc-nhat: #f0eaff;
  --nang: #ffc83d;
  --nang-nhat: #fff2cc;
  --troi: #2f8fe0;
  --troi-nhat: #e3f2ff;
  --la: #22a06b;
  --la-nhat: #ddf6ea;
  --cam: #f07b3f;
  --cam-nhat: #ffe8db;
  --muc-0: #f07b3f;
  --muc-1: #f2b632;
  --muc-2: #22a06b;
  --muc-3: #5b3fb8;
  --f-to: "Baloo 2", "Be Vietnam Pro", system-ui, sans-serif;
  --f-chu: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bo: 18px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--nen);
  color: var(--chu);
  font-family: var(--f-chu);
  font-size: 18px;
  line-height: 1.55;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }

#khung {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px));
}
.dau {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 14px;
  font-family: var(--f-to);
  font-weight: 800;
  color: var(--muc);
  letter-spacing: .04em;
  font-size: .95rem;
}
.dau svg, .dau img { width: 30px; height: 30px; flex: none; }
.logo-khoa { display: block; width: 96px; height: 96px; margin-bottom: 10px; filter: drop-shadow(0 6px 14px rgba(91, 63, 184, .25)); }

.man { display: flex; flex-direction: column; gap: 18px; }
h1, h2, h3 { font-family: var(--f-to); line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: 1.9rem; font-weight: 800; color: var(--muc); }
h2 { font-size: 1.6rem; font-weight: 800; }
h3 { font-size: 1.25rem; font-weight: 700; }
p { margin: 0; }
h1:focus, h2:focus { outline: none; }

.the {
  background: var(--giay);
  border: 2px solid var(--vien);
  border-radius: 22px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.nhe { color: var(--nhat); font-size: 1rem; }
.chao { white-space: pre-line; color: var(--nhat); }
.ghi-chu {
  background: var(--muc-nhat);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 1rem;
}

/* ------------------------------------------------------------------ nút */
.nut {
  min-height: 56px;
  border-radius: 16px;
  border: 0;
  padding: 12px 22px;
  font-family: var(--f-to);
  font-weight: 800;
  font-size: 1.25rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  text-decoration: none;
  touch-action: manipulation;
  transition: transform .08s ease, background-color .15s ease;
}
.nut:active { transform: scale(.97); }
.nut:disabled { opacity: .55; cursor: default; transform: none; }
.nut.chinh { background: var(--muc); color: #fff; box-shadow: 0 4px 0 #3f2a8a; }
.nut.chinh:active { box-shadow: 0 1px 0 #3f2a8a; }
.nut.vang { background: var(--nang); color: var(--chu); box-shadow: 0 4px 0 #c99412; }
.nut.phu { background: var(--giay); color: var(--muc); border: 2px solid var(--muc); }
.nut.nho { min-height: 48px; font-size: 1.05rem; padding: 8px 16px; }
.nut.chu-mong { background: transparent; color: var(--nhat); border: 0; font-family: var(--f-chu); font-weight: 600; font-size: 1rem; min-height: 48px; text-decoration: underline; }
.nut.rong { width: 100%; }
.hang-nut { display: flex; flex-wrap: wrap; gap: 12px; }
.hang-nut > .nut { flex: 1 1 200px; }
:focus-visible { outline: 4px solid var(--nang); outline-offset: 3px; }

/* ------------------------------------------------------------------ đăng nhập */
.tab-vao { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: var(--muc-nhat); padding: 6px; border-radius: 18px; }
.tab-vao button {
  min-height: 52px; border: 0; border-radius: 14px; background: transparent; color: var(--muc);
  font-family: var(--f-to); font-weight: 700; font-size: 1.1rem; cursor: pointer;
}
.tab-vao button[aria-selected="true"] { background: var(--giay); box-shadow: 0 2px 6px rgba(91, 63, 184, .18); }
.goi-y-san { font-weight: 700; color: var(--cam); text-align: center; }
.o-nhap { display: flex; flex-direction: column; gap: 8px; }
label { font-weight: 700; }
.goi-y { color: var(--nhat); font-size: .95rem; }
input[type="tel"], input[type="text"], select {
  width: 100%;
  min-height: 56px;
  border: 2px solid var(--vien);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 1.2rem;
  background: #fff;
}
input:focus, select:focus { border-color: var(--muc); outline: none; box-shadow: 0 0 0 4px var(--muc-nhat); }
.dong-y { display: flex; gap: 12px; align-items: flex-start; font-weight: 500; font-size: 1rem; cursor: pointer; }
.dong-y input { width: 28px; height: 28px; flex: none; margin: 2px 0 0; accent-color: var(--muc); }
.loi {
  background: var(--cam-nhat);
  color: #8a3410;
  border-radius: 14px;
  padding: 12px 14px;
  white-space: pre-line;
  overflow-wrap: anywhere;
  font-size: 1rem;
}
.loi a, .ho-tro a { color: inherit; font-weight: 700; }
.ho-tro { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: .95rem; color: var(--nhat); }
.ho-tro a.lien-ket { overflow-wrap: anywhere; color: var(--muc); }

/* ------------------------------------------------------------------ trang chính, hồ sơ bé */
.ds-be { display: flex; flex-direction: column; gap: 16px; }
.the-be .dau-be { display: flex; gap: 14px; align-items: center; min-width: 0; }
.mat-be {
  width: 56px; height: 56px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-family: var(--f-to); font-weight: 800; font-size: 1.6rem; color: #fff;
}
.ten-be { font-family: var(--f-to); font-weight: 800; font-size: 1.45rem; overflow-wrap: anywhere; }
.chon-bai { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.nut-bai {
  min-height: 92px; border-radius: 18px; border: 0; cursor: pointer; padding: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-family: var(--f-to); font-weight: 800; font-size: 1.2rem; line-height: 1.15; touch-action: manipulation;
}
.nut-bai svg { width: 34px; height: 34px; }
.nut-bai.iq { background: var(--troi-nhat); color: #1b5fa3; }
.nut-bai.eq { background: var(--cam-nhat); color: #a4471a; }
.nut-bai .tiep { font-family: var(--f-chu); font-size: .85rem; font-weight: 700; background: #fff; border-radius: 999px; padding: 2px 10px; }
.the-be .duoi { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; align-items: center; }
#tao-be { display: flex; flex-direction: column; gap: 10px; }

/* ------------------------------------------------------------------ màn mở đầu */
.mo-dau { text-align: center; align-items: center; padding: 28px 20px; }
.mo-dau svg.sao-to { width: 96px; height: 96px; }
.mo-dau .nut { min-width: 220px; }

/* ------------------------------------------------------------------ làm bài */
.thanh-tren { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
#tien-do { font-family: var(--f-to); font-weight: 800; font-size: 1.15rem; color: var(--muc); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tien-do-thanh { height: 14px; background: var(--vien); border-radius: 999px; overflow: hidden; }
.tien-do-thanh i { display: block; height: 100%; background: linear-gradient(90deg, var(--nang), var(--cam)); border-radius: 999px; transition: width .3s ease; }
.the-cau { gap: 16px; }
.de-hang { display: flex; gap: 12px; align-items: flex-start; }
.de { flex: 1; min-width: 0; font-size: 1.4rem; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.de.dai { font-size: 1.15rem; font-weight: 600; }
.hoi-thang { color: var(--nhat); font-weight: 600; }
.loa {
  flex: none; width: 60px; height: 60px; border-radius: 50%; border: 3px solid var(--muc); background: var(--giay); color: var(--muc);
  display: grid; place-items: center; cursor: pointer; padding: 0; touch-action: manipulation;
}
.loa svg { width: 30px; height: 30px; }
.loa.dang { background: var(--muc); color: #fff; }
.hinh { display: flex; justify-content: center; align-items: center; min-width: 0; }
.hinh svg, .lc svg { display: block; max-width: 100%; height: auto; }
.ve-tranh { max-width: 100%; }
.ve-tranh > svg { width: 100%; height: auto; }

.lua-chon { display: grid; grid-template-columns: 1fr; gap: 12px; }
.lua-chon.lc-hinh { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lua-chon.lc-hinh.rong { grid-template-columns: 1fr; }
.lc {
  position: relative;
  min-height: 64px;
  min-width: 0;
  border: 3px solid var(--vien);
  background: var(--giay);
  border-radius: 18px;
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  font-size: 1.2rem;
  font-weight: 600;
  touch-action: manipulation;
  transition: border-color .12s ease, background-color .12s ease, transform .08s ease;
}
.lc:hover { border-color: #c9b8f2; }
.lc:active { transform: scale(.98); }
.lc .k {
  flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--muc-nhat); color: var(--muc);
  display: grid; place-items: center; font-family: var(--f-to); font-weight: 800; font-size: 1.2rem;
}
.lc .chu { overflow-wrap: anywhere; min-width: 0; }
.lc-hinh .lc { flex-direction: column; justify-content: center; padding: 14px 10px 12px; }
.lc-hinh .lc .k { position: absolute; top: 8px; left: 8px; width: 34px; height: 34px; font-size: 1.05rem; }
.lc-hinh .lc .anh { display: flex; justify-content: center; align-items: center; max-width: 100%; min-width: 0; padding-top: 18px; }
.lc-hinh.rong .lc { flex-direction: row; padding: 10px 12px; }
.lc-hinh.rong .lc .k { position: static; }
.lc-hinh.rong .lc .anh { flex: 1; padding-top: 0; }
.lc.chon { border-color: var(--muc); background: var(--muc-nhat); }
.lc.chon .k { background: var(--muc); color: #fff; }
.lc .muc-thang { display: flex; gap: 4px; margin-left: auto; flex: none; }
.lc .muc-thang i { width: 12px; height: 12px; border-radius: 50%; background: var(--vien); }
.lc .muc-thang i.co { background: var(--nang); }
.thanh-duoi { display: flex; justify-content: space-between; gap: 12px; }

.dang-nho .the-cau { align-items: center; text-align: center; }
#dem-nguoc { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; max-width: 360px; }
#dem-nguoc .so { font-family: var(--f-to); font-weight: 800; font-size: 3rem; line-height: 1; color: var(--muc); font-variant-numeric: tabular-nums; }
#dem-nguoc .thanh { width: 100%; height: 12px; border-radius: 999px; background: var(--vien); overflow: hidden; }
#dem-nguoc .thanh i { display: block; height: 100%; background: var(--troi); border-radius: 999px; }

/* ------------------------------------------------------------------ xong, kết quả */
.gioi { text-align: center; align-items: center; padding: 32px 20px; background: linear-gradient(180deg, #fff 0%, var(--nang-nhat) 100%); }
.gioi h2 { font-size: 1.8rem; color: var(--muc); }
.gioi svg.sao-to { width: 120px; height: 120px; }
.gioi .nut { min-width: 240px; }

#bieu-do, .bieu-do { width: 100%; max-width: 480px; height: auto; display: block; margin: 0 auto; }
.thang-muc { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; font-size: .9rem; color: var(--nhat); }
.thang-muc span { display: inline-flex; align-items: center; gap: 6px; }
.thang-muc i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.kq-mang .dau-mang { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; }
.chip { border-radius: 999px; padding: 4px 14px; font-weight: 700; font-size: 1rem; white-space: nowrap; }
.chip.m0 { background: var(--cam-nhat); color: #a4471a; }
.chip.m1 { background: var(--nang-nhat); color: #7a5600; }
.chip.m2 { background: var(--la-nhat); color: #146343; }
.chip.m3 { background: var(--muc); color: #fff; }
.so-dung { color: var(--nhat); font-weight: 600; }
.goi-y-tieu { font-weight: 700; color: var(--muc); }
.ds-goi-y { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 8px; font-size: 1.02rem; }
.lan .ngay { color: var(--nhat); font-size: .95rem; }

/* ------------------------------------------------------------------ thông báo */
.thong-bao {
  position: fixed; inset: 0; z-index: 50; background: rgba(42, 37, 64, .45);
  display: grid; place-items: center; padding: 16px;
}
.thong-bao .hop {
  background: var(--giay); border-radius: 22px; padding: 22px; width: 100%; max-width: 460px;
  display: flex; flex-direction: column; gap: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .2);
}
.thong-bao .tieu { font-family: var(--f-to); font-weight: 800; font-size: 1.35rem; }
.thong-bao .chu { white-space: pre-line; overflow-wrap: anywhere; }
.thong-bao .hang-nut { flex-direction: column; }
.thong-bao .hang-nut > .nut { flex: none; }
.dang-tai { text-align: center; color: var(--nhat); padding: 40px 0; }

@media (min-width: 720px) {
  #khung { padding-top: 24px; }
  h1 { font-size: 2.3rem; }
  .de { font-size: 1.6rem; }
  .de.dai { font-size: 1.25rem; }
  .lua-chon.lc-chu { grid-template-columns: 1fr 1fr; }
  .lua-chon.lc-hinh.rong { grid-template-columns: 1fr 1fr; }
  .the { padding: 26px; }
}
@media (max-width: 380px) {
  .nut-bai { font-size: 1.05rem; min-height: 84px; }
  .chon-bai { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
