:root {
  --bg-dark: #1a0b0b;
  --red-dark: #c00000;
  --red-panel: #c00000;
  --red-deep: #8a0000;
  --red-footer: #6b0000;
  --gold: #f8df75;
  --gold-text: #f8df75;
  --gold-light: #fceabb;
  --gold-mid: #f8df75;
  --gold-border: #f8df75;
  --gold-title: #fceabb;
  --gold-gradient: linear-gradient(180deg, #fceabb 0%, #f8df75 100%);
  --cyan: #59b4e0;
  --magenta: #e137f5;
  --muted: #b8a4a4;
  --header-h: 63px;
  --sidebar-w: 248px;
  --radius: 10px;
  --font: "Noto Sans Thai", "Manrope", "Segoe UI", sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg-dark);
  color: #fff;
  font-family: var(--font);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  padding-top: var(--header-h);
}

a { color: inherit; text-decoration: none; }
img { display: block; height: auto; max-width: 100%; }
button { background: none; border: 0; color: inherit; cursor: pointer; font: inherit; }

.layout-root {
  display: flex;
  min-height: calc(100vh - var(--header-h));
  padding-left: var(--sidebar-w);
  transition: padding-left 0.25s;
}

.layout-root.sidebar-collapsed {
  padding-left: 0;
}

/* ===== SIDEBAR COLUMN (fixed) ===== */
.side-column {
  background: var(--red-dark);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  height: 100vh;
  left: 0;
  overflow: hidden;
  position: fixed;
  top: 0;
  transform: translateX(0);
  transition: transform 0.25s;
  width: var(--sidebar-w);
  z-index: 300;
}

.side-column.collapsed {
  transform: translateX(-100%);
}

.sidebar-toggle {
  align-items: center;
  background: var(--red-panel);
  border: none;
  cursor: pointer;
  display: flex;
  height: var(--header-h);
  justify-content: center;
  left: 0;
  padding: 0;
  position: fixed;
  top: 0;
  width: 48px;
  z-index: 350;
}

.sidebar-toggle svg {
  display: block;
  fill: #fff;
  height: 22px;
  transition: transform 0.25s;
  width: 22px;
}

.layout-root.sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

.side-top {
  align-items: center;
  background: var(--red-panel);
  clip-path: polygon(0 0, 85% 0, 100% 100%, 0 100%);
  flex-shrink: 0;
  height: var(--header-h);
  min-height: var(--header-h);
  width: 100%;
}

.nav-wrapper {
  flex-shrink: 0;
  padding: 6px 14px 0 16px;
}

.nav-item {
  border-radius: 8px;
  display: block;
  margin-top: 10px;
  overflow: hidden;
  transition: transform 0.15s;
}

.nav-item:first-child { margin-top: 6px; }

.nav-item:hover { transform: scale(1.02); }

.nav-item img {
  aspect-ratio: 460 / 150;
  display: block;
  height: auto;
  object-fit: cover;
  width: 100%;
}

.side-menu {
  color: var(--muted);
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  overflow: hidden auto;
  scrollbar-width: thin;
}

.side-menu::-webkit-scrollbar { width: 3px; }
.side-menu::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 2px; }

.side-menu-bg {
  align-items: center;
  display: flex;
  flex-direction: column;
  padding: 0 14px 20px 16px;
}

/* promoEnter */
.promoEnter-wrap {
  background: var(--red-panel);
  border: 1.5px solid var(--gold-border);
  border-radius: var(--radius);
  margin-top: 14px;
  width: 100%;
}

.promo-title {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-size: 15px;
  font-weight: 700;
  gap: 8px;
  padding: 14px 14px 0;
}

.promo-title .dot {
  color: var(--gold);
  font-size: 18px;
}

.promo-title .arrow {
  color: var(--gold-text);
  font-size: 12px;
  margin-left: auto;
  transition: transform 0.25s;
}

.promoEnter-wrap.open .promo-title .arrow { transform: rotate(90deg); }

.promo-list {
  color: var(--gold-text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  max-height: 0;
  overflow: hidden;
  padding: 0 18px;
  transition: max-height 0.3s ease, padding 0.3s;
}

.promoEnter-wrap.open .promo-list {
  max-height: 280px;
  padding: 12px 18px 0;
}

.promo-list-item {
  cursor: pointer;
  display: block;
  margin-top: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.promo-list-item:hover { color: #fff; }

.more-btn {
  align-items: center;
  background: var(--gold-gradient);
  border: 1.5px solid var(--gold-border);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: flex;
  font-size: 14px;
  font-weight: 700;
  justify-content: center;
  margin: 16px;
  padding: 11px 14px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.side-btn {
  align-items: center;
  background: var(--red-panel);
  border: 1.5px solid var(--gold-border);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  font-size: 15px;
  font-weight: 600;
  gap: 14px;
  margin-top: 14px;
  min-height: 62px;
  padding: 10px 18px;
  position: relative;
  width: 100%;
}

.side-btn:hover { color: #fff; }

.side-btn .side-ico {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  font-size: 1.15rem;
  justify-content: center;
  width: 24px;
}

.side-btn .side-label { flex: 1; line-height: 1.35; }

.download-popup {
  background: rgba(0, 0, 0, 0.65);
  border-radius: 10px;
  display: none;
  gap: 12px;
  left: calc(100% + 8px);
  padding: 14px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  z-index: 10;
}

.download-group:hover .download-popup { display: flex; }

.download-popup a {
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--gold-border);
  border-radius: 8px;
  display: flex;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
  padding: 8px 14px;
}

.channel-group { margin-top: 14px; width: 100%; }

.channel-title {
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.channel-list {
  display: flex;
  gap: 14px;
  justify-content: center;
  padding: 14px 0 4px;
}

.channel-item {
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  font-size: 11px;
  font-weight: 800;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.language-select {
  align-items: center;
  background: var(--red-panel);
  border: 1.5px solid var(--gold-border);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  padding: 10px 14px;
  width: 100%;
}

.lang-selected {
  align-items: center;
  color: var(--gold-text);
  display: flex;
  font-size: 15px;
  font-weight: 500;
  gap: 8px;
}

.lang-flag {
  align-items: center;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  display: flex;
  font-size: 10px;
  height: 22px;
  justify-content: center;
  width: 22px;
}

.lang-arrow { color: var(--gold-text); font-size: 10px; }

/* ===== HEADER ===== */
.header-container {
  background: var(--red-dark);
  height: var(--header-h);
  left: var(--sidebar-w);
  position: fixed;
  right: 0;
  top: 0;
  transition: left 0.25s;
  z-index: 200;
}

body:has(#layoutRoot.sidebar-collapsed) .header-container {
  left: 0;
}

.header-content {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: flex-end;
  padding: 0 25px 0 10px;
}

.header-logo {
  left: calc(var(--sidebar-w) + 12px);
  position: fixed;
  top: 8px;
  transition: left 0.25s, transform 0.25s;
  z-index: 400;
}

body:has(#layoutRoot.sidebar-collapsed) .header-logo {
  left: 58px;
}

.header-logo img,
.header-logo .logo-text {
  display: block;
  height: 50px;
  width: auto;
}

.site-logo img {
  display: block;
  height: 42px;
  width: auto;
}

.logo-text {
  align-items: center;
  color: var(--gold);
  display: flex;
  font-size: 1.5rem;
  font-weight: 800;
}

.login-register { display: flex; gap: 8px; }

.btn-login,
.btn-register {
  align-items: center;
  border-radius: 8px;
  box-sizing: border-box;
  color: #fff;
  display: inline-flex;
  flex: 0 0 152px;
  font-size: 16px;
  font-weight: 700;
  height: 39px;
  justify-content: center;
  padding: 0 12px;
  white-space: nowrap;
  width: 152px;
}

.btn-login {
  background: var(--gold-gradient);
  border: 1.5px solid var(--gold-border);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-register {
  background: var(--red-panel);
  border: 1.5px solid var(--gold-border);
}

.btn-login:hover,
.btn-register:hover { opacity: 0.9; }

.menu-toggle { display: none; }

/* ===== MAIN PAGE ===== */
.page-column {
  background: var(--bg-dark);
  flex: 1;
  min-width: 0;
  width: 100%;
}

.primary-carousel {
  margin: 0 auto;
  max-width: 1085px;
  padding: 16px 16px 0;
}

.primary-viewport {
  overflow: hidden;
  width: 100%;
}

.primary-track {
  display: flex;
  gap: 16px;
  transition: transform 0.45s ease;
  will-change: transform;
}

.primary-slide {
  border-radius: 12px;
  display: block;
  flex: 0 0 calc((100% - 32px) / 3);
  overflow: hidden;
}

.primary-slide img {
  aspect-ratio: 350 / 250;
  background: linear-gradient(135deg, #2a1010, var(--bg-dark));
  display: block;
  height: auto;
  object-fit: cover;
  width: 100%;
}

.primary-progress {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  height: 3px;
  margin: 14px auto 0;
  max-width: 220px;
  overflow: hidden;
  position: relative;
}

.primary-progress-fill {
  background: var(--gold);
  border-radius: inherit;
  height: 100%;
  transition: width 0.45s ease;
  width: 16.666%;
}

.home-container {
  margin: 0 auto;
  max-width: 1085px;
  padding: 18px 16px 50px;
}

.game-menu-bar {
  background: var(--red-panel);
  border: 1.5px solid var(--gold-border);
  border-radius: var(--radius);
  margin-bottom: 22px;
  overflow: hidden;
  padding: 9px 10px;
}

.game-menu-track {
  display: flex;
  gap: 4px;
  width: 100%;
}

.game-menu-item {
  align-items: center;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  font-size: 12px;
  font-weight: 700;
  gap: 4px;
  justify-content: center;
  min-width: 0;
  padding: 6px 2px;
  text-align: center;
  white-space: nowrap;
}

.game-menu-item .menu-ico { font-size: 1.1rem; }

.game-menu-item:hover,
.game-menu-item.active {
  background: var(--gold-gradient);
  color: #fff;
}

.game-section { margin-bottom: 26px; }

.game-title-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.game-title-row h2 {
  color: var(--gold);
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
}

.game-title-row a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.game-title-row a:hover { color: var(--gold); }

.game-grid {
  display: grid;
  gap: 16px 14px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.game-list-item {
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  position: relative;
}

.game-list-item .game-img {
  aspect-ratio: 300 / 400;
  background: linear-gradient(160deg, #2a1010, var(--bg-dark));
  border: 1.5px solid rgba(248, 223, 117, 0.15);
  border-radius: 15px;
  overflow: hidden;
  position: relative;
}

.game-list-item .game-img img {
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
  width: 100%;
}

.game-list-item:hover .game-img img { transform: scale(1.08); }

.game-ph {
  align-items: center;
  color: var(--gold-text);
  display: flex;
  font-size: 11px;
  font-weight: 700;
  height: 100%;
  justify-content: center;
  padding: 8px;
  text-align: center;
}

.action-wrap {
  align-items: center;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 6px;
  inset: 0;
  justify-content: center;
  opacity: 0;
  padding: 8px;
  position: absolute;
  transition: opacity 0.25s;
}

.game-list-item:hover .action-wrap { opacity: 1; }

.action-btn {
  background: var(--gold-gradient);
  border-radius: 8px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 8px;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  width: 100%;
}

.action-btn.outline {
  background: var(--red-panel);
  border: 1.5px solid var(--gold-border);
  color: var(--gold-text);
}

.game-name {
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-tag {
  background: var(--gold-gradient);
  border-radius: 6px;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  left: 6px;
  padding: 2px 5px;
  position: absolute;
  top: 6px;
  z-index: 2;
}

.game-tag.hot { background: #ff4d4d; color: #fff; }

.winner-section { margin-top: 8px; }

.winner-title {
  align-items: center;
  color: var(--gold-title);
  display: flex;
  font-size: 20px;
  font-weight: 700;
  gap: 10px;
  margin-bottom: 12px;
}

.winner-board {
  background: var(--red-panel);
  border: 2px solid var(--gold-border);
  border-radius: 12px;
  height: 420px;
  overflow: hidden;
  padding: 12px 0;
}

.winner-scroll-wrap { height: 100%; overflow: hidden; }

.winner-scroll { animation: winner-scroll 26s linear infinite; }
.winner-scroll:hover { animation-play-state: paused; }

@keyframes winner-scroll {
  from { transform: translateY(0); }
  to { transform: translateY(-50%); }
}

.win-item {
  align-items: center;
  display: flex;
  font-size: 14px;
  height: 43px;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 18px;
}

.win-item:nth-child(odd) { background: rgba(26, 11, 11, 0.35); }

.win-item .rank { color: var(--gold); flex: 0 0 36px; font-weight: 800; text-align: center; }
.win-item .player { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-item .prize { color: var(--gold); flex: 0 0 110px; font-weight: 700; text-align: right; }

.footer-container {
  background: var(--red-footer);
  font-size: 14px;
  padding: 35px 16px 24px;
  text-align: center;
}

.footer-inner {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 auto 24px;
  max-width: 1085px;
  text-align: left;
}

.footer-col h4 { color: var(--gold); font-size: 15px; margin-bottom: 10px; }

.footer-col a {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
}

.footer-col a:hover { color: var(--gold); }

.footer-copy {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  font-size: 12px;
  margin: 0 auto;
  max-width: 1085px;
  padding-top: 16px;
}

.footer-copy strong { color: var(--gold); }

.mobile-footer-bar { display: none; }

.sub-page {
  margin: 0 auto;
  max-width: 860px;
  padding: 32px 16px 48px;
}

.sub-page h1 { color: var(--gold); font-size: clamp(1.35rem, 3vw, 1.85rem); margin-bottom: 1rem; }
.sub-page h2 { color: var(--gold-title); font-size: 1.05rem; margin: 1.25rem 0 0.5rem; }
.sub-page p { margin-bottom: 0.85rem; opacity: 0.92; }

/* ===== ARTICLE ===== */
.article-block { margin-top: 28px; }

.article { color: rgba(255, 255, 255, 0.92); }

.article h1 {
  color: var(--gold);
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 1rem;
  text-align: center;
}

.article h2 {
  color: var(--gold);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.5rem 0 0.6rem;
}

.article p {
  font-size: 0.92rem;
  line-height: 1.75;
  margin-bottom: 0.85rem;
  opacity: 0.9;
}

.article a {
  color: var(--gold);
  font-weight: 700;
  text-decoration: none;
}

.article a:hover {
  color: #fff;
  text-decoration: underline;
}

.toc-box {
  background: var(--red-panel);
  border: 1.5px solid var(--gold-border);
  border-radius: var(--radius);
  margin: 1.25rem 0 1.5rem;
  padding: 14px 16px;
}

.toc-box strong {
  color: var(--gold-title);
  display: block;
  margin-bottom: 10px;
  text-align: center;
}

.toc-box ol {
  color: var(--muted);
  font-size: 0.88rem;
  margin-left: 1.2rem;
}

.toc-box a {
  color: var(--gold-text);
  font-weight: 700;
  text-decoration: none;
}

.toc-box a:hover {
  color: #fff;
  text-decoration: underline;
}

.faq-list { margin-top: 12px; }

.faq-list details {
  background: rgba(192, 0, 0, 0.35);
  border: 1px solid rgba(248, 223, 117, 0.2);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.faq-list details[open] {
  background: rgba(192, 0, 0, 0.5);
  border-color: var(--gold-border);
}

.faq-list summary {
  color: var(--gold-title);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  list-style: none;
  padding: 12px 14px;
}

.faq-list summary::-webkit-details-marker { display: none; }

.faq-list summary::after {
  content: '+';
  float: right;
  font-weight: 700;
}

.faq-list details[open] summary::after { content: '−'; }

.faq-list details p {
  border-top: 1px solid rgba(248, 223, 117, 0.12);
  font-size: 0.88rem;
  margin: 0;
  padding: 0 14px 12px;
}

@media (max-width: 1100px) {
  .game-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .primary-slide { flex: 0 0 calc((100% - 16px) / 2); }
  .game-menu-bar { overflow-x: auto; scrollbar-width: none; }
  .game-menu-bar::-webkit-scrollbar { display: none; }
  .game-menu-track { min-width: max-content; width: auto; }
  .game-menu-item {
    flex: 0 0 auto;
    font-size: 13px;
    min-width: 76px;
    padding: 6px 8px;
  }
  .layout-root { padding-left: 0; }

  body:has(#layoutRoot.sidebar-collapsed) .header-container {
    left: 0;
  }

  .sidebar-toggle { display: none; }

  .side-column {
    transform: translateX(-100%);
  }

  .side-column.is-open { transform: translateX(0); }

  .header-container { left: 0; width: 100%; }

  .header-logo {
    left: 50%;
    transform: translateX(-50%);
  }

  body:has(#sideColumn.is-open) .header-logo {
    left: calc(var(--sidebar-w) + (100vw - var(--sidebar-w)) / 2);
    transform: translateX(-50%);
  }

  body:has(#layoutRoot.sidebar-collapsed) .header-logo {
    left: 50%;
    transform: translateX(-50%);
  }

  .menu-toggle {
    align-items: center;
    background: var(--red-panel);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    height: 38px;
    justify-content: center;
    left: 10px;
    padding: 8px;
    position: fixed;
    top: 12px;
    width: 38px;
    z-index: 400;
  }

  .menu-toggle span {
    background: var(--gold);
    border-radius: 2px;
    display: block;
    height: 2px;
    width: 18px;
  }

  .footer-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .primary-slide { flex: 0 0 calc(100% - 48px); }
  .primary-track { gap: 12px; }
}

@media (max-width: 768px) {
  body { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }

  .login-register { display: none; }

  .mobile-footer-bar {
    background: var(--bg-dark);
    border-top: 1.5px solid var(--gold-border);
    bottom: 0;
    display: flex;
    gap: 10px;
    left: 0;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    position: fixed;
    right: 0;
    z-index: 200;
  }

  .mobile-footer-bar .btn-login,
  .mobile-footer-bar .btn-register { flex: 1; min-height: 44px; }

  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .win-item .prize { flex: 0 0 90px; font-size: 12px; }
}

@media (max-width: 520px) {
  .footer-inner { grid-template-columns: 1fr; }
}
