:root {
  --color-bg: #000000;
  --color-surface: #2b2b32;
  --color-surface-2: #181818;
  --color-hover: #2c2c2e;
  --color-accent: #ebc76e;
  --color-text: #d9d9d9;
  --color-heading: #ffffff;
  --color-btn-text: #151515;
  --color-border: rgba(255, 255, 255, 0.10);
  --gold-grad: linear-gradient(227deg, #8b6832 12.69%, #fcdd9a 51.04%, #966b2a 87.06%);
  --gold-grad-v: linear-gradient(180deg, #fcdd9a 0%, #966b2a 100%);
  --font-heading: 'Kanit', system-ui, -apple-system, 'Segoe UI', 'Leelawadee UI', Tahoma, sans-serif;
  --font-body: 'Sarabun', system-ui, -apple-system, 'Segoe UI', 'Leelawadee UI', Tahoma, sans-serif;
  --border-radius-base: 8px;
  --heading-weight: 700;
  --heading-letter-spacing: 0;
  --section-padding: 2rem 0;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.75;
  font-size: 1.02rem;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1080px; width: 100%; margin: 0 auto; padding-left: 16px; padding-right: 16px; }

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: var(--heading-weight);
  line-height: 1.3;
  color: var(--color-heading);
}

h1 {
  font-size: 2.25rem;
  letter-spacing: var(--heading-letter-spacing);
  margin: 0 0 1.1rem;
}

h2 {
  position: relative;
  font-size: 1.65rem;
  margin: 2.75rem 0 1.1rem;
  padding-left: 0.95rem;
  scroll-margin-top: 92px;
}

h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.18em;
  bottom: 0.18em;
  width: 4px;
  border-radius: 2px;
  background: var(--gold-grad-v);
}

h3 {
  font-size: 1.24rem;
  font-weight: 600;
  color: var(--color-accent);
  margin: 1.85rem 0 0.7rem;
}

h4 {
  font-size: 1.04rem;
  font-weight: 600;
  color: var(--color-heading);
  margin: 1.25rem 0 0.5rem;
}

p { margin: 0 0 1.05rem; }

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

ul, ol { margin: 0 0 1.15rem; padding-left: 1.4rem; }
li { margin-bottom: 0.5rem; }

strong { font-weight: 600; color: #ffffff; }

img { max-width: 100%; height: auto; }

/* ---------- Header ---------- */
.site-header {
  background-color: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 0 rgba(235, 199, 110, 0.18);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header-inner {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem 1.4rem;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}
.brand { display: inline-flex; align-items: center; }
.brand-logo { height: 38px; width: auto; display: block; }

/* Row 1: CTA buttons (top of the 2-row menu) */
.header-cta { margin-left: auto; display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

/* Row 2: quick navigation (full-width, centered, below the buttons) */
.primary-nav {
  flex: 0 0 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.6rem;
  align-items: center;
  justify-content: center;
  border-top: 1px solid var(--color-border);
  padding-top: 0.5rem;
  margin-top: 0.1rem;
}
.primary-nav .nav-link {
  color: var(--color-text);
  font-family: var(--font-heading);
  font-size: 0.98rem;
  font-weight: 500;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.primary-nav .nav-link:hover {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  text-decoration: none;
}

/* Hamburger toggle (CSS-only) */
.nav-toggle-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.nav-toggle { display: none; }
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--color-accent); border-radius: 2px; }
.nav-toggle-input:focus-visible ~ .nav-toggle { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* ---------- Buttons: red (login) / gold (register & CTA) ---------- */
.ufa-btn {
  display: inline-block;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.25;
  padding: 0.62rem 1.5rem;
  border-radius: var(--border-radius-base);
  border: 2px solid transparent;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}
.ufa-btn--red {
  background:
    linear-gradient(226.98deg, #c11405 12.69%, #ff2929 51.04%, #c11405 87.06%) padding-box,
    linear-gradient(226.98deg, #8b6832 12.69%, #fcdd9a 51.04%, #966b2a 87.06%) border-box;
  color: #ffffff;
}
.ufa-btn--gold {
  background: var(--gold-grad) border-box;
  color: #0a0425;
}
.ufa-btn:hover { filter: brightness(1.08); text-decoration: none; box-shadow: 0 4px 18px rgba(235, 199, 110, 0.28); }
.ufa-btn--red:hover { color: #ffffff; box-shadow: 0 4px 18px rgba(255, 41, 41, 0.32); }
.ufa-btn--gold:hover { color: #0a0425; }
.ufa-btn:active { transform: translateY(1px); }

/* Header CTA buttons (compact) */
.header-cta .ufa-btn { padding: 0.5rem 1.2rem; font-size: 0.95rem; }

.btn-wrap { text-align: center; margin: 1.8rem 0; }
.btn-wrap .ufa-btn { padding: 0.72rem 2.1rem; font-size: 1.05rem; }

/* ---------- Main / sections ---------- */
main { display: block; padding-bottom: 3rem; }
.page-main { padding-top: 1.75rem; }
.section { padding: 0; }

.lead-block {
  background: linear-gradient(180deg, rgba(235, 199, 110, 0.06), rgba(235, 199, 110, 0));
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-base);
  padding: 1.75rem 1.9rem;
  margin-bottom: 1.75rem;
}
.lead-block h1 { margin-top: 0; }
.lead-block p:last-child { margin-bottom: 0; }
.lead-block > p:first-of-type { font-size: 1.12em; color: #efe9dc; }

/* ---------- Footer ---------- */
.site-footer {
  background-color: var(--color-surface-2);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -1px 0 rgba(235, 199, 110, 0.18);
  margin-top: 3rem;
}
.site-footer-inner { padding: 1.9rem 0; text-align: center; font-size: 0.92rem; }
.site-footer p { margin: 0.35rem 0; }
.footer-copyright { color: #9a958c; }
.footer-links { margin-top: 0.6rem; }
.footer-links a { color: var(--color-accent); }

/* ---------- Images ---------- */
.content-image {
  display: block;
  margin: 1.7rem auto;
  border-radius: var(--border-radius-base);
  border: 1px solid var(--color-border);
  box-shadow: 0 4px 22px rgba(0, 0, 0, 0.55);
}
.img-float-left {
  float: left;
  margin: 0.4rem 1.6rem 1rem 0;
  border-radius: var(--border-radius-base);
  border: 1px solid var(--color-border);
  box-shadow: 0 4px 22px rgba(0, 0, 0, 0.55);
}
.img-float-right {
  float: right;
  margin: 0.4rem 0 1rem 1.6rem;
  border-radius: var(--border-radius-base);
  border: 1px solid var(--color-border);
  box-shadow: 0 4px 22px rgba(0, 0, 0, 0.55);
}

/* ---------- Quick-action table (login / register shortcuts) ---------- */
.quick-action-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.6rem 0;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-base);
  overflow: hidden;
  background: var(--color-surface-2);
}
.quick-action-table th {
  background: rgba(235, 199, 110, 0.10);
  color: var(--color-heading);
  font-family: var(--font-heading);
  font-weight: 600;
  text-align: left;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--color-border);
}
.quick-action-table td {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
  color: var(--color-text);
}
.quick-action-table tr:last-child td { border-bottom: none; }
.quick-action-table td:last-child { text-align: center; white-space: nowrap; width: 42%; }
.quick-action-table td:last-child .ufa-btn { width: 100%; }

/* ---------- Promo grid table (cashback — dark grid, per reference) ---------- */
.promo-grid {
  width: 100%;
  border-collapse: collapse;
  margin: 1.75rem 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 1rem;
}
.promo-grid th {
  color: #ffffff;
  font-family: var(--font-heading);
  font-weight: 600;
  text-align: left;
  padding: 1.15rem 1.4rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
}
.promo-grid td {
  color: var(--color-text);
  padding: 1.25rem 1.4rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  vertical-align: top;
  line-height: 1.7;
}

/* ---------- Generic data table (fallback) ---------- */
.data-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; border: 1px solid var(--color-border); border-radius: var(--border-radius-base); overflow: hidden; }
.data-table th { background: var(--color-surface); color: var(--color-heading); padding: 0.8rem 1rem; text-align: left; font-weight: 600; border-bottom: 2px solid var(--color-accent); }
.data-table td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--color-border); color: var(--color-text); }
.data-table tbody tr:nth-child(even) { background: var(--color-surface); }

/* ---------- Pros / cons (always generated) ---------- */
.pros-cons { margin: 1.5rem 0; padding: 1.4rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--border-radius-base); }
.pros-cons h4 { color: var(--color-accent); font-weight: 600; margin-top: 0; margin-bottom: 0.8rem; }
.pros-cons ul { padding-left: 1.25rem; margin: 0; }
.pros-cons li { margin-bottom: 0.45rem; }

/* ---------- Note box (always generated) ---------- */
.note-box { position: relative; margin: 1.35rem 0; padding: 0.85rem 1rem 0.85rem 1.25rem; background: var(--color-surface-2); border-left: 4px solid var(--color-accent); border-radius: var(--border-radius-base); color: var(--color-text); font-size: 0.96rem; }
.note-box::before { content: "หมายเหตุ"; display: block; font-family: var(--font-heading); font-weight: 600; color: var(--color-accent); margin-bottom: 0.25rem; font-size: 0.82rem; letter-spacing: 0.04em; }

/* ---------- Lists ---------- */
.list-icon { list-style: none; padding: 0; margin: 1.1rem 0; }
.list-icon li { padding-left: 1.7rem; margin-bottom: 0.6rem; position: relative; }
.list-icon li::before { content: '◆'; color: var(--color-accent); position: absolute; left: 0; top: 0.05rem; font-size: 0.8rem; }

.list-steps { list-style: none; padding: 0; margin: 1.15rem 0; counter-reset: steps; }
.list-steps li { display: flex; align-items: flex-start; gap: 0.95rem; margin-bottom: 0.9rem; counter-increment: steps; }
.list-steps li::before {
  content: counter(steps);
  display: flex; align-items: center; justify-content: center;
  min-width: 1.9rem; height: 1.9rem;
  background: var(--gold-grad);
  color: var(--color-btn-text);
  font-family: var(--font-heading); font-weight: 700;
  border-radius: 50%; font-size: 0.9rem; flex-shrink: 0; margin-top: 0.15rem;
}

/* ---------- Injected: badge row ---------- */
.badge-row { display: flex; flex-wrap: wrap; gap: 0.55rem; margin: 1.6rem 0; }
.badge { border: 1px solid var(--color-accent); color: var(--color-accent); padding: 0.28rem 0.9rem; border-radius: 20px; font-size: 0.9rem; font-weight: 500; font-family: var(--font-heading); }

/* ---------- Injected: stat block ---------- */
.stat-block { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1.9rem 0; }
.stat-item { flex: 1 1 150px; text-align: center; background: var(--color-surface-2); border: 1px solid var(--color-border); border-top: 3px solid var(--color-accent); border-radius: var(--border-radius-base); padding: 1.15rem 0.75rem; }
.stat-num { display: block; font-family: var(--font-heading); font-weight: 700; font-size: 2rem; line-height: 1.1; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-label { display: block; font-size: 0.86rem; color: var(--color-text); margin-top: 0.35rem; }

/* ---------- Injected: callout ---------- */
.callout { margin: 2rem 0; padding: 1.5rem 1.85rem; background: linear-gradient(180deg, rgba(235, 199, 110, 0.10), rgba(235, 199, 110, 0.02)); border: 1px solid rgba(235, 199, 110, 0.28); border-radius: var(--border-radius-base); text-align: center; font-size: 1.08rem; color: #f2ecdd; }
.callout p { margin: 0; }

/* ---------- FAQ ---------- */
.faq-list { margin: 1.4rem 0 0; }
.faq-item { background: var(--color-surface-2); border: 1px solid var(--color-border); border-left: 3px solid var(--color-accent); border-radius: var(--border-radius-base); padding: 1.1rem 1.35rem; margin-bottom: 0.9rem; }
.faq-item h3 { margin: 0 0 0.5rem; font-size: 1.1rem; color: var(--color-accent); }
.faq-item p { margin: 0; }

/* ---------- Legal / 404 ---------- */
.legal-page { padding-top: 1.5rem; }
.legal-page h1 { margin-bottom: 0.4rem; }
.legal-page .last-updated { color: #9a958c; font-size: 0.9rem; margin-bottom: 2rem; }
.legal-page h2 { font-size: 1.35rem; }
.legal-page h3 { font-size: 1.1rem; }

.error-page { text-align: center; padding: 5rem 1rem; }
.error-page h1 { font-size: 5rem; color: var(--color-accent); margin-bottom: 0.4rem; font-family: var(--font-heading); }
.error-page h2 { margin-top: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.4rem; }

  .brand { order: 1; }
  .nav-toggle {
    order: 2; margin-left: auto;
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; padding: 10px; cursor: pointer; border-radius: var(--border-radius-base);
  }
  .header-cta { order: 3; flex: 0 0 100%; width: 100%; flex-direction: column; gap: 0.5rem; margin-left: 0; }
  .header-cta .ufa-btn { width: 100%; }
  .primary-nav {
    order: 4; display: none; width: 100%; flex: 0 0 100%; flex-direction: column;
    align-items: stretch; gap: 0; border-top: none; padding-top: 0; margin-top: 0;
  }
  .nav-toggle-input:checked ~ .primary-nav { display: flex; }
  .primary-nav .nav-link { display: block; width: 100%; padding: 0.7rem 0.2rem; border-bottom: 1px solid var(--color-border); border-radius: 0; }

  .img-float-left, .img-float-right { float: none; display: block; margin: 1.3rem auto; }

  /* Quick-action table -> stacked */
  .quick-action-table, .quick-action-table tbody, .quick-action-table tr, .quick-action-table td { display: block; width: 100%; }
  .quick-action-table thead { display: none; }
  .quick-action-table tr { border-bottom: 1px solid var(--color-border); }
  .quick-action-table tr:last-child { border-bottom: none; }
  .quick-action-table td { border-bottom: none; text-align: left; white-space: normal; }
  .quick-action-table td:last-child { width: 100%; padding-top: 0; }

  /* Promo grid -> stacked cards */
  .promo-grid, .promo-grid tbody, .promo-grid tr, .promo-grid td { display: block; width: 100%; }
  .promo-grid thead { display: none; }
  .promo-grid tr { margin-bottom: 1rem; border: 1px solid rgba(255, 255, 255, 0.16); }
  .promo-grid td { border: none; border-bottom: 1px solid rgba(255, 255, 255, 0.12); display: flex; flex-direction: column; gap: 0.25rem; padding: 0.85rem 1.05rem; }
  .promo-grid td:last-child { border-bottom: none; }
  .promo-grid td::before { content: attr(data-label); font-family: var(--font-heading); font-weight: 600; color: var(--color-accent); font-size: 0.85rem; }

  .data-table thead { display: none; }
  .data-table tr { display: block; margin-bottom: 1rem; border: 1px solid var(--color-border); border-radius: var(--border-radius-base); }
  .data-table tbody tr:nth-child(even) { background: transparent; }
  .data-table td { display: flex; justify-content: space-between; gap: 0.75rem; border-bottom: 1px solid var(--color-border); }
  .data-table td::before { content: attr(data-label); font-weight: 600; color: var(--color-accent); }
}

@media (max-width: 480px) {
  .stat-item { flex: 1 1 100%; }
  h1 { font-size: 1.55rem; }
}
