
:root {
  color-scheme:light;
  --paper:#fff8ec; --card:#fff; --ink:#24202a; --muted:#625b59; --line:#e8d3ad;
  --red:#a40c12; --dark-red:#700609; --gold:#d5a32e; --soft:#f9ead0;
  font-family:Sarabun,system-ui,"Noto Sans Thai",sans-serif; color:var(--ink); background:var(--paper);
}
* { box-sizing:border-box }
body { margin:0; min-width:0; background:radial-gradient(ellipse at top,#faeace,transparent 36rem),var(--paper) }
a,button,input,select { color:inherit; -webkit-tap-highlight-color:transparent }
button,input,select { font:inherit }
a:focus-visible,button:focus-visible,select:focus-visible,input:focus-visible { outline:3px solid var(--red); outline-offset:2px }
[hidden] { display:none!important }
main { width:min(100%,52rem); margin:auto; min-height:100vh; min-height:100dvh;
  padding:0 max(16px,env(safe-area-inset-right,0px)) calc(24px + max(env(safe-area-inset-bottom,0px),var(--tg-content-safe-area-inset-bottom,0px))) max(16px,env(safe-area-inset-left,0px)); }
.brandbar { display:flex; align-items:center; justify-content:center; min-height:84px;
  padding:calc(6px + max(env(safe-area-inset-top,0px),var(--tg-content-safe-area-inset-top,0px))) 12px 12px;
  margin:0 -8px 11px; border-radius:0 0 18px 18px; background:#75080b url("/assets/red-gold/header.webp") center 43%/cover no-repeat; border-bottom:2px solid var(--gold); }
.brandbar a { display:flex; align-items:center; min-height:48px }
.brandbar img { width:156px; height:52px; object-fit:contain }
.brandbar a:focus-visible,.intro-home a:focus-visible { outline-color:#ffe597 }
.intro { margin-bottom:14px; padding:13px 2px 8px }
.intro-copy { flex:1; min-width:0 }
.intro h1 { font-family:Kanit,Sarabun,system-ui,sans-serif; font-size:clamp(1.55rem,6.6vw,2.35rem); margin:0; color:var(--dark-red); line-height:1.25; overflow-wrap:anywhere }
.intro-home { display:flex; align-items:center; gap:8px; min-height:104px; padding:11px 13px 11px 16px; border:1px solid #dcae55; border-radius:15px;
  background:linear-gradient(107deg,#74060a 15%,#a40c12 81%,#bf1b14); box-shadow:0 3px 8px #7020081d; }
.intro-home h1 { color:#fff3d4 }
.hero-art { flex:none; width:92px; height:92px; object-fit:contain }
.sync { font-size:.84rem; margin:6px 0 0; line-height:1.45; color:var(--muted) }
.intro-home .sync { color:#fff0d8 }
.sync:empty { display:none }
.back { display:inline-flex; align-items:center; gap:8px; min-height:44px; color:var(--dark-red); text-decoration:none; margin:-10px 0 1px; font-weight:600 }
.icon { display:inline-block; flex:none; position:relative }
.chevron,.left { width:8px; height:8px; border:solid currentColor; border-width:0 1.6px 1.6px 0; transform:rotate(-45deg) }
.left { transform:rotate(135deg) }
.close { width:13px; height:13px }
.close::before,.close::after { content:""; position:absolute; top:6px; inset-inline:0; height:2px; background:currentColor; transform:rotate(45deg); border-radius:2px }
.close::after { transform:rotate(-45deg) }
.search { display:flex; align-items:center; gap:3px; min-height:53px; background:var(--card); border:1px solid var(--line); border-radius:13px; padding:3px; box-shadow:0 2px 6px #54240b0f }
.search-field { display:flex; align-items:center; gap:7px; min-width:0; flex:1; padding-inline:8px 2px }
.search-art { width:23px; height:23px; flex:none; object-fit:contain }
.search input { min-width:0; width:100%; height:44px; border:0; background:transparent; padding:0; font-size:16px }
.search input::-webkit-search-cancel-button { display:none }
.search input::placeholder { color:var(--muted); opacity:1 }
.search input:focus { outline:none }
.search:focus-within { border-color:var(--red); box-shadow:0 0 0 1px var(--red) }
.search-submit,.clear-search { min-height:44px; border:0; border-radius:10px; cursor:pointer; flex:none }
.search-submit { padding:0 12px; background:var(--red); color:white; font-weight:650 }
.clear-search { display:grid; place-items:center; width:44px; background:transparent; color:var(--muted) }
.list-heading { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:18px 0 9px }
.list-heading h2,.history-heading { margin:0; font-size:1.08rem; color:var(--dark-red) }
.list-heading span { color:var(--dark-red); font-size:.84rem; white-space:nowrap; background:var(--soft); border-radius:20px; padding:4px 9px }
.category-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px }
.category { display:flex; align-items:center; gap:6px; min-width:0; min-height:83px; padding:9px 8px 12px;
  border:1px solid var(--line); border-radius:13px; background:linear-gradient(0deg,#fff3d8 0,var(--card) 36%); box-shadow:0 2px 4px #5b240c12; text-decoration:none; }
.category-art { width:39px; height:39px; object-fit:contain; flex:none }
.category-body { min-width:0; flex:1; color:var(--dark-red) }
.category-body strong { display:block; font-size:1rem; line-height:1.3; overflow-wrap:anywhere }
.category-count { display:block; color:var(--muted); font-size:.84rem; margin-top:3px }
.category .chevron,.market .chevron { color:var(--red); margin-right:2px }
.category-grid>.markets,.category-grid>.empty { grid-column:1/-1 }
.markets,.table-box { border:1px solid var(--line); background:var(--card); border-radius:13px; overflow:hidden }
.markets { margin:0 0 8px }
.markets h2 { margin:0; padding:10px 14px; color:var(--dark-red); background:var(--soft); font-size:1rem }
.market { display:flex; justify-content:space-between; align-items:center; gap:12px; min-height:53px; padding:10px 15px; text-decoration:none; font-weight:650 }
.market+.market { border-top:1px solid var(--line) }
.market:focus-visible { outline-offset:-4px }
.result-summary { margin-bottom:17px; border:1px solid #d9ab56; padding:10px; border-radius:15px; background:linear-gradient(120deg,#76070b,#aa1016); color:#fff4dc }
.result-summary-head,.table-tools,.pagination { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap }
.result-summary-head { margin:1px 3px 9px }
.result-summary-head h2 { margin:0; font-size:1.07rem }
.result-summary-head time { font-size:.86rem }
.result-pair { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:0 }
.result-pair>div { padding:8px 5px; text-align:center; border-radius:9px; background:#fff3d5; color:var(--dark-red) }
.result-pair dt { font-size:1rem; font-weight:650 }
.result-pair dd { margin:3px 0 0; font-size:clamp(1.35rem,7vw,2.25rem); line-height:1.2; font-variant-numeric:tabular-nums; font-weight:780; overflow-wrap:anywhere }
.history-heading { margin:0 0 6px }
.table-tools { margin-bottom:8px }
.table-tools>span { color:var(--muted); font-size:.92rem }
.table-tools select,.secondary { min-height:44px; padding:8px 12px; border:1px solid var(--line); border-radius:8px; background:var(--card) }
.secondary { cursor:pointer; text-decoration:none; display:inline-flex; align-items:center; justify-content:center }
.secondary:disabled { opacity:.54; cursor:default }
.pagination { margin-top:12px }
.pagination .secondary:last-child:not(:disabled) { color:white; background:var(--dark-red); border-color:var(--dark-red) }
table { width:100%; table-layout:fixed; border-collapse:collapse; font-variant-numeric:tabular-nums }
th,td { padding:9px 5px; text-align:center; border-bottom:1px solid var(--line) }
th { background:var(--soft); font-size:.94rem; color:var(--dark-red) }
td { font-weight:740; font-size:1.06rem; line-height:1.4; overflow-wrap:anywhere }
th:first-child,td:first-child { width:45%; text-align:left; padding-left:10px }
td:first-child { font-weight:520; font-size:.94rem; padding-block:0 }
td a { display:inline-flex; align-items:center; min-height:44px; text-decoration-color:#a48168; text-underline-offset:3px }
tbody tr:nth-child(even) { background:#fffaf2 }
tbody tr.latest { background:#fcf0d8 }
tr:last-child td { border-bottom:0 }
.empty { margin:0 0 12px; padding:16px; border:1px solid var(--line); border-radius:12px; background:var(--card); color:var(--muted); font-size:1rem }
.loading::before { content:""; display:inline-block; vertical-align:middle; width:14px; height:14px; margin-right:9px; border:2px solid var(--line); border-top-color:var(--red); border-radius:50%; animation:spin .85s linear infinite }
@keyframes spin { to { transform:rotate(360deg) } }
@media(prefers-reduced-motion:reduce) { .loading::before { animation:none } }
@media(max-width:350px) { .category-grid { grid-template-columns:minmax(0,1fr) } .hero-art { width:76px;height:76px } }
@media(min-width:650px) { main { padding-inline:24px } .category-grid { grid-template-columns:repeat(4,minmax(0,1fr)) } .intro-home { padding-inline:23px } .hero-art { width:110px;height:110px } }
@media(hover:hover) { .category:hover,.market:hover { box-shadow:inset 0 0 0 1px var(--red) } .back:hover { text-decoration:underline } }

.quick-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px }
.quick-result { min-height:58px; padding:10px 13px; background:var(--card) }
.quick-result .category-body { overflow-wrap:anywhere }
.category-body strong, .category-body { overflow-wrap:normal }
@media(min-width:650px) { .category-grid { grid-template-columns:repeat(3,minmax(0,1fr)) } }
.has-account-footer main { padding-bottom:calc(98px + max(env(safe-area-inset-bottom,0px),var(--tg-content-safe-area-inset-bottom,0px))) }
#account-footer { position:fixed; z-index:5; bottom:0; left:50%; transform:translateX(-50%); width:min(100%,52rem); display:flex; gap:10px; border-top:1px solid var(--gold); padding:10px max(14px,env(safe-area-inset-right,0px)) calc(10px + max(env(safe-area-inset-bottom,0px),var(--tg-content-safe-area-inset-bottom,0px))) max(14px,env(safe-area-inset-left,0px)); background:var(--paper); box-shadow:0 -4px 16px #54240b1a }
.account-button { display:flex; flex:1; min-width:0; min-height:48px; align-items:center; justify-content:center; padding:7px 9px; border:1.5px solid var(--red); border-radius:11px; font-weight:750; text-align:center; text-decoration:none }
.account-login { color:var(--dark-red); background:var(--card) }
.account-register { color:#fff; background:var(--red) }
