/* ==========================================================================
   Xổ Số Chín Đức — giao diện
   Bộ nhận diện: ĐỎ #C8191F là màu chủ đạo · ĐEN #141414 · TRẮNG. Font: Inter Tight.

   Nguyên tắc:
   - Trang tra cứu số liệu, ưu tiên điện thoại: thanh điều hướng nằm cố định ở đáy màn hình
     (tầm với ngón cái), từ máy tính bảng trở lên chuyển thành hàng tab trong header.
   - Giải đặc biệt luôn là thứ đầu tiên nhìn thấy trong mỗi thẻ; số dùng tabular-nums cho thẳng hàng.
   - Bảng nhiều đài cuộn ngang, cột "Giải" dính bên trái; trên điện thoại tên giải rút gọn (ĐB, G1…G8).
   - Màu: đỏ = cấu trúc & nhấn (header, nav, tiêu đề thẻ, khung dò vé, giải đặc biệt, nút), đen = chữ, số trúng & chân trang, trắng = nền thẻ.
   Mốc responsive: mặc định (điện thoại) · ≥480px · ≥640px · ≥768px (tablet) · ≥1024px (máy tính).
   ========================================================================== */

/* Đỏ là màu chủ đạo; đen và trắng làm nền, chữ và điểm nhấn. */
:root {
  color-scheme: light dark;

  --red: #C8191F;            /* đỏ chính: header, nav, tiêu đề thẻ kết quả, khung dò vé, nút */
  --red-dark: #9B1217;       /* đỏ đậm: hàng tiêu đề bảng đài, mục đang chọn trên nav */
  --red-deep: #7A0D11;       /* hover của nút đỏ */
  --red-ink: #C8191F;        /* chữ đỏ trên nền sáng (tương phản ≥ 5:1) */
  --red-tint: #F9D5D6;
  --red-soft: #FDEEEE;
  --black: #141414;

  --ink: #1A1A1A;
  --ink-2: rgba(26, 26, 26, .74);
  --ink-3: rgba(26, 26, 26, .56);
  --line: rgba(26, 26, 26, .16);
  --line-soft: rgba(26, 26, 26, .08);

  --bg: #F6F4F4;
  --card: #FFFFFF;
  --band: var(--red);        /* dải tiêu đề của thẻ kết quả, popup, mục đang chọn */
  --band-ink: #FFFFFF;
  --band-ink-2: rgba(255, 255, 255, .88);
  --hit-bg: #1A1A1A;         /* số trúng: nền đen, chữ trắng */
  --hit-ink: #FFFFFF;
  --footer-bg: #141414;
  --focus: #C8191F;

  --font: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --gutter: 1rem;
  --container: 1040px;
  --nav-h: 3.75rem;
  --side-w: 16rem;           /* độ rộng cột trái (lịch + danh sách đài) ở máy tính: 256px */
  --area-gap: 5px;           /* khoảng cách giữa các khu vực: lịch, danh sách đài, bảng kết quả (chỉ khai báo MỘT chỗ để không cộng dồn) */
  --cal-gap: var(--area-gap); /* khoảng cách giữa cột bên (lịch + chọn đài) và khối kết quả */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --red-ink: #FF7378;
    --red-tint: rgba(208, 32, 38, .3);
    --red-soft: rgba(208, 32, 38, .14);

    --ink: #F5F2F2;
    --ink-2: rgba(245, 242, 242, .78);
    --ink-3: rgba(245, 242, 242, .56);
    --line: rgba(245, 242, 242, .18);
    --line-soft: rgba(245, 242, 242, .09);

    --bg: #151212;
    --card: #221E1E;
    --hit-bg: #F5F2F2;
    --hit-ink: #141414;
    --footer-bg: #0C0A0A;
    --focus: #FF7378;
  }
}
:root[data-theme="dark"] {
  --red-ink: #FF7378;
  --red-tint: rgba(208, 32, 38, .3);
  --red-soft: rgba(208, 32, 38, .14);

  --ink: #F5F2F2;
  --ink-2: rgba(245, 242, 242, .78);
  --ink-3: rgba(245, 242, 242, .56);
  --line: rgba(245, 242, 242, .18);
  --line-soft: rgba(245, 242, 242, .09);

  --bg: #151212;
  --card: #221E1E;
  --hit-bg: #F5F2F2;
  --hit-ink: #141414;
  --footer-bg: #0C0A0A;
  --focus: #FF7378;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------- Nền tảng ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  /* chừa chỗ cho thanh điều hướng cố định ở đáy điện thoại */
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-underline-offset: .18em; }
img, svg { max-width: 100%; }
table { border-collapse: collapse; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: .5rem; top: -4rem; z-index: 100;
  padding: .6rem 1rem; background: var(--band); color: var(--band-ink);
  border-radius: var(--radius-sm); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: .5rem; }

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Header + điều hướng ---------- */
.site-header { background: var(--red); border-bottom: 3px solid var(--black); color: #fff; }

.site-header__bar {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: .8rem;
}

.brand { display: inline-flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none; }
.brand__mark {
  flex: none; width: 1.5rem; height: 1.05rem; border-radius: 3px;
  background:
    radial-gradient(circle at 0 50%, transparent .2rem, #fff calc(.2rem + .5px)) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% 50%, transparent .2rem, #fff calc(.2rem + .5px)) right / 51% 100% no-repeat;
}
.brand__name { font-size: 1.1875rem; font-weight: 800; letter-spacing: -.015em; }
.brand__accent { color: #FFD3D4; }

.site-header__check {
  padding: .4rem .9rem; border: 1.5px solid rgba(255, 255, 255, .7); border-radius: 999px;
  font-size: .875rem; font-weight: 700; text-decoration: none; color: #fff;
}
.site-header__check:hover { border-color: #fff; background: #fff; color: var(--red); }

/* Điện thoại: thanh tab cố định ở đáy */
.main-nav {
  position: fixed; inset: auto 0 0 0; z-index: 50;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--red); box-shadow: 0 -3px 0 var(--black);
}
.main-nav__list { display: grid; grid-template-columns: repeat(4, 1fr); padding-inline: 0; }
.main-nav a {
  position: relative; display: flex; align-items: center; justify-content: center;
  height: var(--nav-h); padding-inline: .25rem;
  font-size: .8125rem; font-weight: 600; text-align: center; text-decoration: none; color: rgba(255, 255, 255, .84);
}
.main-nav a.is-active { color: #fff; font-weight: 800; background: var(--red-dark); }
.main-nav a.is-active::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: #fff;
}

/* ---------- Bố cục trang ---------- */
.page { display: flex; flex-direction: column; gap: 1.25rem; padding-block: 1.25rem 2.5rem; }
.results { display: flex; flex-direction: column; gap: var(--area-gap); }

/* Hai cột: cột trái (.results-sidebar) gồm lịch + danh sách đài; bảng kết quả (.results-content) bên phải.
   - Máy tính (≥1024px): cột trái cuộn tự nhiên cùng trang (KHÔNG fixed/sticky, vì danh sách đài rất dài).
   - Máy tính bảng / điện thoại: một cột; danh sách đài nằm PHÍA TRÊN kết quả (mở bằng nút menu ≡), lịch ẩn đi
     (vẫn chọn ngày được bằng nút ngày ở thanh điều hướng tuần). */
.results-layout { display: flex; flex-direction: column; gap: var(--area-gap); }
.results-sidebar { display: flex; flex-direction: column; gap: var(--area-gap); min-width: 0; }
.results-sidebar .cal { display: none; }
.results-content { display: flex; flex-direction: column; gap: var(--area-gap); min-width: 0; }

.page-head__title {
  font-size: clamp(1.5rem, 6.4vw, 2.125rem); line-height: 1.15; font-weight: 800; letter-spacing: -.02em;
}
.page-head__date { margin-top: .3rem; color: var(--ink-2); font-size: 1rem; font-weight: 500; }

.today { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: .4rem .9rem; margin-top: .9rem; font-size: .9375rem; }
.today dt { color: var(--ink-3); font-weight: 500; }
.today dd { font-weight: 600; }

.jump { display: flex; gap: .5rem; overflow-x: auto; margin-inline: calc(var(--gutter) * -1); padding: .1rem var(--gutter); scrollbar-width: none; }
.jump::-webkit-scrollbar { display: none; }
.jump a {
  flex: none; padding: .4rem .85rem; border: 1.5px solid var(--line); border-radius: 999px;
  font-size: .875rem; font-weight: 600; text-decoration: none; color: var(--ink);
}
.jump a:hover { border-color: var(--ink); }
.jump a.is-active { border-color: var(--red); background: var(--red); color: #fff; font-weight: 800; }

.empty { padding: 1.25rem 1rem; color: var(--ink-2); font-size: .9375rem; }
.muted { color: var(--ink-3); font-size: .875rem; }

/* ---------- Dải chọn ngày ---------- */
.day-strip { margin-inline: calc(var(--gutter) * -1); }
.day-strip__list {
  position: relative; display: flex; gap: .5rem; overflow-x: auto;
  padding: .15rem var(--gutter); scroll-snap-type: x proximity; scrollbar-width: none;
}
.day-strip__list::-webkit-scrollbar { display: none; }
.day {
  flex: none; display: flex; flex-direction: column; align-items: center; min-width: 4.25rem;
  padding: .55rem .5rem; scroll-snap-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  color: var(--ink); text-decoration: none;
}
.day__label { font-size: .75rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.day__date { font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
a.day:hover { border-color: var(--ink); }
.day.is-current { background: var(--band); border-color: var(--band); color: var(--band-ink); }
.day.is-current .day__label { color: rgba(255, 255, 255, .85); }
.day.is-off { opacity: .45; }

/* ---------- Ô dò vé ---------- */
.check { padding: 1rem; background: var(--red); border: 1px solid var(--red-dark); border-radius: var(--radius); color: #fff; }
.check :focus-visible { outline-color: #fff; }
.check__title { margin-bottom: .75rem; font-size: 1rem; font-weight: 800; }
.check__form { display: grid; gap: .75rem; }
.field label { display: block; margin-bottom: .25rem; font-size: .8125rem; font-weight: 600; color: rgba(255, 255, 255, .92); }
.field input, .field select {
  width: 100%; height: 3rem; padding: 0 .875rem;
  font: inherit; font-size: 1.0625rem; color: var(--black);
  background: #fff; border: 1.5px solid transparent; border-radius: var(--radius-sm);
}
.field input { font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.field input::placeholder { font-size: .9375rem; font-weight: 400; letter-spacing: 0; color: rgba(20, 20, 20, .55); }
.field input:focus, .field select:focus { border-color: var(--black); outline: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, .55); }
.check .btn { background: var(--black); color: #fff; }
.check .btn:hover { background: #000; }

.btn {
  height: 3rem; padding: 0 1.4rem; border: 0; border-radius: var(--radius-sm);
  background: var(--red); color: #fff; font: inherit; font-weight: 800; cursor: pointer;
}
.btn:hover { background: var(--red-deep); }
.btn:active { transform: translateY(1px); }

.check__result:empty { display: none; }
.check__result { margin-top: .875rem; padding: .75rem .9rem; border-radius: var(--radius-sm); background: #fff; color: var(--black); font-size: .9375rem; }
.check__result ul { margin-top: .35rem; padding-left: 1.1rem; list-style: disc; }
.check__result small { display: block; margin-top: .4rem; color: rgba(20, 20, 20, .62); font-size: .75rem; }
.check__result.is-win { background: var(--black); color: #fff; }
.check__result.is-win small { color: rgba(255, 255, 255, .72); }
.check__result.is-error { background: #fff; color: var(--red-dark); font-weight: 700; }

/* ---------- Thẻ kết quả ---------- */
.rcard { overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); scroll-margin-top: 1rem; }
.rcard__head {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .5rem 1rem;
  padding: .875rem 1rem; background: var(--band); color: var(--band-ink);
}
.rcard__title { font-size: 1.1875rem; font-weight: 800; letter-spacing: -.01em; }
.rcard__title a { color: inherit; text-decoration: none; }
.rcard__title a::after { content: " ›"; color: rgba(255, 255, 255, .85); }
.rcard__title a:hover { text-decoration: underline; text-decoration-color: #fff; }
.rcard__sub { margin-top: .1rem; font-size: .8125rem; color: var(--band-ink-2); }
.rcard__state { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; width: 100%; }
.rcard__updated { font-size: .75rem; color: var(--band-ink-2); }

.status-pill {
  display: inline-flex; align-items: center; gap: .4em; padding: .2rem .65rem; border-radius: 999px;
  font-size: .75rem; font-weight: 700; background: rgba(255, 255, 255, .12); color: var(--band-ink-2);
}
.status-pill::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.status-pill--done { background: #fff; color: var(--red-dark); }
.status-pill--pending { background: rgba(255, 255, 255, .22); color: #fff; }

.rcard__tools {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .75rem;
  padding: .55rem 1rem; border-bottom: 1px solid var(--line-soft);
}
.rcard__tools-label { font-size: .8125rem; color: var(--ink-3); font-weight: 600; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg__btn {
  padding: .3rem .8rem; border: 0; background: transparent; color: var(--ink-2);
  font: inherit; font-size: .8125rem; font-weight: 700; cursor: pointer;
}
.seg__btn.is-on { background: var(--band); color: var(--band-ink); }

/* Giải đặc biệt */
.special { padding: 1.125rem 1rem 1.25rem; background: var(--red-soft); border-bottom: 2px solid var(--red); }
.special__label { font-size: .8125rem; font-weight: 700; color: var(--red-ink); }
.special__num {
  margin-top: .1rem; font-size: clamp(2.5rem, 12vw, 3.25rem); line-height: 1.05; font-weight: 800;
  letter-spacing: .04em; font-variant-numeric: tabular-nums; color: var(--red-ink);
}
.special__num--empty { font-size: 1.25rem; font-weight: 600; letter-spacing: 0; color: var(--ink-3); }

.series { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin-top: .85rem; }
.series__label { font-size: .75rem; font-weight: 600; color: var(--ink-2); }
.series__list { display: flex; flex-wrap: wrap; gap: .3rem; }
.series__list li {
  padding: .1rem .5rem; border: 1px solid var(--red-ink); border-radius: 6px;
  font-size: .8125rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--red-ink);
}

.special__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: .9rem 1.25rem; margin-top: .55rem; }
.special__station { display: block; font-size: .8125rem; font-weight: 600; color: var(--ink-2); }
.special__grid .special__num { display: block; margin-top: .1rem; font-size: 1.625rem; letter-spacing: .03em; }
.special__grid .special__num--empty { font-size: 1.25rem; }

/* ---------- Bảng kết quả ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap:focus-visible { outline-offset: -3px; }

.rt { width: 100%; font-size: .9375rem; }
.rt th, .rt td { padding: .65rem .75rem; border-top: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.rt tbody tr:first-child > * { border-top: 0; }
.rt tbody th { white-space: nowrap; font-weight: 600; color: var(--ink-2); }
.lbl-short { display: none; }

.nums { display: flex; flex-wrap: wrap; gap: .2rem .9rem; }
.nums--col { flex-direction: column; gap: .15rem; }
.n {
  padding: .05rem .25rem; margin-inline: -.25rem; border-radius: 4px;
  font-size: 1rem; font-weight: 600; letter-spacing: .02em; font-variant-numeric: tabular-nums;
}
.n.is-hit { background: var(--hit-bg); color: var(--hit-ink) !important; box-shadow: 0 0 0 2px var(--hit-bg); }

tr.is-special > * { background: var(--red-soft); }
tr.is-special .n { font-size: 1.0625rem; font-weight: 800; color: var(--red-ink); }
tr.is-special th { color: var(--red-ink); font-weight: 800; }

.rt--mb tbody th { width: 8.5rem; }

.rt--multi thead th { padding-block: .6rem; vertical-align: bottom; border-top: 0; border-bottom: 0; background: var(--red-dark); color: #fff; }
.rt--multi thead th[data-col] { min-width: 6.75rem; }
.rt--multi td[data-col] { min-width: 6.75rem; }
.st-name { display: block; font-size: .875rem; font-weight: 700; color: #fff; }
.st-code { display: block; margin-top: .1rem; font-size: .6875rem; font-weight: 500; color: rgba(255, 255, 255, .78); white-space: nowrap; }

/* Cột "Giải" dính bên trái khi cuộn ngang */
.rt--multi th:first-child {
  position: sticky; left: 0; z-index: 1; background: var(--card); box-shadow: 1px 0 0 var(--line-soft);
}
.rt--multi tr.is-special th:first-child { background: var(--red-soft); }
.rt--multi thead th.corner { background: var(--red-dark); color: rgba(255, 255, 255, .9); font-size: .8125rem; }

/* ---------- Bảng loto ---------- */
.loto { border-top: 1px solid var(--line-soft); }
.loto summary {
  display: flex; align-items: center; justify-content: space-between; padding: .85rem 1rem;
  font-size: .9375rem; font-weight: 700; cursor: pointer; list-style: none;
}
.loto summary::-webkit-details-marker { display: none; }
.loto summary::after {
  content: ""; width: .5rem; height: .5rem; margin-right: .25rem;
  border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg);
  transition: transform .15s ease;
}
.loto[open] summary::after { transform: rotate(-135deg); }
.loto__body { overflow-x: auto; padding: 0 1rem 1rem; }
.lt { width: 100%; font-size: .9375rem; font-variant-numeric: tabular-nums; }
.lt th, .lt td { padding: .45rem .6rem; border-top: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.lt thead th { border-top: 0; border-bottom: 1px solid var(--line); font-size: .8125rem; color: var(--ink-2); }
.lt tbody th { width: 3.25rem; text-align: center; font-weight: 800; color: var(--red-ink); }
.lt td { font-weight: 600; letter-spacing: .04em; }
.lt td.is-empty { color: var(--ink-3); }

/* ---------- Điện toán ---------- */
.dt-grid { display: grid; grid-template-columns: 1fr; }
.dt { padding: 1rem; border-top: 1px solid var(--line-soft); }
.dt:first-child { border-top: 0; }
.dt__title { font-size: 1rem; font-weight: 800; }
.dt__sub { margin-top: .1rem; font-size: .8125rem; color: var(--ink-3); }
.balls { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; margin-top: .75rem; }
.ball-group { display: flex; flex-wrap: wrap; gap: .4rem; }
.ball-group + .ball-group { padding-left: 1.1rem; border-left: 2px dashed var(--line); }
.ball {
  display: grid; place-items: center; min-width: 2.5rem; height: 2.5rem; padding-inline: .3rem; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 1.0625rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.ball-group--bonus .ball { background: var(--black); color: #fff; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .5); }

/* ---------- Khối phụ: lịch, ghi chú ---------- */
.panel { padding: 1.1rem 1rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.panel__title { margin-bottom: .75rem; font-size: 1.0625rem; font-weight: 800; }
.table-wrap--plain { margin-inline: -1rem; }

.sched { width: 100%; font-size: .9375rem; }
.sched th, .sched td { padding: .6rem 1rem; border-top: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.sched thead th { border-top: 0; border-bottom: 1px solid var(--line); font-size: .8125rem; color: var(--ink-2); }
.sched tbody th { white-space: nowrap; font-weight: 700; }
.sched tr.is-today > * { background: var(--red-soft); }

.notes__list { display: grid; gap: .5rem; padding-left: 1.1rem; list-style: disc; color: var(--ink-2); font-size: .9375rem; }
.notes__list a { color: var(--ink); }

/* ---------- Footer ---------- */
.site-footer { background: var(--footer-bg); color: #fff; border-top: 3px solid var(--red); }
.site-footer__inner { display: grid; gap: .4rem; padding-block: 1.25rem; font-size: .8125rem; color: rgba(255, 255, 255, .78); }
.site-footer__brand { font-size: 1rem; font-weight: 800; color: #fff; }
.site-footer__brand span { color: #FF7378; }
.site-footer__note { max-width: 60ch; }
.site-footer__meta { color: rgba(255, 255, 255, .6); }

/* ==========================================================================
   Chỉ điện thoại (<480px): tên giải rút gọn trong bảng nhiều đài
   ========================================================================== */
@media (max-width: 479.98px) {
  .rt--multi .lbl-long {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .rt--multi .lbl-short { display: inline; font-weight: 800; }
  .rt--multi tbody th, .rt--multi thead th.corner { padding-inline: .6rem; text-align: center; }
  .rt--multi th, .rt--multi td { padding-inline: .5rem; }
  .rt--multi thead th[data-col], .rt--multi td[data-col] { min-width: 6rem; }
  .rt--mb tbody th { width: 6.5rem; }
}

/* Lịch tuần: xếp dọc trên màn hình hẹp */
@media (max-width: 639.98px) {
  .sched thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .sched, .sched tbody { display: block; }
  .sched tr { display: block; padding: .8rem 1rem; border-top: 1px solid var(--line-soft); }
  .sched tr:first-child { border-top: 0; }
  .sched tbody th { display: flex; align-items: center; gap: .5rem; padding: 0 0 .3rem; border: 0; }
  .sched td { display: flex; gap: .75rem; padding: .1rem 0; border: 0; }
  .sched td::before { content: attr(data-label); flex: 0 0 5.6rem; color: var(--ink-3); font-size: .8125rem; }
  .sched tr.is-today > * { background: transparent; }
  .sched tr.is-today { background: var(--red-soft); }
  .sched tr.is-today th::after {
    content: "Hôm nay"; padding: .05rem .5rem; border-radius: 999px; background: var(--red); color: #fff;
    font-size: .6875rem; font-weight: 800;
  }
}

/* ≥480px: nhãn trạng thái dồn sang phải dải tiêu đề */
@media (min-width: 480px) {
  .rcard__state { width: auto; flex-direction: column; align-items: flex-end; gap: .3rem; text-align: right; }
}

/* ==========================================================================
   ≥640px — ô dò vé nằm ngang, điện toán nhiều cột
   ========================================================================== */
@media (min-width: 640px) {
  .check__form { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; align-items: end; }
  .dt-grid { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
  .dt { border-top: 0; border-left: 1px solid var(--line-soft); }
  .dt:first-child { border-left: 0; }
}

/* ==========================================================================
   ≥768px — máy tính bảng: thanh tab chuyển lên header
   ========================================================================== */
@media (min-width: 768px) {
  :root { --gutter: 1.5rem; }

  body { padding-bottom: 0; }

  .brand__name { font-size: 1.3125rem; }

  .main-nav { position: static; padding-bottom: 0; background: transparent; box-shadow: none; }
  .main-nav__list { display: flex; gap: .25rem; padding-inline: var(--gutter); }
  .main-nav li:first-child a { padding-left: 0; }
  .main-nav a { height: auto; padding: .8rem 1.1rem; font-size: .9375rem; background: transparent; }
  .main-nav a:hover { color: #fff; background: rgba(0, 0, 0, .16); }
  .main-nav a.is-active { background: transparent; }
  .main-nav a.is-active::before { top: auto; bottom: -3px; height: 3px; }

  .page { gap: 1.5rem; padding-block: 1.75rem 3rem; }
  .results { gap: var(--area-gap); }
  .results-content { gap: var(--area-gap); }

  /* dt/dd xen kẽ: xếp theo cột, mỗi miền một cột (nhãn trên, tên đài dưới) */
  .today { grid-template-columns: none; grid-template-rows: auto auto; grid-auto-flow: column; grid-auto-columns: max-content; justify-content: start; gap: .1rem 2.5rem; }
  .today dt { font-size: .8125rem; }

  .jump, .day-strip { margin-inline: 0; }
  .jump { padding-inline: 0; flex-wrap: wrap; overflow: visible; }
  .day-strip__list { padding-inline: 0; }
  .day { min-width: 4.75rem; }

  .rcard__head { padding: 1rem 1.5rem; }
  .rcard__title { font-size: 1.3125rem; }
  .rcard__tools { padding-inline: 1.5rem; }
  .special { padding: 1.5rem; }
  .special__num { font-size: 3.5rem; }
  .special__grid .special__num { font-size: 2rem; }

  .rt { font-size: 1rem; }
  .rt th, .rt td { padding: .75rem 1.5rem; }
  .rt--multi th, .rt--multi td { padding-inline: 1rem; }
  .rt--multi thead th[data-col], .rt--multi td[data-col] { min-width: 8rem; }
  .rt--mb tbody th { width: 11rem; }
  .n { font-size: 1.0625rem; }
  tr.is-special .n { font-size: 1.1875rem; }

  .loto summary { padding-inline: 1.5rem; }
  .loto__body { padding-inline: 1.5rem; }
  .dt { padding: 1.25rem 1.5rem; }
  .panel { padding: 1.25rem 1.5rem; }
  .table-wrap--plain { margin-inline: -1.5rem; }
  .sched th, .sched td { padding-inline: 1.5rem; }
}

/* ==========================================================================
   ≥1024px — máy tính
   ========================================================================== */
@media (min-width: 1024px) {
  .page { gap: 1.75rem; padding-block: 2.25rem 4rem; }
  .special__num { font-size: 4rem; }
  .special__grid .special__num { font-size: 2.25rem; }
  .rt--mb tbody th { width: 14rem; }
  .rt--multi thead th[data-col], .rt--multi td[data-col] { min-width: 10rem; }

  .results-layout {
    display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr);
    align-items: start; column-gap: var(--cal-gap);
  }
  .results-sidebar .cal { display: block; }
  .results-content { gap: var(--area-gap); }
}

/* ==========================================================================
   Bộ chọn ngày: UI 1 (.cal) + UI 2 (.cal-pop)
   Site xuất bản tĩnh nên không khoá ngày theo dữ liệu — mọi ngày trong tháng đều bấm được,
   ngày chưa có trang thật sẽ ra 404.html. Dùng chung một lưới ngày (.cal__grid) cho cả hai UI.
   ========================================================================== */
.cal { display: block; width: 100%; padding: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.cal__bar { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.cal__bar--sub { margin: .9rem 0 .4rem; }
.cal__title { flex: 1; text-align: center; font-size: 1.0625rem; font-weight: 800; letter-spacing: -.01em; }
.cal__bar--sub .cal__title { font-size: .9375rem; }
.cal__nav {
  display: grid; place-items: center; flex: none; width: 2.5rem; height: 2.5rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--ink); cursor: pointer;
}
.cal__nav:hover { border-color: var(--ink); }
.cal__open { border-color: var(--red); background: var(--red-soft); }

.cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .2rem; box-sizing: border-box; }
.cal__dow { padding: .3rem 0; text-align: center; font-size: .75rem; font-weight: 700; color: var(--ink-3); }
.cal__day {
  display: grid; place-items: center; min-height: 2rem; padding: 0; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink); font: inherit; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer;
  font-size: .8375rem;
}
.cal__day.is-outside { border-color: transparent; background: transparent; color: var(--ink-3); opacity: .4; cursor: default; }
.cal__day:hover:not(.is-outside):not(:disabled) { border-color: var(--red); background: var(--red-soft); }
.cal__day { position: relative; }
.cal__day.is-today:not(.is-selected) { border-color: var(--red); background: var(--red-soft); }
.cal__day.is-disabled, .cal__day:disabled { opacity: .35; cursor: not-allowed; }
.cal__day.is-open::after {            /* chấm: ngày đài mở thưởng (chỉ trang một đài) */
  content: ""; position: absolute; left: 50%; bottom: 3px; width: 5px; height: 5px; margin-left: -2.5px;
  border-radius: 50%; background: var(--red);
}
.cal__day.is-selected.is-open::after { background: #fff; }
.cal__nav:disabled { opacity: .35; cursor: not-allowed; }
.cal__nav:disabled:hover { border-color: var(--line); }
.cal__day.is-selected, .cal__day.is-selected:hover { background: var(--band); border-color: var(--band); color: var(--band-ink); font-weight: 800; }

.cal__hint { margin-top: .75rem; font-size: .6125rem; color: var(--ink-3); }
.cal__scope { margin-bottom: .6rem; font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--red-ink); }
.cal__legend { display: flex; align-items: flex-start; gap: .45rem; margin-top: .75rem; font-size: .75rem; line-height: 1.4; color: var(--ink-2); }
/* Lịch trong cột trái (256px): thu gọn nút, chữ và ô ngày để cả tuần + tiêu đề tháng vừa một hàng mà vẫn dễ bấm.
   Chỉ áp dụng cho lịch ở cột trái — lịch trong popup (.cal-pop) giữ nguyên kích thước. */
.results-sidebar .cal { padding: .75rem; }
.results-sidebar .cal__scope { margin-bottom: .5rem; font-size: .6875rem; letter-spacing: .04em; line-height: 1.3; }
.results-sidebar .cal .cal__bar { gap: .3rem; margin-bottom: .45rem; }
.results-sidebar .cal .cal__nav { width: 2rem; height: 2rem; border-radius: 8px; }
.results-sidebar .cal .cal__title { font-size: .9375rem; }
.results-sidebar .cal .cal__grid { gap: .15rem; }
.results-sidebar .cal .cal__dow { padding: .2rem 0; font-size: .6875rem; }
.results-sidebar .cal .cal__day { min-height: 1.875rem; border-radius: 8px; font-size: .8125rem; }
.results-sidebar .cal .cal__day.is-open::after { bottom: 2px; width: 4px; height: 4px; margin-left: -2px; }
.results-sidebar .cal__legend { margin-top: .6rem; font-size: .6875rem; line-height: 1.35; }
.cal__legend-dot { flex: none; width: 7px; height: 7px; margin-top: .35em; border-radius: 50%; background: var(--red); }


/* Popup chọn ngày (mở từ nút ngày ở thanh điều hướng tuần): nhỏ gọn, nằm ngay dưới nút trên máy tính, trượt từ đáy trên điện thoại. */
.cal-pop {
  width: min(20rem, calc(100vw - 1rem)); max-height: calc(100dvh - 1rem); padding: 0; overflow: auto;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .3);
}
.cal-pop::backdrop { background: transparent; }
.cal-pop__box { padding: .8rem .8rem .7rem; }
.cal-pop__head { display: flex; align-items: center; gap: .4rem; margin-bottom: .65rem; }
.cal-pop__arrow {
  display: grid; place-items: center; flex: none; width: 2rem; height: 2rem; padding: 0;
  border: 0; border-radius: 50%; background: var(--red); color: #fff; cursor: pointer;
}
.cal-pop__arrow:hover:not(:disabled) { background: var(--red-deep); }
.cal-pop__arrow:disabled { background: var(--line); color: var(--ink-3); cursor: not-allowed; }
.cal-pop__select {
  flex: 1; min-width: 0; height: 2rem; padding: 0 .35rem; border: 1.5px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink); font: inherit; font-size: .875rem; font-weight: 700;
}
.cal-pop .cal__day { min-height: 2.25rem; }
.cal-pop__note { margin-top: .6rem; font-size: .75rem; line-height: 1.4; color: var(--ink-2); }
.cal-pop__foot { display: flex; justify-content: space-between; gap: .5rem; margin-top: .65rem; padding-top: .65rem; border-top: 1px solid var(--line-soft); }
.cal-pop__btn {
  min-width: 4.5rem; padding: .4rem .9rem; border: 1.5px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink); font: inherit; font-size: .875rem; font-weight: 700; cursor: pointer;
}
.cal-pop__btn:hover { border-color: var(--ink); }
.cal-pop__btn--primary { border-color: var(--red); background: var(--red); color: #fff; }
.cal-pop__btn--primary:hover { border-color: var(--red-deep); background: var(--red-deep); }

@media (max-width: 639.98px) {
  .cal-pop { width: 100%; max-width: none; margin: auto 0 0; border-radius: var(--radius) var(--radius) 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .cal-pop::backdrop { background: rgba(28, 26, 29, .55); }
  .cal-pop__box { padding: 1rem; }
}

/* ---------- Trang 404 ---------- */
.notfound { display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; padding-block: 2.5rem 3rem; text-align: left; }
.notfound__code { font-size: clamp(3rem, 14vw, 5rem); font-weight: 800; letter-spacing: -.02em; color: var(--red-ink); }
.notfound__title { font-size: clamp(1.375rem, 5vw, 1.75rem); font-weight: 800; letter-spacing: -.01em; }
.notfound__msg { max-width: 48ch; color: var(--ink-2); font-size: 1rem; }
.notfound__actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.notfound__actions a {
  padding: .6rem 1.1rem; border: 1.5px solid var(--line); border-radius: 999px;
  font-size: .9375rem; font-weight: 700; text-decoration: none; color: var(--ink);
}
.notfound__actions a:hover { border-color: var(--ink); }
.notfound__actions a.is-primary { border-color: var(--red); background: var(--red); color: #fff; }
.notfound__actions a.is-primary:hover { background: var(--red-deep); border-color: var(--red-deep); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}

@media print {
  .main-nav, .cal, .check, .site-header__check, .rcard__tools, .day-strip, .jump, .skip-link, .notfound__actions, .weeknav, .stations, .cal-pop { display: none !important; }
  body { padding-bottom: 0; background: #fff; }
  .results-sidebar { display: none !important; }
  .results-layout { display: block !important; }
  .rcard { break-inside: avoid; }
}


/* ==========================================================================
   In vé dò: nút trên thẻ, popup chọn kiểu in, và bản in (.print-sheet)
   Bản in dùng đơn vị cqw (theo bề rộng của từng bảng) nên chữ tự co theo 1, 4 hay 6 bảng trên A4.
   ========================================================================== */
.rcard__tools-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; }
.btn-print {
  display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .85rem;
  border: 1.5px solid var(--red); border-radius: 999px; background: var(--red-soft); color: var(--ink);
  font: inherit; font-size: .8125rem; font-weight: 700; cursor: pointer;
}
.btn-print:hover { background: var(--red-tint); }
.btn--ghost { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn--ghost:hover { background: transparent; border-color: var(--ink); }

/* Popup */
.print-pop {
  width: min(34rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; overflow: hidden;
  border: 0; border-radius: var(--radius); background: var(--card); color: var(--ink);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .28);
}
.print-pop::backdrop { background: rgba(28, 26, 29, .55); }
.print-pop__box { display: flex; flex-direction: column; max-height: calc(100dvh - 2rem); }
.print-pop__head { display: flex; align-items: center; gap: .5rem; padding: .8rem 1rem; background: var(--band); color: var(--band-ink); }
.print-pop__title { flex: 1; font-size: 1.0625rem; font-weight: 800; }
.print-pop__close { width: 2.25rem; height: 2.25rem; border: 0; border-radius: 50%; background: transparent; color: var(--band-ink); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.print-pop__close:hover { background: rgba(255, 255, 255, .14); }
.print-pop__body { padding: 1rem; overflow-y: auto; }
.print-pop__for { margin-bottom: .75rem; font-size: .875rem; font-weight: 600; color: var(--ink-2); }
.print-pop__for:empty { display: none; }
.print-pop__opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.print-opt {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: .55rem;
  padding: .8rem .4rem .7rem; border: 2px solid transparent; border-radius: var(--radius-sm); cursor: pointer; text-align: center;
}
.print-opt input { position: absolute; opacity: 0; pointer-events: none; }
.print-opt__img { display: grid; place-items: center; padding: .35rem; border-radius: 6px; color: var(--ink); }
.print-opt__img svg { display: block; width: 3.75rem; height: auto; }
.print-opt__txt { display: inline-flex; align-items: center; gap: .4rem; font-size: .875rem; font-weight: 600; }
.print-opt__txt::before {
  content: ""; flex: none; width: .95rem; height: .95rem; border: 2px solid var(--ink-3); border-radius: 50%; background: var(--card);
}
.print-opt:hover { border-color: var(--line); }
.print-opt.is-on { border-color: var(--red); background: var(--red-soft); }
.print-opt.is-on .print-opt__txt { font-weight: 800; }
.print-opt.is-on .print-opt__txt::before { border-color: var(--ink); background: radial-gradient(circle, var(--ink) 0 38%, var(--card) 42%); }
.print-opt:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.print-pop__help { margin-top: 1rem; display: grid; gap: .3rem; padding-left: 1.1rem; list-style: disc; font-size: .875rem; color: var(--ink-2); }
.print-pop__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: .85rem 1rem; border-top: 1px solid var(--line-soft); }
.print-pop__save { display: inline-flex; align-items: center; gap: .5rem; font-size: .9375rem; font-weight: 600; cursor: pointer; }
.print-pop__save input { width: 1.1rem; height: 1.1rem; accent-color: var(--red-ink); }
.print-pop__btns { display: flex; gap: .5rem; }
.print-pop__btns .btn { min-width: 5rem; }

@media (max-width: 639.98px) {
  .print-pop { width: 100%; max-width: none; margin: auto 0 0; border-radius: var(--radius) var(--radius) 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .print-opt__txt { font-size: .8125rem; }
}

/* Bản in: ẩn trên màn hình */
.print-sheet { display: none; }

/* Font số Giải 8: Playfair Display Black (chỉ bộ ký tự Latin, chữ số dạng thẳng hàng), tự lưu trong static/fonts
   nên bản in/PDF không phụ thuộc mạng. Chưa tải được thì dùng Times New Roman đậm. */
@font-face {
  font-family: "Chin Duc Display";
  font-style: normal; font-weight: 900; font-display: block;
  src: url("../fonts/playfair-display-latin-900-normal.woff2") format("woff2");
}

@media print {
  body.is-printing { margin: 0 !important; padding: 0 !important; min-height: 0 !important; background: #fff !important; }
  body.is-printing > :not(.print-sheet) { display: none !important; }

  /* @page lề 0 (tắt luôn đầu/chân trang của trình duyệt); lề giấy 8mm do padding của tờ in đảm nhận.
     Cao 296mm (không phải 297mm) để làm tròn của trình duyệt không đẩy sang trang thứ hai. */
  body.is-printing .print-sheet {
    display: grid !important; box-sizing: border-box; width: 210mm; height: 296mm; margin: 0; padding: 8mm; overflow: hidden;
    grid-template-columns: repeat(var(--pc), minmax(0, 1fr)); grid-template-rows: repeat(var(--pr), minmax(0, 1fr));
    break-inside: avoid; break-after: avoid;
  }
  .print-sheet__cell { display: flex; min-width: 0; min-height: 0; padding: 1.5mm; outline: .2mm dashed #888; outline-offset: -.2mm; }
  .print-sheet[data-per="1"] .print-sheet__cell { padding: 0; outline: 0; }

  .pt, .pt * { -webkit-print-color-adjust: exact; print-color-adjust: exact; box-sizing: border-box; }

  /* ---- Cách tính cỡ chữ ----
     Mỗi bảng là một "container size": cqw = 1% bề rộng bảng, cqh = 1% chiều cao bảng.
     JS (print.js) đặt các biến: --cols số đài, --labw bề rộng cột nhãn (cqw), --W tổng "trọng số" chiều cao các hàng
     (+ chân vé), --span / --dgdb / --dg8 độ rộng chuỗi số dài nhất (đơn vị em), --nm / --nc độ dài tên đài / mã vé.
     --u là chiều cao một dòng số: toàn bộ phần dưới tiêu đề chia đều theo trọng số nên bảng luôn vừa khít chiều cao ô,
     không có hàng nào bị cắt. Cỡ chữ = min(giới hạn theo chiều cao, giới hạn theo bề rộng cột) nên không tràn ngang. */
  .pt {
    --labw: 12; --headh: 15cqw; --W: 24; --span: 3; --dgdb: 6; --dg8: 2; --nm: 8; --nc: 6;
    --u: calc((100cqh - var(--headh)) / var(--W));
    --colw: calc((100cqw - var(--labw) * 1cqw) / var(--cols));
    --avail: calc(var(--colw) - 2.4cqw);
    --labavail: calc((var(--labw) - 1.6) * 1cqw);
    --serif: "Times New Roman", Times, "Liberation Serif", "Noto Serif", serif;
    --sans: Arial, "Liberation Sans", Helvetica, "Noto Sans", sans-serif;
    --disp: "Chin Duc Display", "Times New Roman", Times, "Liberation Serif", serif;

    container-type: size; display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0;
    overflow: hidden; border: .3mm solid #000; background: #fff; color: #000;
    font-family: var(--sans); font-variant-numeric: lining-nums; font-feature-settings: "lnum" 1;
    text-rendering: geometricPrecision; font-kerning: normal;
  }

  /* Tiêu đề */
  .pt__head { flex: none; height: var(--headh); display: flex; align-items: center; justify-content: space-between; gap: 2cqw; padding: 0 3cqw; background: #fff; color: #000; border-bottom: .3mm solid #000; overflow: hidden; }
  .pt__head-l { min-width: 0; }
  .pt__title { font-family: var(--serif); font-size: 3.9cqw; font-weight: 700; line-height: 1.2; letter-spacing: .01em; white-space: nowrap; }
  .pt__sub { margin-top: .8cqw; font-family: var(--serif); font-size: 3cqw; font-style: italic; line-height: 1.25; white-space: nowrap; }
  .pt__head-r { flex: none; text-align: center; }
  .pt__date { font-family: var(--serif); font-size: 6.8cqw; font-weight: 700; line-height: 1; padding-bottom: .7cqw; border-bottom: .35cqw solid #000; white-space: nowrap; }
  .pt__year { margin-top: .8cqw; font-family: var(--sans); font-size: 2.6cqw; font-weight: 700; line-height: 1.1; letter-spacing: .45em; padding-left: .45em; white-space: nowrap; }

  /* Lưới: hàng thứ + tên đài, hàng ngày + mã vé, rồi các giải. Chiều cao hàng do JS đặt theo trọng số (fr). */
  .pt__grid { flex: 1; min-height: 0; display: grid; grid-template-columns: calc(var(--labw) * 1cqw) repeat(var(--cols), minmax(0, 1fr)); }
  .pt__c { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; padding: 0 .9cqw; overflow: hidden;
    border-right: .25mm solid #000; border-bottom: .25mm solid #000; text-align: center; }
  .pt__c.is-last { border-right: 0; }
  .pt__c.is-alt { background: #fff; }   /* nền trắng toàn bảng (như vé giấy), chữ đen */

  .pt__hd { font-weight: 700; line-height: 1.05; }
  .pt__hd:not(.pt__lab) { font-family: var(--serif); font-size: min(calc(var(--u) * .6), calc(var(--avail) / (var(--nm) * .56))); }
  .pt__lab.pt__hd { font-size: min(calc(var(--u) * .6), calc(var(--labavail) / 3.5)); color: #000; }
  .pt__lab.pt__hd--date { font-size: min(calc(var(--u) * .6), calc(var(--labavail) / 2.8)); }
  .pt__code { font-size: min(calc(var(--u) * .55), calc(var(--avail) / (var(--nc) * .6))); font-weight: 400; line-height: 1.05; flex-wrap: wrap; overflow-wrap: anywhere; }

  /* Cột nhãn giải */
  .pt__lab { flex-direction: column; justify-content: center; font-weight: 400; color: #111;
    font-size: min(calc(var(--u) * .5), calc(var(--labavail) / 2.7)); line-height: 1.1; white-space: nowrap; }
  .pt__lab--tall { justify-content: flex-start; padding-top: calc(var(--u) * .3); padding-bottom: calc(var(--u) * .3); gap: calc(var(--u) * .2); }
  .pt__lab--tall .pt__lab-t { flex: none; }
  .pt__vert { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;   /* column = xếp hai dòng chữ dọc cạnh nhau */
    writing-mode: vertical-rl; transform: rotate(180deg);
    font-family: var(--serif); font-weight: 700; line-height: 1.15; white-space: nowrap; color: #000;
    font-size: min(calc(var(--u) * .65), calc(var(--labavail) / 2.4)); }
  @supports (writing-mode: sideways-lr) { .pt__vert { writing-mode: sideways-lr; transform: none; } }
  .pt__vert > span { display: block; }
  .pt__vert > span + span { letter-spacing: .05em; }

  /* Dãy số */
  .pt__nums { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; }
  .pt__n { display: block; width: 100%; height: var(--u); line-height: var(--u); white-space: nowrap; text-align: center;
    font-family: var(--sans); font-weight: 400; font-variant-numeric: lining-nums tabular-nums; letter-spacing: .01em;
    font-size: min(calc(var(--u) * .9), calc(var(--avail) / var(--span))); }

  .pt__val--g8 .pt__n { height: auto; line-height: 1; font-family: var(--disp); font-weight: 900;
    font-size: min(calc(var(--u) * 2), calc(var(--avail) / (var(--dg8) * .7))); }
  .pt__val--db .pt__n { height: auto; line-height: 1; font-family: var(--serif); font-weight: 700;
    font-size: min(calc(var(--u) * 1.25), calc(var(--avail) / (var(--dgdb) * .56 + .1))); }

  /* Miền Bắc: một cột, mỗi dòng 1 đến 4 số (--per do JS đặt cho từng hàng) */
  .pt[data-region="MB"] .pt__nums { flex-direction: row; flex-wrap: wrap; align-content: center; }
  .pt[data-region="MB"] .pt__n { flex: 0 0 calc(100% / var(--per, 1)); width: auto; }
  .pt[data-region="MB"] .pt__val--db .pt__n { flex-basis: 100%; }

  /* Chân vé */
  .pt__foot { flex: none; height: calc(var(--u) * 1.15); display: flex; align-items: center; justify-content: center; padding: 0 2cqw; overflow: hidden;
    background: #fff; color: #000; border-top: .3mm solid #000; text-align: center; white-space: nowrap; font-family: var(--serif); font-weight: 700;
    font-size: min(calc(var(--u) * .62), 4cqw); }
}


/* ==========================================================================
   Chọn đài, thanh điều hướng tuần, thẻ một đài, dải DEMO
   ========================================================================== */

/* ---------- Dải cảnh báo dữ liệu DEMO ---------- */
.demo-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; padding: .6rem .9rem;
  border: 2px dashed var(--red); border-radius: var(--radius-sm); background: var(--red-soft);
  font-size: .875rem; line-height: 1.4;
}
.demo-banner > strong:first-child {
  padding: .1rem .6rem; border-radius: 999px; background: var(--black); color: #fff;
  font-size: .75rem; letter-spacing: .08em;
}

/* ---------- Khu vực chọn đài: danh sách dọc (xem ảnh tham khảo) ----------
   Mỗi miền một khối: thanh tiêu đề đỏ "Xổ Số Miền …" + mỗi đài một dòng; ✓ = có kết quả đúng ngày đang xem, chữ đỏ = đang xem. */
.stations { overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.stations__bar { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; }
.stations__title { font-size: 1.0625rem; font-weight: 800; letter-spacing: -.01em; }
.stations__date { margin-top: .1rem; font-size: .8125rem; font-weight: 600; color: var(--ink-2); }
.stations__group + .stations__group { border-top: 1px solid var(--line-soft); }
.stations__region {                    /* <summary> của từng miền: bấm để thu gọn / mở rộng, mũi tên chỉ trạng thái */
  position: relative; display: block; padding: .65rem 2rem; text-align: center; font-size: 1rem; font-weight: 800; color: #fff;
  background: linear-gradient(180deg, #E4282E 0%, var(--red) 55%, var(--red-dark) 100%);
  cursor: pointer; list-style: none; user-select: none;
}
.stations__region::-webkit-details-marker { display: none; }
.stations__region:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.stations__chev { position: absolute; right: .8rem; top: 50%; margin-top: -8px; transition: transform .15s; }
.stations__group:not([open]) > .stations__region .stations__chev { transform: rotate(-90deg); }   /* đóng: ▸ — mở: ▾ */

/* Ô tìm kiếm: luôn hiện ngay dưới tiêu đề danh sách đài; kính lúp bên trái, nút X xoá bên phải (chỉ hiện khi có chữ). */
.stations__search { position: relative; margin: 0 1rem .7rem; }
.stations__search-input {
  width: 100%; height: 2.375rem; padding: 0 2.1rem; border: 1.5px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--ink); font: inherit; font-size: .9375rem;
}
.stations__search-input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-tint); }
.stations__search-icon { position: absolute; left: .8rem; top: 50%; margin-top: -8px; color: var(--ink-3); pointer-events: none; }
.stations__search-clear {
  position: absolute; right: .35rem; top: 50%; display: grid; place-items: center; width: 1.7rem; height: 1.7rem; margin-top: -.85rem;
  padding: 0; border: 0; border-radius: 50%; background: var(--line-soft); color: var(--ink-2); cursor: pointer;
}
.stations__search-clear:hover { background: var(--red); color: #fff; }
.stations__empty { padding: .9rem 1rem; text-align: center; font-size: .875rem; color: var(--ink-2); }
.stations__list { padding: .3rem 0; }
.station-chip {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  min-height: 2.5rem; padding: .35rem .75rem .35rem 2.1rem;
  font-size: .9375rem; font-weight: 500; text-decoration: none; color: var(--ink);
}
.station-chip::before {               /* dấu đầu dòng ┣ như ảnh */
  content: ""; position: absolute; left: 1rem; top: 50%; width: .45rem; height: 1rem; margin-top: -.5rem;
  border-left: 2px dotted var(--ink-3); background: linear-gradient(var(--ink-3), var(--ink-3)) 0 50% / 100% 2px no-repeat;
}
.station-chip:hover { background: var(--red-soft); color: var(--red-ink); }
.station-chip.is-current, .station-chip.is-current:hover { color: var(--red-ink); font-weight: 700; }
.station-chip--all { font-weight: 700; }
.station-chip__tick { flex: none; font-size: 1.15rem; font-weight: 800; line-height: 1; color: var(--red-ink); }

/* Máy tính bảng / điện thoại: danh sách mở ra từ nút menu (≡) và có KHUNG CUỘN riêng — thanh cuộn luôn hiện, kèm bóng mờ ở mép
   trên/dưới khi còn đài chưa nhìn thấy, để người dùng biết còn có thể cuộn. */
@media (max-width: 1023.98px) {
  .stations__menu {
    max-height: min(55vh, 22rem); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    scrollbar-width: thin; scrollbar-color: var(--red) var(--line-soft);
    background:
      linear-gradient(var(--card) 30%, transparent) center top / 100% 2.5rem no-repeat local,
      linear-gradient(transparent, var(--card) 70%) center bottom / 100% 2.5rem no-repeat local,
      radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, .25), transparent) center top / 100% .75rem no-repeat,
      radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, .25), transparent) center bottom / 100% .75rem no-repeat;
    background-color: var(--card);
  }
  .stations__menu::-webkit-scrollbar { width: 10px; }
  .stations__menu::-webkit-scrollbar-track { background: var(--line-soft); }
  .stations__menu::-webkit-scrollbar-thumb { background: var(--red); border-radius: 6px; border: 2px solid var(--card); }
}

/* ---------- Thanh điều hướng tuần ---------- */
.weeknav { overflow-x: auto; margin-inline: calc(var(--gutter) * -1); padding: .15rem var(--gutter); scrollbar-width: none; }
.weeknav::-webkit-scrollbar { display: none; }
.weeknav__list { display: flex; align-items: stretch; gap: .4rem; min-width: max-content; }
.weeknav__item { display: flex; }
.weeknav__btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .05rem;
  min-width: 3.9rem; min-height: 3rem; padding: .3rem .65rem;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--card);
  color: var(--ink); text-decoration: none; line-height: 1.15;
}
.weeknav__btn:hover { border-color: var(--red); background: var(--red-soft); }
.weeknav__arrow { font-size: 1.0625rem; font-weight: 800; letter-spacing: -.12em; color: var(--red-ink); }
.weeknav__label { font-size: .75rem; font-weight: 800; white-space: nowrap; }
.weeknav__sub { font-size: .6875rem; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.weeknav__btn.is-disabled { opacity: .4; cursor: not-allowed; background: transparent; }
.weeknav__item--current { flex: 1 0 auto; }
.weeknav__date, .weeknav__current {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; width: 100%; min-width: 9rem; min-height: 3rem; padding: .3rem 1rem;
  border: 1.5px solid var(--red); border-radius: var(--radius-sm); background: var(--red-soft); color: var(--ink);
  font: inherit; font-size: 1.0625rem; font-weight: 800; font-variant-numeric: tabular-nums; cursor: pointer;
}
.weeknav__current { cursor: default; }
.weeknav__date:hover { background: var(--red-tint); }
.weeknav__date svg { color: var(--red-ink); }
@media (min-width: 640px) {
  .weeknav { margin-inline: 0; padding-inline: 0; overflow: visible; }
  .weeknav__list { min-width: 0; width: 100%; }
  .weeknav__btn { min-width: 4.4rem; }
}

/* ---------- Thẻ một đài (xem ảnh tham chiếu): tiêu đề đỏ, ĐB và giải tám nổi bật, bảng loto cạnh bảng giải ---------- */
.rcard__more { color: #fff; font-size: .8125rem; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; margin-left: auto; }
.rcard__more::after { content: " ›"; }
.rcard__more:hover { text-decoration-thickness: 2px; }
.rcard__body { display: block; }
.rt--station tbody th { vertical-align: middle; }
.rt--station td[data-col] { text-align: center; }
.rt--station .nums { align-items: center; }
.rt--station .n { font-size: 1.25rem; font-weight: 800; }
.rt--station tr[data-prize="G8"] .n { font-size: 2rem; color: var(--red-dark); }
.rt--station tr.is-special .n { font-size: 2.5rem; line-height: 1.1; color: var(--red-ink); }
.rt--station tr.is-special > * { padding-block: .9rem; }
.lt--split { table-layout: fixed; }
.lt--split th, .lt--split td { text-align: center; vertical-align: middle; font-size: .875rem; }
.lt--split tbody th { width: 3rem; background: var(--red-soft); }
.lt--split sup { font-size: .65em; font-weight: 800; color: var(--red-ink); }
@media (min-width: 900px) {
  .rcard__body { display: grid; grid-template-columns: minmax(0, 1fr) 15.5rem; align-items: start; }
  .rcard--station .loto { border-top: 0; border-left: 1px solid var(--line-soft); }
  .rcard--station .loto summary { padding-inline: 1rem; }
  .rcard--station .loto__body { padding-inline: .75rem; }
}


/* ==========================================================================
   Điện toán — khối ở trang chủ (.rcard--dt) và thẻ "7 ngày qua" của từng game (.dth)
   Dùng lại .ball / .ball-group / .balls ở trên; màu theo biến nên tự đổi ở chế độ tối.
   ========================================================================== */
.rcard--dt .dt-grid { grid-template-columns: 1fr; }                 /* mỗi game một hàng, như website tham khảo */
.rcard--dt .dt { border-left: 0; border-top: 1px solid var(--line-soft); }
.rcard--dt .dt:first-child { border-top: 0; }
.dt__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .1rem 1rem; }
.dt__head .dt__sub { margin-top: 0; }
.dt-face { min-width: 0; }
.rcard--dt .dt .balls { justify-content: center; }
.rcard--dt .dt .dt-prizes { width: fit-content; max-width: 100%; margin-inline: auto; }

/* Max 4D: danh sách giải, mỗi dãy 4 số là một viên; giải đầu (Nhất) tô đỏ đậm */
.dt-prizes { display: grid; grid-template-columns: max-content 1fr; align-items: center; gap: .55rem 1rem; margin-top: .75rem; }
.dt-prizes dt { font-size: .875rem; font-weight: 700; color: var(--ink-2); }
.dt-prizes dd { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; }
.n4 {
  display: inline-block; padding: .25rem .7rem; border-radius: 999px; background: var(--red-soft); color: var(--red-ink);
  font-size: 1.0625rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .1em;
}
.dt-prizes dt:first-of-type + dd .n4 { background: var(--red); color: #fff; }

/* Trang một game: mỗi kỳ quay một hàng — ngày bên trái, số bên phải */
.dth { margin: 0; padding: 0; list-style: none; }
.dth__row { display: grid; grid-template-columns: minmax(0, 1fr); gap: .2rem; padding: .9rem 1rem; border-top: 1px solid var(--line-soft); }
.dth__row:first-child { border-top: 0; }
.dth__when { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .6rem; }
.dth__date { font-size: 1rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.dth__day { font-size: .8125rem; color: var(--ink-3); }
.dth .balls, .dth .dt-prizes { margin-top: .45rem; }

@media (max-width: 479.98px) {
  .rcard--dt .ball { min-width: 2.25rem; height: 2.25rem; padding-inline: .2rem; font-size: 1rem; }
  .rcard--dt .balls { gap: .5rem .75rem; }
  .rcard--dt .ball-group { gap: .3rem; }
  .rcard--dt .ball-group + .ball-group { padding-left: .75rem; }
  .dt-prizes { grid-template-columns: minmax(0, 1fr); gap: .15rem; }
  .dt-prizes dd { margin-bottom: .5rem; }
}

@media (min-width: 640px) {
  .dth__row { grid-template-columns: 9.5rem minmax(0, 1fr); align-items: center; gap: 1rem; padding: 1rem 1.5rem; }
  .dth__when { flex-direction: column; flex-wrap: nowrap; gap: 0; }
  .dth .balls, .dth .dt-prizes { margin-top: 0; }
}


/* ==========================================================================
   Nhận diện đại lý (lấy từ biển hiệu): dải xanh lá trên header, logo chữ + hình Thần Tài, nhãn vàng, footer mới.
   Vàng / xanh lá chỉ dùng làm điểm nhấn — màu chủ đạo vẫn là đỏ + đen. Đặt cuối file để thắng các luật cũ cùng độ ưu tiên.
   ========================================================================== */
:root {
  --sign-yellow: #FFD400;    /* vàng nền biển hiệu: huy hiệu logo, nhãn "Chuyên sỉ & lẻ", nút gọi */
  --sign-green: #0B6B3A;     /* xanh lá thanh địa chỉ dưới biển: dải liên hệ trên header, dải cuối footer */
}

/* --- dải liên hệ trên cùng --- */
.topstrip { background: var(--sign-green); color: #fff; font-size: .8125rem; }
.topstrip__inner { display: flex; align-items: center; justify-content: space-between; gap: .25rem 1rem; padding-block: .2rem; }
.topstrip p { display: flex; align-items: center; gap: .4rem; min-width: 0; margin: 0; }
.topstrip svg { flex: none; }
.topstrip__addr span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topstrip__phones { flex-wrap: wrap; justify-content: flex-end; }
.topstrip a { padding: .3rem .1rem; color: #fff; font-weight: 800; letter-spacing: .02em; text-decoration: none; font-variant-numeric: tabular-nums; }
.topstrip a:hover { text-decoration: underline; }
.topstrip__phones a + a { padding-left: .6rem; border-left: 1px solid rgba(255, 255, 255, .45); }
@media (max-width: 639.98px) {
  .topstrip .topstrip__addr { display: none; }                      /* địa chỉ đã có ở footer; trên điện thoại chỉ giữ số để bấm gọi */
  .topstrip__inner, .topstrip__phones { justify-content: center; }
  .topstrip a { font-size: .9375rem; }
}

/* --- logo chữ: huy hiệu vàng có Thần Tài + "ĐẠI LÝ VÉ SỐ / CHÍN ĐỨC" --- */
.site-header__bar { gap: .5rem 1.25rem; }
.brand { gap: .65rem; }
.brand__badge {
  flex: none; width: 3rem; height: 3rem; overflow: hidden; border-radius: 50%;
  background: var(--sign-yellow); border: 2px solid #fff; box-shadow: 0 2px 0 rgba(0, 0, 0, .25);
}
.brand__mascot { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; transform: scale(1.2); transform-origin: 50% 12%; }
.brand__text { display: grid; gap: .22rem; line-height: 1; }
.brand__kicker { font-size: .6875rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--sign-yellow); }
.brand__name { font-size: 1.5rem; font-weight: 900; letter-spacing: .01em; text-transform: uppercase; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .28); }
.site-header__tagline {
  display: none; margin: 0 auto; padding: .35rem .95rem; border-radius: 999px;
  background: var(--sign-yellow); color: var(--red-deep); font-size: .875rem; font-weight: 700;
}
.site-header__tagline strong { font-weight: 900; }
@media (min-width: 768px) {
  .site-header__tagline { display: block; }
  .brand__badge { width: 3.5rem; height: 3.5rem; }
  .brand__name { font-size: 1.875rem; }
}

/* --- footer: giới thiệu + liên hệ, tên thương hiệu cỡ lớn, liên kết nhanh, dải xanh lá cuối trang --- */
.site-footer__inner { gap: 1.25rem; padding-block: 1.75rem 1.5rem; font-size: .9375rem; color: rgba(255, 255, 255, .86); }
.site-footer__top { display: grid; gap: 1.25rem; }
.site-footer__title { margin: 0 0 .4rem; font-size: .8125rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: rgba(255, 255, 255, .6); }
.site-footer__about .site-footer__title { font-size: 1.25rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: #fff; }
.site-footer__about .site-footer__title strong { color: var(--sign-yellow); font-weight: 900; text-transform: uppercase; }
.site-footer__lead { margin: 0; }
.site-footer__lead strong { color: #fff; }
.site-footer__address { display: grid; gap: .65rem; font-style: normal; }
.site-footer__address p { display: flex; align-items: flex-start; gap: .5rem; margin: 0; }
.site-footer__address svg { flex: none; margin-top: .2rem; color: var(--sign-yellow); }
.site-footer__phones { flex-wrap: wrap; gap: .5rem; }
.site-footer__call {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 2.75rem; padding: .4rem 1rem; border-radius: 999px;
  background: var(--sign-yellow); color: var(--red-deep); font-weight: 800; text-decoration: none; font-variant-numeric: tabular-nums;
}
.site-footer__call svg { margin: 0; color: currentColor; }
.site-footer__call:hover { background: #fff; }

.site-footer__wordmark { display: flex; align-items: center; justify-content: center; gap: .75rem; padding-block: .75rem; border-block: 1px solid rgba(255, 255, 255, .12); }
.site-footer__mascot { flex: none; width: 3.25rem; height: auto; }
.site-footer__mascot--flip { transform: scaleX(-1); }
.site-footer__logo { margin: 0; font-size: clamp(1.75rem, 8vw, 3.5rem); font-weight: 900; line-height: 1.05; letter-spacing: .01em; text-align: center; }
.site-footer__logo-a { color: var(--sign-yellow); }
.site-footer__logo-b { color: #FF3B41; -webkit-text-stroke: 1.5px #fff; paint-order: stroke fill; }
@media (max-width: 479.98px) { .site-footer__mascot--flip { display: none; } }

.site-footer__links { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem 1.25rem; }
.site-footer__links a { padding: .4rem 0; color: rgba(255, 255, 255, .9); font-weight: 600; text-decoration: none; }
.site-footer__links a:hover { color: var(--sign-yellow); text-decoration: underline; }

.site-footer__legal { background: var(--sign-green); color: #fff; }
.site-footer__legal-inner { display: grid; gap: .25rem; padding-block: .85rem; font-size: .8125rem; }
.site-footer__legal p { margin: 0; }
.site-footer__note { max-width: none; color: #fff; }
.site-footer__meta { color: rgba(255, 255, 255, .8); }
@media (min-width: 768px) {
  .site-footer__top { grid-template-columns: 1fr auto; align-items: start; gap: 2rem; }
  .site-footer__mascot { width: 4.5rem; }
  .site-footer__legal-inner { grid-template-columns: 1fr auto; align-items: center; gap: 1rem; }
}

/* --- đang chờ kết quả: GIF ba chấm (static/images/cho-xo-so.gif, 30×10 px nên chỉ phóng theo bội số) --- */
.waiting { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink-3); font-size: .8125rem; font-weight: 600; }
.waiting__gif { display: block; flex: none; height: auto; image-rendering: pixelated; }   /* chỉ phóng theo bội số nguyên của 30×10 nên giữ nét, không mờ */
.waiting--sm .waiting__gif { width: 60px; }
.waiting--md, .waiting--lg { flex-direction: column; gap: .2rem; text-align: center; }
.waiting--md .waiting__gif { width: 90px; }
.waiting--lg .waiting__gif { width: 120px; }
.dt-face__wait { display: flex; justify-content: center; padding: .6rem 0 .25rem; }
.empty--wait { display: flex; flex-direction: column; align-items: center; gap: .4rem; text-align: center; }
@media (prefers-reduced-motion: reduce) { .waiting__gif { display: none; } }
