/* Thai Lottery Hub — paper & ink: trustworthy, fast, legible for every age. */
:root {
  --paper: #fbf6ec; --paper-2: #f4ecdc; --card: #fff; --ink: #14213d; --ink-2: #3d4a66; --muted: #6b7385;
  --line: #e6dccb; --red: #d7263d; --red-d: #a8172b; --red-soft: #fde8ea; --gold: #e9a520; --gold-soft: #fff4d6;
  --green: #1f7a4d; --green-soft: #e3f3ea; --blue-soft: #e7ebf5; --live: #e11d48;
  --r: 18px; --r-sm: 12px; --shadow: 0 1px 0 rgba(20,33,61,.04), 0 8px 24px -12px rgba(20,33,61,.18);
  --f: "Noto Sans Thai", "Leelawadee UI", Tahoma, system-ui, sans-serif;
  --fn: "Chakra Petch", ui-monospace, Consolas, monospace;
  --fs: 16px;
}
html.big { --fs: 21px; --muted: #3d4a66; --line: #c9bba3; }
* { box-sizing: border-box; }
html { font-size: var(--fs); -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--f); color: var(--ink); background: var(--paper); line-height: 1.6; }
a { color: var(--ink); text-decoration-color: rgba(215,38,61,.5); text-underline-offset: 3px; }
a:hover { color: var(--red); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 800; }
h3, .h3 { font-size: 1.12rem; font-weight: 800; }
p { margin: 0 0 .8em; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .86em; background: var(--paper-2); padding: .1em .35em; border-radius: 6px; word-break: break-all; }
.hash { font-size: .72rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.sm { font-size: .86rem; }
.b { font-weight: 800; }
.red { color: var(--red); }
.ok { color: var(--green); font-weight: 600; }
.bad { color: var(--red); font-weight: 600; }
.na { color: var(--muted); font-size: .9rem; }
.mono, .num { font-family: var(--fn); font-weight: 700; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; z-index: 99; background: #fff; padding: 8px 12px; border-radius: 8px; }
.lead { font-size: 1.08rem; color: var(--ink-2); max-width: 70ch; }
.eyebrow { font-size: .82rem; font-weight: 800; letter-spacing: .06em; color: var(--red); text-transform: uppercase; margin-bottom: .3em; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.two { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- header ---------- */
.site-head { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 20; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 6px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand b { font-size: 1.3rem; font-weight: 800; display: block; line-height: 1.1; }
.brand small { color: #aab4cc; font-size: .72rem; }
.logo { width: 40px; height: 40px; --paper: var(--ink); }
.big-toggle { display: inline-flex; align-items: baseline; gap: 2px; background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 6px 14px; cursor: pointer; font: inherit; }
.big-toggle span { font-weight: 800; font-size: .9rem; }
.big-toggle .plus { font-size: 1.3rem; }
.big-toggle em { font-style: normal; font-size: .8rem; margin-left: 6px; }
.big-toggle[aria-pressed="true"] { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.nav { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.nav a { color: #d6dcea; text-decoration: none; padding: 6px 12px; border-radius: 999px; white-space: nowrap; font-size: .92rem; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a[aria-current] { background: #fff; color: var(--ink); font-weight: 800; }
.crumbs { font-size: .82rem; color: var(--muted); padding-top: 12px; display: flex; flex-wrap: wrap; gap: 4px; }
.crumbs i { font-style: normal; opacity: .5; padding: 0 2px; }
main { padding-bottom: 48px; }

/* ---------- demo bar ---------- */
.demo-bar { background: repeating-linear-gradient(135deg, #fff4d6 0 12px, #ffeab0 12px 24px); border-bottom: 2px dashed var(--gold); font-size: .86rem; }
.demo-bar .wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 8px; padding-bottom: 8px; }
.demo-tag { background: var(--ink); color: #fff; font-weight: 800; padding: 2px 10px; border-radius: 999px; }
.demo-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.demo-btns button { font: inherit; border: 1px solid var(--ink); background: #fff; border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.demo-btns button[aria-checked="true"] { background: var(--ink); color: #fff; }
.shop-banner { background: var(--green); color: #fff; padding: 10px 0; font-size: 1.02rem; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; font-size: .95rem; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 9px 16px; cursor: pointer; text-decoration: none; min-height: 44px; transition: transform .08s, background .15s, border-color .15s; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-d); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); }
.btn.sm { padding: 4px 12px; min-height: 34px; font-size: .85rem; }
.btn.lg { padding: 14px 22px; font-size: 1.08rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.on { background: var(--live); color: #fff; border-color: var(--live); animation: pulse 1.2s infinite; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; min-height: 44px; max-width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(233,165,32,.35); }
textarea { width: 100%; resize: vertical; }
label.inline { display: inline-flex; gap: 8px; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); margin: 0 0 20px; }

/* ---------- badges ---------- */
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 14px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 600; border-radius: 999px; padding: 3px 10px; border: 1px solid transparent; }
.badge.sm { font-size: .72rem; padding: 1px 8px; }
.badge.ok { background: var(--green-soft); color: var(--green); border-color: #b9dfc9; }
.badge.full { background: var(--blue-soft); color: var(--ink); }
.badge.legacy { background: var(--gold-soft); color: #8a5a00; }
.badge.wait { background: var(--paper-2); color: var(--ink-2); }
.badge.live { background: #fff7d6; color: #8a5a00; border-color: #f3d27a; }
.badge.demo { background: var(--ink); color: #fff; }

/* ---------- home ---------- */
.home { padding-top: 20px; }
.home-grid { display: grid; gap: 24px; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .home-grid { grid-template-columns: 1fr; } }
body[data-mode="post"] .home-check, body[data-mode="live"] .home-check { order: -1; }
@media (min-width: 901px) { body[data-mode="post"] .home-check, body[data-mode="live"] .home-check { order: 0; } }
.mode-hero h1 { margin-bottom: .2em; }
.hero-result { background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 16px; }
.hr-first { text-align: center; padding: 18px 12px 14px; background: radial-gradient(120% 90% at 50% 0%, var(--red-soft), #fff 70%); border-bottom: 1px dashed var(--line); }
.hr-first .lbl, .hr-row .lbl { display: block; font-size: .86rem; color: var(--muted); font-weight: 600; }
.num.xl { display: block; font-size: clamp(3rem, 11vw, 4.6rem); line-height: 1.05; color: var(--red); letter-spacing: .1em; }
.near { display: block; font-size: .86rem; color: var(--muted); margin-top: 4px; }
.near .num { color: var(--ink-2); margin: 0 4px; font-size: 1rem; }
.hr-row { display: grid; grid-template-columns: 1fr 1fr 1fr; text-align: center; }
.hr-row > div { padding: 12px 6px 14px; }
.hr-row > div + div { border-left: 1px dashed var(--line); }
.hr-row .nums { display: flex; flex-direction: column; align-items: center; }
.hr-row .num { font-size: 1.7rem; line-height: 1.2; }
.hr-last2 { background: var(--red); color: #fff; }
.hr-last2 .lbl { color: #ffd9de !important; }
.hr-last2 .num { font-size: 3rem; line-height: 1.1; }
.fact { background: var(--gold-soft); border-color: #f2d891; }
.fact-line { background: var(--gold-soft); border-radius: var(--r-sm); padding: 10px 14px; }
.num-link { font-family: var(--fn); font-weight: 700; background: var(--ink); color: #fff; text-decoration: none; border-radius: 8px; padding: 0 8px; letter-spacing: .04em; }
.num-link:hover { background: var(--red); color: #fff; }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0 6px; }
.countdown div { background: var(--ink); color: #fff; border-radius: var(--r-sm); text-align: center; padding: 12px 4px; }
.countdown b { display: block; font-family: var(--fn); font-size: clamp(2rem, 7vw, 3rem); line-height: 1; }
.countdown span { font-size: .8rem; color: #aab4cc; }
.countdown.big b { font-size: clamp(2.4rem, 9vw, 4rem); }
.cd-done { grid-column: 1 / -1; font-weight: 800; color: var(--live); font-size: 1.3rem; }
.deposit label { display: block; font-weight: 600; margin-bottom: 8px; }
.deposit input[name=num] { font-family: var(--fn); font-size: 1.4rem; letter-spacing: .2em; width: 10ch; }
.qty-mini { width: 4.5ch; text-align: center; }
.saved-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.saved-list li { background: var(--paper-2); border-radius: 8px; padding: 2px 10px; }
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 28px 0; }
.tile { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px; text-decoration: none; box-shadow: var(--shadow); }
.tile b { display: block; font-size: 1.05rem; }
.tile span { color: var(--muted); font-size: .86rem; }
.tile.hot { background: var(--ink); color: #fff; border-color: var(--ink); }
.tile.hot span { color: #c9d1e4; }
.how ol { margin: 0; padding-left: 1.3em; }
.how li { margin: 4px 0; }

/* LIVE */
.live-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--live); margin-right: 4px; animation: pulse 1.2s infinite; vertical-align: middle; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(225,29,72,.6); } 70% { box-shadow: 0 0 0 10px rgba(225,29,72,0); } 100% { box-shadow: 0 0 0 0 rgba(225,29,72,0); } }
.live-status { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.live-clock { font-size: .9rem; }
.live-clock b { font-family: var(--fn); }
.live-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.lv { background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; transition: background .3s; }
.lv .lbl { font-size: .8rem; color: var(--muted); font-weight: 600; }
.lv .nums { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.lv.on { animation: pop .5s ease-out; border-color: var(--red); }
.lv.on.big .num { font-size: 1.6rem; color: var(--red); }
.lv[data-cat="first"] { grid-column: 1 / -1; text-align: center; }
.lv[data-cat="first"] .nums { justify-content: center; }
.lv[data-cat="first"].on .num { font-size: 3rem; }
.lv.many .nums { max-height: 7.5em; overflow: auto; font-size: .82rem; }
.lv.many .num { font-size: .9rem; }
.pulse { animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .35; } }
@keyframes pop { from { transform: scale(.96); background: var(--gold-soft); } to { transform: none; } }
.warn-note { background: #fff7d6; border-left: 4px solid var(--gold); padding: 10px 14px; border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: .9rem; margin-top: 12px; }

/* ---------- checker ---------- */
.checker { position: relative; border-width: 2px; border-color: var(--ink); --filled: 0; }
.chk-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.chk-head h2 { margin: 0; }
.draw-pick { display: inline-flex; gap: 6px; align-items: center; font-size: .9rem; }
.draw-pick select { max-width: 13em; }
.chk-input-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.six { position: relative; flex: 1 1 260px; }
.six input { width: 100%; font-family: var(--fn); font-size: clamp(2rem, 8vw, 2.6rem); font-weight: 700; letter-spacing: .5em; padding: 10px 0 10px .5em; height: 72px; border-width: 2px; border-color: var(--ink); background: transparent; position: relative; z-index: 1; text-indent: .15em; }
.six input::placeholder { font-family: var(--f); font-size: 1rem; letter-spacing: 0; font-weight: 400; color: var(--muted); }
.six-cells { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; pointer-events: none; border-radius: var(--r-sm); overflow: hidden; }
.six-cells i { border-right: 1px dashed var(--line); }
.six-cells i:last-child { border: 0; }
.qty { display: flex; align-items: center; gap: 4px; }
.qty button { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; font-size: 1.3rem; cursor: pointer; }
.qty input { width: 3.6em; text-align: center; font-weight: 700; }
.hint { font-size: .82rem; color: var(--muted); margin: 6px 0 10px; }
.chk-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.paste { margin-top: 12px; }
.paste label { font-size: .88rem; display: block; margin-bottom: 6px; }
.mic-status { margin-top: 10px; background: var(--blue-soft); border-radius: var(--r-sm); padding: 8px 12px; font-size: .92rem; }
.ttype { display: inline-flex; margin: 14px 0 4px; border: 1.5px solid var(--ink); border-radius: 999px; overflow: hidden; flex-wrap: wrap; }
.ttype button { font: inherit; font-size: .88rem; border: 0; background: #fff; padding: 7px 14px; cursor: pointer; min-height: 40px; }
.ttype button[aria-checked="true"] { background: var(--ink); color: #fff; font-weight: 700; }
.chk-out { margin-top: 12px; }
.chk-empty { background: var(--paper); border-radius: var(--r-sm); padding: 14px; text-align: center; color: var(--ink-2); }
.checker.compact .six input { height: 62px; }

.summary { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 14px; }
.summary.win { background: linear-gradient(160deg, #fff4d6, #fde8ea); border-color: #f0c36b; }
.s-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; font-size: .95rem; }
.s-money { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 12px 0 6px; }
.s-type { background: #fff; border-radius: var(--r-sm); padding: 10px 12px; display: flex; flex-direction: column; }
.s-type small { color: var(--muted); font-weight: 600; }
.s-type b { font-family: var(--fn); font-size: clamp(1.3rem, 3.2vw, 1.6rem); color: var(--red); line-height: 1.2; white-space: nowrap; }
.s-type span { font-size: .82rem; }
.s-warn { background: #fff7d6; border-radius: 8px; padding: 8px 10px; font-weight: 600; font-size: .9rem; margin: 8px 0 0; }
.s-note { font-size: .86rem; color: var(--ink-2); margin: 8px 0 0; }
.s-fine { font-size: .74rem; color: var(--muted); margin: 8px 0 0; }
.s-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.s-actions .btn { font-size: .85rem; min-height: 38px; padding: 6px 12px; }
.tickets { display: grid; gap: 12px; }

/* ticket mockup */
.ticket { position: relative; border-radius: 16px; overflow: hidden; border: 1.5px solid #e9c9cf; background:
  repeating-radial-gradient(circle at 0 0, rgba(215,38,61,.035) 0 2px, transparent 2px 9px),
  linear-gradient(135deg, #fff5f6, #fffaf0 60%, #f3f7ff); padding: 0 14px 12px; }
.ticket::before, .ticket::after { content: ""; position: absolute; top: 46px; width: 18px; height: 18px; border-radius: 50%; background: var(--card); border: 1.5px solid #e9c9cf; }
.ticket::before { left: -10px; } .ticket::after { right: -10px; }
.ticket header { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .76rem; font-weight: 600; color: var(--red-d); padding: 8px 0 6px; border-bottom: 1px dashed #e9c9cf; }
.t-x { border: 0; background: transparent; cursor: pointer; font-size: 1rem; color: var(--muted); padding: 2px 6px; }
.t-body { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0 2px; }
.t-num { display: flex; gap: 4px; }
.t-num b { font-family: var(--fn); font-size: clamp(1.8rem, 7vw, 2.3rem); width: 1.15em; text-align: center; background: #fff; border: 1px solid #ecdcdc; border-radius: 8px; color: var(--ink); line-height: 1.35; }
.t-num b.hit { background: var(--red); border-color: var(--red); color: #fff; }
.t-qty { font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.t-res { font-weight: 800; margin: 6px 0 4px; }
.ticket.win { border-color: var(--red); box-shadow: 0 0 0 3px rgba(215,38,61,.12); }
.ticket.win .t-res { color: var(--red); font-size: 1.12rem; }
.ticket.lose { filter: saturate(.4); }
.ticket.lose .t-res { color: var(--ink-2); font-weight: 600; }
.ticket.wait .t-res { color: #8a5a00; }
.ticket.hist .t-res { color: #8a5a00; }
.t-stamps { list-style: none; padding: 0; margin: 4px 0 8px; display: grid; gap: 4px; }
.t-stamps li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .9rem; }
.stamp { display: inline-block; border: 2px solid var(--red); color: var(--red); font-weight: 800; border-radius: 6px; padding: 0 8px; transform: rotate(-2deg); background: rgba(255,255,255,.7); }
.money { width: 100%; border-collapse: collapse; font-size: .88rem; background: rgba(255,255,255,.8); border-radius: 10px; overflow: hidden; }
.money th, .money td { padding: 5px 8px; text-align: right; border-bottom: 1px solid #f0e4e4; }
.money th:first-child, .money td:first-child { text-align: left; color: var(--muted); }
.money .neg { color: var(--ink-2); }
.money .net td { font-weight: 800; font-size: 1rem; color: var(--red); }
.money .claim td { font-size: .8rem; }
.t-note { font-size: .8rem; color: var(--ink-2); margin: 8px 0 0; }
.t-note.warn { color: #8a5a00; font-weight: 600; }

/* ---------- draw page ---------- */
.draw-page { padding-top: 12px; }
.draw-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; margin-bottom: 20px; }
@media (max-width: 900px) { .draw-grid { grid-template-columns: 1fr; } }
.board-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 8px; }
.board-head h2 { margin: 0; }
.board-search input { width: 17em; font-family: var(--fn); }
.prize-block { border-top: 1px dashed var(--line); padding: 14px 0; }
.prize-block header { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; margin-bottom: 8px; }
.prize-block h3 { margin: 0; }
.prize-block header .btn { margin-left: auto; }
.grid-nums { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.6em, 1fr)); gap: 6px; }
.grid-nums.dense { grid-template-columns: repeat(auto-fill, minmax(5.2em, 1fr)); }
.cell { font-family: var(--fn); font-weight: 700; text-align: center; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 4px 0; letter-spacing: .05em; font-size: 1.05rem; }
#p-first .cell { font-size: 2rem; color: var(--red); background: var(--red-soft); grid-column: span 2; }
#p-last2 .cell, #p-front3 .cell, #p-last3 .cell { font-size: 1.6rem; }
.cell.found { background: var(--gold); border-color: var(--gold); color: var(--ink); box-shadow: 0 0 0 3px rgba(233,165,32,.35); }
.board-actions { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px dashed var(--line); padding-top: 14px; }
.evidence summary { cursor: pointer; font-weight: 800; }
.evidence dl { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 6px 14px; margin: 14px 0; font-size: .88rem; }
.evidence dt { color: var(--muted); }
.evidence dd { margin: 0; word-break: break-all; }
@media (max-width: 600px) { .evidence dl { grid-template-columns: 1fr; } .evidence dd { margin-bottom: 6px; } }
.pager { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.pager a { font-weight: 600; }
.next-card { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; text-decoration: none; border-color: var(--ink); }
.next-card b { font-size: 1.1rem; }
.year-jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 20px; }
.year-jump a { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 2px 12px; text-decoration: none; font-size: .88rem; }
.year-sec { margin-bottom: 28px; scroll-margin-top: 120px; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; background: #fff; }
.tbl th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--line); padding: 6px 8px; }
.tbl td { border-bottom: 1px solid var(--line); padding: 6px 8px; vertical-align: top; }
.tbl tr.hit td { background: var(--red-soft); }
.draws-tbl td.mono { white-space: nowrap; }
@media (max-width: 640px) { .draws-tbl { font-size: .82rem; } .draws-tbl th, .draws-tbl td { padding: 5px 4px; } }
.card .tbl { margin-bottom: 8px; }
.files td { vertical-align: middle; }

/* ---------- stats ---------- */
.disclaimer { background: var(--blue-soft); border-left: 4px solid var(--ink); border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: 12px 16px; font-size: .9rem; margin: 0 0 20px; }
.heatmap { margin: 0; }
.hm-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; max-width: 620px; }
.hm-cell { aspect-ratio: 1; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; color: var(--ink); background: color-mix(in srgb, var(--red) calc(var(--t) * 88%), #f6efe2); line-height: 1.05; transition: transform .1s; }
.hm-cell[data-level="0"] { background: #fff; border: 1px dashed var(--line); }
.hm-cell[data-level="3"], .hm-cell[data-level="4"] { color: #fff; }
.hm-cell b { font-family: var(--fn); font-size: clamp(.8rem, 2.6vw, 1.15rem); }
.hm-cell small { font-size: .62rem; opacity: .8; }
.hm-cell:hover { transform: scale(1.12); outline: 2px solid var(--ink); z-index: 1; color: inherit; }
.heatmap figcaption { font-size: .82rem; color: var(--muted); margin-top: 10px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; max-width: 620px; }
.hm-legend { display: inline-flex; align-items: center; gap: 3px; }
.hm-legend i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.hm-legend i[data-level="0"] { background: #fff; border: 1px dashed var(--line); }
.hm-legend i[data-level="1"] { background: color-mix(in srgb, var(--red) 22%, #f6efe2); }
.hm-legend i[data-level="2"] { background: color-mix(in srgb, var(--red) 44%, #f6efe2); }
.hm-legend i[data-level="3"] { background: color-mix(in srgb, var(--red) 66%, #f6efe2); }
.hm-legend i[data-level="4"] { background: color-mix(in srgb, var(--red) 88%, #f6efe2); }
.gf { background: #fff7d6; border-radius: var(--r-sm); padding: 12px 14px; }
.dry-list { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 6px; }
.dry-list li { display: grid; grid-template-columns: 3.2em 1fr minmax(9em, 15em); gap: 10px; align-items: center; font-size: .88rem; }
.dry-list .bar { background: var(--paper-2); border-radius: 999px; height: 12px; overflow: hidden; }
.dry-list .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--ink-2), var(--ink)); border-radius: 999px; }
@media (max-width: 600px) { .dry-list li { grid-template-columns: 3em 1fr; } .dry-val { grid-column: 2; } }
.freq h3 { margin-bottom: 2px; }
.ev { background: var(--gold-soft); border-radius: var(--r-sm); padding: 12px 14px; margin-top: 12px; }
.month-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.month-chips span { background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: .86rem; }

/* number page */
.number-page { padding-top: 12px; }
.num-head { display: flex; gap: 20px; align-items: center; margin-bottom: 16px; }
.big-num { font-family: var(--fn); font-weight: 700; font-size: clamp(4rem, 16vw, 7rem); line-height: 1; background: var(--red); color: #fff; border-radius: 24px; padding: 8px 22px; box-shadow: var(--shadow); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; text-align: center; }
.kpi b { display: block; font-family: var(--fn); font-size: 1.7rem; line-height: 1.2; }
.kpi span { font-size: .8rem; color: var(--muted); }
.compare { background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 14px; }
.timeline { width: 100%; height: 64px; display: block; }
.timeline .bg { fill: var(--paper-2); }
.timeline .hit { fill: var(--red); }
.timeline .ym { stroke: var(--muted); stroke-width: .6; }
.timeline text { font-size: 8px; fill: var(--muted); font-family: var(--fn); }
.num-nav { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; margin-top: 20px; }
.num-mini { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; font-family: var(--fn); font-size: .78rem; text-align: center; }
.num-mini a { text-decoration: none; padding: 2px 0; border-radius: 4px; }
.num-mini a:hover { background: var(--paper-2); }
.num-mini a[aria-current] { background: var(--red); color: #fff; }

/* ---------- tools ---------- */
.tool-head { padding: 16px 0 6px; }
.vk-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); align-items: start; }
@media (max-width: 900px) { .vk-grid { grid-template-columns: 1fr; } }
.vk-form label, .saved-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .92rem; margin-bottom: 12px; }
.themes { border: 0; padding: 0; display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.themes legend { font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
.themes label { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; margin: 0; cursor: pointer; }
.themes i { width: 22px; height: 22px; border-radius: 50%; background: var(--c); display: inline-block; }
.vk-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.vk-kinds button { font: inherit; font-size: .88rem; border: 1.5px solid var(--ink); background: #fff; border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.vk-kinds button[aria-checked="true"] { background: var(--ink); color: #fff; }
.vk-preview { background: var(--paper-2); border-radius: var(--r-sm); padding: 12px; margin-bottom: 12px; text-align: center; min-height: 120px; display: grid; place-items: center; gap: 10px; }
.vk-preview img { max-width: 100%; max-height: 520px; box-shadow: var(--shadow); border-radius: 6px; background: #fff; }
.vk-bulk { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(220px, .5fr); }
.vk-bulk > div { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
@media (max-width: 700px) { .vk-bulk { grid-template-columns: 1fr; } }
.saved-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }
.saved-form .wide { grid-column: 1 / -1; }
.saved-group header { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.ledger { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.ledger-year { background: var(--paper); border-radius: var(--r-sm); padding: 12px; display: flex; flex-direction: column; gap: 2px; font-size: .92rem; }
.ledger-year b { font-size: 1.1rem; }
textarea.code, pre.code { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; background: var(--ink); color: #e6ebf5; border-radius: var(--r-sm); padding: 12px; overflow: auto; }
.notes { padding-left: 1.2em; font-size: .92rem; }
.notes li { margin: 4px 0; }
.nf { padding: 60px 16px; }
.nf .big-num { display: inline-block; margin-bottom: 16px; }

/* dialog + toast */
.png-dialog { border: 0; border-radius: var(--r); padding: 16px; width: min(560px, 94vw); max-height: 94vh; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.png-dialog::backdrop { background: rgba(20,33,61,.6); }
.pd-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.pd-controls { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; font-size: .88rem; }
.pd-img { background: var(--paper-2); border-radius: var(--r-sm); padding: 8px; text-align: center; min-height: 200px; display: grid; place-items: center; }
.pd-img img { max-width: 100%; max-height: 60vh; border-radius: 6px; }
.pd-actions { margin: 10px 0 4px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 120px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; transition: transform .25s; z-index: 50; }
.toast.show { transform: translate(-50%, 0); }

/* ---------- footer ---------- */
.site-foot { background: var(--ink); color: #c9d1e4; padding: 32px 0; font-size: .86rem; }
.site-foot a { color: #fff; }
.site-foot .muted { color: #97a2bd; }
.site-foot code { background: rgba(255,255,255,.1); color: #fff; }
.foot-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.foot-brand { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; color: #fff; }
.foot-links { display: flex; flex-direction: column; gap: 6px; }

/* ---------- elderly big mode extras ---------- */
html.big .btn { min-height: 54px; font-size: 1rem; }
html.big .six input { height: 88px; font-size: 3rem; }
html.big .t-num b { font-size: 2.6rem; }
html.big .tbl { font-size: 1rem; }
html.big .nav a { font-size: 1rem; }
html.big .hm-cell small { font-size: .7rem; }
html.big body { line-height: 1.7; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print { .site-head, .site-foot, .demo-bar, .chk-tools, .s-actions { display: none; } }

/* ---------- articles ---------- */
.articles-page, .article-page { padding: 20px 16px 48px; }
.a-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 14px; }
.a-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; box-shadow: var(--shadow); }
.a-card:not(:has(.a-thumb)) { grid-template-columns: 1fr; }
.a-card h2, .a-card h3 { margin: 0 0 .3em; }
.a-card h2 a, .a-card h3 a { text-decoration: none; }
.a-card p { margin: 0 0 .35em; }
.a-thumb img { width: 168px; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--r-sm); display: block; }
.a-list.compact .a-card { padding: 12px 14px; box-shadow: none; }
.article { max-width: 760px; margin: 0 auto; }
.a-head h1 { margin-bottom: .35em; }
.a-head .lead { margin-bottom: .5em; }
.byline { margin: 0 0 1.2em; }
.a-cover { margin: 0 0 1.4em; }
.a-cover img { width: 100%; height: auto; border-radius: var(--r); display: block; }
.prose { font-size: 1.06rem; line-height: 1.85; }
.prose h2 { margin: 1.6em 0 .55em; }
.prose h3, .prose h4 { margin: 1.3em 0 .45em; }
.prose p, .prose ul, .prose ol { margin: 0 0 1em; }
.prose li { margin: .25em 0; }
.prose img { max-width: 100%; height: auto; border-radius: var(--r-sm); }
.prose blockquote { margin: 1.2em 0; padding: .6em 1em; border-left: 4px solid var(--gold); background: var(--gold-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.prose blockquote p:last-child { margin: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.prose pre { overflow-x: auto; background: var(--paper-2); padding: 12px; border-radius: var(--r-sm); }
.prose .card { margin: 1.2em 0; }
.sc-table { overflow-x: auto; margin: 1.2em 0; }
.sc-table .tbl { width: 100%; }
.sc-num { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; }
.sc-num .big-num { text-decoration: none; }
.sc-more, .sc-cta { margin: .8em 0 0; }
.a-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 1.4em 0; }
.a-tags span { background: var(--blue-soft); border-radius: 999px; padding: .15em .7em; font-size: .86rem; }
.related { max-width: 760px; margin: 32px auto 0; }
.latest-articles { margin-top: 28px; }
.latest-articles .row { justify-content: space-between; }
.ad-slot { margin: 1.6em 0; min-height: 120px; text-align: center; }
.ad-label { display: block; font-size: .72rem; color: var(--muted); letter-spacing: .08em; margin-bottom: 4px; }
@media (max-width: 560px) {
  .a-card { grid-template-columns: 1fr; }
  .a-thumb img { width: 100%; }
  .sc-num { grid-template-columns: 1fr; }
}
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.cat-chips a { background: var(--card); border: 1.5px solid var(--line); border-radius: 999px; padding: 4px 14px; font-size: .9rem; font-weight: 600; text-decoration: none; }
.cat-chips a[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; }
