/* =====================================================
   รู้รอบเรื่องเสี่ยงโชค — ศูนย์ความรู้หวยและเกมออนไลน์
   Design System: Navy / Gold / Clean Academic
   ===================================================== */

:root {
  --navy: #0e2a47;
  --navy-dark: #081d33;
  --navy-soft: #16395e;
  --gold: #c9a227;
  --gold-soft: #e9cf7a;
  --gold-pale: #faf3dd;
  --bg: #f6f8fb;
  --paper: #ffffff;
  --ink: #20304a;
  --muted: #5d6e84;
  --line: #e2e8f0;
  --green: #1f7a4d;
  --red: #b23b3b;
  --red-pale: #fdf0ee;
  --blue-pale: #eef4fb;
  --radius: 14px;
  --shadow-sm: 0 1px 3px rgba(14, 42, 71, .08);
  --shadow-md: 0 10px 30px rgba(14, 42, 71, .12);
  --font-body: 'Noto Sans Thai', 'Sarabun', system-ui, sans-serif;
  --font-head: 'Noto Serif Thai', 'Noto Sans Thai', serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 96px; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.85;
  font-size: 16.5px;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--navy-soft); text-decoration: none; }
a:hover { color: var(--gold); }

h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.45; color: var(--navy); font-weight: 700; }

.container { width: min(1180px, 92%); margin-inline: auto; }

/* ---------- Top strip ---------- */
.topstrip {
  background: var(--navy-dark);
  color: #cdd9e6;
  font-size: .8rem;
  padding: 7px 0;
}
.topstrip .container { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.topstrip span b { color: var(--gold-soft); font-weight: 600; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 14px 0; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--navy), var(--navy-soft));
  display: grid; place-items: center;
  border: 2px solid var(--gold);
}
.brand-mark svg { width: 26px; height: 26px; }
.brand-text b { display: block; font-family: var(--font-head); font-size: 1.15rem; color: var(--navy); line-height: 1.2; }
.brand-text small { color: var(--muted); font-size: .72rem; letter-spacing: .4px; }

.main-nav ul { display: flex; gap: 4px; list-style: none; align-items: center; }
.main-nav a {
  display: block; padding: 9px 13px; border-radius: 9px;
  font-weight: 600; font-size: .92rem; color: var(--ink);
  transition: background .2s, color .2s;
}
.main-nav a:hover, .main-nav a.active { background: var(--blue-pale); color: var(--navy); }

.nav-toggle {
  display: none; border: 1px solid var(--line); background: var(--paper);
  border-radius: 9px; padding: 9px 12px; cursor: pointer; font-size: 1.1rem; color: var(--navy);
}

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(1000px 400px at 85% -10%, rgba(201, 162, 39, .18), transparent 60%),
    linear-gradient(160deg, var(--navy-dark), var(--navy) 55%, var(--navy-soft));
  color: #eaf1f8;
  padding: 72px 0 84px;
  position: relative; overflow: hidden;
}
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(201, 162, 39, .16); border: 1px solid rgba(201, 162, 39, .45);
  color: var(--gold-soft); padding: 6px 14px; border-radius: 99px;
  font-size: .8rem; font-weight: 600; letter-spacing: .3px;
}
.hero h1 { color: #fff; font-size: clamp(1.9rem, 3.6vw, 2.9rem); margin: 18px 0 14px; }
.hero h1 em { font-style: normal; color: var(--gold-soft); }
.hero p { color: #c3d2e2; font-size: 1.06rem; max-width: 56ch; }
.hero-actions { display: flex; gap: 14px; margin-top: 26px; flex-wrap: wrap; }
.hero-figure img { border-radius: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .12); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: 11px; font-weight: 700; font-size: .95rem;
  transition: transform .18s, box-shadow .18s, background .18s;
  border: 1px solid transparent; cursor: pointer;
}
.btn-gold { background: linear-gradient(135deg, var(--gold), #b8901e); color: #17243a; }
.btn-gold:hover { color: #17243a; transform: translateY(-2px); box-shadow: 0 10px 24px rgba(201, 162, 39, .35); }
.btn-ghost { border-color: rgba(255, 255, 255, .35); color: #eaf1f8; }
.btn-ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-soft); color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ---------- Stats strip ---------- */
.stats-strip { background: var(--paper); border-bottom: 1px solid var(--line); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat { padding: 26px 20px; text-align: center; border-left: 1px solid var(--line); }
.stat:first-child { border-left: none; }
.stat b { display: block; font-family: var(--font-head); font-size: 1.7rem; color: var(--navy); }
.stat b i { font-style: normal; color: var(--gold); }
.stat span { color: var(--muted); font-size: .86rem; }

/* ---------- Sections ---------- */
.section { padding: 72px 0; }
.section-alt { background: var(--paper); border-block: 1px solid var(--line); }
.section-head { max-width: 720px; margin-bottom: 42px; }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head .eyebrow {
  display: inline-block; color: var(--gold); font-weight: 700; font-size: .82rem;
  letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 8px;
}
.section-head h2 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); }
.section-head p { color: var(--muted); margin-top: 10px; }

/* ---------- Card grid ---------- */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.kcard {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .22s, box-shadow .22s, border-color .22s;
}
.kcard:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: var(--gold-soft); }
.kcard-img { position: relative; aspect-ratio: 16/10; overflow: hidden; }
.kcard-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.kcard:hover .kcard-img img { transform: scale(1.05); }
.kcard-tag {
  position: absolute; top: 12px; left: 12px;
  background: rgba(8, 29, 51, .85); color: var(--gold-soft);
  font-size: .72rem; font-weight: 700; padding: 4px 12px; border-radius: 99px; letter-spacing: .5px;
}
.kcard-body { padding: 22px 22px 24px; display: flex; flex-direction: column; flex: 1; }
.kcard-body h3 { font-size: 1.12rem; margin-bottom: 8px; }
.kcard-body h3 a { color: var(--navy); }
.kcard-body h3 a:hover { color: var(--gold); }
.kcard-body p { color: var(--muted); font-size: .9rem; flex: 1; }
.kcard-link { margin-top: 14px; font-weight: 700; font-size: .88rem; color: var(--navy-soft); display: inline-flex; align-items: center; gap: 6px; }
.kcard-link:hover { color: var(--gold); gap: 10px; }
.kcard-link::after { content: '→'; transition: inherit; }

/* ---------- Feature list ---------- */
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.feature {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 22px; text-align: left;
}
.feature .ic {
  width: 48px; height: 48px; border-radius: 12px; margin-bottom: 14px;
  background: linear-gradient(135deg, var(--gold-pale), #f4e5bd);
  display: grid; place-items: center; font-size: 1.35rem;
}
.feature h3 { font-size: 1.02rem; margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: .87rem; }

/* ---------- Article layout ---------- */
.article-hero {
  background: linear-gradient(160deg, var(--navy-dark), var(--navy) 60%, var(--navy-soft));
  color: #eaf1f8; padding: 52px 0 56px;
}
.article-hero h1 { color: #fff; font-size: clamp(1.6rem, 3vw, 2.35rem); margin: 14px 0 12px; max-width: 22ch; }
.article-hero p { color: #c3d2e2; max-width: 68ch; }
.article-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 18px; font-size: .82rem; color: #9fb3c8; }
.article-meta span { display: inline-flex; align-items: center; gap: 6px; }
.article-meta i { font-style: normal; color: var(--gold-soft); }

.breadcrumb { font-size: .82rem; color: #9fb3c8; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.breadcrumb a { color: #cdd9e6; }
.breadcrumb a:hover { color: var(--gold-soft); }
.breadcrumb .sep { opacity: .5; }

.article-layout { display: grid; grid-template-columns: 1fr 300px; gap: 48px; padding: 56px 0 72px; align-items: start; }

.article-content { min-width: 0; }
.article-content .featured-img { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-md); margin-bottom: 34px; border: 1px solid var(--line); }
.article-content h2 {
  font-size: 1.45rem; margin: 42px 0 14px; padding-left: 14px;
  border-left: 4px solid var(--gold);
}
.article-content h3 { font-size: 1.14rem; margin: 28px 0 10px; color: var(--navy-soft); }
.article-content p { margin-bottom: 16px; }
.article-content ul, .article-content ol { margin: 0 0 18px 1.4rem; }
.article-content li { margin-bottom: 8px; }
.article-content strong { color: var(--navy); }

.lead { font-size: 1.08rem; color: var(--ink); background: var(--blue-pale); border: 1px solid #d7e5f4; border-radius: var(--radius); padding: 20px 24px; margin-bottom: 28px; }

.callout { border-radius: var(--radius); padding: 18px 22px; margin: 24px 0; font-size: .94rem; border: 1px solid; }
.callout b, .callout strong { display: inline; }
.callout-title { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 6px; }
.callout-info { background: var(--blue-pale); border-color: #cfe0f2; }
.callout-info .callout-title { color: var(--navy-soft); }
.callout-warn { background: var(--gold-pale); border-color: #ecdcb0; }
.callout-warn .callout-title { color: #8a6a10; }
.callout-danger { background: var(--red-pale); border-color: #f2cfca; }
.callout-danger .callout-title { color: var(--red); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 22px 0 28px; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
table.data { width: 100%; border-collapse: collapse; background: var(--paper); font-size: .93rem; min-width: 560px; }
table.data caption { caption-side: top; text-align: left; font-weight: 700; color: var(--navy); padding: 14px 18px; background: var(--blue-pale); font-family: var(--font-head); }
table.data th { background: var(--navy); color: #fff; text-align: left; padding: 12px 16px; font-weight: 600; white-space: nowrap; }
table.data td { padding: 11px 16px; border-top: 1px solid var(--line); vertical-align: top; }
table.data tr:nth-child(even) td { background: #fbfcfe; }
table.data td b { color: var(--navy); }
.prize { color: var(--red); font-weight: 700; white-space: nowrap; }

/* Sidebar */
.article-sidebar { position: sticky; top: 110px; display: flex; flex-direction: column; gap: 22px; }
.toc-box, .side-box {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow-sm);
}
.toc-box h4, .side-box h4 {
  font-size: .95rem; margin-bottom: 12px; padding-bottom: 10px;
  border-bottom: 2px solid var(--gold); display: inline-block;
}
.toc-box ol { list-style: none; }
.toc-box li { margin-bottom: 4px; }
.toc-box a {
  display: block; padding: 6px 10px; border-radius: 8px; font-size: .87rem;
  color: var(--muted); border-left: 2px solid transparent;
}
.toc-box a:hover, .toc-box a.active { background: var(--blue-pale); color: var(--navy); border-left-color: var(--gold); }
.side-box ul { list-style: none; }
.side-box li { border-bottom: 1px dashed var(--line); }
.side-box li:last-child { border-bottom: none; }
.side-box a { display: block; padding: 9px 2px; font-size: .88rem; font-weight: 600; color: var(--ink); }
.side-box a:hover { color: var(--gold); }
.side-box a small { display: block; color: var(--muted); font-weight: 400; font-size: .76rem; }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 12px; }
.faq-item { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.faq-q {
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  padding: 16px 20px; font-family: var(--font-body); font-size: .97rem; font-weight: 700; color: var(--navy);
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
}
.faq-q .chev { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--blue-pale); display: grid; place-items: center; transition: transform .25s; color: var(--navy); font-size: .8rem; }
.faq-item.open .faq-q .chev { transform: rotate(180deg); background: var(--gold); color: #fff; }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.faq-a-inner { padding: 0 20px 18px; color: var(--muted); font-size: .93rem; }

/* Related */
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* Disclaimer */
.disclaimer {
  background: var(--navy-dark); color: #b9c9da; border-radius: var(--radius);
  padding: 26px 30px; font-size: .88rem; border: 1px solid var(--navy-soft);
}
.disclaimer b { color: var(--gold-soft); display: block; margin-bottom: 8px; font-family: var(--font-head); font-size: 1rem; }

/* ---------- CTA band ---------- */
.cta-band {
  background:
    radial-gradient(700px 260px at 20% 0%, rgba(201, 162, 39, .22), transparent 60%),
    linear-gradient(150deg, var(--navy), var(--navy-dark));
  color: #eaf1f8; border-radius: 20px; padding: 52px 48px;
  display: grid; grid-template-columns: 1.3fr .7fr; gap: 30px; align-items: center;
}
.cta-band h2 { color: #fff; font-size: 1.6rem; margin-bottom: 10px; }
.cta-band p { color: #b9c9da; font-size: .95rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-dark); color: #93a9c0; margin-top: 72px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 36px; padding: 56px 0 40px; }
.site-footer h4 { color: #fff; font-size: 1rem; margin-bottom: 14px; }
.site-footer ul { list-style: none; }
.site-footer li { margin-bottom: 8px; }
.site-footer a { color: #93a9c0; font-size: .9rem; }
.site-footer a:hover { color: var(--gold-soft); }
.footer-brand p { font-size: .88rem; margin-top: 12px; max-width: 40ch; }
.footer-bottom { border-top: 1px solid var(--navy-soft); padding: 18px 0; font-size: .8rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  width: 46px; height: 46px; border-radius: 12px; border: none; cursor: pointer;
  background: var(--navy); color: var(--gold-soft); font-size: 1.1rem;
  box-shadow: var(--shadow-md); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { background: var(--gold); color: var(--navy-dark); transform: translateY(-3px); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-figure { order: -1; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .article-layout { grid-template-columns: 1fr; }
  .article-sidebar { position: static; flex-direction: row; flex-wrap: wrap; }
  .article-sidebar > * { flex: 1 1 280px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .cta-band { grid-template-columns: 1fr; padding: 38px 30px; }
}

@media (max-width: 760px) {
  body { font-size: 15.5px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: none; }
  .stat { border-top: 1px solid var(--line); }
  .card-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  /* เมนูมือถือเกาะใต้ header ด้วย absolute — ห้ามใช้ fixed
     .site-header มี backdrop-filter ซึ่งทำให้มันกลายเป็น containing block ของลูก
     ที่ position:fixed ดังนั้น top:0 จะหมายถึงขอบบนของ header ไม่ใช่ขอบบนของจอ
     ของเดิมเมนูที่ "ปิด" อยู่จึงถูกดันขึ้นไปไม่พ้นจอ โผล่ค้างบนสุด 72px
     (เห็นเป็นคำว่า "ความเสี่ยง" ลอยอยู่เหนือแถบอัปเดตล่าสุด)

     visibility: hidden คือตัวกันพลาด ต่อให้ตำแหน่งเพี้ยนอีกก็มองไม่เห็นและ
     กด Tab ไปโดนลิงก์ที่ซ่อนอยู่ไม่ได้ */
  .main-nav {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 99;
    background: var(--paper); padding: 10px 6% 22px;
    border-bottom: 1px solid var(--line); box-shadow: var(--shadow-md);
    max-height: 70vh; overflow: auto;
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity .22s ease, transform .22s ease, visibility .22s;
  }
  .main-nav.open { opacity: 1; visibility: visible; transform: none; }
  .main-nav ul { flex-direction: column; align-items: stretch; gap: 2px; }
  .main-nav a { padding: 13px 16px; font-size: 1rem; }
  .nav-toggle { display: block; position: relative; z-index: 100; }
  .section { padding: 52px 0; }
}

/* ---------- Provider logo wall & game shots ---------- */
.logo-wall { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin: 24px 0 8px; }
.logo-cell {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  aspect-ratio: 20/11; display: grid; place-items: center; overflow: hidden;
  box-shadow: var(--shadow-sm); transition: transform .2s, border-color .2s;
}
.logo-cell:hover { transform: translateY(-3px); border-color: var(--gold-soft); }
.logo-cell img { width: 100%; height: 100%; object-fit: contain; }
.logo-note { color: var(--muted); font-size: .78rem; margin-bottom: 24px; }

.game-shot { float: right; width: 300px; margin: 4px 0 16px 24px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.game-shot img { width: 100%; aspect-ratio: 16/10; object-fit: cover; }
.game-shot figcaption { font-size: .75rem; color: var(--muted); padding: 8px 12px; background: var(--paper); }

@media (max-width: 1020px) { .logo-wall { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) {
  .logo-wall { grid-template-columns: repeat(2, 1fr); }
  .game-shot { float: none; width: 100%; margin: 0 0 16px; }
}
