@charset "UTF-8";
/*
 * KetQuaViet - giao diện theo bố cục xsmn.mobi, giữ màu nền và bảng màu của hệ thống.
 * Màu chủ đạo --red thay cho cam của xsmn, --gold thay cho cam nhạt (hover, mục đang chọn).
 */
:root {
    --red: #A4161A;
    --red-dark: #5C0B0E;
    --gold: #F2AF03;
    --cream: #F7E9BE;
    --cream-soft: #FFF5D5;
    --link: #0059A9;
    --ink: #333333;
    --muted: #5A5A5A;
    --line: #E4E4E4;
    --bg: #F6F6F4;
    --white: #FFFFFF;
    --stripe: #EEEEEE;
    --live: #1E8E3E;
    --warn: #B26A00;
    --special: #FFF6D6;
    --radius: 8px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: Arial, Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--red); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
p, .breadcrumb, .tool-list a, .footer-note { overflow-wrap: anywhere; }
button, input[type="button"], input[type="submit"], input[type="reset"], .btn {
    border-radius: var(--radius);
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

h1, h2, h3, h4 { margin: 0; }
h3 { font-size: 15px; margin: 8px 0; }
p { margin: 0 0 8px; }
img { border: 0; max-width: 100%; }
table { width: 100%; border-collapse: collapse; border-spacing: 0; }

.main, .container { width: 100%; max-width: 1090px; margin: 0 auto; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 8px; background: var(--white); padding: 4px 8px; z-index: 200; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.status { color: var(--muted); font-size: 13px; margin: 6px 0; }
.num { font-variant-numeric: tabular-nums; }

/* ===== Header: logo trắng + thanh menu đỏ ===== */
.site-header { background: var(--white); }
.header-main { display: flex; align-items: center; justify-content: space-between; padding: 3px 8px; min-height: 46px; }
.logo { display: inline-block; line-height: 0; padding: 4px 0; }
.logo:hover { text-decoration: none; }
.logo img { display: block; width: auto; height: 38px; max-width: 100%; }

.navbar-toggle { display: none; border: 1px solid var(--red); background: transparent; padding: 6px; cursor: pointer; border-radius: var(--radius); }
.navbar-toggle .icon-bar { display: block; width: 22px; height: 2px; background: var(--red); border-radius: 1px; }
.navbar-toggle .icon-bar + .icon-bar { margin-top: 4px; }

.site-nav { background: var(--red); min-height: 38px; margin-bottom: 10px; }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav a { color: var(--white); font-size: 13px; font-weight: 700; text-transform: uppercase; display: block; line-height: 38px; padding: 0 5px; text-decoration: none; }
.menu-pc { display: flex; flex-wrap: wrap; }
.menu-pc > li { position: relative; padding: 0 5px; }
.menu-pc > li:hover, .menu-pc > li.active { background: var(--gold); }
.menu-pc > li:hover > a, .menu-pc > li.active > a { color: var(--red-dark); }
.menu-pc .menu-header { display: none; }
.child-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: none;
    position: absolute;
    top: 38px;
    left: 0;
    width: 220px;
    z-index: 90;
    background: var(--cream);
    border: 1px solid var(--gold);
    border-top: 0;
    box-shadow: 0 3px 2px 0 #ccc;
}
@media (min-width: 901px) {
    .menu-pc > li:hover .child-menu, .menu-pc > li:focus-within .child-menu { display: block; }
}
.child-menu li { padding-left: 8px; }
.child-menu li:hover { background: var(--white); }
.site-nav .child-menu a { color: var(--ink); text-transform: none; font-weight: 400; line-height: 30px; font-size: 14px; }
.site-nav .child-menu a:hover { color: var(--red); }
.menu-mobi { display: none; }
.menu-pc > li.drawer-only { display: none; }
.sub-toggle { display: none; }

@media (max-width: 900px) {
    .navbar-toggle { display: block; }
    .site-nav { position: sticky; top: 0; z-index: 80; }
    .menu-mobi { display: flex; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .menu-mobi::-webkit-scrollbar { display: none; }
    .menu-mobi li { flex: 0 0 auto; padding: 0 6px; }
    .menu-mobi li.active { background: var(--gold); }
    .menu-mobi li.active a { color: var(--red-dark); }
    .menu-mobi a { padding: 0; }
    .menu-pc {
        display: block;
        visibility: hidden;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        width: 85vw;
        max-width: 320px;
        overflow-y: auto;
        background: var(--white);
        transform: translateX(100%);
        transition: transform .3s;
        box-shadow: 0 0 20px rgba(0, 0, 0, .5);
    }
    html.menu-active .menu-pc { visibility: visible; transform: translateX(0); }
    .menu-pc > li.drawer-only { display: block; }
    .menu-pc .menu-header { display: block; background: var(--red); padding: 4px 10px; }
    .menu-pc .menu-header button { background: transparent; border: 0; color: var(--white); font-size: 14px; cursor: pointer; padding: 8px 0; }
    .menu-pc > li { padding: 0; }
    .menu-pc > li:hover, .menu-pc > li.active { background: #F5F5F5; }
    .menu-pc > li > a { color: var(--ink); text-transform: none; font-size: 15px; padding: 0 16px; }
    .menu-pc > li.active > a, .menu-pc > li:hover > a { color: var(--red); }
    .menu-pc > li.has-children { position: relative; }
    .menu-pc > li.has-children > a { padding-right: 52px; }
    .sub-toggle { display: block; position: absolute; top: 0; right: 0; width: 52px; height: 38px; border: 0; background: transparent; cursor: pointer; }
    .sub-toggle::before { content: ""; position: absolute; top: 14px; left: 20px; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; }
    .menu-pc > li.is-open > .sub-toggle::before { top: 17px; transform: rotate(-135deg); }
    .child-menu { display: none; position: static; width: 100%; background: transparent; border: 0; box-shadow: none; }
    .menu-pc > li.is-open > .child-menu { display: block; }
    .child-menu li { padding-left: 2em; }
    .menu-backdrop { display: none; position: fixed; inset: 0; z-index: 99; background: rgba(255, 255, 255, .7); }
    html.menu-active .menu-backdrop { display: block; }
}

/* ===== Khung trang: cột trái nội dung, cột phải 336px ===== */
.layout { padding: 0 0 12px; }
.layout.with-sidebar { display: flex; flex-direction: column; gap: 10px; }
.content { min-width: 0; }
.content > * + * { margin-top: 10px; }
.sidebar { min-width: 0; }
.sidebar > * + * { margin-top: 10px; }
@media (min-width: 901px) {
    .layout.with-sidebar { flex-direction: row; align-items: flex-start; padding: 0 5px; }
    .layout.with-sidebar .content { flex: 1 1 auto; width: calc(100% - 346px); }
    .layout.with-sidebar .sidebar { flex: 0 0 336px; width: 336px; }
}

.breadcrumb { padding: 0 8px; margin-bottom: 4px; }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; line-height: 12px; }
.breadcrumb li { display: inline; }
.breadcrumb li a { color: var(--link); padding: 5px 0; display: inline-block; }
.breadcrumb li + li::before { content: "/ "; padding: 5px; color: #ccc; }
.breadcrumb [aria-current] { color: var(--link); }

/* Tiêu đề trang: giữa, đậm, màu chủ đạo */
.content > h1 { font-size: 17px; text-align: center; color: var(--red); font-weight: 700; margin: 4px 0; padding: 2px 8px; line-height: 1.35; }
.content > h2 { font-size: 16px; text-align: center; color: var(--red); font-weight: 700; margin: 6px 0; }

/* ===== Khối (box) có viền chủ đạo và thanh tiêu đề ===== */
.card {
    background: var(--white);
    border: 2px solid var(--red);
    border-radius: var(--radius);
    padding: 0 0 10px;
    overflow: hidden;
}
.card > h2, h2.title-bar {
    background: var(--red);
    color: var(--white);
    font-size: 16px;
    font-weight: 700;
    line-height: 23px;
    padding: 7px 8px;
    text-align: center;
    margin: 0 0 8px;
    border: 0;
}
.card > h2 a { color: var(--white); text-decoration: underline; }
.card > *:not(h2):not(.table-wrap):not(.result-block):not(table) { margin-left: 10px; margin-right: 10px; }
.card > * + * { margin-top: 8px; }
.card > h2 + * { margin-top: 0; }
.card.seo-text p { margin: 0 10px 8px; line-height: 1.6; }
.card h3 { color: var(--ink); }

/* Hộp phụ ở cột phải: tiêu đề chữ hoa, có biểu tượng tròn vàng */
.sidebar .card { border: 0; border-radius: var(--radius); box-shadow: 0 1px 3px 0 #ccc; padding-bottom: 8px; }
.sidebar .card > h2 {
    text-align: left;
    font-size: 14px;
    text-transform: uppercase;
    line-height: 21px;
    padding: 8px 10px;
    border-radius: var(--radius) var(--radius) 0 0;
}
.sidebar .card > h2::before {
    content: "";
    display: inline-block;
    width: 1.3em;
    height: 1.3em;
    margin-right: .5em;
    vertical-align: middle;
    border-radius: 50%;
    background: radial-gradient(circle, var(--red) 0 22%, var(--gold) 24% 100%);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .6);
}
.sidebar .card > h2 a { color: var(--white); text-decoration: none; }

/* Danh sách tỉnh hai cột, chấm đầu dòng và dấu ✓ khi đã quay */
.province-list { list-style: none; margin: 5px auto 0; padding: 0 8px; display: flex; flex-wrap: wrap; }
.province-list li { width: 50%; padding: 4px 0; color: var(--red); display: block; }
.province-list li::before { content: "•"; margin: 0 8px 0 6px; color: var(--red); }
.province-list li a { color: var(--ink); font-size: 14px; }
.province-list li a:hover { color: var(--red); }
.status-dot { display: none; }
.status-dot.is-drawn { display: inline-block; width: auto; height: auto; margin-left: 6px; background: none; color: #1E8E3E; font-weight: 700; }
.status-dot.is-drawn::before { content: "\2713"; }
.province-groups-list { display: grid; gap: 10px; }
.province-spinner { color: var(--red); margin-left: 6px; margin-right: 0; }

.tool-list { list-style: none; margin: 4px 0 0; padding: 0 8px; }
.tool-list li { padding: 6px 0 6px 2px; border-bottom: 1px dotted var(--line); }
.tool-list li:last-child { border-bottom: 0; }
.tool-list li::before { content: "•"; color: var(--red); margin-right: 8px; }
.more-link { margin: 8px 0 0; }
.link-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px 16px; }
.link-grid h3 { margin: 8px 0 0; font-size: 15px; }

/* ===== Tab (thứ trong tuần, chọn kỳ, chọn loại): gắn liền khung bên dưới ===== */
.week-tabs { display: flex; flex-wrap: wrap; padding: 0; margin: 0; }
.week-tabs a {
    flex: 1 1 12.5%;
    min-width: 0;
    text-align: center;
    padding: 10px 2px;
    background: #fff;
    border: 1px solid #D9D9D9;
    color: var(--ink);
    font-weight: 400;
    text-decoration: none;
    line-height: 1.3;
    border-radius: var(--radius);
}
.week-tabs a:hover { background: var(--cream); color: var(--red); }
.week-tabs a.active { background: var(--red); border-color: var(--red); color: var(--white); font-weight: 700; }
.week-tabs a small { display: block; font-size: 11px; color: var(--muted); }
.week-tabs a.active small { color: var(--white); }
.week-tabs + .card, .week-tabs + .result-block, .week-tabs + section { margin-top: 0; }
@media (max-width: 640px) {
    .week-tabs { flex-wrap: nowrap; gap: 4px; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
    .week-tabs a { flex: 0 0 auto; min-width: 44px; padding: 9px 8px; white-space: nowrap; }
}

/* ===== Nút ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border-radius: var(--radius);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid var(--red);
}
.btn-primary { background: var(--red); color: var(--white); }
.btn-primary:hover { background: var(--red-dark); color: var(--white); text-decoration: none; }
.btn-secondary { background: var(--white); color: var(--red); }
.btn-secondary:hover { background: var(--cream); color: var(--red-dark); text-decoration: none; }
.btn[hidden] { display: none; }
.day-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.day-nav .btn { flex: 1 1 140px; }
.date-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.date-form label { font-weight: 700; }
.date-form input { min-height: 38px; padding: 0 10px; border: 1px solid #ccc; border-radius: var(--radius); font: inherit; }

/* ===== Bảng chung ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.simple-table, .stats-table { width: 100%; border: 1px solid #ccc; }
.simple-table caption, .result-table caption, .loto-table caption, .freq-grid caption, .pair-table caption {
    caption-side: top;
    background: var(--cream);
    color: var(--red);
    font-weight: 700;
    font-size: 15px;
    padding: 7px 6px;
    text-align: center;
}
.simple-table th, .loto-table th, .freq-grid th, .archive-table th, .schedule-table th {
    background: linear-gradient(to bottom, #FAFAFA, var(--stripe));
    color: var(--ink);
    font-weight: 700;
    text-align: center;
    padding: 5px;
    line-height: 20px;
    border: 1px solid var(--line);
}
.simple-table td, .archive-table td, .schedule-table td { border: 1px solid var(--line); text-align: center; padding: 5px 4px; font-size: 15px; vertical-align: middle; font-variant-numeric: tabular-nums; }
.simple-table tbody th, .schedule-table tbody th { color: var(--red); background: var(--white); }
.simple-table tbody tr:nth-child(even) td, .simple-table tbody tr:nth-child(even) th { background: #FAFAFA; }
.simple-table tr.today th, .simple-table tr.today td, .schedule-table tr.today th, .schedule-table tr.today td { background: var(--cream-soft); }
.schedule-table td { text-align: left; }

/* ===== Bảng kết quả (kiểu xsmn: ô đóng khung, số lớn, dòng xen kẽ) ===== */
.result-block { display: block; margin: 0; background: var(--white); }
.result-table { width: 100%; table-layout: fixed; border: 0; }
.result-table th, .result-table td { border: 1px solid var(--line); padding: 0; text-align: center; background: var(--white); vertical-align: middle; }
.result-table col.col-prize { width: 54px; }
.loto-table col.col-digit { width: 44px; }
.result-table tbody th { width: 54px; font-weight: 400; font-size: 16px; color: var(--ink); white-space: nowrap; padding: 4px 2px; }
.result-table tbody tr:nth-child(even):not(.row-special) th,
.result-table tbody tr:nth-child(even):not(.row-special) td { background: var(--stripe); }
.result-table td.num { line-height: 1.3; }
.result-table .num-item { display: block; margin: 0; padding: 7px 4px; font-size: 28px; font-weight: 700; color: var(--ink); letter-spacing: 0; line-height: 1.25; }
.result-table tr.row-special .num-item { color: var(--red); font-size: 32px; }
.result-table tr.row-special th { font-size: 16px; }
.result-table tr.row-kytu th { font-size: 12px; background: var(--white); padding: 0 1px; }
.result-table tr.row-kytu td.num { white-space: nowrap; overflow: hidden; }
.kytu-item { display: inline-block; color: var(--link); font-size: clamp(11px, 3.4vw, 16px); font-weight: 700; padding: 6px 0; }
.kytu-item + .kytu-item::before { content: "-"; color: var(--muted); font-weight: 400; margin: 0 clamp(3px, 1.2vw, 8px); }
.result-table tr.row-kytu th { white-space: nowrap; }
.result-table .row-eighth .num-item { color: var(--red); font-size: 32px; }
.result-table mark { background: #FFE365; color: inherit; }

/* Bảng giải miền Bắc: mỗi số một ô, chia cột theo số giá trị của giải */
.result-table:not(.region-result-table) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.result-table:not(.region-result-table) td.num { overflow: hidden; }
.result-table:not(.region-result-table) td.num::after { content: ""; display: block; clear: both; }
.result-table:not(.region-result-table) .num-item { float: left; width: 100%; }
.result-table:not(.region-result-table) .num-item:first-child:nth-last-child(2),
.result-table:not(.region-result-table) .num-item:first-child:nth-last-child(2) ~ .num-item { width: 50%; }
.result-table:not(.region-result-table) .num-item:first-child:nth-last-child(3),
.result-table:not(.region-result-table) .num-item:first-child:nth-last-child(3) ~ .num-item,
.result-table:not(.region-result-table) .num-item:first-child:nth-last-child(6),
.result-table:not(.region-result-table) .num-item:first-child:nth-last-child(6) ~ .num-item { width: 33.3333%; }
.result-table:not(.region-result-table) .num-item:first-child:nth-last-child(4),
.result-table:not(.region-result-table) .num-item:first-child:nth-last-child(4) ~ .num-item { width: 25%; }
.result-table:not(.region-result-table) .num-item + .num-item { box-shadow: inset 1px 0 0 var(--line); }
.result-table:not(.region-result-table) .num-item:first-child:nth-last-child(6) ~ .num-item:nth-child(3n+1) { box-shadow: none; }
.result-table:not(.region-result-table) .num-item:first-child:nth-last-child(6) ~ .num-item:nth-child(n+4) { border-top: 1px solid var(--line); }
.result-table:not(.region-result-table) tbody tr:last-child .num-item { color: var(--red); font-size: 32px; }
.result-table:not(.region-result-table) tbody tr.row-special .num-item { font-size: 36px; }

/* Bảng giải miền Nam / Trung: mỗi đài một cột, tên đài màu liên kết */
.region-result-table thead th { background: linear-gradient(to bottom, #FAFAFA, var(--stripe)); padding: 6px 4px; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.region-result-table thead th a { color: var(--link); text-decoration: none; }
.region-result-table thead th a:hover { text-decoration: underline; }
.region-result-table td, .region-result-table th { min-width: 0; }
.region-result-many .region-result-table .num-item { font-size: 21px; }
.region-result-many .region-result-table tr.row-special .num-item,
.region-result-many .region-result-table .row-eighth .num-item { font-size: 24px; }
.region-result-single .region-result-table .num-item { display: inline-block; margin: 0 8px; }
.product-result-table { border: 1px solid var(--line); }
.product-result-table tbody th { width: 30%; text-align: center; }
.product-result-table td { padding: 6px; }

/* Điều khiển hiển thị: đầy đủ / 2 số / 3 số và chọn đầu đuôi 0–9 */
.result-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px; padding: 4px 6px; background: var(--white); border-top: 1px solid var(--line); }
.result-controls[hidden] { display: none; }
.result-control-group { display: flex; flex-wrap: wrap; gap: 4px; }
.result-controls .result-control-group:last-child { flex: 1 1 100%; gap: 0; }
.result-controls button { border: 1px solid #ccc; border-radius: var(--radius); background: var(--white); color: var(--ink); padding: 5px 10px; cursor: pointer; font: inherit; font-weight: 700; }
.result-controls .result-control-group:first-child button { border-radius: var(--radius); }
.result-controls .result-control-group:last-child button { flex: 1 1 10%; padding: 5px 0; border-top: 1px solid var(--line); background: var(--stripe); }
.result-controls button[aria-pressed="true"],
.result-controls .result-control-group:last-child button[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: var(--white); }
@media (max-width: 767px) {
    .result-controls { flex-wrap: nowrap; justify-content: flex-start; gap: 3px; padding: 4px 3px; }
    .result-controls .result-control-group { flex-wrap: nowrap; min-width: 0; }
    .result-controls .result-control-group:first-child { flex: 0 0 auto; gap: 2px; }
    .result-controls .result-control-group:last-child { flex: 1 1 0; gap: 0; }
    .result-controls button { font-size: 12px; line-height: 1.2; padding: 6px 5px; white-space: nowrap; }
    .result-controls .result-control-group:last-child button { flex: 1 1 0; min-width: 0; padding: 6px 0; border-top: 1px solid #ccc; }
}

/* ===== Bảng lô tô đầu/đuôi (kiểu xsmn: tiêu đề kem, số đầu màu chủ đạo) ===== */
.loto-table { width: 100%; table-layout: fixed; border: 1px solid #ccc; margin-top: 10px; }
.loto-table thead th { background: var(--cream); color: var(--ink); padding: 6px 4px; }
.loto-table tbody th { width: 44px; padding: 3px 2px; color: var(--red); font-size: 16px; background: var(--white); text-align: center; }
.loto-table td { border: 1px solid var(--line); padding: 3px 6px; text-align: left; font-weight: 700; font-size: 16px; vertical-align: middle; line-height: 22px; overflow-wrap: anywhere; }
.loto-table td .lo-item { display: inline-block; min-width: 0; margin: 0 4px 0 0; font-weight: 700; }
.loto-table td .lo-hot, .loto-table td .lo-hot sup { color: var(--red); }
.mb-loto-table thead th:nth-child(1), .mb-loto-table thead th:nth-child(4) { width: 44px; }
.mb-loto-table td.loto-right { text-align: right; }
.region-loto-table td { text-align: center; }
.region-loto-table thead th a { color: var(--link); }
.lo-item { display: inline-block; margin-right: 6px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lo-item sup { font-weight: 400; color: var(--muted); font-size: 11px; }
.loto-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.loto-list { list-style: none; margin: 0; padding: 0; }
.loto-list li { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.loto-grid-table td .lo-item { min-width: 0; margin-right: 8px; }

@media (max-width: 640px) {
    .result-table .num-item { font-size: 22px; padding: 6px 2px; }
    .result-table tr.row-special .num-item, .result-table .row-eighth .num-item,
    .result-table:not(.region-result-table) tbody tr:last-child .num-item { font-size: 26px; }
    .result-table:not(.region-result-table) tbody tr.row-special .num-item { font-size: 30px; }
    .result-table col.col-prize { width: 40px; }
    .loto-table col.col-digit { width: 36px; }
    .result-table tbody th { width: 40px; font-size: 14px; }
    .region-result-table thead th { font-size: 12px; padding: 5px 2px; }
    .region-result-table .num-item { font-size: 19px; }
    .region-result-table tr.row-special .num-item, .region-result-table .row-eighth .num-item { font-size: 21px; }
    .region-result-many .region-result-table .num-item { font-size: 15px; padding: 5px 0; }
    .region-result-many .region-result-table tr.row-special .num-item,
    .region-result-many .region-result-table .row-eighth .num-item { font-size: 16px; }
    .loto-table td { font-size: 14px; padding: 3px 3px; }
    .loto-table tbody th { width: 36px; font-size: 15px; }
    .loto-table thead th { font-size: 12px; padding: 6px 1px; }
    .mb-loto-table thead th:nth-child(1), .mb-loto-table thead th:nth-child(4) { width: 36px; }
}
@media (max-width: 360px) {
    .result-table:not(.region-result-table) .num-item { font-size: 19px; }
    .region-result-table .num-item { font-size: 17px; }
}

/* ===== Thống kê ===== */
.info-table { table-layout: fixed; border: 1px solid #CCC; }
.info-table th { background: linear-gradient(to bottom, #FAFAFA, var(--stripe)); border: 1px solid var(--line); padding: 6px 4px; text-align: center; font-size: 13px; }
.info-table td { border: 1px solid var(--line); padding: 8px 4px; text-align: center; vertical-align: top; }
.info-value { display: block; color: var(--red); font-size: 20px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.info-hint { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
@media (max-width: 480px) { .info-table th { font-size: 11px; padding: 5px 2px; } .info-value { font-size: 14px; } .info-hint { font-size: 10px; } }
.stats-pair { display: grid; gap: 10px; }
@media (min-width: 640px) { .stats-pair { grid-template-columns: 1fr 1fr; } }
.province-lo-stats-table { table-layout: fixed; }
.province-lo-stats-table th, .province-lo-stats-table td { overflow-wrap: anywhere; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); }
.stats-grid > div { border: 1px solid var(--line); padding: 6px; min-width: 0; text-align: center; }
.stats-grid h3 { color: var(--red); margin: 0; font-size: 15px; }
.stats-grid .small { font-size: 12px; margin: 2px 0 6px; }
.stats-grid .more-link { grid-column: 1 / -1; margin: 0; font-size: 14px; }
.stats-table th, .stats-table td { padding: 4px 6px; font-size: 14px; }
.stats-table tbody th { color: var(--red); font-size: 15px; }
.freq-grid { table-layout: fixed; border: 1px solid #ccc; }
.freq-grid th, .freq-grid td { border: 1px solid var(--line); text-align: center; padding: 6px 2px; }
.freq-grid thead th { background: var(--cream); }
.freq-grid tbody th { width: 44px; color: var(--red); background: var(--white); }
.frequency-history-details { padding-top: 8px; }
.frequency-history-details summary { cursor: pointer; color: var(--red-dark); font-weight: 700; padding: 4px 0 8px; }
.matrix-pair-selection { margin: 8px 0 12px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--cream-soft); }
.matrix-pair-selection h3 { margin: 0 0 8px; color: var(--red-dark); }
.matrix-pair-shortcuts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; max-width: 360px; margin-bottom: 6px; }
.matrix-pair-shortcuts button { min-width: 0; min-height: 36px; padding: 4px 2px; border: 1px solid #CCC; border-radius: var(--radius); background: var(--white); color: var(--red-dark); font: inherit; font-size: 13px; white-space: nowrap; cursor: pointer; }
.matrix-pair-shortcuts button[aria-pressed="true"] { border-color: var(--red); background: var(--red); color: var(--white); }
.matrix-pair-touches button { min-height: 34px; font-size: 14px; font-weight: 700; }
.matrix-pair-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 4px; max-height: 240px; overflow: auto; padding: 6px; border: 1px solid var(--line); background: var(--white); }
.matrix-pair-options label { display: flex; align-items: center; gap: 5px; min-height: 32px; padding: 3px 4px; border: 1px solid var(--line); white-space: nowrap; }
.matrix-pair-options input { margin: 0; accent-color: var(--red); }
.matrix-pair-status { margin: 6px 0 0; color: var(--red-dark); font-size: 13px; font-weight: 700; }
.frequency-history-table { width: max-content; min-width: 100%; }
.frequency-history-table caption { text-align: left; }
.frequency-history-table th, .frequency-history-table td { min-width: 42px; border: 1px solid var(--line); padding: 4px 3px; text-align: center; white-space: nowrap; }
.frequency-history-table thead th { background: var(--cream); }
.frequency-history-table tbody th { position: sticky; left: 0; z-index: 1; background: var(--white); color: var(--red); }
.frequency-history-table [data-matrix-cell] { cursor: pointer; }
.frequency-history-table [data-matrix-cell]:hover { background: var(--cream-soft); }
.frequency-history-table [data-matrix-cell].is-selected { outline: 2px solid var(--red); outline-offset: -2px; }
.frequency-history-table [data-matrix-cell].is-special { color: var(--warn); font-weight: 700; }
.stats-matrix-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; }
.stats-matrix-view, .stats-matrix-zoom { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.stats-matrix-zoom[hidden] { display: none; }
.stats-matrix-view { font-weight: 700; }
.stats-matrix-view a, .stats-matrix-zoom button { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 34px; padding: 4px 8px; border: 1px solid #CCC; border-radius: var(--radius); background: var(--white); color: var(--red-dark); font: inherit; }
.stats-matrix-view a[aria-current="page"] { border-color: var(--red); background: var(--red); color: var(--white); }
.stats-matrix-zoom button { cursor: pointer; font-weight: 700; }
.stats-matrix-zoom button:disabled { cursor: not-allowed; opacity: .55; }
.stats-matrix-zoom output { min-width: 48px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats-matrix-scroll { max-width: 100%; overflow: auto; overscroll-behavior-x: contain; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.frequency-history-table th:first-child { z-index: 2; background: var(--cream); }
.frequency-history-table tbody th:first-child { background: var(--white); }
.frequency-history-table .matrix-label { min-width: 68px; }
.frequency-history-table .matrix-total { position: sticky; right: 0; z-index: 1; min-width: 76px; background: var(--cream); }
.frequency-history-table td.is-empty { background: var(--stripe); color: var(--muted); }
.frequency-history-table [hidden] { display: none !important; }
.frequency-history-table[hidden] { display: none !important; }
.stats-history-matrix[data-matrix-scale="0"] .frequency-history-table th,
.stats-history-matrix[data-matrix-scale="0"] .frequency-history-table td { min-width: 32px; padding: 3px 2px; font-size: 11px; }
.stats-history-matrix[data-matrix-scale="1"] .frequency-history-table th,
.stats-history-matrix[data-matrix-scale="1"] .frequency-history-table td { min-width: 42px; padding: 4px 3px; font-size: 13px; }
.stats-history-matrix[data-matrix-scale="2"] .frequency-history-table th,
.stats-history-matrix[data-matrix-scale="2"] .frequency-history-table td { min-width: 54px; padding: 7px 4px; font-size: 15px; }
.stats-history-matrix[data-matrix-scale="0"] .frequency-history-table .matrix-label { min-width: 58px; }
.stats-history-matrix[data-matrix-scale="1"] .frequency-history-table .matrix-label { min-width: 68px; }
.stats-history-matrix[data-matrix-scale="2"] .frequency-history-table .matrix-label { min-width: 80px; }
.frequency-history-table .matrix-totals-row td { font-weight: 700; }
@media (max-width: 640px) {
    .stats-history-matrix[data-matrix-scale="0"] .frequency-history-table[data-direction="ngang"] th,
    .stats-history-matrix[data-matrix-scale="0"] .frequency-history-table[data-direction="ngang"] td { padding: 2px 1px; font-size: 10px; }
    .stats-history-matrix[data-matrix-scale="1"] .frequency-history-table[data-direction="ngang"] th,
    .stats-history-matrix[data-matrix-scale="1"] .frequency-history-table[data-direction="ngang"] td { padding: 3px 1px; font-size: 11px; }
    .stats-history-matrix[data-matrix-scale="2"] .frequency-history-table[data-direction="ngang"] th,
    .stats-history-matrix[data-matrix-scale="2"] .frequency-history-table[data-direction="ngang"] td { padding: 4px 2px; font-size: 12px; }
    .stats-history-matrix[data-matrix-scale="0"] .frequency-history-table[data-direction="ngang"] th:not(.matrix-label),
    .stats-history-matrix[data-matrix-scale="0"] .frequency-history-table[data-direction="ngang"] td { box-sizing: border-box; width: 18px; min-width: 18px; max-width: 18px; }
    .stats-history-matrix[data-matrix-scale="1"] .frequency-history-table[data-direction="ngang"] th:not(.matrix-label),
    .stats-history-matrix[data-matrix-scale="1"] .frequency-history-table[data-direction="ngang"] td { box-sizing: border-box; width: 22px; min-width: 22px; max-width: 22px; }
    .stats-history-matrix[data-matrix-scale="2"] .frequency-history-table[data-direction="ngang"] th:not(.matrix-label),
    .stats-history-matrix[data-matrix-scale="2"] .frequency-history-table[data-direction="ngang"] td { box-sizing: border-box; width: 28px; min-width: 28px; max-width: 28px; }
    .frequency-history-table[data-direction="ngang"] thead th:not(.matrix-label) { white-space: normal; overflow-wrap: anywhere; }
    .stats-history-matrix[data-matrix-scale="0"] .frequency-history-table[data-direction="ngang"] .matrix-label { min-width: 48px; }
    .stats-history-matrix[data-matrix-scale="1"] .frequency-history-table[data-direction="ngang"] .matrix-label { min-width: 54px; }
    .stats-history-matrix[data-matrix-scale="2"] .frequency-history-table[data-direction="ngang"] .matrix-label { min-width: 64px; }
    .frequency-history-table[data-direction="ngang"] .matrix-label { white-space: nowrap; }
    .frequency-history-table[data-direction="ngang"] .matrix-totals-row td { white-space: normal; overflow-wrap: anywhere; }
}
.freq-number { display: block; font-weight: 700; font-size: 15px; color: var(--ink); }
.freq-value { display: block; font-size: 12px; color: var(--muted); }
.freq-cool { background: var(--white); }
.freq-mild { background: #FFF8E1; }
.freq-warm { background: #FFE9A8; }
.freq-hot { background: var(--red); color: var(--white); }
.freq-hot .freq-number, .freq-hot .freq-value { color: var(--white); }
.kqxs-3-mien-table { table-layout: auto; min-width: 640px; }
.kqxs-3-mien-table th.group-head { background: var(--cream); text-align: center; }
.kqxs-3-mien-table .num-item { margin: 0 4px 2px; font-size: 16px; }
.special-weekday-table td .lo-item, .special-day-table td .lo-item { min-width: 1.8em; margin-right: 4px; }
.special-weekday-table .row-special-item { color: var(--red); font-size: 18px; font-weight: 700; }
.dd-tail { display: inline-block; min-width: 2.2em; margin: 2px 4px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 4px; text-align: center; font-variant-numeric: tabular-nums; }
.draw-links { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; }
.station-pagination { text-align: center; }
.recent-stations a + a { border-top: 1px solid var(--line); }
.recent-stations strong { font-variant-numeric: tabular-nums; }
.num-item { display: inline-block; margin: 0 8px 4px 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.num-row { margin: 0 0 8px; }

/* Bảng giải đặc biệt theo tuần, cặp số, lâu chưa về (trang thống kê giải đặc biệt) */
.card.flush > .week-tabs { margin-left: 0; margin-right: 0; }
.option-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; background: var(--cream-soft); padding: 8px; margin: 0 !important; }
.option-bar a { padding: 5px 14px; border: 1px solid #CCC; border-radius: var(--radius); background: var(--white); color: var(--ink); font-weight: 700; }
.option-bar a:hover { text-decoration: none; border-color: var(--red); color: var(--red); }
.option-bar a.active { background: var(--red); border-color: var(--red); color: var(--white); }
.special-calendar { table-layout: fixed; border: 1px solid #CCC; }
.special-calendar th { background: linear-gradient(to bottom, #FAFAFA, var(--stripe)); border: 1px solid var(--line); padding: 6px 2px; text-align: center; font-size: 14px; }
.special-calendar td { border: 1px solid var(--line); text-align: center; padding: 4px 1px; line-height: 1.25; vertical-align: top; height: 44px; }
.special-calendar td.weekend { background: var(--cream-soft); }
.special-value { display: block; font-size: 18px; font-weight: 700; color: var(--red); font-variant-numeric: tabular-nums; }
.special-date { display: block; font-size: 11px; color: var(--muted); }
.pair-table { table-layout: fixed; border: 1px solid #CCC; margin-bottom: 0; }
.pair-table th, .pair-table td { border: 1px solid var(--line); text-align: center; padding: 5px 2px; font-size: 15px; }
.pair-table thead th { background: linear-gradient(to bottom, #FAFAFA, var(--stripe)); font-size: 14px; }
.pair-table tbody th { color: var(--red); font-size: 17px; background: var(--white); }
.gap-block .status { text-align: center; margin: 6px 8px; }
.gap-block .pair-table { margin-bottom: 0; }
.gap-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); }
.gap-grid li { border: 1px solid var(--line); border-top: 0; text-align: center; padding: 6px 2px; font-size: 15px; font-variant-numeric: tabular-nums; }
.gap-grid strong { color: var(--red); }
.gap-grid .gap-tail { color: var(--link); }
@media (max-width: 480px) { .gap-grid { grid-template-columns: repeat(2, 1fr); } .special-value { font-size: 14px; } .special-date { font-size: 9px; } }
.list-html-link { list-style: none; margin: 0; padding: 0 10px; display: flex; flex-wrap: wrap; }
.list-html-link li { flex: 1 1 50%; padding: 4px 0; color: var(--red); }
.list-html-link li::before { content: "•"; margin-right: 8px; }
.list-html-link li a { font-size: 15px; }

/* ===== Sản phẩm, FAQ, tin tức, thông báo ===== */
.province { margin-top: 12px; }
.province summary { cursor: pointer; font-weight: 700; padding: 8px 0; color: var(--red-dark); }
.product-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.product-card h3 { color: var(--red); }
.product-group { margin: 6px 0 2px; }
.ball { display: inline-block; min-width: 2.4rem; height: 2.4rem; line-height: calc(2.4rem - 4px); padding: 0 6px; margin: 4px; text-align: center; border-radius: 999px; font-size: 1.2rem; font-weight: 700; color: var(--red); background: radial-gradient(50% 50% at 50% 50%, #FFF 0, #FFE486 100%); border: 2px solid var(--red); font-variant-numeric: tabular-nums; }
.ball.ball-red { color: var(--white); background: var(--red); border-color: var(--red-dark); }
.product-result-table td { text-align: center; }
.product-result-table tbody th { color: var(--red); }
.product-ball { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin: 2px; border: 2px solid var(--red); border-radius: 50%; background: radial-gradient(circle, #FFF 0, #FFE486 100%); color: var(--red); font-weight: 700; }
.faq-item { border-bottom: 1px solid #E5E7EB; padding: 8px 0; }
.faq-item summary { cursor: pointer; font-weight: 700; }
.faq-item p { margin: 6px 0 0; color: #4B5563; }
.notice { border: 1px solid var(--line); border-left: 4px solid var(--red); background: #FBF5F5; padding: 10px 12px; }
.notice-warn { border-left-color: var(--warn); }
.news-list-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.news-list-item h3, .news-list-item p { margin: 0 0 4px; }
.news-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.soon { color: var(--muted); }
.editor-form { display: grid; gap: 8px; max-width: 760px; }
.editor-form label { font-weight: 700; }
.editor-form input, .editor-form textarea, .editor-form select { width: 100%; padding: 9px; font: inherit; border: 1px solid #999; border-radius: 4px; }
.editor-form textarea { resize: vertical; }
.editor-form .btn { justify-self: start; }
.admin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.reel-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.reel { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; height: 64px; border: 2px solid var(--red); border-radius: 6px; background: var(--white); color: var(--red-dark); font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }
.reel-actions { text-align: center; margin: 0; }
.reel-actions .btn:disabled { opacity: .6; cursor: default; }
.quay-thu-tabs { display: flex; flex-wrap: wrap; margin: 0 0 8px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.quay-thu-tabs a { flex: 1 1 145px; padding: 9px 6px; border: 1px solid var(--line); background: var(--white); text-align: center; font-weight: 700; }
.quay-thu-tabs a.active { background: var(--red); border-color: var(--red); color: var(--white); }
.quay-thu-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; margin-bottom: 8px; background: var(--white); border: 1px solid var(--line); }
.quay-thu-filter label { font-weight: 700; }
.quay-thu-filter select { min-height: 38px; min-width: 150px; padding: 5px 8px; border: 1px solid #ccc; border-radius: var(--radius); background: var(--white); color: var(--ink); font: inherit; }
.quay-thu-date { margin-bottom: 10px; }
.quay-thu-region, .quay-thu-statistics { margin-bottom: 12px; }
.quay-thu-region > p { margin-bottom: 8px; }
.quay-thu-region-actions { margin: 8px 0; }
.quay-thu-draw-statistics { padding: 8px 10px; }
.quay-thu-draw-statistics h3 { margin: 0 0 8px; color: var(--red-dark); text-align: center; }
.quay-thu-draw-stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.quay-thu-draw-statistics caption { padding: 4px; font-weight: 700; }
.quay-thu-draw-statistics th, .quay-thu-draw-statistics td { padding: 4px; text-align: center; }
.quay-thu-draw-statistics td { font-variant-numeric: tabular-nums; }
.quay-thu-table { table-layout: auto; }
.quay-thu-table thead th { min-width: 74px; }
.quay-thu-table tbody th { width: 48px; }
.quay-thu-table td { min-width: 0; padding: 2px; }
.quay-thu-table .simulation-number { display: inline-block; min-width: 2ch; margin: 0 3px; padding: 5px 1px; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: clamp(16px, 3.8vw, 24px); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer; }
.quay-thu-table .simulation-number:disabled { cursor: default; opacity: 1; }
.quay-thu-table .simulation-number:focus-visible, .quay-thu-controls button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.quay-thu-table .simulation-number.is-selected { border-radius: 2px; background: var(--cream); }
.quay-thu-table .simulation-number mark { padding: 0; background: var(--cream); color: inherit; }
.quay-thu-table tr.row-special .simulation-number, .quay-thu-table .row-eighth .simulation-number { color: var(--red); }
.quay-thu-table .simulation-number.is-rolling { animation: quay-thu-pulse .15s linear infinite alternate; }
.quay-thu-controls { display: grid; gap: 4px; padding: 4px; }
.quay-thu-mode-controls { display: flex; flex-wrap: wrap; gap: 4px; }
.quay-thu-mode-controls button, .quay-thu-digit-controls button { min-height: 36px; border: 1px solid var(--line); background: var(--white); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.quay-thu-mode-controls button { padding: 4px 10px; }
.quay-thu-digit-controls { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); }
.quay-thu-digit-controls button { padding: 4px 0; }
.quay-thu-controls button[aria-pressed="true"] { border-color: var(--red); background: var(--red); color: var(--white); }
.quay-thu-empty { padding: 12px; text-align: center; }
.quay-thu-statistics > p { margin-bottom: 8px; }
.quay-thu-stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 0 10px; }
.quay-thu-stat-grid h3 { margin: 0 0 6px; padding: 6px; background: var(--cream); color: var(--red-dark); text-align: center; }
.quay-thu-stat-grid .simple-table th, .quay-thu-stat-grid .simple-table td { padding: 4px; font-size: 13px; }
.quay-thu-stat-grid .more-link { margin: 6px 0 0; }
@keyframes quay-thu-pulse { from { opacity: .55; } to { opacity: 1; } }
@media (max-width: 640px) {
    .quay-thu-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .quay-thu-tabs a { min-width: 0; }
    .quay-thu-filter { align-items: stretch; }
    .quay-thu-filter label { flex: 0 0 100%; }
    .quay-thu-filter select, .quay-thu-filter .btn { flex: 1 1 100%; width: 100%; }
    .quay-thu-stat-grid { grid-template-columns: minmax(0, 1fr); }
    .quay-thu-draw-stat-grid { grid-template-columns: minmax(0, 1fr); }
}
.dose-form { display: grid; grid-template-columns: 1fr; gap: 10px; }
.dose-form .field { display: flex; flex-direction: column; gap: 4px; }
.dose-form label { font-weight: 700; }
.dose-form select, .dose-form input[type="date"], .dose-form textarea { font: inherit; padding: 8px 10px; border: 1px solid #ccc; border-radius: 4px; max-width: 100%; }
.dose-form textarea { resize: vertical; min-height: 72px; }
.field-actions { display: flex; justify-content: flex-start; }
@media (min-width: 640px) {
    .dose-form { grid-template-columns: 1fr 1fr; }
    .dose-form .field-wide, .dose-form .field-actions { grid-column: 1 / -1; }
    .product-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 768px) {
    .loto-grid { grid-template-columns: 1fr 1fr; }
    .product-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ===== Bảng đặc biệt tuần / tháng / năm (kiểu xsmn, công tắc bằng CSS thuần) ===== */
.gdb-tabs { display: flex; border: 1px solid #CCC; border-radius: var(--radius); overflow: hidden; background: var(--stripe); }
.gdb-tab { flex: 1 1 0; text-align: center; padding: 11px 4px; color: var(--ink); font-size: 16px; line-height: 1.3; border-left: 1px solid #CCC; }
.gdb-tab:first-child { border-left: 0; }
a.gdb-tab:hover { background: var(--cream); color: var(--red); text-decoration: none; }
.gdb-tab.is-active { background: var(--red); color: var(--white); font-weight: 700; }
.gdb-box { background: var(--white); border: 2px solid var(--red); border-radius: var(--radius); overflow: hidden; }
.gdb-box > h2 { background: var(--red); color: var(--white); font-size: 16px; line-height: 23px; padding: 7px 8px; text-align: center; margin: 0; }
.gdb-input { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; }
.gdb-controls { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 8px 10px; padding: 10px 8px 4px; background: var(--cream-soft); }
.gdb-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.gdb-field label { font-size: 13px; font-weight: 700; }
.gdb-field select, .gdb-field input { height: 40px; padding: 0 8px; border: 1px solid #CCC; border-radius: var(--radius); background: var(--white); font: inherit; font-size: 15px; max-width: 100%; }
.gdb-field-small input { width: 72px; }
.gdb-submit { height: 40px; padding: 0 18px; border: 0; border-radius: var(--radius); background: var(--red); color: var(--white); font: inherit; font-weight: 700; cursor: pointer; }
.gdb-submit:hover { background: var(--red-dark); }
.gdb-times { align-self: center; padding-top: 16px; font-size: 18px; }
.gdb-unmerge { align-self: center; padding: 8px 14px; border: 1px solid var(--red); border-radius: var(--radius); background: var(--white); font-weight: 700; color: var(--red); }
.gdb-hint { margin: 0; padding: 6px 10px 8px; font-size: 13px; color: var(--muted); background: var(--cream-soft); }
.gdb-pills { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; padding: 0 8px 10px; background: var(--cream-soft); }
.gdb-pill { display: block; min-width: 0; height: 34px; line-height: 32px; text-align: center; border: 1px solid #b26a00; border-radius: var(--radius); background: #fff; color: #222; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gdb-pill:hover { background: var(--cream); color: var(--red); text-decoration: none; }
.gdb-pill.is-active { background: var(--red); border-color: var(--red); color: var(--white); font-weight: 700; }
.gdb-year-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 10px 8px; }
.gdb-year-pills .gdb-pill { flex: 0 0 auto; min-width: 58px; padding: 0 12px; background: var(--white); font-weight: 700; }
.gdb-pair-pills { display: flex; flex-wrap: wrap; justify-content: center; padding-top: 4px; }
.gdb-pair-pills .gdb-pill { flex: 0 0 auto; padding: 0 10px; background: var(--white); font-weight: 700; }
.gdb-year-pills .gdb-pill.is-active, .gdb-pair-pills .gdb-pill.is-active { background: var(--red); border-color: var(--red); color: var(--white); }
.gdb-nav { display: flex; align-items: center; min-height: 41px; background: var(--cream); }
.gdb-nav-arrow { flex: 0 0 40px; text-align: center; font-size: 28px; line-height: 41px; color: var(--ink); text-decoration: none; }
a.gdb-nav-arrow:hover { background: var(--white); color: var(--red); text-decoration: none; }
.gdb-nav-arrow.is-off { opacity: .25; }
.gdb-nav-title { flex: 1 1 auto; min-width: 0; margin: 0; text-align: center; font-size: 16px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gdb-grid { width: 100%; table-layout: fixed; border-collapse: collapse; }
.gdb-grid th { background: linear-gradient(to bottom, #FAFAFA, var(--stripe)); border: 1px solid var(--line); padding: 6px 2px; text-align: center; font-size: 15px; }
.gdb-month-grid thead th { font-size: 13px; white-space: nowrap; }
.gdb-cell { border: 1px solid var(--line); text-align: center; padding: 5px 2px; line-height: 1.2; vertical-align: top; background: var(--white); }
.gdb-cell.is-weekend { background: var(--cream-soft); }
.gdb-cell.is-empty { background: #FAFAFA; }
.gdb-week-grid .gdb-cell { height: 58px; }
.is-dim { opacity: .24; }
.gdb-link { display: block; color: inherit; text-decoration: none; }
a.gdb-link:hover { text-decoration: none; background: rgba(0, 0, 0, .04); }
.gdb-val { display: block; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gdb-head { color: #444; }
.gdb-tail { color: var(--red); }
.gdb-date { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.gdb-chips { display: block; }
.gdb-chip { display: none; font-size: 12px; color: var(--muted); }
.gdb-chip b { color: var(--red); font-size: 14px; }
.gdb-empty { padding: 16px 8px; text-align: center; color: var(--muted); margin: 0; }
.gdb-filter-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; padding: 8px 10px; background: var(--white); border-top: 1px solid var(--line); }
.gdb-toggle { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 15px; font-weight: 700; }
.gdb-switch { position: relative; display: inline-block; width: 36px; height: 22px; border-radius: 100px; background: #898989; transition: background .2s; flex: 0 0 auto; }
.gdb-switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--white); transition: left .2s; }
.gdb-box #gdb-dau:checked ~ * [for="gdb-dau"] .gdb-switch,
.gdb-box #gdb-duoi:checked ~ * [for="gdb-duoi"] .gdb-switch,
.gdb-box #gdb-loto:checked ~ * [for="gdb-loto"] .gdb-switch,
.gdb-box #gdb-tong:checked ~ * [for="gdb-tong"] .gdb-switch,
.gdb-box #gdb-chan:checked ~ * [for="gdb-chan"] .gdb-switch,
.gdb-box #gdb-le:checked ~ * [for="gdb-le"] .gdb-switch { background: var(--red); }
.gdb-box #gdb-dau:checked ~ * [for="gdb-dau"] .gdb-switch::after,
.gdb-box #gdb-duoi:checked ~ * [for="gdb-duoi"] .gdb-switch::after,
.gdb-box #gdb-loto:checked ~ * [for="gdb-loto"] .gdb-switch::after,
.gdb-box #gdb-tong:checked ~ * [for="gdb-tong"] .gdb-switch::after,
.gdb-box #gdb-chan:checked ~ * [for="gdb-chan"] .gdb-switch::after,
.gdb-box #gdb-le:checked ~ * [for="gdb-le"] .gdb-switch::after { left: 16px; }
.gdb-box #gdb-dau:checked ~ * .chip-dau,
.gdb-box #gdb-duoi:checked ~ * .chip-duoi,
.gdb-box #gdb-tong:checked ~ * .chip-tong { display: inline-block; margin: 0 3px; }
.gdb-box #gdb-loto:checked ~ * .gdb-head { display: none; }
.gdb-box #gdb-chan:checked ~ * .is-even { background: #E8F4FF; }
.gdb-box #gdb-le:checked ~ * .is-odd { background: #FFF0D6; }
.gdb-input:focus-visible ~ .gdb-filter-bar, .gdb-input:focus-visible ~ .gdb-top-tools { outline: 2px solid var(--gold); outline-offset: -2px; }
.gdb-view-bar { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px 8px; padding: 6px 8px; border-top: 1px solid var(--line); }
.gdb-view-label { font-weight: 700; color: var(--red); font-size: 13px; }
.gdb-filter-label { margin-left: 8px; }
.gdb-view { padding: 4px 14px; border: 1px solid #CCC; border-radius: var(--radius); background: var(--white); color: var(--ink); font-weight: 700; }
.gdb-view:hover { text-decoration: none; background: var(--cream); }
.gdb-view.is-active { background: var(--red); border-color: var(--red); color: var(--white); }
.gdb-digit-pills { display: flex; flex: 1 1 auto; flex-wrap: nowrap; gap: 4px; min-width: 0; overflow-x: auto; }
.gdb-digit { flex: 1 0 24px; min-width: 24px; padding: 3px 4px; text-align: center; border: 1px solid #CCC; border-radius: 100px; background: var(--white); font-weight: 700; cursor: pointer; }
.gdb-digit:first-child { flex: 0 0 auto; }
.gdb-box #gdb-f-all:checked ~ * [for="gdb-f-all"],
.gdb-box #gdb-f-0:checked ~ * [for="gdb-f-0"], .gdb-box #gdb-f-1:checked ~ * [for="gdb-f-1"],
.gdb-box #gdb-f-2:checked ~ * [for="gdb-f-2"], .gdb-box #gdb-f-3:checked ~ * [for="gdb-f-3"],
.gdb-box #gdb-f-4:checked ~ * [for="gdb-f-4"], .gdb-box #gdb-f-5:checked ~ * [for="gdb-f-5"],
.gdb-box #gdb-f-6:checked ~ * [for="gdb-f-6"], .gdb-box #gdb-f-7:checked ~ * [for="gdb-f-7"],
.gdb-box #gdb-f-8:checked ~ * [for="gdb-f-8"], .gdb-box #gdb-f-9:checked ~ * [for="gdb-f-9"] { background: var(--red); border-color: var(--red); color: var(--white); }
.gdb-box #gdb-f-0:checked ~ * .gdb-cell:not(.has-0):not(.is-empty), .gdb-box #gdb-f-1:checked ~ * .gdb-cell:not(.has-1):not(.is-empty),
.gdb-box #gdb-f-2:checked ~ * .gdb-cell:not(.has-2):not(.is-empty), .gdb-box #gdb-f-3:checked ~ * .gdb-cell:not(.has-3):not(.is-empty),
.gdb-box #gdb-f-4:checked ~ * .gdb-cell:not(.has-4):not(.is-empty), .gdb-box #gdb-f-5:checked ~ * .gdb-cell:not(.has-5):not(.is-empty),
.gdb-box #gdb-f-6:checked ~ * .gdb-cell:not(.has-6):not(.is-empty), .gdb-box #gdb-f-7:checked ~ * .gdb-cell:not(.has-7):not(.is-empty),
.gdb-box #gdb-f-8:checked ~ * .gdb-cell:not(.has-8):not(.is-empty), .gdb-box #gdb-f-9:checked ~ * .gdb-cell:not(.has-9):not(.is-empty) { opacity: .2; }
.gdb-scroll { overflow-x: auto; max-width: 100%; }
.gdb-month-grid, .gdb-year-grid { min-width: 860px; }
.gdb-month-grid th[scope="row"], .gdb-year-grid th[scope="row"] { width: 54px; }
.gdb-year-grid { min-width: 1500px; }
.gdb-year-grid th { font-size: 13px; padding: 5px 1px; }
.gdb-year-grid .gdb-year-head { background: var(--red); color: var(--white); font-size: 16px; }
.gdb-year-grid .gdb-val { font-size: 15px; }
.gdb-year-grid td:nth-child(12) { border-right: 2px solid var(--red); }
.gdb-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 8px; }
.gdb-stat { border: 1px solid var(--line); }
.gdb-stat caption { background: var(--cream); color: var(--ink); font-size: 15px; font-weight: 700; padding: 6px 2px; text-align: center; caption-side: top; }
.gdb-stat th { background: linear-gradient(to bottom, #FAFAFA, var(--stripe)); text-align: center; padding: 4px 2px; font-size: 14px; }
.gdb-stat tbody th { background: var(--white); color: var(--red); font-size: 16px; }
.gdb-stat td { text-align: center; padding: 4px 2px; font-size: 15px; border: 1px solid var(--line); }
.gdb-stat .more-row { display: none; }
.gdb-box #gdb-more:checked ~ * .more-row { display: table-row; }
.gdb-more { text-align: center; margin: 0; }
.gdb-more-btn { display: inline-block; padding: 6px 22px; border: 1px solid var(--red); border-radius: var(--radius); font-weight: 700; color: var(--red); cursor: pointer; }
.gdb-more-btn .when-open { display: none; }
.gdb-box #gdb-more:checked ~ * .when-open { display: inline; }
.gdb-box #gdb-more:checked ~ * .when-closed { display: none; }
.gdb-note { text-align: center; margin: 4px 0 8px; font-size: 13px; color: var(--muted); }
@media (max-width: 600px) {
    .gdb-tab { font-size: 13px; padding: 9px 2px; }
    .gdb-nav-title, .gdb-box > h2 { font-size: 14px; }
    .gdb-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr) 64px auto; gap: 5px; align-items: end; padding: 8px; }
    .gdb-field label { font-size: 10px; white-space: nowrap; }
    .gdb-field select, .gdb-field input { padding: 0 3px; font-size: 13px; }
    .gdb-field-small input { width: 64px; }
    .gdb-submit { padding: 0 9px; }
    .gdb-compare { display: flex; }
    .gdb-pill { font-size: 12px; padding: 0 2px; }
    .gdb-week-grid th { font-size: 13px; }
    .gdb-val { font-size: 14px; }
    .gdb-week-grid .gdb-date { font-size: 9px; }
    .gdb-chip { font-size: 10px; }
    .gdb-chip b { font-size: 12px; }
    .gdb-filter-bar { position: sticky; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; padding: 8px 2px; border-top: 1px solid var(--red); }
    .gdb-toggle { flex-direction: column; gap: 3px; font-size: 11px; text-align: center; line-height: 1.1; }
    .gdb-top-tools .gdb-filter-bar { position: static; grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .gdb-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Trực tiếp */
.live-panels { display: grid; gap: 10px; }
.live-spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: live-spin .8s linear infinite; vertical-align: -2px; margin-right: 5px; }
.result-table:not(.region-result-table) .num-item.live-prize-slot { display: flex; }
.live-prize-slot { min-height: 48px; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.live-prize-spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid var(--live); border-right-color: transparent; border-radius: 50%; animation: live-spin .8s linear infinite; vertical-align: middle; }
.live-prize-spinner.live-prize-roll { display: inline-flex; align-items: flex-start; width: auto; height: 1.5em; border: 0; border-radius: 0; animation: none; overflow: hidden; color: var(--red); }
.live-prize-digit { display: block; width: .62em; height: 1.5em; overflow: hidden; text-align: center; }
.live-prize-digit-track { display: block; animation: live-digit-roll .55s linear infinite; }
.live-prize-digit-track > span { display: block; height: 1.5em; line-height: 1.5em; }
.live-prize-static { display: none; color: var(--muted); }
.live-prize-digit:nth-child(2) .live-prize-digit-track { animation-delay: -.13s; }
.live-prize-digit:nth-child(3) .live-prize-digit-track { animation-delay: -.26s; }
.live-prize-digit:nth-child(4) .live-prize-digit-track { animation-delay: -.39s; }
.live-prize-digit:nth-child(5) .live-prize-digit-track { animation-delay: -.52s; }
.live-prize-digit:nth-child(6) .live-prize-digit-track { animation-delay: -.65s; }
.region-result-table .live-prize-slot { display: inline-flex; min-height: 38px; min-width: 38px; }
.region-result-many .region-result-table .live-prize-slot { display: flex; min-height: 30px; min-width: 30px; }
.live-insights { min-height: calc(1.5em + 14px); margin-top: 4px; padding: 6px 10px; border: 1px solid var(--live); border-radius: var(--radius); background: var(--cream-soft); color: var(--ink); font-size: 14px; font-weight: 700; }
.live-insights:not([data-has-message]) { visibility: hidden; }
.live-insight-message { margin: 0; min-height: 1.5em; }
.site-live-announcement { margin: 8px 0; padding: 8px 12px; border: 1px solid var(--live); border-left-width: 3px; background: var(--cream-soft); color: var(--ink); }
.site-live-announcement a { color: var(--link); font-weight: 700; }
.live-panels.is-loading { opacity: .8; }
@keyframes live-spin { to { transform: rotate(360deg); } }
@keyframes live-digit-roll { to { transform: translateY(-100%); } }
@media (prefers-reduced-motion: reduce) {
    .live-spinner, .live-prize-spinner { animation: none; border-right-color: currentColor; }
    .live-prize-spinner.live-prize-roll { border: 0; }
    .live-prize-digit { display: none; }
    .live-prize-static { display: inline; }
}
.live-panel { border-left-width: 2px; }
.live-panel.live-dang-quay { border-color: var(--live); }
.live-panel.live-cho, .live-panel.live-cho-ket-qua { border-color: var(--red); }
.live-panel.live-co-ket-qua { border-color: var(--red); }
.live-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.card > .live-head { margin: 0 0 8px; padding: 6px 10px; background: var(--red); }
.live-head h2 { margin: 0; font-size: 16px; background: none; color: var(--white); padding: 0; text-align: left; line-height: 23px; }
.live-head h2 a { color: var(--white); }
.live-badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: var(--radius); background: var(--cream-soft); color: var(--ink); }
.live-dang-quay .live-badge { background: var(--live); color: var(--white); }
.live-cho .live-badge, .live-cho-ket-qua .live-badge { background: var(--special); color: var(--warn); }

/* ===== Chân trang: lưới liên kết nền xám nhạt + khối bản quyền màu chủ đạo ===== */
.footer-row { background: #F5F5F5; margin-top: 10px; padding: 8px 10px 4px; }
.footer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 8px; }
.footer-col { padding: 6px 5px 8px 0; }
.footer-title { font-size: 16px; font-weight: 700; margin: 0 0 4px; color: var(--link); background: none; border: 0; padding: 0; text-align: left; }
.footer-title a { color: var(--link); }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { padding: 4px 0 4px 2px; }
.footer-col li a { color: var(--ink); }
.footer-col li a:hover { color: var(--red); }
.site-footer { background: var(--red); border-top: 1px solid #DFDFDF; color: var(--white); }
.site-footer a { color: var(--white); }
.site-footer a:hover { text-decoration: underline; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 14px 32px; padding: 18px 10px; }
.footer-brand { flex: 1 1 300px; min-width: 0; }
.footer-copy { margin: 0 0 8px; font-size: 13px; line-height: 1.6; }
.footer-legal { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-wrap: wrap; gap: 0 17px; font-size: 13px; line-height: 1.5; }
.footer-legal li { position: relative; }
.footer-legal li + li::before { content: ""; position: absolute; left: -9px; top: 50%; width: 1px; height: 12px; margin-top: -6px; background: rgba(255, 255, 255, .45); }
.footer-legal a { display: inline-block; padding: 5px 0; }
.footer-note { flex: 1 1 340px; max-width: 520px; font-size: 13px; line-height: 1.6; list-style: none; margin: 0; padding: 0; }
.footer-note li + li { margin-top: 4px; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 900px) {
    .footer-inner { justify-content: center; text-align: center; padding: 16px 12px; }
    .footer-brand, .footer-note { flex: 1 1 100%; max-width: none; }
    .footer-legal { justify-content: center; gap: 0 20px; }
    .footer-legal li + li::before { display: none; }
    .footer-legal a { padding: 8px 0; }
}

/* Nút lên đầu trang */
.go-top { position: fixed; right: 10px; bottom: 16px; z-index: 70; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; background: var(--red); color: var(--white); cursor: pointer; padding: 0; border-radius: 50%; font-size: 26px; line-height: 1; }
.go-top[hidden] { display: none; }

/* Sổ kết quả theo khoảng ngày */
.archive-form { align-items: flex-end; }
.archive-kind { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; border: 0; margin: 0; padding: 0; min-width: 0; }
.archive-kind legend { float: left; font-weight: 700; padding: 0 8px 0 0; }
.archive-kind label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.archive-pills { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.archive-pills .gdb-pill { font-weight: 700; }
.archive-jump { margin: 0; padding: 0 10px 10px; background: var(--cream-soft); }
.archive-jump a { color: var(--red); font-weight: 700; text-decoration: underline; }
.archive-day { margin-bottom: 14px; }
.archive-day-title { background: var(--cream); color: var(--red); text-align: center; font-size: 16px; margin: 0; padding: 7px 6px; border-top: 1px solid var(--line); }
.archive-day .result-block .table-wrap:first-child caption { display: none; }
.archive-station { text-align: left; padding-left: 8px; }
.special-cell strong { color: var(--red); }
.loto-book td { font-size: 13px; padding: 3px 2px; }
.loto-book th[scope="row"] { white-space: nowrap; }
.loto-weekday { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.card.flush { padding-bottom: 0; }

/* Trang kết quả Vietlott / Điện toán / Thần tài */
.product-tabs .gdb-tab { font-size: 14px; padding: 9px 2px; }
.product-latest .product-result-table { border: 0; }
.product-history-table td { text-align: left; }
.product-history-table .product-result { padding: 4px 8px; }
.product-line { padding: 2px 0; }
.product-line-label { font-weight: 700; color: var(--muted); margin-right: 6px; font-size: 13px; }
.product-history-table .num-item { font-size: 16px; color: var(--red); margin: 0 8px 0 0; }
.product-history-table .ball-small { min-width: 1.9rem; height: 1.9rem; line-height: calc(1.9rem - 4px); font-size: 1rem; margin: 2px 3px; padding: 0 4px; }
.product-date { width: 120px; text-align: center !important; white-space: nowrap; }
.product-more { text-align: center; }
@media (max-width: 600px) { .product-tabs { flex-wrap: wrap; } .product-tabs .gdb-tab { flex: 1 1 33%; border-top: 1px solid #CCC; } }

/* Sổ đầu đuôi dạng bảng */
.dd-book-table { table-layout: auto; }
.dd-book-table th, .dd-book-table td { border: 1px solid var(--line); padding: 8px 6px; text-align: center; }
.dd-book-table thead th { background: var(--gold); color: var(--red-dark); font-size: 15px; }
.dd-book-table .dd-date { background: var(--stripe); width: 130px; font-weight: 400; line-height: 1.5; }
.dd-book-table .dd-date a { color: var(--ink); }
.dd-book-table .dd-last { color: var(--link); font-weight: 700; font-size: 17px; letter-spacing: .5px; }
.dd-book-table .dd-special { color: var(--red); font-size: 20px; font-variant-numeric: tabular-nums; }
.dd-book-table .dd-station { color: var(--link); font-weight: 700; }
.dd-more { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 10px 8px 0; }
.dd-more .gdb-pill { min-width: 84px; padding: 0 10px; background: var(--white); font-weight: 700; }
.dd-more .gdb-pill.is-active { background: var(--red); border-color: var(--red); color: var(--white); }
@media (max-width: 600px) { .dd-book-table .dd-date { width: 96px; font-size: 13px; } .dd-book-table .dd-special { font-size: 17px; } .dd-book-table .dd-last { font-size: 14px; } }

.hot-loto-table { table-layout: fixed; border: 1px solid #CCC; }
.hot-loto-table caption { background: var(--cream); color: var(--ink); font-weight: 700; padding: 6px; caption-side: top; text-align: center; }
.hot-loto-table td { border: 1px solid var(--line); text-align: center; padding: 8px 2px; font-size: 15px; }
.hot-loto-table strong { color: var(--red); font-size: 17px; }
@media (max-width: 480px) { .hot-loto-table td { font-size: 12px; padding: 6px 0; } .hot-loto-table strong { font-size: 14px; } }

@media (max-width: 600px) {
    .archive-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: end; }
    .archive-form .gdb-field label { font-size: 12px; }
    .archive-form .gdb-field select, .archive-form .gdb-field input { font-size: 14px; width: 100%; }
    .archive-form .gdb-field-small input { width: 100%; }
    .archive-kind { grid-column: 1 / -1; }
    .archive-kind legend { float: none; padding: 0 0 2px; }
    .archive-form .gdb-submit { grid-column: 1 / -1; height: 40px; }
    .archive-pills { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.stats-province-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; }
.stats-window-form { display: flex; flex-wrap: nowrap; align-items: end; gap: 8px; margin: 8px 0; }
.stats-window-form > div { display: flex; align-items: center; gap: 6px; min-width: 0; }
.stats-window-form label { font-weight: 700; white-space: nowrap; }
.stats-window-form input {
    width: 10ch;
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 8px;
    border: 1px solid #CCC;
    border-radius: var(--radius);
    background: var(--white);
    font: inherit;
}
.stats-window-form .form-error { color: var(--red); font-size: 13px; }
@media (max-width: 480px) {
    .stats-window-form label { font-size: 12px; }
    .stats-window-form .btn { flex: 0 0 auto; padding-right: 8px; padding-left: 8px; white-space: nowrap; }
}
.stats-province-picker label, .long-term-filter-field label { font-weight: 700; }
.stats-province-picker select, .long-term-filter-field select, .long-term-filter-field input {
    min-height: 38px;
    max-width: 100%;
    padding: 0 8px;
    border: 1px solid #CCC;
    border-radius: var(--radius);
    background: var(--white);
    font: inherit;
}
.long-term-control-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 8px; padding: 8px 0; }
.long-term-control-layout .stats-province-picker { align-items: stretch; flex-direction: column; min-width: 0; padding: 0; }
.long-term-control-layout .stats-province-picker select { width: 100%; }
.long-term-filter-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; min-width: 0; }
.long-term-filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.long-term-filter-field select { width: 100%; min-width: 0; }
.long-term-table-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px; }
.long-term-kind-filter { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; margin: 0; padding: 0; border: 0; }
.long-term-kind-filter legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.long-term-kind-filter label { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 4px 8px; border: 1px solid #CCC; border-radius: var(--radius); background: var(--white); cursor: pointer; }
.long-term-kind-filter label.is-selected { border-color: var(--red); background: var(--red); color: var(--white); font-weight: 700; }
.long-term-kind-filter input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.long-term-kind-filter input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 2px; }
.long-term-sort { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; font-weight: 700; cursor: pointer; }
.long-term-sort input { appearance: none; position: relative; width: 42px; height: 24px; margin: 0; border-radius: 999px; background: #777; cursor: pointer; transition: background-color .15s ease; }
.long-term-sort input::before { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--white); content: ""; transition: transform .15s ease; }
.long-term-sort input:checked { background: var(--red); }
.long-term-sort input:checked::before { transform: translateX(18px); }
.long-term-sort input:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.long-term-filter-form .btn { justify-self: start; }
.long-term-gap-table td.gan-max { color: var(--red); font-weight: 700; }
[data-lo-gan-results][aria-busy="true"] { opacity: .65; }
.stats-history-table td.gan-max { color: var(--red); font-weight: 700; }
.stats-history-table tbody td:nth-child(2) { font-weight: 700; }

@media (max-width: 600px) {
    .stats-province-picker { align-items: stretch; flex-direction: column; }
    .stats-province-picker select { width: 100%; }
    .long-term-control-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .long-term-filter-form { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
    .long-term-filter-field { min-width: 0; }
    .long-term-filter-field select { min-width: 0; }
    .long-term-filter-form .btn { justify-self: stretch; padding-right: 8px; padding-left: 8px; }
    .long-term-table-controls { padding: 6px 4px; }
    .long-term-kind-filter { flex: 1 1 auto; gap: 3px; }
    .long-term-kind-filter label { padding: 4px 6px; }
    .long-term-sort { min-height: 32px; }
}

.recent-days-table tr.is-current th, .recent-days-table tr.is-current td { background: var(--cream-soft); }
.recent-days-table td { padding: 5px 4px; }

.products-table tbody th { text-align: left; width: 150px; padding-left: 8px; }
.products-table .product-result { text-align: left; padding: 4px 8px; }
.products-table .num-item { font-size: 16px; color: var(--red); margin: 0 8px 0 0; }
.products-table .ball-small { min-width: 1.9rem; height: 1.9rem; line-height: calc(1.9rem - 4px); font-size: 1rem; margin: 2px 3px; padding: 0 4px; }
@media (max-width: 600px) { .products-table tbody th { width: 92px; } .products-table .product-date { width: 84px; font-size: 13px; } }

.hub-table { table-layout: fixed; border: 1px solid #CCC; }
.hub-table th, .hub-table td { border: 1px solid var(--line); padding: 8px 6px; text-align: center; vertical-align: middle; overflow-wrap: anywhere; }
.hub-table thead th { background: var(--cream); color: var(--ink); font-size: 15px; }
.hub-table tbody th { text-align: left; background: var(--stripe); font-weight: 700; color: var(--ink); width: 26%; }
.hub-table tbody tr:nth-child(even) td { background: #FAFAFA; }
@media (max-width: 600px) { .hub-table th, .hub-table td { padding: 6px 3px; font-size: 12px; } .hub-table thead th { font-size: 12px; } }
