/* =========================================================
   MIMI — MÀU VÀ PHÔNG
   Muốn đổi màu cả trang: chỉ sửa trong :root.
   ========================================================= */
@font-face { font-family: "Be Vietnam Pro"; font-weight: 400; font-display: swap; src: url("fonts/BeVietnamPro-Regular.ttf") format("truetype"); }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 600; font-display: swap; src: url("fonts/BeVietnamPro-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 800; font-display: swap; src: url("fonts/BeVietnamPro-ExtraBold.ttf") format("truetype"); }

:root {
  --cam: #E8833A;        /* cam lông sóc: điểm nhấn chính */
  --cam-dam: #A9501A;    /* chữ cam trên nền sáng */
  --cam-nhat: #FFE9D4;   /* nền khối nhấn */
  --kem: #FFF8EE;        /* nền trang */
  --trang: #FFFFFF;
  --nau: #3D2716;        /* chữ chính */
  --nau-nhat: #7A6252;   /* chữ phụ */
  --vien: #F0DCC6;
  --xanh: #1F7A64;       /* nút chính */
  --xanh-nhat: #DDF3EC;
  --dung: #2E8B57;
  --dung-nen: #E2F5E9;
  --sai: #C0392B;
  --sai-nen: #FBE3E0;
  --vang: #FFD166;
  --bong: 0 4px 0 #F0DCC6;
  --bo: 18px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--kem);
  color: var(--nau);
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
.khung { max-width: 640px; margin: 0 auto; padding: 0 16px; }
main.khung { padding-top: 16px; padding-bottom: 24px; min-height: 80vh; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 8px; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 800; }
p { margin: 0 0 12px; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--cam-dam); }

/* ---------- Đầu trang có sóc Mimi ---------- */
.dau { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.dau .soc { width: 92px; height: 92px; flex: none; }
.bong-noi {
  position: relative; background: var(--trang); border: 2px solid var(--vien);
  border-radius: var(--bo); padding: 10px 14px; font-weight: 600;
}
.bong-noi::before {
  content: ""; position: absolute; left: -9px; top: 50%; transform: translateY(-50%) rotate(45deg);
  width: 14px; height: 14px; background: var(--trang);
  border-left: 2px solid var(--vien); border-bottom: 2px solid var(--vien);
}
.ten-web { font-size: 0.85rem; color: var(--cam-dam); font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }

/* ---------- Thống kê ---------- */
.thong-ke { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.o-so { background: var(--trang); border: 2px solid var(--vien); border-radius: 14px; padding: 10px 8px; text-align: center; }
.o-so b { display: block; font-size: 1.4rem; font-weight: 800; color: var(--cam-dam); line-height: 1.2; }
.o-so span { font-size: 0.78rem; color: var(--nau-nhat); }

/* ---------- Chọn mức TOEIC ---------- */
.nhan { font-weight: 800; margin: 0 0 8px; }
.chon-muc { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 22px; }
.chip {
  background: var(--trang); border: 2px solid var(--vien); border-radius: 14px;
  padding: 8px 4px; text-align: center; font-weight: 800; line-height: 1.25;
}
.chip small { display: block; font-weight: 400; font-size: 0.75rem; color: var(--nau-nhat); }
.chip[aria-pressed="true"] { background: var(--cam); border-color: var(--cam); color: #fff; }
.chip[aria-pressed="true"] small { color: #fff; }

/* ---------- Lưới chủ đề ---------- */
.luoi { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.the-chu-de {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  background: var(--trang); border: 2px solid var(--vien); border-radius: var(--bo);
  padding: 14px; box-shadow: var(--bong); min-height: 118px; text-decoration: none; color: var(--nau);
}
.the-chu-de .bieu-tuong { font-size: 1.7rem; line-height: 1; }
.the-chu-de b { font-weight: 800; line-height: 1.3; }
.the-chu-de .phu { font-size: 0.78rem; color: var(--nau-nhat); margin-top: auto; }
.the-chu-de.sap-co { opacity: .6; box-shadow: none; cursor: default; }
.the-chu-de:not(.sap-co):active { transform: translateY(2px); box-shadow: 0 2px 0 var(--vien); }

/* ---------- Trang chủ đề ---------- */
.quay-lai { background: none; border: 0; padding: 6px 0; font-weight: 600; color: var(--cam-dam); margin-bottom: 6px; }
.tab { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--cam-nhat); padding: 5px; border-radius: 16px; margin: 12px 0 18px; }
.tab button { border: 0; background: none; border-radius: 12px; padding: 9px 4px; font-weight: 600; font-size: 0.9rem; line-height: 1.25; }
.tab button[aria-selected="true"] { background: var(--trang); font-weight: 800; color: var(--cam-dam); box-shadow: 0 2px 0 var(--vien); }
.muc-nho { display: flex; gap: 6px; flex-wrap: wrap; }
.muc-nho .chip { padding: 6px 12px; font-size: 0.85rem; }

/* ---------- Thẻ lật ---------- */
.dem { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--nau-nhat); margin-bottom: 8px; }
.the-lat { height: 300px; margin-bottom: 14px; }
.the-lat .ruot { position: relative; width: 100%; height: 100%; cursor: pointer; }
.mat {
  position: absolute; inset: 0;
  background: var(--trang); border: 2px solid var(--vien); border-radius: 22px; box-shadow: var(--bong);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; text-align: center;
}
.mat.sau { display: none; background: var(--cam-nhat); }
.the-lat.da-lat .mat.truoc { display: none; }
.the-lat.da-lat .mat.sau { display: flex; }
.the-lat.vua-lat .ruot { animation: lat .35s ease; }
@keyframes lat { 0% { transform: scaleX(.05); } 100% { transform: scaleX(1); } }
.mat .tu { font-size: 2rem; font-weight: 800; line-height: 1.2; word-break: break-word; }
.mat .loai { color: var(--nau-nhat); font-size: 0.9rem; margin: 4px 0 14px; }
.mat .nghia { font-size: 1.35rem; font-weight: 800; color: var(--cam-dam); margin-bottom: 12px; }
.mat .vd { font-weight: 600; margin-bottom: 4px; }
.mat .dich { color: var(--nau-nhat); font-size: 0.92rem; margin: 0; }
.goi-y { font-size: 0.8rem; color: var(--nau-nhat); position: absolute; bottom: 12px; }
.da-thuoc-dau { position: absolute; top: 12px; right: 14px; font-size: 0.78rem; font-weight: 800; color: var(--dung); }

.nut-loa {
  border: 2px solid var(--vien); background: var(--trang); border-radius: 999px;
  padding: 6px 14px; font-weight: 600; font-size: 0.9rem;
}
.hang-nut { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.nut {
  border: 0; border-radius: 16px; padding: 13px 12px; font-weight: 800; text-align: center;
  background: var(--xanh); color: #fff; box-shadow: 0 4px 0 #155746;
}
.nut:active { transform: translateY(2px); box-shadow: 0 2px 0 #155746; }
.nut.phu { background: var(--trang); color: var(--nau); border: 2px solid var(--vien); box-shadow: var(--bong); }
.nut.cam { background: var(--cam); box-shadow: 0 4px 0 #B8601F; }
.nut:disabled { opacity: .5; cursor: default; }
.dieu-huong { display: flex; justify-content: space-between; margin-top: 12px; }
.dieu-huong button { background: none; border: 0; color: var(--cam-dam); font-weight: 600; padding: 8px 4px; }

/* ---------- Trắc nghiệm ---------- */
.thanh { height: 10px; background: var(--cam-nhat); border-radius: 99px; overflow: hidden; margin-bottom: 16px; }
.thanh i { display: block; height: 100%; background: var(--cam); border-radius: 99px; transition: width .3s; }
.cau-hoi { background: var(--trang); border: 2px solid var(--vien); border-radius: var(--bo); padding: 16px; font-size: 1.1rem; font-weight: 600; margin-bottom: 14px; }
.lua-chon { display: grid; gap: 10px; margin-bottom: 14px; }
.lua-chon button {
  text-align: left; background: var(--trang); border: 2px solid var(--vien); border-radius: 14px;
  padding: 12px 14px; font-weight: 600; box-shadow: var(--bong);
}
.lua-chon button .chu { display: inline-block; width: 1.6em; color: var(--nau-nhat); }
.lua-chon button.dung { background: var(--dung-nen); border-color: var(--dung); color: #1d5e3a; }
.lua-chon button.sai { background: var(--sai-nen); border-color: var(--sai); color: #8e2a20; }
.lua-chon button:disabled { cursor: default; }
.giai-thich { border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; font-size: 0.95rem; }
.giai-thich.dung { background: var(--dung-nen); }
.giai-thich.sai { background: var(--sai-nen); }
.ket-qua { text-align: center; padding: 10px 0; }
.ket-qua .soc { width: 140px; height: 140px; }
.ket-qua .diem { font-size: 2.6rem; font-weight: 800; color: var(--cam-dam); line-height: 1.1; }

/* ---------- Phản xạ nói ---------- */
.tinh-huong { background: var(--trang); border: 2px solid var(--vien); border-radius: var(--bo); padding: 16px; margin-bottom: 16px; }
.tinh-huong .nhan-nho { font-size: 0.78rem; font-weight: 800; color: var(--cam-dam); text-transform: uppercase; letter-spacing: .04em; }
.tinh-huong p { font-size: 1.08rem; font-weight: 600; margin: 4px 0 0; }
.nut-mic {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  border: 0; border-radius: 999px; padding: 16px; font-weight: 800; font-size: 1.05rem;
  background: var(--cam); color: #fff; box-shadow: 0 4px 0 #B8601F; margin-bottom: 12px;
}
.nut-mic.dang-nghe { background: var(--sai); box-shadow: 0 4px 0 #8e2a20; animation: nhip 1s infinite; }
@keyframes nhip { 50% { transform: scale(1.03); } }
.hop { border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; background: var(--trang); border: 2px solid var(--vien); }
.hop .nhan-nho { font-size: 0.78rem; font-weight: 800; color: var(--nau-nhat); }
.hop.mau { background: var(--xanh-nhat); border-color: #BFE6D9; }
.tu-khop { color: var(--dung); font-weight: 800; }
.tu-thieu { color: var(--sai); text-decoration: underline wavy; text-underline-offset: 3px; }
.thong-bao { background: var(--cam-nhat); border-radius: 14px; padding: 12px 14px; font-size: 0.92rem; margin-bottom: 14px; }

/* ---------- Phiên âm, câu 3 dòng, nút nghe ---------- */
.ipa { font-family: "Segoe UI", "Lucida Sans Unicode", "DejaVu Sans", "Noto Sans", Arial, sans-serif; color: #8A5A3A; font-size: 0.95rem; }
.ipa.lon { font-size: 1.15rem; margin-top: 2px; }
.en { font-weight: 800; font-size: 1.05rem; line-height: 1.4; }
.vi { color: var(--nau-nhat); font-size: 0.92rem; margin: 2px 0 8px; }
.en-nho { font-weight: 800; color: var(--cam-dam); }
.cum-nghe { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.nut-loa.nho { padding: 2px 8px; font-size: 0.8rem; }

/* ---------- Khối luyện phát âm ---------- */
.khoi-luyen { background: var(--trang); border: 2px solid var(--vien); border-radius: var(--bo); padding: 14px; margin: 18px 0 14px; }
.khoi-luyen h3 { font-size: 1.02rem; font-weight: 800; }
.the-cau { background: var(--xanh-nhat); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; }
.meo-rieng { background: var(--cam-nhat); border-radius: 12px; padding: 9px 12px; font-size: 0.9rem; margin-bottom: 12px; }
.ghi-chu { font-size: 0.75rem; color: var(--nau-nhat); margin: 8px 0 0; }
.ket-qua-noi { border-radius: 14px; padding: 12px 14px; border: 2px solid var(--vien); margin-bottom: 4px; }
.ket-qua-noi.tot { background: var(--dung-nen); border-color: #BFE3CC; }
.ket-qua-noi.kha { background: #FFF4D6; border-color: #F2DFA6; }
.ket-qua-noi.can { background: var(--sai-nen); border-color: #F1C4BE; }
.dong-diem { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-weight: 600; line-height: 1.35; }
.so-diem { font-size: 1.6rem; font-weight: 800; color: var(--cam-dam); }
.ket-qua-noi .nhan-nho { font-size: 0.72rem; font-weight: 800; color: var(--nau-nhat); letter-spacing: .04em; margin-top: 8px; }
.ket-qua-noi .nghe { font-style: italic; }
.tin-cay { font-size: 0.8rem; color: var(--nau-nhat); margin-top: 6px; }
.gop-y { margin: 4px 0 0; padding-left: 18px; }
.gop-y li { margin-bottom: 6px; }
.meo { font-size: 0.88rem; color: var(--nau); margin-top: 2px; }
.ket-qua-noi .meo-rieng { margin: 8px 0 0; background: rgba(255,255,255,.6); }

/* ---------- Lý do đáp án ---------- */
.ly-do { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.ly-do li { background: rgba(255,255,255,.7); border-radius: 10px; padding: 8px 10px; font-size: 0.9rem; border-left: 4px solid var(--sai); }
.ly-do li.ld-dung { border-left-color: var(--dung); }

/* ---------- Luyện nói: câu ngắn và hội thoại ---------- */
.phan-noi { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.phan-noi button { border: 2px solid var(--vien); background: var(--trang); border-radius: 14px; padding: 10px; font-weight: 800; }
.phan-noi button[aria-pressed="true"] { background: var(--cam); border-color: var(--cam); color: #fff; }
.cong-tac { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--nau); text-align: right; }
.cong-tac input { width: 18px; height: 18px; accent-color: var(--cam); }
.dem { gap: 10px; align-items: center; }
.boi-canh { background: var(--cam-nhat); border-radius: 12px; padding: 9px 12px; font-size: 0.92rem; margin-bottom: 12px; }
.bong { border: 2px solid var(--vien); border-radius: 18px; padding: 12px 14px; margin-bottom: 12px; background: var(--trang); max-width: 94%; }
.bong.trai { border-bottom-left-radius: 6px; }
.bong.phai { margin-left: auto; background: var(--xanh-nhat); border-color: #BFE6D9; border-bottom-right-radius: 6px; }
.bong .ai { font-size: 0.75rem; font-weight: 800; color: var(--cam-dam); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }
.bong .cum-nghe { justify-content: flex-start; }
.noi-ht { margin-top: 10px; }
.noi-ht .nut-mic { padding: 12px; font-size: 0.98rem; margin-bottom: 8px; }
.the-ht { background: var(--trang); border: 2px solid var(--vien); border-radius: var(--bo); padding: 14px; margin-bottom: 12px; }
.the-ht .phu { font-size: 0.85rem; color: var(--nau-nhat); margin-bottom: 10px; }
.the-ht .nut small { font-weight: 400; font-size: 0.78rem; }

/* ---------- Bài hôm nay ---------- */
.the-hom-nay { background: var(--trang); border: 2px solid var(--cam); border-radius: var(--bo); padding: 14px; margin-bottom: 22px; box-shadow: 0 4px 0 #F3C9A2; }
.the-hom-nay .dong-dau { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.the-hom-nay .dong-dau b { font-size: 1.1rem; font-weight: 800; }
.the-hom-nay .dong-dau span { font-size: 0.8rem; color: var(--nau-nhat); }
.dong-tien-do { display: grid; grid-template-columns: 9.5em 1fr 3em; align-items: center; gap: 10px; padding: 8px 0; color: var(--nau); text-decoration: none; font-weight: 600; font-size: 0.92rem; border-top: 1px dashed var(--vien); }
.dong-tien-do b { text-align: right; color: var(--cam-dam); }
.thanh-nho { height: 8px; background: var(--cam-nhat); border-radius: 99px; overflow: hidden; }
.thanh-nho i { display: block; height: 100%; background: var(--cam); border-radius: 99px; }
.tab button small, .phan-noi small { display: block; font-size: 0.72rem; font-weight: 600; opacity: .8; }
a.nut { text-decoration: none; }

/* ---------- Chân trang ---------- */
.chan-trang { font-size: 0.8rem; color: var(--nau-nhat); text-align: center; padding-top: 8px; padding-bottom: 28px; }

@media (min-width: 560px) {
  .luoi { grid-template-columns: repeat(3, 1fr); }
  .the-lat { height: 320px; }
}
@media (prefers-reduced-motion: reduce) {
  .the-lat.vua-lat .ruot { animation: none; }
  .nut-mic.dang-nghe { animation: none; }
}
