@font-face { font-family: 'Be Vietnam Pro'; font-weight: 400; src: url('../fonts/BeVietnamPro-Regular.ttf'); font-display: swap; }
@font-face { font-family: 'Be Vietnam Pro'; font-weight: 500; src: url('../fonts/BeVietnamPro-Medium.ttf'); font-display: swap; }
@font-face { font-family: 'Be Vietnam Pro'; font-weight: 600; src: url('../fonts/BeVietnamPro-SemiBold.ttf'); font-display: swap; }
@font-face { font-family: 'Be Vietnam Pro'; font-weight: 700; src: url('../fonts/BeVietnamPro-Bold.ttf'); font-display: swap; }
@font-face { font-family: 'Be Vietnam Pro'; font-weight: 800; src: url('../fonts/BeVietnamPro-ExtraBold.ttf'); font-display: swap; }

:root {
  --nau-go: #7A4B2A;
  --nau-dam: #58331A;
  --nau-tram: #2C1E16;
  --xanh-mam: #86B97A;   /* chỉ làm vạch, không làm chữ */
  --xanh-dam: #5B8851;   /* chữ chỉ từ 24px đậm */
  --kem: #FBF9F5;
  --cat: #F3EDE7;
  --chu-than: #4A3E37;
  /* chủ đề mặc định = Tiếng Anh; app.js/applyTheme sẽ ghi đè */
  --chu-de-main: #1F5FA8;
  --chu-de-soft: #E3EDF8;
  --chu-de-on: #FFFFFF;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--kem); }
body {
  font-family: 'Be Vietnam Pro', sans-serif;
  color: var(--chu-than);
  line-height: 1.5;
  font-size: 16px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { color: var(--nau-tram); line-height: 1.3; }
img, svg, video { max-width: 100%; }

.vach { height: 4px; background: var(--xanh-mam); border-radius: 99px; }
.trang { max-width: 720px; margin: 0 auto; padding: 24px 16px; }
.the { background: var(--cat); border-radius: 12px; padding: 16px; }
.nut {
  background: var(--chu-de-main); color: var(--chu-de-on);
  border: 0; border-radius: 10px; padding: 12px 16px; min-height: 44px;
  font: inherit; font-weight: 600; cursor: pointer;
}

/* ===== Giao diện Task 4 ===== */
body { overflow-wrap: anywhere; }
a { color: var(--nau-dam); }
:focus-visible { outline: 3px solid var(--nau-go); outline-offset: 2px; }
.bo-qua { position: absolute; left: 8px; top: -60px; background: var(--kem); padding: 10px 14px; border-radius: 8px; z-index: 10; }
.bo-qua:focus { top: 8px; }
h1.tieu-de { font-size: 1.75rem; font-weight: 800; }
h1:focus { outline: none; }
.muc { font-size: 1.15rem; font-weight: 700; margin: 24px 0 10px; }
.trang { padding-bottom: 48px; }
.dau-trang { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.streak { font-weight: 600; color: var(--nau-go); }
.banner { background: #FBE9D0; color: var(--nau-tram); border-left: 4px solid var(--nau-go); padding: 12px 14px; border-radius: 8px; margin: 14px 0; }
.trong, .ghi-chu, .dem { font-size: 0.9rem; color: var(--chu-than); }
.du-lieu { margin: 8px 0 14px; max-width: 62ch; line-height: 1.5; }
.dem.qua { color: #9A2B1B; font-weight: 700; }
.loi { color: #9A2B1B; font-weight: 600; }
.loi:not(:empty) { margin: 8px 0; padding: 10px 12px; background: #FBE4DF; border-radius: 8px; }

.luoi-chu-de { list-style: none; display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 560px) { .luoi-chu-de { grid-template-columns: 1fr 1fr; } }
.the-chu-de { position: relative; background: var(--s); border-radius: 14px; overflow: hidden; border: 1px solid rgba(44, 30, 22, 0.1); }
.the-chu-de-link { display: block; text-decoration: none; color: var(--nau-tram); min-height: 44px; }
.the-chu-de-dai { display: block; background: var(--m); color: var(--on); font-weight: 700; font-size: 0.85rem; padding: 12px 70px 12px 14px; min-height: 44px; }
.the-chu-de-ten { display: block; font-size: 1.25rem; font-weight: 800; padding: 14px 14px 2px; }
.the-chu-de-so { display: block; padding: 0 14px 14px; font-size: 0.95rem; }
.nut-phu { font: inherit; font-weight: 600; min-height: 44px; min-width: 44px; padding: 8px 12px; border-radius: 10px; cursor: pointer; }
.nut-xoa { position: absolute; right: 0; top: 0; background: transparent; border: 0; color: var(--on); }

.form-them { margin-top: 28px; display: flex; flex-direction: column; gap: 8px; }
.form-them .muc { margin-top: 0; }
.form-them label { font-weight: 600; margin-top: 6px; }
input[type=text], input[type=url], textarea {
  width: 100%; font: inherit; color: var(--nau-tram); background: #fff;
  border: 1.5px solid #B9A998; border-radius: 10px; padding: 12px; min-height: 44px; line-height: 1.5;
}
textarea { min-height: 220px; resize: vertical; }
.form-them .nut { align-self: flex-start; margin-top: 8px; }
.chon-mau { border: 0; margin-top: 6px; }
.chon-mau legend { font-weight: 600; margin-bottom: 6px; }
.luoi-mau { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 560px) { .luoi-mau { grid-template-columns: repeat(3, 1fr); } }
.o-mau { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 10px; background: #fff; border: 1.5px solid #D9CDBF; border-radius: 10px; font-weight: 500; cursor: pointer; margin: 0; }
.o-mau:has(input:checked) { border-color: var(--nau-go); box-shadow: 0 0 0 2px var(--nau-go); }
.o-mau input { width: 18px; height: 18px; accent-color: var(--nau-go); }
.o-mau-chip { width: 22px; height: 22px; border-radius: 50%; flex: none; border: 1px solid rgba(0, 0, 0, 0.2); }

.vet { font-size: 0.9rem; margin-bottom: 12px; }
.vet a { display: inline-block; padding: 12px 0; min-height: 44px; }
.dau-chu-de { background: var(--chu-de-main); color: var(--chu-de-on); border-radius: 14px; padding: 18px 16px; margin-bottom: 8px; }
.dau-chu-de h1 { color: var(--chu-de-on); }
.dau-chu-de .nhan { font-size: 0.85rem; font-weight: 600; }
.ds-buoi { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.the-buoi { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; color: var(--nau-tram); min-height: 56px; border-left: 6px solid var(--chu-de-main); }
.the-buoi-ten { font-weight: 700; }
.the-buoi-ngay { font-size: 0.85rem; flex: none; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 0; border-bottom: 3px solid var(--chu-de-main); }
.tab { font: inherit; font-weight: 600; min-height: 44px; padding: 8px 14px; white-space: nowrap; border: 0; border-radius: 10px 10px 0 0; background: var(--cat); color: var(--nau-tram); cursor: pointer; }
.tab[aria-selected=true] { background: var(--chu-de-main); color: var(--chu-de-on); }
.tabpanel { padding: 16px 0; }
.xem-truoc { background: var(--cat); border-radius: 10px; padding: 12px; margin-bottom: 14px; white-space: pre-wrap; }
.ds { padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.thuat-ngu dt { font-weight: 700; margin-top: 8px; }
.thuat-ngu dd { margin-left: 0; }
.tom-tat .muc:first-child { margin-top: 0; }
.video { position: relative; aspect-ratio: 16 / 9; margin: 14px 0; border-radius: 12px; overflow: hidden; background: var(--cat); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.nut[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ===== Giao diện Task 5: ôn bài ===== */
.muc-nho { font-size: 1rem; font-weight: 700; margin: 16px 0 6px; color: var(--nau-tram); }
.cau-hoi { font-size: 1.1rem; font-weight: 700; margin: 8px 0 12px; line-height: 1.4; }
.cau-hoi:focus { outline: none; }
.tien-do { font-size: 0.9rem; font-weight: 600; color: var(--chu-than); }
.ds-dap-an { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.dap-an {
  display: block; width: 100%; text-align: left; font: inherit; color: var(--nau-tram);
  min-height: 48px; padding: 12px 14px; background: #fff; border: 2px solid #B9A998; border-radius: 10px; cursor: pointer;
}
.dap-an:not([disabled]):hover { border-color: var(--chu-de-main); background: var(--chu-de-soft); }
.dap-an[disabled] { cursor: default; color: var(--nau-tram); }
.dap-an.dung { border-color: #2F6B2F; background: #E4F1E1; border-width: 3px; font-weight: 700; }
.dap-an.sai { border-color: #9A2B1B; background: #FBE4DF; border-style: dashed; border-width: 3px; font-weight: 700; }
.phan-hoi { margin: 14px 0; padding: 12px 14px; border-radius: 10px; border-left: 6px solid; background: var(--cat); }
.phan-hoi.dung { border-color: #2F6B2F; }
.phan-hoi.sai { border-color: #9A2B1B; }
.phan-hoi p { margin-top: 6px; }
.diem { font-size: 1.6rem; font-weight: 800; margin: 12px 0; }
.diem:focus { outline: none; }
.cau-sai { padding-left: 24px; display: flex; flex-direction: column; gap: 14px; }
.cau-sai p { margin-top: 4px; }
.hang-nut { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.nut-phu { background: #fff; color: var(--nau-tram); border: 2px solid var(--chu-de-main); }
.the-hoi { background: var(--cat); border-radius: 12px; padding: 14px; margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.the-hoi .cau-hoi { margin: 0; }
.the-hoi .nut { align-self: flex-start; }
.nhan-tl { font-weight: 600; }
textarea.tra-loi { min-height: 120px; }
.goi-y summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.goi-y p { padding: 4px 0 8px; }
.ket-qua { background: #fff; border-radius: 10px; padding: 12px 14px; border: 1px solid #D9CDBF; }
.diem-cham { font-size: 1.3rem; font-weight: 800; }
.haha-noi { display: flex; align-items: flex-start; gap: 12px; margin: 10px 0; }
.haha-nho { width: 64px; flex: none; }
.haha-bong { position: relative; flex: 1 1 0; min-width: 0; margin: 0; padding: 10px 12px; background: #FFF4E3; color: var(--nau-tram); border: 2px solid var(--nau-go); border-radius: 12px; overflow-wrap: anywhere; }
.haha-bong::before { content: ''; position: absolute; left: -9px; top: 18px; width: 14px; height: 14px; background: #FFF4E3; border-left: 2px solid var(--nau-go); border-bottom: 2px solid var(--nau-go); transform: rotate(45deg); }
.nguon { margin: 8px 0; }
.nguon a { display: inline-block; min-height: 44px; padding: 10px 0; }

/* ===== Giao diện Task 7: hướng dẫn người mới ===== */
.khoi-bat-dau { margin: 18px 0; border-left: 6px solid var(--chu-de-main); display: flex; flex-direction: column; gap: 10px; }
.khoi-bat-dau .muc { margin: 0; font-size: 1.3rem; }
.khoi-bat-dau .hang-nut { align-items: center; margin-top: 4px; }
.lien-ket-nut { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 4px; font-weight: 600; }
.dong-demo { margin: 6px 0 0; }
.cho-video { aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; margin: 14px 0; border: 2px dashed #B9A998; text-align: center; }
.cho-video-chu { font-weight: 700; color: var(--nau-tram); }
.ds-buoc { list-style: none; counter-reset: none; display: flex; flex-direction: column; gap: 10px; }
.buoc { background: #fff; border: 1.5px solid #D9CDBF; border-left: 6px solid #D9CDBF; border-radius: 10px; padding: 12px 14px; }
.buoc-dau { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.buoc-ten { color: var(--nau-tram); }
.buoc-huong-dan { margin-top: 4px; }
.buoc-nhan { font-size: 0.8rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; border: 1.5px solid var(--nau-go); color: var(--nau-tram); background: var(--cat); }
.buoc[aria-current=step] { border-color: var(--chu-de-main); border-left-color: var(--chu-de-main); background: var(--chu-de-soft); box-shadow: 0 0 0 2px var(--chu-de-main); }
.buoc[aria-current=step] .buoc-nhan { background: var(--chu-de-main); color: var(--chu-de-on); border-color: var(--chu-de-main); }
.buoc-xong { border-left-color: #2F6B2F; }
.buoc-xong .buoc-nhan { border-color: #2F6B2F; background: #E4F1E1; }
.buoc .nut-phu { margin-top: 8px; }
.danh-sach-buoc { margin: 14px 0 0; }
.danh-sach-buoc .muc { margin-top: 0; }
.chuc-mung { font-weight: 700; margin: 6px 0 12px; }
.nhan-mau { display: inline-block; margin: 8px 0 0; padding: 8px 12px; border-radius: 8px; border: 2px dashed var(--nau-go); background: #FBE9D0; color: var(--nau-tram); font-weight: 700; }
.thay-bai { display: flex; flex-direction: column; gap: 8px; padding: 6px 0; }
.thay-bai label { font-weight: 600; }
.thay-bai .nut { align-self: flex-start; }
textarea.o-ngan { min-height: 100px; }

/* Haha, mèo cam */
.haha-the { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 16px 0; }
.haha-hinh { width: 100%; max-width: 180px; flex: none; }
.haha-svg { display: block; width: 100%; height: auto; overflow: visible; }
.haha-loi { width: 100%; min-width: 0; }
.haha-loi p + p, .haha-loi .haha-vai { margin-top: 8px; }
.haha-tieu-de { margin-top: 0; font-weight: 800; color: var(--nau-tram); }
.haha-vai { list-style: disc; padding-left: 22px; }
.haha-vai li + li { margin-top: 6px; }
.haha-vai-sap { list-style: none; margin-left: -22px; padding: 8px 12px; border: 2px dashed var(--nau-go); border-radius: 10px; background: var(--kem); }
.haha-nhan { display: inline-block; margin-right: 8px; padding: 0 8px; border-radius: 99px; background: var(--nau-dam); color: var(--kem); font-size: 0.8rem; font-weight: 700; }
.haha-gon { flex-direction: row; align-items: center; }
.haha-gon .haha-hinh { width: 84px; }
@media (min-width: 560px) {
  .haha-the:not(.haha-gon) { flex-direction: row; align-items: flex-start; gap: 20px; }
}
.haha-svg [data-part] { transform-box: fill-box; }
/* Tay phải xoay quanh vai (142,112 trong khung vẽ); đuôi quanh gốc đuôi. */
.haha-svg [data-part="tay-phai"] { transform-box: view-box; transform-origin: 142px 112px; }
.haha-svg[data-state="chao"] [data-part="tay-phai"] { transform: rotate(-150deg); }
@media (prefers-reduced-motion: no-preference) {
  .haha-svg[data-state="chao"] [data-part="tay-phai"] { animation: haha-vay 1.8s ease-in-out alternate; animation-iteration-count: 4; }
  .haha-svg[data-state="chao"] [data-part="duoi"] { transform-origin: 0% 100%; animation: haha-duoi 3.2s ease-in-out alternate; animation-iteration-count: 4; }
}
@keyframes haha-vay { from { transform: rotate(-136deg); } to { transform: rotate(-166deg); } }
@keyframes haha-duoi { from { transform: rotate(-4deg); } to { transform: rotate(5deg); } }
