/* Bản web "Đề thi lớp 1": cùng bảng màu và cỡ chữ với app điện thoại. */
:root {
  --chinh: #FF7A2F; --chinh-dam: #E8601A; --phu: #FFE3D1; --nen: #FFF8F0; --nen-o: #FFF0E3;
  --toan: #2F7BFF; --tieng-viet: #FF5C8A; --dung: #2EB872; --sai: #F04438;
  --chu: #2B2B3A; --chu-phu: #6B6B7B; --vien: #E3E3EA;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--nen); color: var(--chu); font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 26px; } h3 { font-size: 20px; margin-top: 8px; }
a { color: var(--chinh-dam); }
main { max-width: 600px; margin: 0 auto; }
.cot { display: flex; flex-direction: column; gap: 10px; }
.cot.rong { gap: 16px; padding: 12px 16px 32px; }
.giua { display: flex; justify-content: center; }
.giua-chu { text-align: center; }
.chu-phu { color: var(--chu-phu); } .nho { font-size: 14px; }
.goi-y { font-size: 14px; color: var(--chu-phu); } .goi-y.xanh { color: var(--dung); }

/* Thanh tiêu đề */
.thanh-tieu-de { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 6px 12px; background: var(--chinh); color: #fff; }
.thanh-tieu-de h1 { flex: 1; font-size: 19px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nut-lui { width: 40px; height: 40px; border: 0; border-radius: 20px; background: rgba(255,255,255,.2); color: #fff; font-size: 22px; line-height: 1; }

/* Nút */
.nut { min-height: 52px; padding: 10px 20px; border-radius: 26px; border: 2px solid var(--chinh); font-size: 18px; font-weight: 600; }
.nut.chinh { background: var(--chinh); color: #fff; }
.nut.phu { background: #fff; color: var(--chinh-dam); }
.nut.nho { min-height: 44px; padding: 6px 18px; font-size: 16px; align-self: flex-start; }
.nut:active, .the:active, .nut-de:active { transform: scale(.98); }
.nut-chu { border: 0; background: none; color: var(--chinh-dam); font-weight: 600; padding: 10px; }
.hang-nut { display: flex; justify-content: center; gap: 16px; }
.hang-nut .nut.nho { align-self: auto; }

/* Lưới */
.luoi { display: grid; gap: 10px; }
.luoi.mot-cot { grid-template-columns: 1fr; } .luoi.hai-cot { grid-template-columns: 1fr 1fr; }
.luoi.ba-cot { grid-template-columns: repeat(3, 1fr); gap: 8px; } .luoi.bon-cot { grid-template-columns: repeat(4, 1fr); gap: 8px; }

/* Đăng nhập, trang chủ */
.dang-nhap { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 40px 28px 28px; text-align: center; }
.dang-nhap h2 { font-size: 32px; }
.logo { border-radius: 28px; box-shadow: 0 8px 18px rgba(255,122,47,.35); }
.the-gioi-thieu { align-self: stretch; display: flex; flex-direction: column; gap: 10px; margin: 16px 0 10px; padding: 16px; list-style: none; background: #fff; border-radius: 18px; box-shadow: 0 2px 8px rgba(0,0,0,.06); text-align: left; font-size: 16px; }
.the-gioi-thieu li { display: flex; align-items: center; gap: 12px; } .the-gioi-thieu span { font-size: 22px; flex-shrink: 0; }
.khung-google { min-height: 44px; display: flex; justify-content: center; align-items: center; color: var(--chu-phu); font-size: 14px; }
.the-mon { display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 24px; padding: 22px 20px; color: #fff; text-align: left; }
.the-mon.toan { background: var(--toan); box-shadow: 0 6px 14px rgba(47,123,255,.35); }
.the-mon.tieng-viet { background: var(--tieng-viet); box-shadow: 0 6px 14px rgba(255,92,138,.35); }
.ten-mon { display: flex; flex-direction: column; gap: 4px; font-size: 14px; } .ten-mon b { font-size: 30px; font-weight: 600; }
.bieu-tuong-mon { font-size: 52px; line-height: 1; }
.the-luot { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: #fff; border-radius: 18px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.ve { font-size: 26px; }

/* Chọn đề */
.toan { --mau-mon: var(--toan); } .tieng-viet { --mau-mon: var(--tieng-viet); }
.nut-de { height: 64px; border: 0; border-radius: 20px; background: var(--mau-mon); color: #fff; font-size: 18px; font-weight: 600; }
.nut-de.nho { height: 48px; border: 2px solid var(--mau-mon); border-radius: 14px; background: #fff; color: var(--mau-mon); font-size: 15px; padding: 0; }

/* Làm bài */
.dai-dong-ho { position: sticky; top: 52px; z-index: 4; display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; background: var(--phu); color: var(--chu-phu); font-size: 15px; }
.dong-ho { font-weight: 600; color: var(--chinh-dam); font-variant-numeric: tabular-nums; }
.the-ghi-chu { padding: 14px 16px; background: var(--phu); border-radius: 18px; font-size: 15px; }
.doan-van { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: #FFFBEA; border-radius: 18px; font-size: 21px; line-height: 1.5; white-space: pre-line; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.doan-van.nho { font-size: 18px; }
.the-cau { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: #fff; border-radius: 18px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.dau-cau { display: flex; align-items: center; gap: 8px; }
.so-cau { padding: 4px 12px; border-radius: 12px; background: var(--chinh); color: #fff; font-weight: 600; font-size: 16px; }
.diem-cau { flex: 1; font-size: 14px; color: var(--chu-phu); }
.nut-loa { width: 48px; height: 44px; border: 0; border-radius: 22px; background: var(--phu); font-size: 20px; }
.de-bai { font-size: 21px; white-space: pre-line; overflow-wrap: anywhere; }
.minh-hoa-chu { font-size: 34px; text-align: center; white-space: pre-line; overflow-wrap: anywhere; line-height: 1.35; }
.minh-hoa-chu.nho { font-size: 18px; }

/* Ảnh thư viện */
.nhom-anh { display: inline-grid; gap: 4px; vertical-align: middle; }
.nhom-anh img { display: block; object-fit: contain; user-select: none; }
.anh-gach { position: relative; display: block; } .anh-gach img { opacity: .55; }
.anh-gach span { position: absolute; inset: 0; } .anh-gach svg { width: 100%; height: 100%; display: block; }
.day-anh { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; }
.khung-nhom-anh { margin: 4px; padding: 6px; border: 1.5px solid var(--vien); border-radius: 12px; }
.dau-cong { margin: 0 8px; font-size: 30px; font-weight: 600; color: var(--chinh); }

/* Thẻ lựa chọn */
.the { min-height: 52px; padding: 10px 14px; border: 2px solid var(--vien); border-radius: 16px; background: #fff; color: var(--chu); font-size: 20px; overflow-wrap: anywhere; }
.the.nho { font-size: 16px; padding: 8px 4px; }
.the.chon { background: var(--mau-chon, var(--chinh)); border-color: var(--mau-chon, var(--chinh)); color: #fff; }
.the.dang-cho { border-color: var(--chinh); border-width: 4px; }
.the.co-anh { padding: 6px; }
.the-trong { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 100%; padding: 6px; border-radius: 12px; background: #fff; }
.the-nhan { font-size: 16px; font-weight: 600; color: var(--chu-phu); }
.vung-the { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.vung-the.giua-ngang { justify-content: center; }
.vung-sap-xep { min-height: 64px; padding: 8px; border: 2px dashed var(--chinh); border-radius: 14px; }

/* Điền, phép tính */
.dien { display: flex; flex-wrap: wrap; align-items: center; }
.dien .tu { font-size: 21px; margin: 4px 6px 4px 0; } .dien .ngat { flex-basis: 100%; height: 0; }
.o-go { width: 84px; height: 52px; margin: 4px; padding: 0 4px; border: 0; border-bottom: 2px solid var(--chinh); border-radius: 8px 8px 0 0; background: var(--nen-o); color: var(--chinh-dam); font-size: 22px; text-align: center; }
.o-go:focus { outline: 2px solid var(--chinh); }
.o-dau { min-width: 62px; height: 52px; margin: 4px 10px 4px 6px; padding: 0; border: 2px solid var(--chinh); border-radius: 12px; background: var(--nen-o); color: var(--chinh-dam); font-size: 26px; font-weight: 600; }
.o-dau.dai { padding: 0 10px; } .o-dau.chon { background: var(--chinh); color: #fff; }
.hang-phep { display: flex; justify-content: center; align-items: center; gap: 2px; }
.hang-phep .o-go { width: 58px; margin: 2px; flex-shrink: 1; min-width: 40px; }
.hang-phep .o-dau { min-width: 52px; margin: 2px 4px; flex-shrink: 0; }
.bang { margin: 0 2px; font-size: 26px; font-weight: 600; }
.day-dat-tinh { display: flex; flex-wrap: wrap; justify-content: space-around; }
.khung-dat-tinh { margin: 4px 8px 12px; } .de-dat-tinh { margin-bottom: 6px; font-size: 20px; font-weight: 600; text-align: center; }
.luoi-dat-tinh { display: grid; grid-template-columns: 70px repeat(4, 46px); gap: 4px; align-items: center; }
.luoi-dat-tinh .o-go { width: 46px; margin: 0; font-size: 24px; } .luoi-dat-tinh .o-dau { margin: 0; min-width: 58px; }
.gach-tinh { grid-column: 1 / -1; height: 3px; background: var(--chu); }

/* Phân loại, Đúng/Sai, nối */
.khung-nhom { min-height: 120px; padding: 8px; border: 2px solid var(--vien); border-radius: 16px; background: #fff; cursor: pointer; }
.khung-nhom.chon { border: 3px solid var(--mau-nhom); background: color-mix(in srgb, var(--mau-nhom) 8%, #fff); }
.ten-nhom { margin-bottom: 6px; font-size: 16px; font-weight: 600; text-align: center; } .khung-nhom.chon .ten-nhom { color: var(--mau-nhom); }
.dong-ds { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border: 1px solid var(--vien); border-radius: 14px; }
.chu-ds { flex: 1; font-size: 22px; font-weight: 600; overflow-wrap: anywhere; }
.the.o-ds { width: 52px; height: 52px; padding: 0; border-radius: 10px; font-size: 22px; font-weight: 600; flex-shrink: 0; }
.luoi-noi { position: relative; display: grid; grid-template-columns: 1fr 1fr; column-gap: 56px; row-gap: 10px; margin-top: 8px; }
.lop-noi { position: absolute; inset: 0; pointer-events: none; } .lop-noi svg { display: block; }
.luoi-noi .the { position: relative; z-index: 1; }

/* Đồng hồ, lịch, hình, chuỗi tính */
.to-lich { width: 196px; border: 2px solid #C9C9D3; border-radius: 12px; background: #fff; overflow: hidden; text-align: center; }
.lich-thang { padding: 10px 0; background: #E53935; color: #fff; font-size: 18px; }
.lich-ngay { font-size: 88px; line-height: 1.25; } .lich-thu { padding-bottom: 12px; font-size: 24px; } .do { color: #E53935; }
.day-hinh { display: flex; flex-wrap: wrap; justify-content: center; } .o-hinh { margin: 4px; text-align: center; }
.so-hinh { font-size: 16px; font-weight: 600; color: var(--chu-phu); }
.chuoi { display: flex; flex-wrap: wrap; align-items: center; }
.chuoi-dau, .chuoi-sao { position: relative; display: grid; place-items: center; margin: 4px 0; }
.chuoi-dau > *, .chuoi-sao > * { grid-area: 1 / 1; } .chuoi-dau b { font-size: 24px; font-weight: 600; }
.chuoi-o { display: flex; align-items: center; gap: 2px; margin: 4px 0; }
.chuoi-buoc { display: flex; flex-direction: column; align-items: center; } .chuoi-buoc b { font-size: 19px; font-weight: 600; color: var(--chinh); }
.o-go.o-chuoi { width: 70px; margin: 0; } .o-go.o-chuoi.cuoi { width: 58px; margin-top: 14px; }
.o-hoi { display: grid; place-items: center; width: 64px; height: 44px; border: 2px solid var(--chu); background: #fff; font-size: 20px; color: var(--chu-phu); }
.o-hoi.cuoi { width: 52px; margin-top: 14px; }

/* Đọc to, tự luận */
.bai-doc { padding: 12px 16px; border: 1px solid #F2E3A6; border-radius: 14px; background: #FFFBEA; font-size: 26px; font-weight: 600; white-space: pre-line; }
.khung-viet { position: relative; border: 2px solid var(--vien); border-radius: 14px; overflow: hidden; background: #fff repeating-linear-gradient(to bottom, transparent 0 55px, #DCE6FF 55px 56px); }
.bang-ve { display: block; width: 100%; height: 230px; touch-action: none; cursor: crosshair; }
.nut-xoa { position: absolute; top: 6px; right: 6px; height: 36px; padding: 4px 12px; border: 0; border-radius: 18px; background: #F2F2F7; font-size: 14px; }
.o-tu-luan { width: 100%; min-height: 100px; padding: 10px; border: 0; border-radius: 12px; background: var(--nen-o); font-size: 20px; resize: vertical; }
.khung-chup { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 2px dashed var(--vien); border-radius: 14px; }
.khung-chup .nut.nho { align-self: stretch; }
.huong-dan-chup { margin: 16px 8px; font-size: 16px; text-align: center; }
.anh-vo, .anh-bai-lam { max-width: 100%; max-height: 320px; object-fit: contain; background: #fff; align-self: center; } .anh-bai-lam { max-height: 160px; border: 1px solid var(--vien); border-radius: 8px; }

/* Kết quả, lịch sử */
.the-diem { display: flex; flex-direction: column; gap: 6px; padding: 16px; background: #fff; border-radius: 18px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.the-diem .nut.nho { align-self: center; }
.sao { font-size: 40px; line-height: 1.2; } .diem-lon { font-size: 56px; font-weight: 600; color: var(--chinh); line-height: 1.1; }
.the-diem .chu-phu + .chu-phu, .diem-lon + .chu-phu { font-size: 20px; }
.nhan-xet-chung { margin-top: 8px; text-align: left; white-space: pre-line; }
.chua { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px dashed var(--vien); font-size: 16px; }
.ket-luan { font-weight: 600; } .ket-luan.dung { color: var(--dung); } .ket-luan.mot-phan { color: #C98A00; } .ket-luan.sai { color: var(--sai); }
.dong-chua { overflow-wrap: anywhere; white-space: pre-line; } .nhan-xet { font-size: 15px; color: var(--chu-phu); white-space: pre-line; }
.dong-lich-su { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 0; border-radius: 18px; background: #fff; text-align: left; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.dong-lich-su .bieu-tuong { font-size: 30px; } .giua-dong { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.diem-dong { font-size: 24px; font-weight: 600; color: var(--chinh); }

/* Mua gói, nạp tiền */
.the-luot.cot-so-du { flex-direction: column; align-items: flex-start; gap: 4px; } .so-du { font-size: 18px; }
.hang-tien { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.o-tien { flex: 1; min-width: 160px; height: 52px; padding: 0 12px; border: 2px solid var(--vien); border-radius: 12px; background: #fff; font-size: 18px; }
.o-tien:focus { outline: 2px solid var(--chinh); } .nhan-tien { font-size: 18px; color: var(--chinh-dam); }
.anh-qr { width: 100%; max-width: 300px; aspect-ratio: 1; object-fit: contain; align-self: center; background: #fff; }
.thong-tin-ck { white-space: pre-line; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }

/* Chương trình, giới thiệu, thông tin */
.nut-tieu-de { border: 0; border-radius: 18px; padding: 8px 12px; background: rgba(255,255,255,.2); color: #fff; font-size: 15px; white-space: nowrap; }
.the-cau.chu-nho { font-size: 15px; white-space: pre-line; }
.the-cau.dong-tuan { flex-direction: row; align-items: flex-start; }
.o-tuan { flex-shrink: 0; width: 58px; padding: 6px 0; border-radius: 12px; background: var(--mau-mon); color: #fff; font-size: 15px; font-weight: 600; text-align: center; white-space: pre-line; line-height: 1.3; }
.ma-gioi-thieu { font-size: 40px; font-weight: 600; letter-spacing: 6px; text-align: center; color: var(--chinh); }
.dong-thong-tin { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.dong-thong-tin > :last-child { text-align: right; overflow-wrap: anywhere; min-width: 0; }
a.nut { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.nut-chu.do { color: var(--sai); font-weight: 400; align-self: center; }

/* Hộp thoại, lớp chờ */
.hop { width: min(360px, calc(100vw - 32px)); padding: 16px 20px; border: 0; border-radius: 20px; color: var(--chu); }
.hop::backdrop { background: rgba(0,0,0,.4); }
.hop-tieu-de { margin-bottom: 12px; font-size: 18px; font-weight: 600; text-align: center; }
.hop-noi-dung { margin-bottom: 16px; white-space: pre-line; }
.hop-nut { display: flex; justify-content: flex-end; gap: 10px; } .hop-nut .nut.nho { align-self: auto; }
.hop-dau { display: grid; grid-template-columns: repeat(3, 72px); justify-content: center; gap: 12px; }
.hop-dau.dai { grid-template-columns: repeat(2, minmax(72px, auto)); }
.nut-dau { min-width: 72px; height: 72px; padding: 0 10px; border: 2px solid var(--chinh); border-radius: 18px; background: var(--nen-o); color: var(--chinh-dam); font-size: 32px; font-weight: 600; }
.hop-dau.dai .nut-dau { font-size: 24px; padding: 0 14px; } .nut-dau.chon { background: var(--chinh); color: #fff; }
.lop-cho { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; background: rgba(255,248,240,.94); text-align: center; font-size: 19px; font-weight: 600; }
.quay { width: 56px; height: 56px; border: 6px solid var(--phu); border-top-color: var(--chinh); border-radius: 50%; animation: quay 1s linear infinite; }
@keyframes quay { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .quay { animation-duration: 3s; } }

/* Trang đề mẫu tĩnh (toan/, tieng-viet/): nút và thẻ là thẻ <a>. */
a.nut, a.the-mon, a.nut-lui, a.the-cau { text-decoration: none; }
a.nut, a.nut-lui { display: flex; align-items: center; justify-content: center; text-align: center; }
a.the-cau { color: inherit; }
a.the-cau:hover, a.the-cau:focus-visible { outline: 2px solid var(--mau-mon); }
.xem-de { color: var(--mau-mon); font-size: 15px; font-weight: 600; }
.chu-phu.nho a { display: inline-block; padding: 6px 2px; }
