/* Giao diện Tra Cứu Thần Số Học247.
   Mọi màu/cỡ chữ lấy từ bộ nhận diện (brand/project/tokens.json) — sửa ở đó rồi chép sang đây,
   đừng tự chế màu mới giữa đường.

   Nền ĐÊM là mặc định của thương hiệu: chủ đề nói về bầu trời và những con số, nền tối làm con
   số vàng nổi lên như chữ dập kim loại. Chủ đề NGÀY dành cho bản in. */
:root {
  /* màu nền */
  --nen-100: #12101C;
  --nen-200: #1B1830;
  --nen-300: #262043;
  /* chữ */
  --chu-100: #F2EDE4;
  --chu-200: #A9A2C0;
  --vien: #312A52;
  /* nhấn: VÀNG chỉ dành cho con số và nút chính */
  --vang-500: #E3B23C;
  --vang-100: #3A2F17;
  --tim-500: #8B7BD8;
  --ngoc-500: #4FB89A;
  --do-500: #F08A7E;
  /* chữ */
  --hien-thi: "Lora", Georgia, "Times New Roman", serif;
  --van-ban: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* bo góc */
  --bo-nho: 10px;
  --bo-vua: 14px;
  --bo-lon: 20px;
  --bo-tron: 999px;
  --do-noi-1: 0 6px 24px rgba(10, 6, 30, .28);
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* Phải đứng trước mọi display: flex/grid/inline-block bên dưới, nếu không thuộc tính
   hidden của HTML bị đè và hộp thoại sẽ hiện sẵn ngay khi mở trang. */
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 0 0 calc(80px + env(safe-area-inset-bottom, 0px));
  background: var(--nen-100);
  color: var(--chu-100);
  font: 16px/26px var(--van-ban);
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- đầu trang */
.dau-trang {
  position: relative;
  overflow: hidden;
  padding: calc(26px + env(safe-area-inset-top, 0px)) 20px 30px;
  text-align: center;
  border-bottom: 1px solid var(--vien);
}
/* Con số mờ rải nền — hình nền duy nhất thương hiệu cho phép, độ mờ dưới 10% */
.dau-trang::before {
  content: "7 2 4 9 1";
  position: absolute; inset: 0;
  font-family: var(--hien-thi); font-size: 84px; letter-spacing: 46px;
  color: var(--tim-500); opacity: .08; pointer-events: none;
  display: grid; place-items: center;
}
.logo { display: grid; grid-template-columns: repeat(3, 13px); gap: 4px;
        justify-content: center; margin-bottom: 14px; }
.logo i { width: 13px; height: 13px; border-radius: 4px;
          border: 2px solid var(--tim-500); opacity: .5; }
.logo i.sang { background: var(--vang-500); border-color: transparent; opacity: 1; }
.dau-trang h1 { position: relative; margin: 0; font-family: var(--hien-thi);
                font-size: 26px; line-height: 34px; font-weight: 600; text-wrap: balance; }
.dau-trang h1 em { font-style: normal; color: var(--vang-500); }
.dau-trang p { position: relative; margin: 8px 0 0; color: var(--chu-200);
               font-size: 12px; letter-spacing: 2.4px; text-transform: uppercase; }
.huy-hieu {
  position: relative; display: inline-block; margin-top: 14px; padding: 6px 14px;
  background: var(--nen-300); border: 1px solid var(--vien);
  border-radius: var(--bo-tron); font-size: 13px; color: var(--chu-200);
}
.huy-hieu.dev { background: var(--vang-100); border-color: var(--vang-500);
                color: var(--vang-500); }

main { max-width: 680px; margin: 0 auto; padding: 20px 16px 0; }

/* ---------------------------------------------------------------- thẻ & form */
.the {
  background: var(--nen-200); border: 1px solid var(--vien); border-radius: var(--bo-lon);
  padding: 20px; margin-bottom: 16px; box-shadow: var(--do-noi-1);
}
label { display: block; font-weight: 600; margin: 16px 0 6px; font-size: 14px; }
label:first-child { margin-top: 0; }
input {
  width: 100%; padding: 13px 14px; font: inherit; color: var(--chu-100);
  border: 1px solid var(--vien); border-radius: var(--bo-vua); background: var(--nen-100);
}
input::placeholder { color: var(--chu-200); opacity: .6; }
input:focus-visible { outline: 2px solid var(--tim-500); outline-offset: 1px; }
.hang-ngay { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 10px; }
.hang-ngay input { text-align: center; letter-spacing: 1px;
                   font-variant-numeric: tabular-nums; }
.ghi-chu { color: var(--chu-200); font-size: 13px; line-height: 20px; margin: 8px 0 0; }
.loi { color: var(--do-500); font-size: 14px; margin: 10px 0 0; }

.nut { width: 100%; padding: 15px; margin-top: 16px; font: inherit; font-weight: 600;
       border: 0; border-radius: var(--bo-vua); cursor: pointer; }
.nut.chinh { background: var(--vang-500); color: #12101C; }
.nut.chinh:hover { filter: brightness(1.08); }
.nut.phu { background: transparent; color: var(--tim-500); border: 1px solid var(--vien); }
.nut:focus-visible { outline: 2px solid var(--tim-500); outline-offset: 2px; }
.nut[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------------------------------------------------------------- kết quả */
.tom-tat { text-align: center; margin: 24px 0 10px; }
.tom-tat h2 { margin: 0; font-family: var(--hien-thi); font-size: 26px; font-weight: 600; }
.tom-tat p { margin: 4px 0 0; color: var(--chu-200); }
.hang-nut { display: flex; gap: 10px; justify-content: center; margin-top: 14px;
            flex-wrap: wrap; }
.nut-nho { border: 1px solid var(--vien); background: transparent; color: var(--tim-500);
           border-radius: var(--bo-tron); padding: 8px 16px; font: inherit; font-size: 13px;
           font-weight: 600; cursor: pointer; }
.nut-nho:hover { border-color: var(--tim-500); }
.muc { margin: 30px 0 12px; font-size: 12px; text-transform: uppercase;
       letter-spacing: 2px; color: var(--chu-200); }

.luoi-the { display: grid; gap: 14px; }
.chi-so { background: var(--nen-200); border: 1px solid var(--vien);
          border-radius: var(--bo-lon); padding: 20px; box-shadow: var(--do-noi-1); }
.chi-so .hang { display: flex; align-items: center; gap: 14px; }
.vien-so {
  flex: 0 0 60px; height: 60px; border-radius: var(--bo-vua); display: grid;
  place-items: center; background: var(--vang-500); color: #12101C;
  font-family: var(--hien-thi); font-size: 28px; font-weight: 600;
}
.vien-so.nhieu { flex: 0 0 auto; width: auto; min-width: 60px; padding: 0 14px;
                 font-family: var(--van-ban); font-size: 15px; white-space: nowrap; }
.chi-so h4 { margin: 0; font-family: var(--hien-thi); font-size: 20px; font-weight: 600; }
.chi-so .ten-chi-so { color: var(--chu-200); font-size: 12px; font-weight: 600;
                      letter-spacing: 1px; text-transform: uppercase; margin: 0 0 3px; }
.tu-khoa { color: var(--vang-500); font-size: 13px; font-weight: 600; margin: 12px 0 0; }
.chi-so p.mo-ta { margin: 10px 0 0; }
.chi-so ul { margin: 10px 0 0; padding-left: 20px; }
.chi-so li { margin: 4px 0; }
.nhan { display: inline-block; font-size: 12px; font-weight: 600; padding: 4px 10px;
        border-radius: var(--bo-tron); margin-top: 12px; }
.nhan.manh { background: rgba(79, 184, 154, .16); color: var(--ngoc-500); }
.nhan.yeu { background: rgba(240, 138, 126, .14); color: var(--do-500); }
.nhan.no { background: var(--vang-100); color: var(--vang-500); }
.cac-buoc { font-size: 13px; color: var(--chu-200); margin-top: 14px;
            font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- vùng khoá */
.khoa { text-align: center; border: 1px dashed var(--tim-500); background: var(--nen-200); }
.o-khoa { font-size: 34px; }
.khoa h3 { margin: 8px 0; font-family: var(--hien-thi); }
.danh-sach-khoa { text-align: left; color: var(--chu-200); font-size: 14px;
                  margin: 14px 0 0; padding-left: 22px; }
.danh-sach-khoa li { margin: 6px 0; }

/* ---------------------------------------------------------------- biểu đồ */
.ten-bd { font-size: 12px; font-weight: 600; color: var(--chu-200);
          text-transform: uppercase; letter-spacing: 2px; margin: 0 0 12px; }
.bieu-do { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.o-bieu-do {
  aspect-ratio: 1; border-radius: var(--bo-vua); display: grid; place-items: center;
  background: var(--nen-300); border: 1px solid var(--vien);
  font-family: var(--hien-thi); font-size: 20px; font-weight: 600; color: var(--tim-500);
}
.o-bieu-do.co { background: var(--vang-500); color: #12101C; border-color: transparent; }

.khia-canh { margin-top: 16px; border-top: 1px solid var(--vien); padding-top: 4px; }
.kc { padding: 12px 0; border-bottom: 1px solid var(--vien); }
.kc:last-child { border-bottom: 0; }
.kc b { display: block; font-size: 12px; color: var(--vang-500); margin-bottom: 3px;
        letter-spacing: .5px; }
.kc p { margin: 0; font-size: 15px; line-height: 24px; }
.canh-bao { background: var(--vang-100); border-left: 3px solid var(--vang-500);
            border-radius: 0 var(--bo-nho) var(--bo-nho) 0; padding: 12px 14px;
            margin: 12px 0 0; font-size: 15px; line-height: 24px; }

.dong-luan { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0;
             border-bottom: 1px solid var(--vien); }
.dong-luan:last-child { border-bottom: 0; }
.dong-luan.trong { opacity: .62; }
.dong-luan .o-nho { flex: 0 0 48px; min-height: 32px; display: grid; place-items: center;
                    border-radius: var(--bo-nho); font-family: var(--hien-thi);
                    font-size: 14px; font-weight: 600; padding: 4px;
                    background: var(--vang-500); color: #12101C; word-break: break-all; }
.dong-luan.trong .o-nho { background: var(--nen-300); color: var(--tim-500); }
.dong-luan b { font-size: 14px; }
.dong-luan small { color: var(--chu-200); }
.dong-luan p { margin: 3px 0 0; }

.mui-ten-item { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; }
.mui-ten-item .cham { flex: 0 0 auto; margin-top: 3px; color: var(--vang-500); }

/* ---------------------------------------------------------------- mục lục */
.muc-luc ol { margin: 0; padding-left: 20px; color: var(--chu-200); }
.muc-luc li { margin: 6px 0; }
.muc-luc a { color: var(--chu-100); text-decoration: none; }
.muc-luc a:hover { color: var(--vang-500); }

/* ---------------------------------------------------------------- vận trình */
.bang-vt { display: grid; grid-template-columns: 1fr; gap: 8px; }
.bang-vt.thang { grid-template-columns: repeat(3, 1fr); }
.o-vt { display: grid; grid-template-columns: 58px 34px 1fr; gap: 10px; align-items: center;
        padding: 10px; border: 1px solid var(--vien); border-radius: var(--bo-vua);
        font-size: 14px; }
/* Ô tháng hẹp (3 cột trên điện thoại) nên nhãn "Th 10" phải cấm xuống dòng,
   không thì chữ "Th" và số tách làm hai hàng, ô cao gấp đôi. */
.bang-vt.thang .o-vt { grid-template-columns: 1fr auto; gap: 6px; padding: 10px 8px; }
.bang-vt.thang .o-vt .nam { white-space: nowrap; }
.o-vt.nay { border-color: var(--vang-500); background: var(--vang-100); }
.o-vt .nam { font-weight: 600; font-variant-numeric: tabular-nums; }
.o-vt .so-vt { width: 32px; height: 32px; border-radius: var(--bo-nho); display: grid;
               place-items: center; background: var(--vang-500); color: #12101C;
               font-family: var(--hien-thi); font-weight: 600; }
.o-vt .dg { color: var(--chu-200); font-size: 13px; line-height: 19px; }
/* Ô tháng là nút bấm được */
button.o-vt { font: inherit; color: inherit; text-align: left; cursor: pointer;
              background: transparent; }
button.o-vt:hover { border-color: var(--tim-500); }
button.o-vt:focus-visible { outline: 2px solid var(--tim-500); outline-offset: 2px; }
button.o-vt.chon { border-color: var(--vang-500); background: var(--vang-100); }

.chi-tiet-thang { margin-top: 14px; border-top: 1px solid var(--vien); padding-top: 16px; }
.chi-tiet-thang .hang { display: flex; align-items: center; gap: 14px; }
.chi-tiet-thang .vien-so { flex: 0 0 48px; height: 48px; font-size: 22px; }
.chi-tiet-thang .ten-chi-so { color: var(--chu-200); font-size: 12px; font-weight: 600;
                              letter-spacing: 1px; text-transform: uppercase; margin: 0 0 3px; }
.chi-tiet-thang h4 { margin: 0; font-family: var(--hien-thi); font-size: 19px;
                     font-weight: 600; }
.chi-tiet-thang .mo-ta { margin: 12px 0 0; }
.nen-tranh { margin: 10px 0 0; padding-left: 12px; border-left: 2px solid var(--vien);
             font-size: 15px; line-height: 24px; }
.nen-tranh.nen { border-left-color: var(--ngoc-500); }
.nen-tranh.nen b { color: var(--ngoc-500); }
.nen-tranh.tranh { border-left-color: var(--do-500); }
.nen-tranh.tranh b { color: var(--do-500); }

/* ---------------------------------------------------------------- nhóm ngành */
.nganh { margin-bottom: 14px; }
.ten-nganh { display: flex; justify-content: space-between; gap: 10px; font-size: 14px;
             margin-bottom: 5px; }
.ten-nganh b { color: var(--vang-500); font-variant-numeric: tabular-nums; }
.thanh { height: 8px; background: var(--nen-300); border-radius: var(--bo-tron);
         overflow: hidden; }
.thanh i { display: block; height: 100%; border-radius: var(--bo-tron);
           background: var(--vang-500); }

/* ---------------------------------------------------------------- tương hợp */
.diem-hop { text-align: center; }
.vong-diem { width: 120px; height: 120px; margin: 4px auto 16px; border-radius: 50%;
             display: grid; place-items: center; align-content: center;
             border: 3px solid var(--vang-500); color: var(--vang-500); }
.vong-diem span { font-family: var(--hien-thi); font-size: 40px; font-weight: 600;
                  line-height: 1; }
.vong-diem small { color: var(--chu-200); font-size: 12px; }

/* ---------------------------------------------------------------- lịch sử */
.the-lich-su { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
               background: var(--nen-200); border: 1px solid var(--vien);
               border-radius: var(--bo-vua); padding: 14px; margin-bottom: 10px;
               cursor: pointer; font: inherit; color: var(--chu-100); }
.the-lich-su:hover { border-color: var(--tim-500); }
.the-lich-su .vien-so { flex: 0 0 44px; height: 44px; font-size: 20px; }
.the-lich-su b { display: block; }
.the-lich-su small { color: var(--chu-200); }
.the-lich-su .xoa { margin-left: auto; background: none; border: 0; color: var(--chu-200);
                    font-size: 18px; padding: 6px; cursor: pointer; font: inherit; }

/* ---------------------------------------------------------------- hộp thoại */
.man-che { position: fixed; inset: 0; background: rgba(6, 4, 16, .72); z-index: 50;
           display: flex; align-items: flex-end; justify-content: center; }
.hop { background: var(--nen-200); width: 100%; max-width: 480px;
       border: 1px solid var(--vien); border-bottom: 0;
       border-radius: var(--bo-lon) var(--bo-lon) 0 0;
       padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
       max-height: 92vh; overflow-y: auto; position: relative; }
.dong { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px;
        border: 1px solid var(--vien); border-radius: 50%; background: var(--nen-300);
        color: var(--chu-100); font-size: 16px; cursor: pointer; }
.hop h3 { margin: 0 0 16px; font-family: var(--hien-thi); }
.goi-item { border: 1px solid var(--vien); border-radius: var(--bo-vua); padding: 16px;
            margin-bottom: 12px; cursor: pointer; }
.goi-item:hover { border-color: var(--vang-500); }
.goi-item .gia { font-family: var(--hien-thi); font-size: 24px; font-weight: 600;
                 color: var(--vang-500); }
.goi-item .ten-goi { font-weight: 600; }
.goi-item .mo-ta-goi { color: var(--chu-200); font-size: 14px; margin-top: 4px; }

.qr { display: block; width: 100%; max-width: 280px; margin: 0 auto 16px;
      border-radius: var(--bo-vua); background: #fff; padding: 8px; }
.bang-ck div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0;
               border-bottom: 1px solid var(--vien); font-size: 14px; }
.bang-ck span { color: var(--chu-200); }
.bang-ck b { text-align: right; word-break: break-all; }
.noi-dung { font-family: ui-monospace, "Courier New", monospace; color: var(--vang-500); }
.noi-dung.to { font-size: 24px; font-weight: 700; text-align: center; letter-spacing: 2px; }
.cho { text-align: center; color: var(--chu-200); font-size: 14px; }
.cho.xong-roi { color: var(--ngoc-500); font-weight: 600; }
.xong { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 50%;
        background: rgba(79, 184, 154, .16); color: var(--ngoc-500); font-size: 32px;
        display: grid; place-items: center; }

/* ---------------------------------------------------------------- thanh tab */
.thanh-tab { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
             display: grid; grid-template-columns: repeat(3, 1fr);
             background: var(--nen-200); border-top: 1px solid var(--vien);
             padding-bottom: env(safe-area-inset-bottom, 0px); }
.thanh-tab .tab { border: 0; background: none; padding: 10px 4px 12px; cursor: pointer;
                  font: inherit; font-size: 12px; color: var(--chu-200);
                  display: grid; gap: 3px; justify-items: center; }
.thanh-tab .tab span { font-size: 18px; line-height: 1; }
.thanh-tab .tab.dang-chon { color: var(--vang-500); font-weight: 600; }

footer { text-align: center; color: var(--chu-200); font-size: 13px; line-height: 20px;
         margin-top: 40px; padding: 0 20px; }
footer a { color: var(--chu-200); }

@media (min-width: 620px) {
  .luoi-the { grid-template-columns: 1fr 1fr; }
  .man-che { align-items: center; }
  .hop { border-radius: var(--bo-lon); border-bottom: 1px solid var(--vien); }
}

/* ---------------------------------------------------------------- bản in / PDF
   Chuyển sang chủ đề NGÀY: mực đen trên giấy trắng, không đốt mực in. */
@media print {
  :root {
    --nen-100: #FFFFFF; --nen-200: #FFFFFF; --nen-300: #F0ECE4;
    --chu-100: #1A1726; --chu-200: #5D5873; --vien: #E3DED2;
    --vang-500: #A9762A; --vang-100: #FBF0D9; --tim-500: #5A49B0;
    color-scheme: light;
  }
  .thanh-tab, .hang-nut, #o-nhap, footer, .man-che, .muc-luc { display: none !important; }
  body { padding: 0; }
  .dau-trang { padding: 0 0 14px; border-bottom: 2px solid var(--vang-500); }
  .dau-trang::before, .huy-hieu { display: none; }
  main { max-width: none; padding: 0; }
  .the, .chi-so { box-shadow: none; break-inside: avoid; page-break-inside: avoid; }
  .muc { break-after: avoid; page-break-after: avoid; }
  .luoi-the { grid-template-columns: 1fr 1fr; }
  .vien-so, .o-bieu-do.co, .o-vt .so-vt, .thanh i, .dong-luan .o-nho {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ---------------------------------------------------------------- tài khoản */
.nut-tk { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 16px;
          padding: 7px 14px; border-radius: var(--bo-tron); font: inherit; font-size: 13px;
          font-weight: 600; cursor: pointer; color: var(--chu-100);
          background: rgba(255, 255, 255, .06); border: 1px solid var(--vien); }
.nut-tk:hover { border-color: var(--vang-500); color: var(--vang-500); }
.nut-tk img { width: 20px; height: 20px; border-radius: 50%; vertical-align: -5px;
              margin-right: 6px; }
.dau-trang { position: relative; }

/* gạch ngang có chữ "hoặc" ở giữa */
.hoac { display: flex; align-items: center; gap: 12px; color: var(--chu-200);
        font-size: 13px; margin: 18px 0; }
.hoac::before, .hoac::after { content: ""; flex: 1; height: 1px; background: var(--vien); }

.lien-ket { background: none; border: 0; padding: 0; font: inherit; font-weight: 600;
            color: var(--vang-500); cursor: pointer; text-decoration: underline; }

.the-tk { display: flex; align-items: center; gap: 12px; padding: 14px;
          border: 1px solid var(--vien); border-radius: var(--bo-vua);
          background: var(--nen-300); margin-bottom: 14px; }
.the-tk img { width: 44px; height: 44px; border-radius: 50%; flex: 0 0 44px; }
.quyen { margin: 0 0 18px; padding: 10px 14px; border-radius: var(--bo-nho);
         background: var(--vang-100); border: 1px solid var(--vang-500);
         color: var(--vang-500); font-size: 14px; font-weight: 600; }
.quyen.thuong { background: var(--nen-300); border-color: var(--vien);
                color: var(--chu-200); font-weight: 400; }

.mo-them { margin: 18px 0; border-top: 1px solid var(--vien); padding-top: 14px; }
.mo-them summary { cursor: pointer; color: var(--chu-200); font-size: 14px; }
.mo-them[open] summary { margin-bottom: 10px; color: var(--chu-100); }
