/* Zoveso — one hand-written stylesheet. No inline styles anywhere (CSP).
   Short class names: wrap, the (card), bang (table), so (number), db (special
   prize), seg (segmented switch), crumb, note. Max 3 selector levels.
   Breakpoints: < 640 phone, 640–1023 tablet (one column), ≥ 1024 desktop
   (header nav, results + 320px sidebar). */

/* Text: Inter (Rasmus Andersson), one variable font, wght 400–800 — bold is a
   weight, never another family. Google Fonts latin + vietnamese subsets.
   Numbers of the result tables: Nunito (Vernon Adams, Google), rounded,
   variable, cut to the digits 0–9 (tabular by design); other characters
   fall back to Inter.
   Both SIL Open Font License 1.1. */
@font-face { font-family: "Inter"; font-weight: 400 800; font-display: swap;
  src: url(inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-weight: 400 800; font-display: swap;
  src: url(inter-viet.woff2) format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Zoveso So"; font-weight: 400 800; font-display: swap;
  src: url(nunito-so.woff2) format("woff2"); unicode-range: U+0030-0039; }

:root {
  --do: #c8102e;        /* brand red: links, ĐB numbers, buttons */
  --do-dam: #a00d25;    /* hover, ĐB label */
  --do-nhat: #fef2f2;   /* red tint: ĐB row, active pills */
  --do-nhat-2: #fde7e9; /* stronger tint: ĐB label cell */
  --chu: #18181b;       /* ink */
  --chu-2: #3f3f46;     /* secondary ink: buttons, prose */
  --nhat: #52525b;      /* muted text */
  --nhat-2: #71717a;    /* labels, captions */
  --nen: #f4f4f5;       /* page ground */
  --nen-2: #fafafa;     /* table header cells */
  --the: #ffffff;       /* cards */
  --vien: #e4e4e7;      /* card borders */
  --ke: #f0f0f2;        /* hairlines inside cards */
  --xanh: #15803d;      /* "ĐÃ HOÀN TẤT" */
  --r: 12px;            /* card radius (14px desktop) */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 14px/1.45 var(--font); color: var(--chu); background: var(--nen);
  -webkit-font-smoothing: antialiased; overflow-wrap: break-word;
}
svg { flex: none; }
a { color: var(--do); }
a:hover { color: var(--do-dam); }
h1, h2, h3 { line-height: 1.3; margin: 1.1em 0 .5em; }
h1 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p, ul, ol { margin: 0 0 .8em; }
:focus-visible { outline: 2px solid var(--do); outline-offset: 2px; }
button, input, select { font: inherit; }

.an {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 8px; }
main.wrap { padding-bottom: 8px; min-height: 60vh; }
.note { color: var(--nhat); font-size: 12.5px; }
.nut {
  display: inline-block; padding: 8px 16px; border-radius: 10px; border: 0;
  background: var(--do); color: #fff; font-weight: 700; text-decoration: none; cursor: pointer;
}
.nut:hover { background: var(--do-dam); color: #fff; }
.the { background: var(--the); border: 1px solid var(--vien); border-radius: var(--r); overflow: hidden; }
.bang { width: 100%; border-collapse: collapse; }
.so { display: block; font-family: "Zoveso So", var(--font); font-weight: 700; font-variant-numeric: tabular-nums; }
.db { color: var(--do); }
.trong { padding: 16px 12px; background: var(--the); border: 1px solid var(--vien); border-radius: var(--r); }
.xem-them { margin: 8px 4px; font-size: 13px; font-weight: 600; }

/* Header: [logo] [ticket search, flex] [menu] on phones (50px); desktop adds
   the wordmark and nav, the search is as wide as the sidebar (320px). */
.top { background: var(--the); border-bottom: 1px solid var(--vien); }
.top-in {
  max-width: 1200px; margin: 0 auto; height: 50px; padding: 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.logo {
  display: flex; align-items: center; gap: 8px; flex: none; min-width: 34px; height: 34px;
  justify-content: center; color: var(--chu); text-decoration: none; font-weight: 800; font-size: 20px; letter-spacing: -.01em;
}
.logo:hover { color: var(--chu); }
.logo span { display: none; }
.nav { display: none; gap: 4px; }
.nav a { padding: 8px 12px; border-radius: 8px; font-weight: 600; color: var(--chu-2); text-decoration: none; white-space: nowrap; }
.nav a:hover { color: var(--do); }
.nav a.on { color: var(--do); background: var(--do-nhat); }
.cham { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--do); vertical-align: 1px; }
.tim {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 36px;
  padding: 0 3px 0 10px; background: var(--nen); border: 1px solid var(--vien); border-radius: 10px;
}
.tim svg { color: var(--nhat-2); }
.tim input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--chu); font-size: 14px; outline: 0; }
.tim input::placeholder { color: var(--nhat-2); }
.tim:focus-within { border-color: var(--do); }
.tim button {
  height: 28px; padding: 0 11px; border: 0; border-radius: 7px; background: var(--do); color: #fff;
  font-weight: 700; font-size: 13px; cursor: pointer;
}
.tim button:hover { background: var(--do-dam); }
.tt-nut {
  flex: none; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border: 1px solid var(--vien); border-radius: 10px; background: var(--the); color: var(--do);
}
.tt-nut:hover, .tt-nut.on { border-color: var(--do); background: var(--do-nhat); }
.tt-tam { animation: tt-nhip 1.6s ease-in-out infinite; }
@keyframes tt-nhip { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .tt-tam { animation: none; } }
.menu { position: relative; flex: none; }
.menu summary {
  list-style: none; cursor: pointer; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--vien); border-radius: 10px; background: var(--the); color: var(--chu);
}
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { border-color: var(--do); color: var(--do); }
/* No JS: while open, a transparent layer over the page belongs to the
   summary, so a click outside the panel toggles the menu closed. */
.menu[open] summary::before { content: ""; position: fixed; inset: 0; z-index: 9; cursor: default; }
.menu-hop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; width: 288px; max-width: calc(100vw - 20px); padding: 12px;
  background: var(--the); border: 1px solid var(--vien); border-radius: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, .14);
}
.menu ul { margin: 0; padding: 0; list-style: none; }
.m-tde { margin: 2px 4px 8px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--nhat-2); }
.menu .m-mien { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 14px; }
.m-mien a {
  display: grid; gap: 1px; padding: 9px 4px; text-align: center; text-decoration: none;
  background: var(--nen-2); border: 1px solid var(--vien); border-radius: 10px; color: var(--chu);
}
.m-mien b { font-size: 13px; font-weight: 700; white-space: nowrap; }
.m-mien small { font-size: 11px; font-weight: 600; color: var(--nhat-2); }
.m-mien a:hover, .m-mien a.on { border-color: var(--do); background: var(--do-nhat); }
.m-mien a.on b, .m-mien a.on small, .m-mien a:hover small { color: var(--do); }
.m-ds a { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 10px; font-weight: 600; color: var(--chu); text-decoration: none; }
.m-ds a:hover, .m-ds a.on { background: var(--nen); color: var(--do); }
.m-ic { display: grid; flex: none; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--do-nhat); color: var(--do); }
.m-ic svg { width: 18px; height: 18px; }
.m-live { margin-left: auto; padding: 2px 7px; border-radius: 999px; background: var(--do); font-size: 10px; font-weight: 800; letter-spacing: .04em; color: #fff; }
.m-cuoi { display: flex; gap: 16px; margin: 10px 0 0; padding: 10px 6px 0; border-top: 1px solid var(--ke); font-size: 13px; }
.m-cuoi a { color: var(--nhat); text-decoration: none; }
.m-cuoi a:hover { color: var(--do); }

/* Breadcrumb */
.crumb { font-size: 12px; color: var(--nhat-2); margin: 8px 4px 0; }
.crumb ol { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.crumb li + li::before { content: "›"; margin: 0 6px; }
.crumb a { color: var(--nhat); text-decoration: none; }
.crumb a:hover { color: var(--do); }
.crumb [aria-current] { color: var(--chu); font-weight: 600; }
.tieu-de { margin: 4px 4px 8px; }
.tieu-de small { display: block; font-size: 13px; font-weight: 400; color: var(--nhat); letter-spacing: 0; }
.sub { margin: 0 4px 10px; font-size: 12.5px; color: var(--nhat); }

/* Segmented switch (regions, ky=30…365) and the date with ‹ ›. */
.seg { display: flex; gap: 2px; padding: 3px; background: var(--vien); border-radius: 10px; }
.seg a, .seg label {
  padding: 4px 10px; border-radius: 8px; line-height: 20px; font-size: 13px; font-weight: 600;
  color: var(--chu-2); text-decoration: none; white-space: nowrap; cursor: pointer;
}
.seg a:hover, .seg label:hover { color: var(--do); }
.seg .on, .seg [aria-current] { background: var(--the); color: var(--do); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.dk { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 0; }
.ngay { display: flex; align-items: center; gap: 2px; }
.ngay a, .ngay .tat { width: 28px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--chu-2); }
.ngay a:hover { background: var(--vien); }
.ngay .tat { opacity: .3; }
.ngay b { font-size: 13px; white-space: nowrap; }
.rong { display: none; }

/* Result tables. Phone budget (home / Miền Nam, 4 stations, 360×640 with
   ~560px visible): header 50 + bar 42 + card (thead 30 + 17 lines × 21 +
   ĐB 26 + 9 hairlines + 2) 424 + digit strip 40 = 556px. */
.kq { table-layout: fixed; }
.kq caption { caption-side: top; }
.kq th, .kq td { padding: 0; border-top: 1px solid var(--ke); text-align: center; }
.kq td + td, .kq th + td { border-left: 1px solid var(--nen); }
.kq thead th { height: 30px; border-top: 0; background: var(--nen-2); font-size: 12.5px; font-weight: 700; line-height: 1.2; }
.kq thead a, .cap a { color: var(--chu); text-decoration: none; }
.kq thead a:hover, .cap a:hover { color: var(--do); }
.kq thead small { display: none; }
.kq .nhan { width: 30px; }
/* 4 MN/MT stations: the prize column only fits from 440px; below it is hidden
   and each row's first cell carries the label for screen readers (.nh4). */
.k4 .nh4 { display: none; }
@media (max-width: 439px) {
  .k4 .nhan, .k4 tbody th { display: none; }
  .k4 .nh4 { display: inline; }
}
.kq abbr { text-decoration: none; }
.kq tbody th { font-size: 11px; font-weight: 600; color: var(--nhat-2); background: var(--nen-2); }
.kq .so { font-size: 16px; line-height: 21px; }
.kq .g8 .so, .kq .g7 .so { font-size: 18px; color: var(--do); }
.kq .hang-db { background: var(--do-nhat); }
.kq .hang-db th { background: var(--do-nhat-2); color: var(--do-dam); }
.kq .hang-db .so { font-weight: 800; color: var(--do); } /* same size as the other prizes */
.kq tbody tr:first-child > * { border-top-color: var(--vien); }

/* Miền Bắc: station + date strip, one row per prize. */
.cap {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0;
  padding: 8px 12px; background: var(--nen-2); border-bottom: 1px solid var(--ke); font-size: 12.5px;
}
.cap a, .cap b { font-weight: 700; }
.cap span { color: var(--nhat-2); }
.bac { table-layout: auto; }
.bac th, .bac td { padding: 3px 0; }
.bac tbody tr:first-child > * { border-top: 0; }
.bac tbody th { width: 42px; }
.dong { display: flex; justify-content: space-evenly; }
.bac .so { font-size: 17px; line-height: 25px; }
.bac .g7 .so { font-size: 19px; }
.hang-kh .dong { flex-wrap: wrap; gap: 4px; justify-content: center; padding: 2px 4px; }
.kq .hang-kh .so {
  font-size: 12px; line-height: 20px; font-weight: 700; color: var(--chu-2);
  background: var(--nen); border-radius: 6px; padding: 0 6px;
}

/* Digit strip under result tables (loc.js builds it after the card): all
   10 buttons on one row at 360px. Print button only ≥ 640px. */
.loc { display: flex; align-items: center; justify-content: space-between; gap: 3px; padding: 8px 0 4px; }
.loc select {
  flex: none; width: 60px; height: 28px; margin-right: 2px; padding: 0 12px 0 5px; border: 1px solid var(--vien); appearance: none;
  background: var(--the) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0h8L4 5z' fill='%2371717a'/%3E%3C/svg%3E") no-repeat right 4px center;
  border-radius: 8px; color: var(--chu); font-size: 11px; font-weight: 600; cursor: pointer; letter-spacing: -.02em;
}
.loc button {
  flex: 1 1 0; min-width: 0; max-width: 28px; height: 26px; padding: 0; border: 1px solid var(--vien); border-radius: 50%;
  background: var(--the); color: var(--chu-2); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer;
}
.loc button:hover { border-color: var(--do); }
.loc button[aria-pressed="true"] { background: var(--do); border-color: var(--do); color: #fff; }
/* Print button + menu (region tables, ≥ 640px). The menu stays 300ms after
   the pointer leaves, like Doveso. */
.in-kq { position: relative; display: none; flex: none; }
.in-nut {
  display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid var(--vien);
  border-radius: 9px; background: var(--the); color: var(--chu-2); font-size: 13px; font-weight: 600; text-decoration: none;
  white-space: nowrap;
}
.in-nut:hover { border-color: var(--do); color: var(--do); }
.in-nut[aria-disabled] { opacity: .45; cursor: not-allowed; border-color: var(--vien); color: var(--chu); }
.in-nut svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.in-menu {
  position: absolute; left: 0; bottom: 100%; z-index: 5; margin-bottom: 4px; padding: 4px 0; min-width: 176px;
  background: var(--the); border: 1px solid var(--vien); border-radius: 10px; box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
  visibility: hidden; opacity: 0; transition: visibility 0s .3s, opacity .15s .15s;
}
.in-kq:hover .in-menu, .in-kq:focus-within .in-menu { visibility: visible; opacity: 1; transition-delay: 0s; }
.in-menu a { display: block; padding: 8px 12px; color: var(--chu); font-size: 13px; white-space: nowrap; text-decoration: none; }
.in-menu a:hover { background: var(--nen); color: var(--do); }
.kq .so.mo { opacity: .2; }
.kq .hl {
  background: linear-gradient(90deg, #dc2626, #f97316, #ec4899, #dc2626) 0 0 / 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: hl 2s linear infinite;
}
@keyframes hl { to { background-position: 300% 0; } }
@media (prefers-reduced-motion: reduce) { .kq .hl { animation: none; } }

/* Section heading above a card: "Lô tô Miền Nam", "Thống kê". */
.sec { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 16px 4px 8px; }
.sec h2 { margin: 0; font-size: 15px; font-weight: 700; }
.sec a { font-size: 12.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }

/* Lô tô: MN/MT one table "Đầu | đài…"; MB two, mirrored "Lô tô | Đuôi". */
.lt { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12.5px; }
.lt th, .lt td { padding: 4px 2px; border-top: 1px solid var(--ke); text-align: center; font-variant-numeric: tabular-nums; }
.lt thead th { border-top: 0; background: var(--nen-2); font-size: 11.5px; font-weight: 700; }
.lt tbody th { width: 30px; background: var(--nen-2); color: var(--do); font-weight: 700; }
.lt-hai { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lt-hai .lt + .lt { border-left: 1px solid var(--ke); }
.lt-hai th, .lt-hai td { padding: 4px 6px; text-align: left; }
.lt-hai tbody th { width: 40px; background: none; text-align: center; }
.lt-hai thead th:first-child { width: 40px; padding: 4px 2px; text-align: center; }
.guong td, .guong thead th:first-child { text-align: right; }
.lt-doi { display: grid; gap: 8px; }
/* Đầu left, Đuôi right once the block is wide enough for both tables
   without wrapping a cell (6 tails "0, 1, 4, 7, 8, 9" is the worst case). */
.loto { container-type: inline-size; }
@container (min-width: 720px) {
  .lt-doi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lt-doi .lt { font-size: 12.5px; }
  .lt-doi td { padding: 4px 1px; word-spacing: -.12em; }
}
.lt-doi .guong td, .lt-doi .guong thead th { text-align: center; }
.lt-doi .lt thead th:first-child, .lt-doi .guong thead th:last-child { width: 44px; }
.lt-doi .guong thead th:first-child { width: auto; }
.lt-hai .guong thead th:first-child { width: auto; }
.guong thead th:last-child { width: 40px; padding: 4px 2px; text-align: center; }

/* Page columns: main results, sidebar, SEO card. Phones stack them; the
   sidebar's schedule only shows on desktop. */
.cot { display: flex; flex-direction: column; }
.ben .lich-hn { display: none; }
.ben .the { padding: 10px 12px 12px; }
.ben h3 { display: flex; justify-content: space-between; gap: 6px; margin: 10px 0 6px; font-size: 12.5px; color: var(--chu-2); }
.ben h3:first-child { margin-top: 2px; }
.ben h3 small, .tk-nhom small { font-weight: 400; color: var(--nhat-2); }
.chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.chips a {
  display: block; padding: 6px 4px; border: 1px solid var(--vien); border-radius: 999px; background: var(--nen-2);
  color: var(--chu); font-size: 12.5px; font-weight: 600; text-align: center; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chips a:hover { border-color: var(--do); color: var(--do); }
.chips .pool { border-color: var(--do); color: var(--do); background: var(--do-nhat); }
.chips li:has(> .pool) { grid-column: span 2; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
/* Wide "Chọn ngày" block (phone landscape, tablet): days and the date form
   share one row instead of stretching across the card. */
.chon { container-type: inline-size; }
@container (min-width: 680px) {
  /* Only when there is a date form (home has none: days keep the full width). */
  .chon .the:has(.chon-ngay) { display: flex; align-items: center; gap: 20px; }
  .chon .the:has(.chon-ngay) .tuan { flex: none; }
  .chon .the:has(.chon-ngay) .days { grid-template-columns: repeat(7, 52px); }
  .chon .chon-ngay { flex: 1; margin-top: 0; }
}
.days a {
  display: flex; flex-direction: column; padding: 6px 0; border-radius: 9px; color: var(--chu-2);
  font-size: 11px; font-weight: 600; text-decoration: none;
}
.days a:hover { background: var(--nen); }
.days b { font-size: 15px; color: var(--chu); }
.days .on, .days .on:hover { background: var(--do); color: #fff; }
.days .on b { color: #fff; }
.chon-ngay { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12.5px; }
.chon-ngay label { color: var(--nhat); white-space: nowrap; }
.chon-ngay input { cursor: pointer;
  flex: 1; min-width: 0; height: 32px; padding: 0 8px; border: 1px solid var(--vien); border-radius: 8px;
  background: var(--the); color: var(--chu); font-size: 13px;
}
.chon-ngay button {
  height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: var(--do); color: #fff; font-weight: 700; cursor: pointer;
}
.tabs .tuan, .tabs .tab-ngay { display: none; }
.sch { display: grid; grid-template-columns: max-content max-content 1fr; gap: 8px 12px; align-items: center; margin: 0; list-style: none; }
/* One grid for the whole list (rows are display: contents) so region,
   time and state line up in columns. */
.sch li { display: contents; font-size: 13px; }
.sch b { font-size: 13px; }
.sch .gio { font-variant-numeric: tabular-nums; }
.sch li > span { text-align: right; }
.sch b a { color: var(--chu); text-decoration: none; }
.sch span { font-size: 12px; color: var(--nhat); }
.sch .live span { color: var(--do); font-weight: 700; }

/* SEO prose card, under the main content. */
.seo {
  margin: 16px 0 0; padding: 12px 14px; background: var(--the); border: 1px solid var(--vien); border-radius: 12px;
  font-size: 13px; line-height: 1.6; color: var(--chu-2);
}
.seo h2 { margin: 0 0 6px; font-size: 15px; line-height: 1.35; color: var(--chu); }
.seo h3 { margin: 10px 0 4px; font-size: 13.5px; color: var(--chu); }
.seo p { margin: 0 0 8px; }
.seo p:last-child { margin: 0; }
.seo a { font-weight: 600; text-decoration: none; }
.seo b { color: var(--chu); font-variant-numeric: tabular-nums; }

/* Home: one tab per region, pure CSS (the server sets `checked`); the
   labels are the segmented switch, the date and week picker follow it. */
.tab-radio { position: absolute; opacity: 0; pointer-events: none; }
.tabs .tab { display: none; }
.tabs:has(#t-nam:checked) #p-nam, .tabs:has(#t-bac:checked) #p-bac, .tabs:has(#t-trung:checked) #p-trung,
.tabs:has(#t-nam:checked) .n-nam, .tabs:has(#t-bac:checked) .n-bac, .tabs:has(#t-trung:checked) .n-trung { display: block; }
.tabs:has(#t-nam:checked) [for="t-nam"],
.tabs:has(#t-bac:checked) [for="t-bac"],
.tabs:has(#t-trung:checked) [for="t-trung"] { background: var(--the); color: var(--do); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.tabs:has(#t-nam:focus-visible) [for="t-nam"],
.tabs:has(#t-bac:focus-visible) [for="t-bac"],
.tabs:has(#t-trung:focus-visible) [for="t-trung"] { outline: 2px solid var(--do); outline-offset: 2px; }
@supports not selector(:has(*)) {
  .tab-bar { display: none; }
  .tabs .tab, .tabs .tuan { display: block; }
}

/* Ticket check (/do-ve-so): hero card with the form, summary strip, one
   card per ticket (badge + win rows), then the guide cards. */
.dv-hero { margin: 8px 0 0; padding: 14px; overflow: visible; }
.dv-gt h1 { margin: 0 0 4px; font-size: 21px; }
.dv-gt p { margin: 0 0 10px; color: var(--chu-2); font-size: 13.5px; }
.dv-diem { display: none; }
.dv-form { display: flex; flex-direction: column; gap: 10px; }
.dv-nhan { font-weight: 700; font-size: 13.5px; }
.dv-nhan span { display: block; font-weight: 400; font-size: 12px; color: var(--nhat-2); }
.dv-form textarea {
  width: 100%; min-height: 64px; padding: 10px 12px; resize: vertical; border: 1px solid var(--vien); border-radius: 10px;
  background: var(--nen); color: var(--chu); font: 600 18px/1.4 var(--font); letter-spacing: .04em; font-variant-numeric: tabular-nums;
}
.dv-form textarea::placeholder { color: var(--nhat-2); font-weight: 400; letter-spacing: 0; }
.dv-form textarea:focus { outline: 0; border-color: var(--do); background: var(--the); box-shadow: 0 0 0 3px var(--do-nhat-2); }
.dv-mien { margin: 0; border: 0; min-width: 0; }
.dv-mien label { flex: 1 1 0; position: relative; text-align: center; }
.dv-mien input { position: absolute; opacity: 0; pointer-events: none; }
.dv-mien label:has(:checked) { background: var(--the); color: var(--do); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.dv-mien label:has(:focus-visible) { outline: 2px solid var(--do); outline-offset: 1px; }
@supports not selector(:has(*)) { .dv-mien input { position: static; opacity: 1; } }
.dv-nut { display: flex; align-items: center; justify-content: center; gap: 8px; height: 46px; font-size: 16px; border-radius: 11px; }
.dv-chu { margin: -2px 0 0; text-align: center; font-size: 12px; color: var(--nhat-2); }
.dv-loi { margin: 10px 0 0; padding: 12px 14px; border-color: #f5b5bf; background: var(--do-nhat); }
.dv-loi h2 { margin: 0 0 2px; font-size: 14.5px; color: var(--do-dam); }
.dv-loi p { margin: 0; color: var(--chu-2); }
.dv-tom { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.dv-tom li {
  padding: 5px 11px; border: 1px solid var(--vien); border-radius: 999px; background: var(--the);
  font-size: 12.5px; color: var(--nhat);
}
.dv-tom b { color: var(--chu); font-variant-numeric: tabular-nums; }
.dv-tom .co { border-color: var(--do-nhat-2); background: var(--do-nhat); color: var(--do-dam); }
.dv-tom .co b { color: var(--do); }
.dv-pham { margin: 6px 4px 10px; font-size: 12.5px; color: var(--nhat); }
.dv-pham b { color: var(--chu); font-variant-numeric: tabular-nums; }
.co-kq .dv-gt p { display: none; }
.ve { margin: 0 0 10px; }
.ve-dau { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 14px; font-size: 14px; }
.ve-dau small { flex: 1; font-size: 12px; font-weight: 600; color: var(--nhat-2); }
.so-ve { font-size: 24px; font-weight: 800; letter-spacing: .05em; font-variant-numeric: tabular-nums; }
.bd { margin-left: auto; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.ve.trung { border-color: var(--do); box-shadow: 0 0 0 3px var(--do-nhat-2); }
.trung .ve-dau { background: var(--do-nhat); }
.trung .bd { background: var(--do); color: #fff; }
.phu .bd { background: var(--do-nhat-2); color: var(--do-dam); }
.ve.phu { border-color: #f5b5bf; }
.khong { background: var(--nen-2); }
.khong .bd { background: var(--vien); color: var(--nhat); }
.khong .so-ve { color: var(--nhat-2); }
.ve-khong { margin: 0; padding: 0 14px 12px; font-size: 13px; color: var(--nhat); }
.ve-ds { margin: 0; padding: 0; list-style: none; }
.ve-ds li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--ke); }
.ve-dai a { display: block; font-weight: 700; color: var(--chu); text-decoration: none; }
.ve-dai a:hover { color: var(--do); }
.ve-dai small, .ve-giai small { display: block; font-size: 12px; color: var(--nhat-2); }
.ve-giai { text-align: right; }
.ve-giai small { font-weight: 600; color: var(--chu-2); }
.khop { font-size: 19px; font-weight: 800; letter-spacing: .04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.khop b { color: var(--do); }
.khop i { font-style: normal; font-weight: 600; color: #a1a1aa; }
.khop em { margin-right: 6px; font-size: 10.5px; font-style: normal; letter-spacing: 0; color: var(--nhat-2); vertical-align: 2px; }
.dv-huong { margin-top: 16px; }
.dv-bai { margin: 0 0 10px; }
.dv-bai h2 { font-size: 16px; }
.dv-buoc { margin: 6px 0 8px; padding-left: 20px; }
.dv-buoc li { margin: 0 0 6px; padding-left: 2px; }
.dv-buoc li::marker { font-weight: 800; color: var(--do); }
.dv-bangs { display: grid; gap: 12px; margin: 8px 0; }
.dv-co h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 0 6px; }
.dv-co h3 small { font-size: 12px; font-weight: 400; color: var(--nhat-2); }
.dv-co table { border: 1px solid var(--vien); border-radius: 10px; border-collapse: separate; border-spacing: 0; overflow: hidden; font-size: 12.5px; }
.dv-co th, .dv-co td { padding: 6px 7px; border-top: 1px solid var(--ke); text-align: left; font-variant-numeric: tabular-nums; }
.dv-co thead th { border-top: 0; white-space: nowrap; background: var(--nen-2); font-size: 11.5px; color: var(--nhat-2); }
.dv-co tbody th { font-weight: 600; color: var(--chu); white-space: nowrap; }
.dv-co tbody tr:first-child th { color: var(--do-dam); }
.dv-co .phu { background: var(--do-nhat); }
.dv-co td:last-child { white-space: nowrap; }
.dv-co .phu td:nth-child(2) { white-space: normal; font-size: 12px; }
.dv-hoi h3 { margin-top: 12px; }

/* Statistics: period switch, KPI tiles, heat grid, lô gan, đầu–đuôi. */
.tk-dau { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 8px; margin: 0 0 8px; }
.tk-dau > div { display: contents; }
.tk-dau .tieu-de { flex-basis: 100%; }
.tk-dau .sub { order: 3; flex: 1; margin: 0; font-size: 11.5px; text-align: right; color: var(--nhat-2); }
.tk-dau .seg a { padding: 4px 7px; font-size: 12.5px; } /* 5 tabs fit 360px */
.tk-thu { margin: 0 0 8px; overflow-x: auto; } /* 8 weekday tabs fit 360px */
.tk-thu a { flex: 1 0 auto; padding: 4px 6px; font-size: 12.5px; text-align: center; }
.tk-luu-y { margin: 0 4px 8px; font-size: 11.5px; color: var(--nhat); }
/* Below 1024px one column: the two column wrappers dissolve so that the
   grid and the lô gan (first of each column) come first. */
.tk-luoi { display: flex; flex-direction: column; }
.tk-luoi > div { display: contents; }
.tk-luoi .tk { order: 2; }
.tk-luoi > div > .tk:first-child { order: 1; }
.kpi { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 0 0 10px; padding: 0; list-style: none; }
.kpi li { padding: 8px 10px; background: var(--the); border: 1px solid var(--vien); border-radius: var(--r); }
.kpi span { display: block; font-size: 11.5px; color: var(--nhat); }
.kpi b { display: block; margin: 2px 0; font-size: 18px; line-height: 1.25; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi i { font-style: normal; }
.kpi em { display: block; font-style: normal; font-size: 12px; color: var(--nhat); } /* own line under the value */
.kpi .rong-k { display: none; }
.tk { margin: 0 0 10px; }
.ch { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 10px 12px 6px; }
.ch h2 { margin: 0; font-size: 14.5px; font-weight: 700; }
.ch span { font-size: 11.5px; color: var(--nhat-2); text-align: right; }
.luoi { width: 100%; border-collapse: separate; border-spacing: 2px; table-layout: fixed; padding: 0 6px 8px; }
.luoi th { font-size: 10.5px; font-weight: 700; color: var(--nhat-2); }
.luoi thead th:first-child { width: 18px; }
.luoi abbr { text-decoration: none; }
.o { height: 30px; border-radius: 6px; text-align: center; line-height: 1.05; font-variant-numeric: tabular-nums; }
.o b { display: block; font-size: 11.5px; font-weight: 700; }
.o small { display: block; font-size: 9.5px; opacity: .75; }
.h0 { background: #f4f4f5; color: #52525b; }
.h1 { background: #fde7e9; color: #7f1d1d; }
.h2 { background: #fbc8cf; color: #7f1d1d; }
.h3 { background: #f48a99; color: #450a0a; }
.h4 { background: #e0435a; color: #fff; }
.h5 { background: #b10e28; color: #fff; }
.chu-giai { display: flex; align-items: center; gap: 4px; margin: 0; padding: 0 12px 10px; font-size: 11px; color: var(--nhat-2); }
.chu-giai i { display: inline-block; width: 16px; height: 10px; border-radius: 3px; }
.gan, .db30 { width: 100%; border-collapse: collapse; font-size: 13px; }
.gan th, .gan td, .db30 th, .db30 td { padding: 6px 10px; border-top: 1px solid var(--ke); text-align: left; font-variant-numeric: tabular-nums; }
.gan thead th, .db30 thead th { background: var(--nen-2); font-size: 11.5px; font-weight: 600; color: var(--nhat); }
.gan tbody th { font-size: 15px; }
.db30 .db { font-weight: 800; }
.thanh { display: block; height: 6px; margin-top: 3px; background: var(--ke); border-radius: 999px; overflow: hidden; }
.thanh i { display: block; height: 100%; background: var(--do); border-radius: 999px; }
.dd { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 10px; padding: 0 12px 10px; font-size: 12px; }
.dd h3 { margin: 4px 0; font-size: 12px; color: var(--nhat); }
.dd ol { margin: 0; padding: 0; list-style: none; }
.dd li { display: flex; align-items: center; gap: 6px; height: 20px; }
.dd li b { width: 12px; color: var(--do); }
.dd .thanh { flex: 1; height: 8px; margin: 0; }
.dd .thanh i { background: #f48a99; }
.dd li span { flex: none; min-width: 16px; text-align: right; color: var(--nhat); font-variant-numeric: tabular-nums; }
/* Bảng đặc biệt theo năm: year switch, month anchors, Miền Bắc calendar
   (7 columns × 5-digit numbers fit 360px), station month rows. */
.db-nam-chon { display: flex; align-items: center; gap: 4px; margin: 0 0 8px; font-size: 12.5px; }
.db-nam-chon span { display: flex; flex: 1; gap: 2px; padding: 3px; overflow-x: auto; background: var(--vien); border-radius: 10px; }
.db-nam-chon span a { flex: none; padding: 4px 7px; border-radius: 8px; color: var(--nhat); }
.db-nam-chon [aria-current] { background: var(--the); color: var(--do); font-weight: 700; }
.db-nam-chon .ke { flex: none; padding: 4px 6px; font-weight: 600; }
.db-tom { margin: 0 4px 4px; font-size: 13px; }
.db-thang-neo { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0 4px 10px; font-size: 12.5px; }
.db-luoi { display: grid; gap: 10px; margin: 0 0 10px; }
.db-nam { width: 100%; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; }
.db-nam th { padding: 4px 0; background: var(--nen-2); font-size: 11px; font-weight: 600; color: var(--nhat); }
.db-nam td { height: 38px; padding: 2px 1px; border-top: 1px solid var(--ke); text-align: center; vertical-align: top; }
.db-nam i, .db-ds i { display: block; font-style: normal; font-size: 10px; color: var(--nhat-2); }
.db-nam a, .db-ds a { font-family: "Zoveso So", var(--font); font-size: 11.5px; color: var(--chu); text-decoration: none; }
.db-nam b, .db-ds b { color: var(--do); font-weight: 800; }
.db-thang { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.db-thang thead th { padding: 6px 10px; background: var(--nen-2); font-size: 11.5px; font-weight: 600; color: var(--nhat); text-align: left; }
.db-thang tbody th { width: 44px; padding: 6px 4px 6px 10px; border-top: 1px solid var(--ke); font-size: 13px; text-align: center; vertical-align: top; }
.db-thang td { padding: 6px 10px 6px 4px; border-top: 1px solid var(--ke); }
.db-ds { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 0; padding: 0; list-style: none; }
.db-ds a { display: block; font-size: 13px; }
.db-lk { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 10px 4px; font-size: 13px; }
/* Trang một số: grid cells link to it (the link fills the cell), prev/next
   number, history table, gap distribution. */
.o a { display: flex; flex-direction: column; justify-content: center; height: 100%; color: inherit; text-decoration: none; }
.so-ke { display: flex; justify-content: space-between; gap: 8px; margin: 0 4px 8px; font-size: 13px; font-weight: 600; }
.so-ls td span { display: block; font-family: "Zoveso So", var(--font); }
.so-ls i { font-family: var(--font); font-style: normal; font-size: 11px; color: var(--nhat-2); }
.so-ls b { color: var(--do); font-weight: 800; }
.so-kc tbody th { font-size: 13px; font-weight: 600; }
.so-tb { margin: 0; padding: 8px 12px 12px; font-size: 13px; }
@media (min-width: 640px) {
  .db-luoi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .db-nam a { font-size: 13px; }
  .db-nam-chon { font-size: 13.5px; }
}
@media (min-width: 1024px) {
  .db-luoi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.cl { grid-template-columns: minmax(0, 1fr); }
.cl li b { width: 84px; font-weight: 600; color: var(--chu-2); }
.cl li span { min-width: 28px; }
.b0 { width: 0%; }
.b1 { width: 5%; }
.b2 { width: 10%; }
.b3 { width: 15%; }
.b4 { width: 20%; }
.b5 { width: 25%; }
.b6 { width: 30%; }
.b7 { width: 35%; }
.b8 { width: 40%; }
.b9 { width: 45%; }
.b10 { width: 50%; }
.b11 { width: 55%; }
.b12 { width: 60%; }
.b13 { width: 65%; }
.b14 { width: 70%; }
.b15 { width: 75%; }
.b16 { width: 80%; }
.b17 { width: 85%; }
.b18 { width: 90%; }
.b19 { width: 95%; }
.b20 { width: 100%; }
/* /thong-ke: one card per region. */
.tk-nhom { margin: 0 0 8px; padding: 10px 12px 12px; }
.tk-nhom h2 { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 8px; font-size: 14px; }
.tk-nhom h3 { margin: 10px 0 6px; font-size: 12.5px; color: var(--chu-2); }

/* Live page (/truc-tiep). Drawing cells pulse in red tint, waiting cells
   stay blank but keep one line of height. */
.tt { margin: 8px 0 6px; padding: 10px 12px; }
.tt-dau { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tt-dau b { font-size: 14px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px;
  background: var(--do); color: #fff; font-size: 11.5px; font-weight: 800; letter-spacing: .06em;
}
.pill i { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: nhay 1.2s ease-in-out infinite; }
.pill.xong { background: var(--xanh); }
.pill.xong i { animation: none; }
@keyframes nhay { 50% { opacity: .25; } }
.tt-dem { display: flex; justify-content: space-between; gap: 8px; margin: 8px 0 0; font-size: 12px; color: var(--nhat); }
.prog { display: block; height: 6px; margin-top: 5px; background: var(--ke); border-radius: 999px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--do); border-radius: 999px; }
.xong-prog i { background: var(--xanh); }
.cho::after { content: "\a0"; }
/* Next cell to draw: one dot per digit, no background. Each dot sits on a
   transparent 0 so the cell keeps the number's width. Calm wave: the dots
   rest faint and light up one after another, left to right. */
.quay { width: fit-content; }
.kq td > .quay { margin-inline: auto; }
.quay i { position: relative; color: transparent; font-style: normal; }
.quay i::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: .36em; height: .36em; margin: -.18em 0 0 -.18em;
  border-radius: 50%; background: var(--do-dam); opacity: .3; animation: song 1.8s ease-in-out infinite;
}
.quay i:nth-child(2)::before { animation-delay: .15s; }
.quay i:nth-child(3)::before { animation-delay: .3s; }
.quay i:nth-child(4)::before { animation-delay: .45s; }
.quay i:nth-child(5)::before { animation-delay: .6s; }
.quay i:nth-child(6)::before { animation-delay: .75s; }
@keyframes song { 0%, 55%, 100% { opacity: .3; } 25% { opacity: 1; } }
.bac .dong .so { min-width: 52px; }
.bac .hang-kh .so { min-width: 0; }
@media (prefers-reduced-motion: reduce) {
  .quay i::before, .pill i { animation: none; }
  .quay i::before { opacity: 1; }
}
.lich3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.lich3 li { padding: 8px; background: var(--the); border: 1px solid var(--vien); border-radius: 10px; text-align: center; font-size: 12px; color: var(--nhat); }
.lich3 b { display: block; font-size: 13px; }
.lich3 a { color: var(--chu); text-decoration: none; }
.lich3 .live { border-color: var(--do); }
.lich3 .live a { color: var(--do); }
.tt-chu { margin: 12px 4px 0; font-size: 12px; color: var(--nhat); }
.tt-cho { padding: 12px 14px; }
.tt-cho h2 { margin: 0 0 6px; font-size: 15px; }
.tt-cho p { margin: 0 0 6px; color: var(--chu-2); }
.tt-cho p:last-child { margin: 0; }

/* Content pages (giới thiệu, liên hệ, chính sách, điều khoản, 404). */
.doc {
  max-width: 760px; margin: 8px 0 0; padding: 16px; background: var(--the); border: 1px solid var(--vien);
  border-radius: var(--r); line-height: 1.6; color: var(--chu-2);
}
.doc h1 { margin: 0 0 8px; color: var(--chu); }
.doc h2, .doc h3 { color: var(--chu); }
.doc .lead { font-size: 15px; color: var(--chu); }
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px; padding: 0; list-style: none;
}
.stats li { padding: 10px; background: var(--nen-2); border: 1px solid var(--ke); border-radius: 10px; text-align: center; }
.stats b { display: block; font-size: 22px; font-weight: 800; color: var(--do); }
.mail { font-size: 15px; }

/* Knowledge section (/kien-thuc): articles inside .doc, list of articles. */
.bai { font-size: 15px; line-height: 1.7; }
.bai h1 { font-size: 23px; line-height: 1.3; letter-spacing: -.01em; }
.bai .note { margin: 0 0 14px; font-size: 12.5px; color: var(--nhat-2); }
.bai .lead { margin: 0 0 18px; padding: 2px 0 2px 14px; border-left: 3px solid var(--do); font-size: 16px; line-height: 1.6; }
.bai h2 { margin: 30px 0 8px; font-size: 19px; line-height: 1.35; letter-spacing: -.005em; }
.bai > h3 { margin: 18px 0 4px; font-size: 16px; }
.bai ol, .bai ul { padding-left: 22px; }
.bai li { margin: 4px 0; }
.bai li::marker { color: var(--do); font-weight: 700; }
.bai .dv-bangs { margin: 12px 0; }
.bai-nhom { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--do); }
.bai-nhom .kt-ic { width: 28px; height: 28px; border-radius: 8px; }
.bai-nhom svg { width: 16px; height: 16px; }
.dv-hoi.bai-hoi { column-count: 1; margin-top: 30px; }
.bai-hoi .hoi-o { margin: 8px 0 0; padding: 12px 14px; background: var(--nen-2); border: 1px solid var(--ke); border-radius: 10px; }
.bai-hoi .hoi-o h3 { margin: 0 0 4px; font-size: 15px; }
.bai-hoi .hoi-o p { margin: 0; font-size: 14.5px; }
.bai-nguon { margin-top: 26px; padding-top: 4px; border-top: 1px solid var(--ke); }
.bai-nguon h2 { font-size: 15px; }
.bai-nguon ul { margin: 0; font-size: 13.5px; line-height: 1.55; }
.bai-ben { display: grid; gap: 4px; align-content: start; margin-top: 8px; }
.bai-ben .sec { margin-top: 12px; }
.cuon { overflow-x: auto; margin: 8px 0; }
.kt-lich { min-width: 420px; font-size: 13px; line-height: 1.45; }
.kt-lich th, .kt-lich td { padding: 6px 8px; border-top: 1px solid var(--ke); text-align: left; vertical-align: top; }
.kt-lich thead th { border-top: 0; background: var(--nen-2); font-size: 12px; color: var(--nhat-2); }
.kt-lich a { text-decoration: none; }
.kt-hero { margin: 8px 0 0; padding: 20px 18px; background: var(--the); border: 1px solid var(--vien); border-radius: var(--r); }
.kt-mat { display: inline-block; margin: 0 0 8px; padding: 3px 10px; border-radius: 999px; background: var(--do-nhat); font-size: 12px; font-weight: 700; color: var(--do); }
.kt-hero h1 { margin: 0 0 8px; font-size: 24px; letter-spacing: -.01em; }
.kt-hero .lead { max-width: 720px; margin: 0; line-height: 1.6; color: var(--chu-2); }
.kt-so { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 14px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--nhat-2); }
.kt-so b { color: var(--chu); }
.kt-nhom-dau { display: flex; align-items: center; gap: 10px; margin: 22px 4px 10px; }
.kt-nhom-dau h2 { margin: 0; font-size: 17px; }
.kt-nhom-dau small { margin-left: auto; font-size: 12.5px; color: var(--nhat-2); }
.kt-ds, .kt-cu { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.kt-ds a, .kt-cu a {
  display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 14px 16px; background: var(--the);
  border: 1px solid var(--vien); border-radius: var(--r); text-decoration: none; color: var(--chu-2);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.kt-ds a:hover, .kt-cu a:hover { border-color: var(--do); box-shadow: 0 4px 14px rgb(0 0 0 / .06); transform: translateY(-1px); }
.kt-ds b, .kt-cu b { font-size: 15px; line-height: 1.4; color: var(--chu); }
.kt-ds span, .kt-cu span { font-size: 13.5px; line-height: 1.55; }
.kt-ds em { display: flex; align-items: center; gap: 2px; margin-top: auto; padding-top: 4px; font-size: 13px; font-style: normal; font-weight: 600; color: var(--do); }
.kt-ds em svg { width: 14px; height: 14px; }
.kt-cong .sec { margin-top: 26px; }
.kt-ben { margin: 0; padding: 4px 0; list-style: none; }
.kt-ben li + li { border-top: 1px solid var(--ke); }
.kt-ben a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; color: var(--chu); text-decoration: none; }
.kt-ben a > svg { flex: none; color: var(--nhat-2); transition: transform .15s, color .15s; }
.kt-ben a:hover { background: var(--nen-2); }
.kt-ben a:hover b, .kt-ben a:hover > svg { color: var(--do); }
.kt-ben a:hover > svg { transform: translateX(2px); }
.kt-ic { display: grid; flex: none; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--do-nhat); color: var(--do); }
.kt-tx { display: grid; flex: 1; min-width: 0; gap: 1px; }
.kt-tx b { overflow: hidden; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.kt-tx small { font-size: 12px; color: var(--nhat-2); }
.ben .kt-ben { padding: 4px 0; }
@media (min-width: 640px) and (max-width: 1023px) {
  .ben .kt-ben { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0; }
  .ben .kt-ben li:nth-child(odd) { border-right: 1px solid var(--ke); }
  .ben .kt-ben li + li { border-top: 0; }
  .ben .kt-ben li:nth-child(n+3) { border-top: 1px solid var(--ke); }
}

/* Footer (dark): blurb, stations by region, info links. */
.foot { margin-top: 20px; background: var(--chu); color: #a1a1aa; font-size: 12.5px; }
.foot-in { max-width: 1200px; margin: 0 auto; padding: 20px 16px 8px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; }
.foot h2 { margin: 0 0 6px; font-size: 12.5px; color: #fff; }
.foot a { color: #e4e4e7; text-decoration: none; }
.foot a:hover { color: #fff; text-decoration: underline; }
.foot ul { display: flex; flex-direction: column; gap: 3px; margin: 0; padding: 0; list-style: none; }
.foot-gt, .foot-tt { grid-column: 1 / -1; }
/* One region per row, its stations flowing across columns (3 on phones). */
.foot-mien { grid-column: 1 / -1; }
.foot-mien ul { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 12px; }
.foot-gt p { margin: 0; }
.foot-tt ul { flex-direction: row; flex-wrap: wrap; gap: 4px 14px; }
.foot-cuoi { display: block; padding-top: 12px; padding-bottom: 20px; border-top: 1px solid #27272a; }
.foot-cuoi p { margin: 0 0 6px; }

/* Phones only: the result and live pages start right under the header;
   their h1 and breadcrumb stay for search engines and readers. */
@media (max-width: 639px) {
  .p-home .dau .tieu-de, .p-truc-tiep > .tieu-de {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0;
  }
  .p-region .crumb, .p-station .crumb, .p-truc-tiep .crumb { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  /* Live page: h1 and breadcrumb hidden, so its first card keeps a gap under the header. */
  .p-truc-tiep #live { padding-top: 12px; }
  .p-truc-tiep #live > .tt { margin-top: 0; }
  /* Region and station pages have no region switch: the h1 (≤ 2 lines)
     takes its place, beside the date, in the same height as the old bar. */
  .p-region .dau, .p-station .dau { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 42px; }
  .p-region .dau .tieu-de, .p-station .dau .tieu-de { margin: 0 0 0 4px; font-size: 15px; line-height: 1.3; }
  .p-region .dau .tieu-de small, .p-station .dau .tieu-de small { display: none; } /* the date is beside it */
  /* Result table fills the screen down to the digit strip: every number line
     grows evenly (never below the base size). MN/MT: 18 lines, table top 94 +
     thead/borders 39 + strip 41 + 6 gap = 180. MB: 11 lines, top 129 +
     KH row/paddings/borders 86 + strip 41 + 6 = 262. */
  .p-home .kq .so, .p-region .kq .so, .p-station .kq .so { line-height: max(21px, calc((100svh - 180px) / 18)); }
  .p-home .bac .so, .p-region .bac .so, .p-station .bac .so { line-height: max(25px, calc((100svh - 262px) / 11)); }
  .kq .hang-kh .so { line-height: 20px; } /* symbol chips keep their size */
}

@media (min-width: 640px) {
  .kt-hero { padding: 24px 28px; }
  .kt-hero h1 { font-size: 28px; }
  .kt-ds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kt-cu { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bai h1 { font-size: 28px; }
  .logo span { display: inline; }
  .gon { display: none; }
  .rong { display: inline; }
  .dau { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0; }
  .dau .tieu-de { margin: 0; font-size: 24px; }
  .p-home .dau .tieu-de { font-size: 20px; }
  .dk { gap: 10px; padding: 0; }
  .seg a, .seg label { padding: 6px 14px; font-size: 13.5px; }
  .tk-dau .seg a { padding: 6px 12px; font-size: 13.5px; }
  .tk-thu { display: inline-flex; }
  .tk-thu a { flex: none; padding: 6px 12px; font-size: 13.5px; }
  .ngay { gap: 4px; padding: 3px; background: var(--the); border: 1px solid var(--vien); border-radius: 10px; }
  .ngay a, .ngay .tat { width: 30px; height: 30px; }
  .ngay b { padding: 0 6px; font-size: 13.5px; }
  .kq th, .kq td { padding: 2px 0; }
  .kq thead th { height: 52px; font-size: 15px; }
  .kq thead small { display: block; font-size: 11.5px; font-weight: 400; color: var(--nhat-2); }
  .kq .nhan { width: 72px; }
  .kq tbody th { font-size: 12.5px; }
  .kq .so { font-size: 21px; line-height: 31px; letter-spacing: .02em; }
  .kq .g8 .so, .kq .g7 .so { font-size: 26px; }
  .bac tbody th { width: 96px; }
  .kq .hang-kh .so { font-size: 13px; line-height: 24px; letter-spacing: 0; }
  .cap { padding: 10px 16px; font-size: 14px; }
  /* The digit strip joins the card as its footer. */
  .the:has(+ .loc) { border-bottom: 0; border-radius: 14px 14px 0 0; }
  .the + .loc {
    gap: 6px; padding: 12px 14px; background: var(--nen-2); border: 1px solid var(--vien);
    border-top-color: var(--ke); border-radius: 0 0 14px 14px;
  }
  .loc select { flex: none; width: auto; height: 36px; margin-right: 0; padding: 0 22px 0 10px; background-position: right 9px center; border-radius: 9px; font-size: 13px; }
  .loc button { flex: 0 1 36px; width: auto; max-width: 36px; height: auto; aspect-ratio: 1; font-size: 14px; } /* shrinks on tablets */
  .in-kq { display: block; }
  .lt { font-size: 13.5px; }
  .kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
  .kpi li { padding: 12px 16px; }
  .kpi b { font-size: 24px; }
  .kpi em { font-size: 13px; }
  .kpi .rong-k { display: block; }
  .foot-in { gap: 20px 24px; padding: 28px 24px 12px; }
  .foot-mien ul { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 5px 16px; }
  .foot-cuoi { display: block; padding: 12px 24px 24px; }
  .doc { padding: 24px 28px; }
  .dv-hero { padding: 20px 22px; }
  .dv-gt h1 { font-size: 26px; }
  .dv-form { display: grid; grid-template-columns: minmax(0, 1fr) 180px; align-items: stretch; gap: 10px 12px; }
  .dv-nhan, .dv-chu { grid-column: 1 / -1; }
  .dv-form textarea { grid-column: 1 / -1; }
  .dv-nut { height: auto; min-height: 40px; }
  .dv-chu { text-align: left; }
  .dv-bangs { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .tk-nhom .chips { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  /* Footer: brand + info on the left, the 3 regions stacked on the right. */
  .foot-in { grid-template-columns: 260px minmax(0, 1fr); gap: 20px 56px; }
  .foot-gt { grid-column: 1; grid-row: 1 / span 3; align-self: start; }
  .foot-tt { grid-column: 1; grid-row: 1 / span 3; align-self: end; }
  .foot-tt ul { flex-direction: column; gap: 4px; }
  .foot-mien { grid-column: 2; }
  .kt-ds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bai-cot { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 0 24px; align-items: start; }
  .bai-cot .doc { max-width: none; }
  .bai-ben .sec:first-child { margin-top: 8px; }
  :root { --r: 14px; }
  .top-in { height: 64px; padding: 0 24px; gap: 24px; }
  .nav { display: flex; }
  .tim { flex: 0 0 320px; margin-left: auto; height: 40px; padding: 0 4px 0 12px; gap: 8px; }
  .tim button { height: 32px; padding: 0 16px; border-radius: 8px; font-size: 14px; }
  .menu, .tt-nut { display: none; }
  .wrap { padding: 0 24px; }
  main.wrap { padding-bottom: 12px; }
  .crumb { margin: 16px 0 0; font-size: 12.5px; }
  .tieu-de { margin: 6px 0 16px; font-size: 26px; }
  .cot { display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: auto 1fr; gap: 0 20px; align-items: start; padding-top: 8px; }
  .p-home .cot { padding-top: 20px; }
  .chinh { grid-column: 1; grid-row: 1; }
  .dau { margin: 0 0 12px; }
  .ben { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; gap: 14px; }
  .cot > .seo { grid-column: 1; grid-row: 2; }
  .ben .khoi { padding: 14px 16px; background: var(--the); border: 1px solid var(--vien); border-radius: 14px; }
  .ben .sec { margin: 0 0 10px; }
  .ben .the { padding: 0; border: 0; border-radius: 0; overflow: visible; }
  .ben .lich-hn { display: block; }
  .ben .kt-ben { margin: 0 -8px; padding: 0; }
  .ben .kt-ben a { padding: 9px 8px; border-radius: 8px; }
  .ben .kt-ben li + li { border-top: 0; }
  .seo { padding: 16px 20px; font-size: 14px; }
  .sec { margin: 20px 0 10px; }
  .sec h2 { font-size: 16px; }
  .tk-dau { flex-wrap: nowrap; align-items: flex-end; gap: 16px; margin: 6px 0 16px; }
  .tk-dau > div { display: block; }
  .tk-dau .tieu-de { margin: 0; }
  .tk-dau .sub { margin: 2px 0 0; font-size: 13.5px; text-align: left; color: var(--nhat); }
  .tk-luoi { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .tk-luoi > div { display: block; }
  .tk-luoi .tk { margin: 0 0 16px; }
  .ch { padding: 14px 16px 8px; }
  .ch h2 { font-size: 16px; }
  .luoi { border-spacing: 3px; padding: 0 12px 10px; }
  .luoi th { font-size: 11.5px; }
  .o { height: 40px; border-radius: 7px; }
  .o b { font-size: 13.5px; }
  .o small { font-size: 10.5px; }
  .chu-giai { padding: 0 16px 14px; font-size: 11.5px; }
  .gan, .db30 { font-size: 13.5px; }
  .gan th, .gan td, .db30 th, .db30 td { padding: 8px 16px; }
  .gan .thanh { width: 180px; height: 7px; }
  .dd { gap: 0 20px; padding: 0 16px 14px; font-size: 12.5px; }
  .dd li { height: 22px; }
  .tk-cuoi .seo { max-width: 860px; }
  .dv-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 32px; align-items: start; padding: 28px 32px; }
  .dv-gt h1 { margin-top: 4px; font-size: 30px; }
  .dv-gt p { font-size: 15px; line-height: 1.55; }
  .dv-diem { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
  .dv-diem li { padding: 4px 10px; border-radius: 999px; background: var(--do-nhat); color: var(--do-dam); font-size: 12.5px; font-weight: 600; }
  .dv-form textarea { min-height: 76px; font-size: 20px; }
  .co-kq .dv-gt p { display: block; }
  .dv-ves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
  .ve { margin: 0; }
  .ve-dau { padding: 14px 18px; }
  .ve-ds li { padding: 10px 18px; }
  .dv-huong { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 20px; }
  .dv-bai { margin: 0; }
  .dv-ca { grid-column: 1 / -1; }
  .dv-hoi { column-count: 2; column-gap: 32px; }
  .dv-hoi h2 { column-span: all; }
  .dv-hoi h3 { break-after: avoid; }
  .dv-hoi p { break-inside: avoid; }
  .tk-nhom { padding: 14px 16px; }
}

/* 6 header links + the 320px search box: tighter links until 1200px. */
@media (min-width: 1024px) and (max-width: 1199px) {
  .nav a { padding: 8px 5px; }
}
