/*
Theme Name: KetQua77
Theme URI: https://ketqua77.com/
Author: Ban biên tập KetQua77
Description: Giao diện tra cứu kết quả xổ số 3 miền cho KetQua77 – bảng kết quả kiểu vé dò, tối ưu đọc trên điện thoại, đi kèm plugin KetQua77 Core.
Version: 1.0.0
Requires PHP: 7.4
Text Domain: ketqua77
*/

:root {
	--red: #c8102e;
	--red-d: #9e0b22;
	--ink: #1b2a4a;
	--ink-2: #2c3e66;
	--paper: #fff8e1;
	--paper-line: #eadfb8;
	--gold: #e8b400;
	--bg: #f3f5f9;
	--card: #ffffff;
	--line: #dce2ec;
	--text: #1d2433;
	--muted: #5d6779;
	--green: #0e7c4a;
	--radius: 10px;
	--font: "Be Vietnam Pro", 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; background: var(--bg); color: var(--text); font: 400 16px/1.6 var(--font); }
a { color: var(--ink-2); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--red); }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.25; color: var(--ink); }
h1 { font-size: 1.6rem; font-weight: 800; margin: .2em 0 .3em; letter-spacing: -.01em; }
h2 { font-size: 1.22rem; font-weight: 700; margin: 1.6em 0 .6em; }
h3 { font-size: 1.05rem; font-weight: 700; margin: 1.2em 0 .4em; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--gold); color: var(--ink); padding: 8px 12px; z-index: 99; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); font-size: .92em; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
.site-top { background: var(--ink); color: #fff; }
.site-top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand svg { width: 44px; height: 44px; flex: none; }
.brand-name { display: block; font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em; line-height: 1.1; }
.brand-sub { display: block; font-size: .78rem; color: #c9d3ea; }
.nav { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.nav ul { list-style: none; margin: 0 auto; padding: 0 8px; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; max-width: 1240px; }
.nav ul::-webkit-scrollbar { display: none; }
.nav a { display: block; padding: 12px 12px; white-space: nowrap; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .95rem; border-bottom: 3px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--red); border-bottom-color: var(--red); }
.nav .live a { color: var(--red); }
.nav .live a::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-right: 6px; vertical-align: 1px; }

/* ---------- Layout 3 cột ---------- */

.page-head .lead { color: var(--muted); margin: 0 0 12px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 0 0 6px; font-size: .85rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 4px; color: #a0a9ba; }
.crumbs a { color: var(--muted); }
.intro, .note { margin: .4em 0 1em; }
.note { background: #fff; border-left: 4px solid var(--gold); padding: 10px 14px; border-radius: 6px; }
.take { background: #fff; border: 1px dashed var(--paper-line); padding: 10px 14px; border-radius: 8px; font-size: .95rem; }
.more { font-size: .95rem; }

/* ---------- Bảng kết quả kiểu vé dò ---------- */
.kq-box { background: var(--paper); border: 1px solid var(--paper-line); border-radius: var(--radius); margin: 0 0 22px; position: relative; overflow: hidden; }
.kq-box::before, .kq-box::after { content: ""; position: absolute; top: 56px; bottom: 10px; width: 8px; background: radial-gradient(circle at 50% 6px, var(--bg) 3.2px, transparent 3.6px) 0 0 / 8px 12px repeat-y; }
.kq-box::before { left: -3px; }
.kq-box::after { right: -3px; }
.kq-head { background: var(--red); color: #fff; padding: 10px 16px; }
.kq-title { margin: 0; font-size: 1.08rem; color: #fff; font-weight: 700; }
.kq-title a { color: #fff; text-decoration: none; }
.kq-title a:hover { text-decoration: underline; color: #fff; }
.kq-meta { margin: 2px 0 0; font-size: .82rem; color: #ffe1e6; }
.live-dot { color: #fff; font-weight: 700; }
.live-dot::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-right: 5px; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .live-dot::before { animation: none; } }
.kq-body { padding: 10px 14px 4px; display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.kq-body.kq-scroll { display: block; }
@media (max-width: 720px) { .kq-body { grid-template-columns: minmax(0, 1fr); } }
.kq-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; }
.kq th, .kq td { border-bottom: 1px solid var(--paper-line); padding: 7px 4px; text-align: center; }
.kq tr:last-child th, .kq tr:last-child td { border-bottom: 0; }
.kq th[scope="row"] { width: 54px; color: var(--muted); font-weight: 700; font-size: .9rem; text-align: left; padding-left: 2px; }
.kq td { display: flex; flex-wrap: wrap; justify-content: space-around; gap: 4px 10px; }
.kq td.c6, .kq td.c3 { display: grid; grid-template-columns: repeat(3, 1fr); justify-items: center; }
.kq td.c4, .kq td.c7 { display: grid; grid-template-columns: repeat(4, 1fr); justify-items: center; }
.kq td.c2 { display: grid; grid-template-columns: repeat(2, 1fr); justify-items: center; }
@media (max-width: 400px) { .kq td.c4, .kq td.c7 { grid-template-columns: repeat(2, 1fr); } }
.kq-multi td, .kq-multi th { display: table-cell; }
.kq-multi thead th { font-size: .95rem; color: var(--ink); padding: 8px 4px; border-bottom: 2px solid var(--paper-line); }
.kq-multi thead th a { color: var(--ink); text-decoration: none; font-weight: 700; }
.kq-multi td .n { display: block; }
.n { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.18rem; letter-spacing: .02em; color: var(--text); white-space: nowrap; }
.n i { font-style: normal; }
.n b { font-weight: 800; }
.n-db, .r-db .n { color: var(--red); font-size: 1.62rem; font-weight: 800; }
.r-g8 .n, .r-g7 .n:only-child { color: var(--red); }
.kq-mb .r-g7 .n { color: var(--red); }
.n-wait b { color: #b7a46a; font-weight: 400; }
.r-code td { font-size: .9rem; color: var(--ink); font-weight: 600; justify-content: flex-start; gap: 4px 12px; }
.mode-d2 .n .h, .mode-d2 .n .m, .mode-d3 .n .h { display: none; }
.kq-tools { display: flex; gap: 6px; padding: 6px 14px 12px; flex-wrap: wrap; }
.kq-tools button { font: 600 .82rem var(--font); border: 1px solid var(--paper-line); background: #fff; color: var(--ink); padding: 5px 12px; border-radius: 999px; cursor: pointer; }
.kq-tools button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.kq-dd, .kq-lt { font-size: .9rem; background: #fff; border-radius: 8px; overflow: hidden; }
.kq-dd th, .kq-dd td, .kq-lt th, .kq-lt td { border: 1px solid #f0e8cc; padding: 4px 6px; text-align: left; }
.kq-dd thead th, .kq-lt thead th { background: #fbf2d3; font-size: .8rem; color: var(--muted); }
.kq-dd th[scope="row"], .kq-lt th[scope="row"] { width: 30px; text-align: center; color: var(--red); font-weight: 800; }
.kq-lt { margin: 8px 14px 0; width: calc(100% - 28px); }
.kq-lt caption { text-align: left; font-weight: 700; font-size: .9rem; color: var(--ink); padding: 6px 0; }
.dt .dt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; padding: 12px 14px 14px; }
.dt-item h3 { margin: 0 0 6px; font-size: .95rem; }

/* ---------- Thành phần chung ---------- */
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 16px; }
.chips a { display: inline-block; padding: 6px 12px; background: #fff; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink); font-size: .9rem; font-weight: 600; }
.chips a:hover { border-color: var(--red); color: var(--red); }
.chips .on a { background: var(--ink); color: #fff; border-color: var(--ink); }
.ball { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 999px; background: #fff; border: 2px solid var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.ball.hot { border-color: var(--red); color: var(--red); }
.balls { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.balls.lg .ball { min-width: 72px; height: 44px; font-size: 1.3rem; border-color: var(--red); color: var(--red); }
.balls.wide .ball { min-width: 74px; }
.kq-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 14px; flex-wrap: wrap; }
.kq-nav a { font-weight: 600; text-decoration: none; padding: 6px 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.pick { display: flex; gap: 6px; align-items: center; }
.pick input, .pick button, .dove input, .dove select, .dove button, .pick-print select, .pick-print input, .pick-print button, input[type="search"] { font: 500 1rem var(--font); padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); }
.pick button, .dove button, .pick-print button, .btn-spin { background: var(--red); color: #fff; border-color: var(--red); font-weight: 700; cursor: pointer; }
.pick.big { background: #fff; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line); flex-wrap: wrap; }
.kq-list { background: #fff; border-radius: var(--radius); overflow: hidden; font-size: .95rem; border: 1px solid var(--line); }
.kq-list th, .kq-list td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.kq-list thead th { background: var(--ink); color: #fff; font-weight: 600; font-size: .88rem; position: sticky; top: 0; }
.kq-list thead th[data-type], .sortable thead th { cursor: pointer; }
.kq-list th small { display: block; color: var(--muted); font-weight: 400; }
.kq-list td.db .n, .kq-list td.db strong { color: var(--red); font-size: 1.1rem; }
.kq-list td.lt { font-size: .88rem; color: var(--muted); }
.kq-list tr.hl td { background: #fff4f5; }
.kq-list.week td, .kq-list.cal-m td, .kq-list.year td { text-align: center; }
.kq-list.week b, .kq-list.cal-m b { color: var(--red); }
.kq-list.cal-m td small { display: block; color: var(--muted); font-size: .72rem; text-align: left; }
.kq-list.year td { padding: 4px 2px; font-variant-numeric: tabular-nums; }
.kq-list.year a { text-decoration: none; font-weight: 700; }
.bar { display: inline-block; min-width: 64px; padding: 2px 6px; border-radius: 4px; background: linear-gradient(90deg, #ffd9df var(--w), transparent var(--w)); }
table.plain { background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: .6em 0 1em; font-size: .95rem; }
table.plain th, table.plain td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; }
table.plain thead th { background: #eef2f8; font-size: .88rem; }
table.sched tr.today { background: #fff8e1; }
table.mini { font-size: .92rem; }
table.mini th, table.mini td { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.quick { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px 10px; margin: 0 0 22px; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 560px) { .quick-grid { grid-template-columns: 1fr; } }
.analysis { background: #fff; border-left: 4px solid var(--red); border-radius: 0 var(--radius) var(--radius) 0; padding: 4px 18px 10px; margin: 0 0 22px; }
.analysis h2 { margin-top: .8em; }
.analysis ul { padding-left: 18px; margin: 0 0 8px; }
.analysis li { margin: 4px 0; }
.prose { background: #fff; border-radius: var(--radius); border: 1px solid var(--line); padding: 4px 20px 14px; margin: 0 0 22px; }
.prose p, .prose li { max-width: 72ch; }
.related h2 { font-size: 1.05rem; }
.heat { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; margin: 0 0 18px; }
.hc { background: #fff; border-radius: 6px; text-align: center; padding: 6px 0; border: 1px solid var(--line); }
.hc b { display: block; font-size: 1rem; font-variant-numeric: tabular-nums; }
.hc small { font-size: .68rem; color: var(--muted); }
.hc.h1 { background: #ffeef1; } .hc.h2 { background: #ffd6dd; } .hc.h3 { background: #ffb3c0; }
.hc.h4 { background: #f2697f; color: #fff; } .hc.h5 { background: var(--red); color: #fff; }
.hc.h4 small, .hc.h5 small { color: #ffe1e6; }
@media (max-width: 480px) { .hc small { display: none; } .hc b { font-size: .9rem; } }
.switch { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; margin: 0 0 14px; }
.switch summary { cursor: pointer; font-weight: 600; }
.switch-in p { margin: .5em 0; line-height: 2; }
.switch-in a { margin-right: 8px; white-space: nowrap; }
.switch-in a[aria-current] { font-weight: 800; color: var(--red); }
.hub { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.hub-item { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 2px 16px 8px; }
.hub-item h2 { font-size: 1.05rem; }
.cal { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
.cal a { display: block; background: #fff; border: 1px solid var(--line); border-radius: 8px; text-align: center; padding: 6px; text-decoration: none; }
.cal small { display: block; color: var(--muted); font-size: .75rem; }
.faq { margin: 0 0 22px; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: 8px; margin: 0 0 8px; }
.faq summary { cursor: pointer; padding: 12px 14px; font-weight: 600; }
.faq details > div { padding: 0 14px 6px; }
.spin { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 22px; }
.btn-spin { font: 700 1.05rem var(--font); padding: 10px 22px; border-radius: 999px; border: 0; }
.spin-out { margin-top: 12px; }
.dove { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; align-items: end; }
.dove label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.dove input, .dove select { width: 100%; }
.dove-out { margin: 14px 0 22px; }
.win { background: #eaf7f0; border: 1px solid #b8e2cb; border-radius: 8px; padding: 10px 14px; }
.lose { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.post-list { list-style: none; padding: 0; }
.post-list li { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 0 0 8px; }
.post-list a { font-weight: 700; }
.post-list p { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }

/* ---------- Bài viết ---------- */
.entry { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 22px 18px; }
.entry p, .entry li { max-width: 72ch; }
.entry table { border: 1px solid var(--line); margin: 1em 0; font-size: .95rem; }
.entry th, .entry td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.entry-meta { color: var(--muted); font-size: .88rem; margin: 0 0 10px; }

/* ---------- Footer ---------- */
.site-foot { background: var(--ink); color: #c9d3ea; padding: 28px 0 22px; font-size: .9rem; }
.site-foot a { color: #fff; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
.foot-grid h2 { color: #fff; font-size: .95rem; margin: 0 0 8px; }
.foot-grid ul { list-style: none; padding: 0; margin: 0; line-height: 1.9; }
.foot-note { border-top: 1px solid #34466f; margin-top: 18px; padding-top: 14px; font-size: .82rem; }

/* ---------- In ấn ---------- */
@media print {
	.site-top, .nav, .col-left, .col-right, .site-foot, .crumbs, .no-print, .kq-tools, .faq, .related, .kq-nav, .page-head .lead { display: none !important; }
	body { background: #fff; font-size: 12px; }
	.cols { display: block; padding: 0; }
	.kq-box { border: 1px solid #000; break-inside: avoid; }
	.kq-box::before, .kq-box::after { display: none; }
	.kq-head { background: #fff; color: #000; border-bottom: 1px solid #000; }
	.kq-title, .kq-title a, .kq-meta { color: #000; }
	.n { color: #000 !important; }
	.r-db .n { font-size: 1.4em; }
	.kq-body { display: block; }
	.kq-dd { margin-top: 6px; }
}
@media print and (max-width: 90mm) {
	body { font-size: 10px; }
	.kq-dd, .kq-lt { display: none; }
}

/* ---------- Bổ sung v6 ---------- */
.kq-list.mx { font-size: .82rem; }
.kq-list.mx th, .kq-list.mx td { padding: 3px 5px; text-align: center; min-width: 30px; }
.kq-list.mx thead th { font-size: .72rem; font-weight: 600; }
.kq-list.mx tbody th { position: sticky; left: 0; background: #fff; z-index: 1; }
.kq-list.mx td.on { background: #ffd6dd; font-weight: 700; color: var(--red-d); }
.kq-list.mx td.x { background: var(--red); color: #fff; }
.spin .hd { margin: 0 0 12px; font-size: .95rem; }
.btn-spin.alt { background: var(--ink); }
.lookup { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; }
.lookup label { font-weight: 700; }
.lookup input, .lookup select { font: 500 1rem var(--font); padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; width: auto; }
.lookup input { width: 90px; }
.lookup button { font: 700 1rem var(--font); padding: 7px 14px; border-radius: 8px; border: 0; background: var(--red); color: #fff; cursor: pointer; }
.lookup-out { margin: 0 0 16px; }
.lookup-out .win, .lookup-out .lose { margin: 0; }

/* ---------- v8: bố cục 3 cột ---------- */
.site-top .wrap { min-height: 76px; padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; }
.topkq { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); border-radius: 10px; padding: 6px 12px 6px 12px; font-size: .84rem; color: #dbe3f5; display: grid; grid-template-columns: auto 1fr auto; gap: 2px 14px; align-items: center; max-width: 720px; }
.topkq .tk-h { margin: 0; grid-row: span 2; text-align: center; line-height: 1.25; font-size: .78rem; }
.topkq .tk-h span { display: block; background: var(--red); color: #fff; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; border-radius: 6px; padding: 3px 8px; margin-bottom: 3px; font-size: .8rem; }
.topkq ul { list-style: none; margin: 0; padding: 0; grid-row: span 2; }
.topkq li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topkq li b a { color: var(--gold); text-decoration: none; display: inline-block; min-width: 44px; }
.topkq li a { color: #fff; }
.topkq small { color: #9fb0d6; }
.topkq .tk-y { grid-row: span 2; color: #fff; font-weight: 700; text-decoration: none; background: rgba(255,255,255,.1); padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.topkq .tk-y:hover { background: var(--red); color: #fff; }
@media (max-width: 760px) {
	.site-top .wrap { justify-content: center; }
	.topkq { width: 100%; min-width: 0; grid-template-columns: minmax(0, 1fr); }
	.topkq li { white-space: normal; }
	.topkq .tk-h { grid-row: auto; grid-column: 1 / -1; text-align: left; }
	.topkq .tk-h span { display: inline-block; margin: 0 6px 0 0; }
	.topkq ul { grid-row: auto; }
	.topkq .tk-y { grid-row: auto; justify-self: start; padding: 4px 10px; font-size: .8rem; }
}
.nav { background: var(--red); border-bottom: 0; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.nav a { color: #fff; border-bottom: 3px solid transparent; padding: 11px 13px; }
.nav a:hover, .nav a[aria-current="page"] { color: #fff; background: var(--red-d); border-bottom-color: var(--gold); }
.nav .live a { color: #fff; }
.nav .live a::before { background: var(--gold); animation: blink 1.2s infinite; }
@media (prefers-reduced-motion: reduce) { .nav .live a::before { animation: none; } }

.cols { display: grid; grid-template-columns: 172px minmax(0, 1fr) 290px; grid-template-areas: "left main right"; gap: 18px; padding-top: 14px; padding-bottom: 36px; align-items: start; }
.col-main { grid-area: main; min-width: 0; }
.col-left { grid-area: left; }
.col-right { grid-area: right; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 1099px) {
	.cols { grid-template-columns: minmax(0, 1fr) 280px; grid-template-areas: "main right" "left left"; }
	.col-left { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
	.col-left .lnote { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
	.cols { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "right" "left"; }
}
.lbox, .rbox { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lbox + .lbox { margin-top: 12px; }
@media (max-width: 1099px) { .lbox + .lbox { margin-top: 0; } }
.lbox-h, .rbox-h { margin: 0; background: var(--ink); color: #fff; font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; padding: 9px 12px; border-left: 4px solid var(--gold); }
.rbox-h small { text-transform: none; font-weight: 500; color: #c9d3ea; letter-spacing: 0; }
.lbox ul { list-style: none; margin: 0; padding: 4px 0; }
.lbox li a { display: flex; align-items: center; justify-content: space-between; padding: 5px 12px; font-size: .9rem; text-decoration: none; color: var(--text); border-left: 3px solid transparent; }
.lbox li a:hover { background: #fff4f5; color: var(--red); }
.lbox li a[aria-current="page"] { border-left-color: var(--red); background: #fff4f5; color: var(--red); font-weight: 700; }
.lbox li.td a::after, .lnote i { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--red); flex: none; display: inline-block; }
.lnote { font-size: .78rem; color: var(--muted); margin: 8px 2px 0; }
.rbox .tools { list-style: none; margin: 0; padding: 6px 0; display: grid; grid-template-columns: 1fr; }
.rbox .tools a { display: flex; align-items: center; gap: 10px; padding: 7px 12px; text-decoration: none; font-weight: 600; font-size: .92rem; color: var(--ink); }
.rbox .tools a:hover, .rbox .tools a[aria-current="page"] { background: #fff4f5; color: var(--red); }
.rbox .tools a::before { content: ""; width: 26px; height: 26px; flex: none; border-radius: 8px; background: var(--paper) center / 16px no-repeat; border: 1px solid var(--paper-line); }
.i-cal a::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c8102e' stroke-width='2.2'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E") !important; }
.i-pair a::before, .i-freq a::before, .i-gan a::before, .i-dd a::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c8102e' stroke-width='2.4'%3E%3Cpath d='M5 20V11M12 20V4M19 20v-6'/%3E%3C/svg%3E") !important; }
.i-spin a::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c8102e' stroke-width='2.2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 3v9l6 4'/%3E%3C/svg%3E") !important; }
.i-db a::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c8102e' stroke-width='2.2'%3E%3Cpath d='M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z'/%3E%3C/svg%3E") !important; }
.i-cau a::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c8102e' stroke-width='2.2'%3E%3Cpath d='M3 17c4-8 14-8 18 0M7 17v-3M12 17v-6M17 17v-3'/%3E%3C/svg%3E") !important; }
.i-tick a::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c8102e' stroke-width='2.6'%3E%3Cpath d='M4 12l5 5L20 6'/%3E%3C/svg%3E") !important; }
.i-dream a::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c8102e' stroke-width='2.2'%3E%3Cpath d='M20 14.5A8 8 0 019.5 4 8 8 0 1020 14.5z'/%3E%3C/svg%3E") !important; }
.yday { list-style: none; margin: 0; padding: 4px 12px 10px; font-size: .9rem; }
.yday li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.yday li:last-child { border-bottom: 0; }
.yday b a { text-decoration: none; color: var(--red); }
.yday span { display: block; color: var(--muted); }
.rbox .chips { padding: 10px 12px 4px; }
.mcal { padding: 8px 10px 10px; }
.mcal-top { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.mcal-top select { flex: 1; font: 600 .88rem var(--font); padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
.mcal-top button { width: 30px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; font-size: 1.1rem; color: var(--ink); }
.mcal table { table-layout: fixed; font-size: .88rem; }
.mcal th { font-size: .72rem; color: var(--muted); padding: 4px 0; font-weight: 700; }
.mcal td { text-align: center; padding: 2px; }
.mcal td a, .mcal td span { display: block; padding: 5px 0; border-radius: 6px; text-decoration: none; font-variant-numeric: tabular-nums; }
.mcal td a { color: var(--ink); font-weight: 600; background: #f5f7fb; }
.mcal td a:hover { background: var(--red); color: #fff; }
.mcal td span { color: #b3bccc; }
.mcal td.today a { background: var(--red); color: #fff; }
.mcal td a[aria-current="page"] { outline: 2px solid var(--gold); }
.kq-tabs { display: flex; gap: 0; margin: 4px 0 14px; border-bottom: 2px solid var(--red); flex-wrap: wrap; }
.kq-tabs a { padding: 8px 16px; font-weight: 700; text-decoration: none; color: var(--ink); background: #fff; border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; margin-right: 4px; }
.kq-tabs a:hover { background: var(--red); color: #fff; border-color: var(--red); }
.kq-tabs a.is-live::after { content: "LIVE"; font-size: .62rem; background: var(--gold); color: var(--ink); border-radius: 4px; padding: 1px 4px; margin-left: 6px; vertical-align: 2px; }
.kq-region { scroll-margin-top: 56px; }
.foot-copy { margin: 10px 0 0; font-size: .8rem; color: #9fb0d6; }
.mcal td.today span { color: var(--red); font-weight: 700; }

/* ---------- v13: lịch, sổ mơ, quay thử, in ---------- */
.tag { display: inline-block; font-size: .74rem; font-weight: 700; border-radius: 5px; padding: 1px 6px; margin-left: 4px; vertical-align: 1px; }
.tag.big { background: #fff1c2; color: #7a5a00; }
.tag.off { background: #eef1f6; color: var(--muted); margin: 0; }
small.lunar { color: var(--muted); font-weight: 500; }
table.sched.up th[scope="row"] { white-space: nowrap; }
.nextdraw { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: var(--radius); padding: 8px 14px; margin: 0 0 14px; }
.nextdraw p { margin: 0; }
.nd-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--red); margin-right: 7px; animation: blink 1s infinite; }
@media (prefers-reduced-motion: reduce) { .nd-dot { animation: none; } }
.kq-list tr.grp th { background: var(--ink); color: #fff; text-align: left; font-size: .9rem; }
.somo-tools { padding: 6px 0 2px; }
.somo-wrap .kq-scroll { max-height: 640px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.somo-tools .search input { width: 100%; font: 500 1rem var(--font); padding: 10px 12px; border: 2px solid var(--red); border-radius: 10px; }
.cat-chips { margin: 8px 0 4px; }
.cat-chips button { padding: 5px 11px; background: #fff; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); font: 600 .84rem var(--font); cursor: pointer; }
.cat-chips button:hover { border-color: var(--red); color: var(--red); }
.cat-chips .on button { background: var(--ink); color: #fff; border-color: var(--ink); }
.filter-count { margin: 0; min-height: 1.2em; font-size: .85rem; }
table.somo td.cat { color: var(--muted); font-size: .84rem; }
a.sn { display: inline-block; min-width: 2.1em; text-align: center; padding: 1px 4px; margin: 1px 2px 1px 0; border-radius: 6px; background: #fff1f3; color: var(--red); font-weight: 800; text-decoration: none; font-variant-numeric: tabular-nums; }
a.sn:hover { background: var(--red); color: #fff; }
.numgrid { list-style: none; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.numgrid li { scroll-margin-top: 120px; }
.numgrid button { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 1px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 4px; cursor: pointer; font: 400 .74rem/1.3 var(--font); color: var(--muted); }
.numgrid button:hover, .numgrid li:target button { border-color: var(--red); box-shadow: 0 0 0 2px #ffd6dd; }
.numgrid b { font-size: 1.35rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.numgrid .g0 { color: var(--green); font-weight: 700; }
.numgrid .g1 { color: var(--ink); font-weight: 700; }
.numgrid .g2 { color: var(--red); font-weight: 700; }
.spin-out .kq .n.n-wait { opacity: .35; }
.spin-out .kq .n.pop { animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(1.5); color: var(--red); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .spin-out .kq .n.pop { animation: none; } }
.spin-opts { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 8px 0 0; font-size: .9rem; }
.print-head { display: none; }
@media print {
	.print-head { display: block; text-align: center; margin: 0 0 6px; font-size: 1.05em; }
	.print-head small { display: block; font-size: .8em; }
	body[data-paper="a5"] { font-size: 11px; }
	body[data-paper="80"] { font-size: 10px; }
	body[data-paper="80"] .kq-dd, body[data-paper="80"] .kq-lt, body[data-paper="80"] .page-head h1 { display: none; }
	body[data-paper="80"] .cols, body[data-paper="80"] .col-main { width: 72mm; max-width: 72mm; }
}
table.somo td:last-child { white-space: nowrap; }
@media (max-width: 560px) { table.somo td.cat, table.somo th:nth-child(2) { display: none; } .somo-wrap .kq-scroll { max-height: 520px; } .numgrid { grid-template-columns: repeat(3, 1fr); } }
