/* ລາວເຊົ້າ: the Lao results-portal standard, played straight (white page, gold-framed result, navy and red chrome) */
:root {
  --navy: #0b2149;
  --navy-2: #13306a;
  --red: #c8102e;
  --gold: #b8860b;
  --gold-2: #d4a017;
  --gold-soft: #fbf3dc;
  --page: #eef0f4;
  --white: #ffffff;
  --text: #16181d;
  --muted: #545c6b;
  --line: #d3d8e0;
  --line-2: #e6e9ee;
  --void-bg: #fdecee;
  --ok: #1f7a3a;

  --f-lao: "Noto Sans Lao", "Phetsarath OT", "Saysettha OT", sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --wrap: 1000px;
  --gutter: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--f-lao);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--page);
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
::selection { background: var(--gold-2); color: var(--white); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
a { color: inherit; text-underline-offset: 0.2em; }
img { display: block; max-width: 100%; }
button { font: inherit; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--navy); color: var(--white); padding: 8px 14px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---------- top strip + masthead ---------- */
.topbar { background: var(--navy); color: #c9d3e8; font-size: 13px; }
.topbar__inner { max-width: var(--wrap); margin: 0 auto; padding: 4px var(--gutter); display: flex; justify-content: flex-end; gap: 12px; }
#clock-time { color: var(--white); font-weight: 700; font-variant-numeric: tabular-nums; }

.masthead { background: var(--white); border-bottom: 4px solid var(--red); }
.masthead__inner {
  position: relative; overflow: hidden;
  max-width: var(--wrap); margin: 0 auto;
  min-height: 132px;
  display: flex; align-items: center;
  padding: 12px var(--gutter);
}
.masthead__photo {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 52%; height: 100%; object-fit: cover; object-position: 50% 62%;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 34%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 34%);
}
.brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--navy); }
.brand__mark { width: 104px; height: 104px; flex: none; filter: drop-shadow(0 3px 5px rgba(11, 33, 73, 0.3)); }
.brand__text { display: flex; flex-direction: column; }
.brand__name { display: flex; align-items: center; gap: 0.18em; font-size: 50px; white-space: nowrap; }
/* wordmark: gradient fill over a white inner rule and a navy outer rule (both painted from data-text behind the fill) */
.wm { position: relative; isolation: isolate; display: inline-block; line-height: 1.3; font-family: "Noto Serif Lao", var(--f-lao); font-weight: 900; }
.wm::before, .wm::after { content: attr(data-text); position: absolute; left: 0; top: 0; z-index: -1; }
.wm::before { color: var(--navy); -webkit-text-stroke: 0.16em var(--navy); text-shadow: 0 0.07em 0.1em rgba(11, 33, 73, 0.35); }
.wm::after { color: var(--white); -webkit-text-stroke: 0.08em var(--white); }
.wm__fill { background: linear-gradient(180deg, #ff5a6b 0%, #e01834 42%, #a70b22 78%, #7a0617 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wm--vip { font-family: "Montserrat", var(--f-lao); font-weight: 800; font-size: 0.68em; line-height: 1.2; letter-spacing: 0.02em; transform: skewX(-8deg); }
.wm--vip::before { -webkit-text-stroke-width: 0.2em; }
.wm--vip .wm__fill { background-image: linear-gradient(180deg, #5b8cf0 0%, #1f4fc4 45%, #0a2a86 80%, #061a55 100%); }
.brand__latin { font-family: "Montserrat", var(--f-lao); font-size: 15px; font-weight: 800; color: var(--navy); letter-spacing: 0.04em; }

.nav { background: var(--navy); }
.nav__inner { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); display: flex; overflow-x: auto; scrollbar-width: none; }
.nav__inner::-webkit-scrollbar { display: none; }
.nav a {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 16px; color: #dbe3f3; text-decoration: none; font-weight: 600; font-size: 15px;
  border-bottom: 3px solid transparent;
  transition: background-color 150ms ease, color 150ms ease;
}
.nav a[aria-current="page"] { color: var(--white); background: var(--navy-2); border-bottom-color: var(--gold-2); }
@media (hover: hover) { .nav a:hover { color: var(--white); background: var(--navy-2); } }
.nav__dot { width: 8px; height: 8px; border-radius: 50%; background: #8fa0c3; }
.nav__dot.is-live { background: #ff3b3b; box-shadow: 0 0 0 0 rgba(255, 59, 59, 0.6); animation: pulse 1.6s var(--ease-out) infinite; }
@keyframes pulse { to { box-shadow: 0 0 0 8px rgba(255, 59, 59, 0); } }

/* ---------- layout ---------- */
main { flex: 1; width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 12px var(--gutter) 32px; outline: none; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 860px) { .grid { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; } }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; }
.h2 { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.4; }

/* ---------- result box ---------- */
.shrine {
  position: relative;
  background: var(--white);
  border: 3px solid var(--gold);
  padding: 18px clamp(12px, 3vw, 22px) 18px;
  text-align: center;
}
.shrine__head { display: grid; gap: 0; }
.shrine__round { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.5; color: var(--text); }
.shrine__id { font-size: 13px; color: var(--muted); }

.reels {
  --digit: clamp(54px, 17vw, 76px);
  display: flex; justify-content: center; gap: clamp(4px, 2vw, 16px);
  margin: 6px auto 0; position: relative;
}
.reel { position: relative; width: calc(var(--digit) * 0.68); height: calc(var(--digit) * 1.12); overflow: hidden; border-radius: 6px; transition: background-color 300ms var(--ease-out); }
.reel.is-spinning, .reel.is-idle, .reel.is-settling { background: #f4f6f9; }
.reel__strip {
  display: flex; flex-direction: column; align-items: center;
  font-family: var(--f-lao); font-weight: 800; font-size: var(--digit); line-height: 1.12;
  color: var(--text); font-variant-numeric: tabular-nums;
  will-change: transform;
}
.reel__strip span { height: 1.12em; display: block; }
.reel.is-idle .reel__strip { color: #b7bfcc; }
.reel.is-spinning .reel__strip { animation: spin var(--spin, 520ms) linear infinite; filter: blur(0.7px); color: var(--red); }
@keyframes spin { from { transform: translateY(calc(var(--digit) * -1.12)); } to { transform: translateY(calc(var(--digit) * -12.32)); } }
.reels.is-revealed .reel__strip { animation: land 700ms var(--ease-out) 1; }
@keyframes land { 0% { color: var(--red); } 100% { color: var(--text); } }
.reel.is-landed .reel__strip { animation: land 700ms var(--ease-out) 1; }
.reels[hidden] { display: none; }

/* reveal machine (reveal.css) inside the result box */
.shrine .machine { margin: 10px auto 0; max-width: 520px; }
.shrine .machine--slot { width: fit-content; max-width: 100%; }
.shrine.is-stage .machine--drum { max-width: 560px; }
.shrine.is-stage .machine--drum:not([hidden]) + .reels { --digit: clamp(64px, 14vw, 104px); }
.shrine.is-stage .cab { --cell: clamp(60px, 16vw, 132px); }

.shrine__time { margin: 2px 0 0; font-size: 17px; font-weight: 600; }

.split { width: 100%; max-width: 440px; margin: 14px auto 0; border-collapse: collapse; font-size: 16px; }
.split th, .split td { border: 1px solid var(--line); padding: 7px 10px; width: 50%; }
.split th { font-weight: 500; background: #fafbfc; }
.split td { font-weight: 700; font-size: 18px; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }
.split tr.is-key td { color: var(--red); }

.status { margin: 12px auto 0; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; font-size: 15px; }
.status__label { font-weight: 600; }
.status__count { font-weight: 800; font-size: 22px; color: var(--navy); font-variant-numeric: tabular-nums; }
.status__pill { display: inline-flex; align-items: center; gap: 7px; padding: 2px 12px 3px; border-radius: 999px; background: var(--gold-soft); color: #7a5a00; font-size: 14px; font-weight: 700; border: 1px solid #ecd9a3; }
.status__pill.is-live { background: var(--red); color: var(--white); border-color: var(--red); }
.status__pill.is-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--white); animation: blink 1s steps(2, start) infinite; }
.status__pill.is-done { background: #e8f5ec; color: var(--ok); border-color: #bfe3c9; }
@keyframes blink { to { visibility: hidden; } }

.voids { margin: 14px auto 0; max-width: 440px; display: grid; gap: 8px; text-align: left; }
.void { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; padding: 8px 12px; background: var(--void-bg); border: 1px solid #f3c2c8; border-radius: 4px; }
.void__num { position: relative; font-weight: 800; font-size: 24px; letter-spacing: 0.06em; color: #8f97a3; text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.void__text { font-size: 13.5px; line-height: 1.55; color: var(--text); }
.void__text strong { color: var(--red); }
.stamp { display: inline-block; border: 1.5px solid var(--red); color: var(--red); border-radius: 3px; padding: 0 6px; font-weight: 700; font-size: 12.5px; line-height: 1.55; transform: rotate(-3deg); background: var(--white); }

.proof { margin: 14px auto 0; max-width: 520px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; justify-items: center; }
.proof__row { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--muted); max-width: 100%; }
.hash { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--muted); background: #f4f6f9; border: 1px solid var(--line-2); padding: 1px 6px; border-radius: 3px; max-width: min(100%, 300px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proof__help { margin: 0; font-size: 12.5px; color: var(--muted); max-width: 52ch; line-height: 1.55; }
.btn-line { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 2px 10px; background: var(--white); color: var(--navy); border: 1px solid var(--line); border-radius: 4px; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; transition: background-color 150ms ease, transform 120ms ease; }
.btn-line svg { width: 14px; height: 14px; }
@media (hover: hover) { .btn-line:hover { background: #f4f6f9; } }
.btn-line:active { transform: scale(0.97); }

.next { background: var(--white); border: 1px solid var(--line); border-top: 3px solid var(--navy); padding: 12px 14px; display: grid; gap: 2px; }
.next p { margin: 0; }
.next__meta { font-size: 13.5px; color: var(--muted); }
.next-slot--inline { display: none; }
@media (max-width: 859px) { .next-slot--inline { display: block; } .next-slot--side { display: none; } }
.next__when { font-size: 20px; font-weight: 700; color: var(--navy); }

.live-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.live-head__tools { display: flex; gap: 8px; }
.shrine.is-stage { padding-block: 28px; }
.shrine.is-stage .reels { --digit: clamp(64px, 16vw, 132px); }
.recent { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.recent__item { flex: none; background: var(--white); border: 1px solid var(--line); padding: 6px 14px; text-align: center; min-width: 116px; }
.recent__date { font-size: 13px; color: var(--muted); }
.recent__num { font-weight: 800; font-size: 22px; letter-spacing: 0.06em; color: var(--text); }

/* ---------- history table ---------- */
.paper { background: var(--white); border: 1px solid var(--line); }
.ledger__head { display: flex; align-items: center; justify-content: center; position: relative; gap: 12px; padding: 7px 12px; background: #9a6c06; color: var(--white); }
.ledger__head .h2 { font-size: 18px; color: var(--white); font-weight: 600; }
.ledger__head a { position: absolute; right: 12px; font-size: 13.5px; color: var(--white); font-weight: 600; }
.table-wrap { overflow-x: auto; }
.ledger { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.ledger caption { position: absolute; left: -9999px; }
.ledger th { font-weight: 700; font-size: 13.5px; padding: 7px 6px; border: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
.ledger td { padding: 6px; border: 1px solid var(--line); text-align: center; vertical-align: middle; font-variant-numeric: tabular-nums; }
.ledger .num { font-weight: 600; letter-spacing: 0.04em; }
.ledger .date { white-space: nowrap; }
.ledger .date small { display: none; }
.ledger tr.is-void-reason td { text-align: left; font-size: 13px; color: var(--muted); line-height: 1.5; padding: 5px 10px 7px; }
.ledger tr.is-void td { background: var(--void-bg); }
.ledger tr.is-void .num { color: #8f97a3; text-decoration: line-through; text-decoration-color: var(--red); }
.ledger .reason { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.ledger a.check { display: inline-flex; align-items: center; gap: 3px; color: var(--navy); font-size: 13px; font-weight: 600; text-decoration: none; padding: 4px 2px; }
.ledger a.check svg { width: 14px; height: 14px; }
@media (hover: hover) { .ledger a.check:hover { text-decoration: underline; } }
@media (max-width: 520px) {
  .ledger { font-size: 13.5px; }
  .ledger th, .ledger td { padding: 6px 3px; }
  .ledger th:last-child, .ledger tr:not(.is-void-reason) td:last-child { display: none; }
  .ledger .reason { font-size: 11.5px; }
}
.empty { padding: 24px 12px; text-align: center; color: var(--muted); margin: 0; }

/* ---------- ads: banner creatives ---------- */
.ad { position: relative; display: block; overflow: hidden; background: #dfe4ec; color: var(--white); }
.ad__tag { position: absolute; top: 6px; right: 6px; z-index: 2; font-size: 11px; line-height: 1.5; padding: 0 6px; border-radius: 2px; background: rgba(0, 0, 0, 0.5); color: #fff; }
.ad__photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform 700ms var(--ease-out); }
@media (hover: hover) { .ad:hover .ad__photo { transform: scale(1.04); } }
.ad__body { position: absolute; left: 0; right: 0; bottom: 0; padding: 36px 14px 12px; display: grid; gap: 2px; background: linear-gradient(to top, rgba(6, 12, 28, 0.88), rgba(6, 12, 28, 0.6) 60%, transparent); }
.ad__brand { font-size: 12.5px; font-weight: 700; color: #ffd76a; }
.ad__headline { margin: 0; font-size: 21px; font-weight: 800; line-height: 1.3; color: var(--white); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.ad__sub { margin: 0; font-size: 13px; line-height: 1.45; color: #e7ecf5; }
.ad__cta { margin-top: 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ad__btn { display: inline-flex; align-items: center; min-height: 30px; padding: 2px 14px; border-radius: 999px; background: #ffcc00; color: #1b1b1b; font-weight: 800; font-size: 13.5px; }
.ad__phone { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; font-weight: 700; color: var(--white); font-variant-numeric: tabular-nums; }
.ad__phone svg { width: 14px; height: 14px; }

.ad--lead .ad__photo { aspect-ratio: 16 / 6; object-position: 50% 60%; }
.ad--lead .ad__body { top: 0; right: auto; width: min(62%, 420px); padding: 16px 18px; align-content: center; background: linear-gradient(90deg, rgba(4, 34, 64, 0.92), rgba(4, 34, 64, 0.7) 70%, transparent); }
.ad--lead .ad__headline { font-size: clamp(20px, 3.6vw, 28px); }
.ad--lead .ad__btn { background: #00a3e0; color: var(--white); }
@media (max-width: 560px) {
  .ad--lead .ad__photo { aspect-ratio: 16 / 9; }
  .ad--lead .ad__body { top: auto; width: 100%; background: linear-gradient(to top, rgba(4, 34, 64, 0.92), rgba(4, 34, 64, 0.55) 70%, transparent); }
}

.ad--bank { background: linear-gradient(110deg, #0b4f45 0%, #0f6b5c 55%, #13806d 100%); }
.ad--bank .ad__inner { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding: 18px 20px; }
.ad--bank svg.champa { width: 76px; height: 76px; color: #ffd76a; }
.ad--bank .ad__brand { color: #9fe3cf; }
.ad--bank .ad__sub { color: #d9f3eb; }
.ad--bank .ad__btn { background: #ffd76a; color: #0b4f45; }

.ad--net { background: linear-gradient(110deg, #2a0f6b, #4a1a9e 60%, #6b25c9); }
.ad--net .ad__inner { display: flex; align-items: center; gap: 18px; padding: 16px 20px; flex-wrap: wrap; }
.ad--net .big5g { font-weight: 800; font-size: 64px; line-height: 1; color: #ffd400; font-style: italic; }
.ad--net .ad__copy { display: grid; gap: 2px; flex: 1; min-width: min(100%, 220px); }
.ad--net .ad__brand { color: #c9b6ff; }
.ad--net .ad__sub { color: #e6dcff; }
.ad--net .ad__btn { background: #ffd400; color: #2a0f6b; }

/* ---------- prose pages ---------- */
.prose { padding: clamp(16px, 4vw, 28px); }
.prose h1 { font-size: clamp(22px, 4.4vw, 28px); margin: 0 0 10px; line-height: 1.4; color: var(--navy); }
.prose h2 { font-size: 19px; margin: 24px 0 6px; color: var(--navy); line-height: 1.4; }
.prose p, .prose li { max-width: 70ch; }
.prose ol { padding-left: 1.3em; }
.prose code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.86em; background: #f4f6f9; padding: 1px 5px; border-radius: 3px; overflow-wrap: anywhere; }

.vform { display: grid; gap: 12px; margin-top: 16px; max-width: 760px; }
.vform label { display: grid; gap: 4px; font-weight: 600; font-size: 14.5px; }
.vform input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 16px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 4px; background: var(--white); color: var(--text); width: 100%; min-width: 0; }
.vform input:focus-visible { outline: 2px solid var(--navy); outline-offset: 0; border-color: var(--navy); }
.vform .row { display: grid; grid-template-columns: minmax(0, 1fr) 100px; gap: 10px; }
.btn-solid { justify-self: start; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 20px; background: var(--red); color: var(--white); border: 0; border-radius: 4px; font-weight: 700; font-size: 16px; cursor: pointer; transition: background-color 150ms ease, transform 120ms ease; }
.btn-solid svg { width: 18px; height: 18px; }
@media (hover: hover) { .btn-solid:hover { background: #a50d26; } }
.btn-solid:active { transform: scale(0.97); }
.vresult { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--line); background: #fafbfc; display: grid; gap: 6px; border-radius: 4px; }
.vresult.is-ok { border-color: #9fd3ae; background: #f1faf3; }
.vresult.is-bad { border-color: #f3b3bc; background: var(--void-bg); }
.vresult__title { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.vresult.is-ok .vresult__title { color: var(--ok); }
.vresult.is-bad .vresult__title { color: var(--red); }
.vresult__title svg { width: 20px; height: 20px; }
.vresult dl { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; font-size: 13.5px; }
.vresult dt { color: var(--muted); }
.vresult dd { margin: 0; font-family: ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; }

/* ---------- footer ---------- */
.foot { background: var(--navy); color: #c9d3e8; }
.foot__inner { max-width: var(--wrap); margin: 0 auto; padding: 16px var(--gutter) calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 2px; font-size: 13px; text-align: center; }
.foot p { margin: 0; }
.foot__brand { color: var(--white); font-weight: 700; font-size: 14px; }
.foot__credits { font-size: 12px; color: #9fb0d0; }
.foot__copy { margin-top: 6px !important; color: var(--white); }

.offline { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--navy); color: var(--white); padding: 8px 14px; font-size: 14px; border-radius: 4px; z-index: 20; }

@media (max-width: 640px) {
  .masthead__inner { min-height: 0; flex-direction: column; align-items: stretch; padding: 0; }
  .brand { padding: 10px var(--gutter) 8px; gap: 10px; }
  .brand__mark { width: 64px; height: 64px; }
  .brand__name { font-size: 32px; }
  .brand__latin { font-size: 11.5px; }
  .masthead__photo { position: static; width: 100%; height: 92px; -webkit-mask-image: none; mask-image: none; object-position: 50% 58%; }
  .nav a { padding: 10px 10px; font-size: 14.5px; }
  .nav__inner:not(.is-end) { -webkit-mask-image: linear-gradient(90deg, #000 84%, transparent); mask-image: linear-gradient(90deg, #000 84%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .reel.is-spinning .reel__strip { animation: none; filter: none; }
  .reels.is-revealed .reel__strip, .reel.is-landed .reel__strip { animation: none; }
  .nav__dot.is-live, .status__pill.is-live::before { animation: none; }
  .ad__photo { transition: none; }
}
.next__count { color: var(--red); font-size: 17px; font-variant-numeric: tabular-nums; }

.ledger .check.is-lock { display: inline-flex; align-items: center; gap: 3px; color: var(--gold); font-size: 13px; font-weight: 600; padding: 4px 2px; }
.ledger .check.is-lock svg { width: 14px; height: 14px; }
.vresult.is-lock { border-color: #e8cf8a; background: #fff9e8; }
.vresult.is-lock .vresult__title { color: #8a6300; }
