:root {
  --bg: #0a0a0a;
  --shell: #121212;
  --surface: #181818;
  --panel: #1f1f1f;
  --sidebar-w: 200px;
  --sidebar-w-mobile: 118px;
  --header-h: 64px;
  --primary: #ff6b00;
  --primary-dark: #e85d04;
  --primary-light: #ffb347;
  --green: #22c55e;
  --green-dark: #16a34a;
  --cream: #ffe0b2;
  --text: #ffffff;
  --muted: #9ca3af;
  --shell-max: 1320px;
  --radius: 12px;
  --radius-pill: 999px;
  --side-menu-w: 168px;
  --font: "Noto Sans Thai", "Sarabun", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: #000;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  min-height: 100vh;
}

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; }

.app-shell {
  background: var(--shell);
  margin: 0 auto;
  max-width: var(--shell-max);
  min-height: 100vh;
}

/* ===== TOP HEADER ===== */
.topbar {
  align-items: center;
  background: var(--bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  gap: 16px;
  height: var(--header-h);
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar .brand-logo { height: 46px; width: auto; }

.topnav {
  align-items: center;
  display: none;
  flex: 1;
  gap: clamp(10px, 1.4vw, 20px);
  justify-content: center;
  min-width: 0;
}

.topnav a {
  color: #e5e7eb;
  font-size: clamp(12px, 1.1vw, 14px);
  font-weight: 600;
  white-space: nowrap;
}

.topnav a:hover,
.topnav a.active { color: var(--primary-light); }

.topbar-actions {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  gap: 10px;
}

.topbar-actions .btn-pill {
  flex: 0 0 150px;
  width: 150px;
}

.btn-pill,
.btn-pill:link,
.btn-pill:visited {
  align-items: center;
  background: transparent;
  border: 1.5px solid var(--primary-light);
  border-radius: var(--radius-pill);
  box-sizing: border-box;
  color: var(--primary-light);
  display: inline-flex;
  font-size: 14px;
  font-weight: 700;
  height: 38px;
  justify-content: center;
  padding: 0 12px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn-pill:hover {
  background: rgba(255, 179, 71, 0.14);
  border-color: #ffc870;
  color: #ffc870;
}

.menu-toggle {
  display: none;
}

/* ===== BODY LAYOUT ===== */
.layout-body {
  align-items: start;
  column-gap: 6px;
  display: grid;
  grid-template-columns: var(--side-menu-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--header-h));
  padding: 12px 12px 32px;
  position: relative;
  row-gap: 0;
}

/* ===== LEFT SIDEBAR ===== */
.side-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  position: sticky;
  top: calc(var(--header-h) + 10px);
  width: var(--side-menu-w);
  z-index: 40;
}

.side-item {
  align-items: center;
  background: linear-gradient(180deg, #4a4a4a 0%, #2b2b2b 100%);
  border-radius: 16px;
  box-sizing: border-box;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  color: #fff;
  display: flex;
  flex-direction: row;
  font-size: 12px;
  font-weight: 700;
  gap: 8px;
  min-height: 48px;
  padding: 8px 10px;
  text-align: left;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  width: 100%;
}

.side-item .side-ico {
  align-items: center;
  display: flex;
  flex: 0 0 40px;
  height: 40px;
  justify-content: center;
  position: relative;
  width: 40px;
}

.side-item .side-emoji {
  align-items: center;
  display: flex;
  font-size: 22px;
  height: 100%;
  justify-content: center;
  line-height: 1;
  width: 100%;
}

.side-item .side-ico img {
  display: block;
  height: 40px;
  left: 0;
  object-fit: contain;
  position: absolute;
  top: 0;
  width: 40px;
}

.side-item .side-ico:has(img) .side-emoji {
  visibility: hidden;
}

.side-label {
  flex: 1;
  font-size: 12px;
  line-height: 1.15;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-item.active {
  background: linear-gradient(180deg, #ff7a1a 0%, var(--primary) 55%, var(--primary-dark) 100%);
  box-shadow: 0 3px 10px rgba(255, 107, 0, 0.35);
  color: #fff;
}

.side-item:hover:not(.active) {
  background: linear-gradient(180deg, #565656 0%, #333 100%);
  transform: translateY(-1px);
}

.side-overlay {
  background: rgba(0, 0, 0, 0.55);
  display: none;
  inset: 0;
  position: fixed;
  z-index: 140;
}

.side-overlay.is-open {
  display: block;
}

body.side-open {
  overflow: hidden;
}

/* ===== MAIN PANEL ===== */
.main-panel {
  background: var(--bg);
  min-width: 0;
  padding: 0;
  position: relative;
  width: 100%;
}

.hero-banner { margin-bottom: 18px; }

.banner-viewport { overflow: hidden; width: 100%; }

.banner-track {
  display: flex;
  gap: 0;
  transition: transform 0.45s ease;
}

.banner-slide {
  border-radius: var(--radius);
  flex: 0 0 100%;
  overflow: hidden;
}

.banner-slide picture {
  display: block;
  width: 100%;
}

.banner-slide img {
  aspect-ratio: 750 / 1000;
  background: var(--panel);
  display: block;
  object-fit: cover;
  width: 100%;
}

@media (min-width: 641px) {
  .banner-slide img {
    aspect-ratio: 1920 / 720;
  }
}

.banner-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 10px;
}

.banner-dot {
  background: rgba(255, 255, 255, 0.25);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  height: 6px;
  transition: width 0.25s, background 0.25s;
  width: 6px;
}

.banner-dot.active {
  background: var(--primary);
  width: 20px;
}

.section-label {
  align-items: center;
  color: var(--cream);
  display: flex;
  font-size: 15px;
  font-weight: 700;
  gap: 8px;
  margin-bottom: 12px;
}

.section-label .fire { font-size: 18px; }

/* ===== PROVIDER GRID ===== */
.provider-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 14px;
  width: 100%;
}

.provider-tile {
  aspect-ratio: 1;
  background: #0a0a0a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  display: block;
  min-width: 0;
  overflow: hidden;
  position: relative;
  transition: transform 0.15s, border-color 0.15s;
  width: 100%;
}

.provider-tile:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.provider-tile img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.provider-tile .prov-fallback {
  display: none;
}

.provider-tile:not(:has(img)) {
  align-items: center;
  display: flex;
  flex-direction: column;
  font-size: 13px;
  font-weight: 800;
  gap: 4px;
  justify-content: center;
  text-transform: uppercase;
}

.provider-tile:not(:has(img)) .prov-fallback {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}

.provider-tile:not(:has(img)) .prov-fallback span:first-child {
  color: var(--primary-light);
  font-size: 22px;
  line-height: 1;
}

.provider-tile:not(:has(img)) .prov-fallback span:last-child {
  color: #fff;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.provider-tile .prov-label {
  align-items: center;
  background: rgba(0, 0, 0, 0.55);
  bottom: 0;
  display: flex;
  font-size: 11px;
  font-weight: 700;
  justify-content: center;
  left: 0;
  padding: 6px 4px;
  position: absolute;
  right: 0;
}

.provider-tile.text-only {
  align-items: center;
  display: flex;
  flex-direction: column;
  font-size: 13px;
  font-weight: 800;
  gap: 4px;
  justify-content: center;
  text-transform: uppercase;
}

.provider-tile.text-only span:first-child {
  color: var(--primary-light);
  font-size: 22px;
}

/* ===== GAME GRID ===== */
.game-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.game-tile {
  display: block;
  position: relative;
}

.game-tile .thumb {
  aspect-ratio: 1;
  background: var(--panel);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.game-tile .thumb img {
  display: block;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s;
  width: 100%;
}

.game-tile:hover .thumb img { transform: scale(1.05); }

.game-tile .play-mask {
  align-items: center;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  inset: 0;
  justify-content: center;
  opacity: 0;
  position: absolute;
  transition: opacity 0.2s;
}

.game-tile:hover .play-mask,
.game-tile:focus-visible .play-mask { opacity: 1; }

.play-btn {
  background: linear-gradient(180deg, #ff7a1a 0%, var(--primary) 100%);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(255, 107, 0, 0.45);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  min-width: 72px;
  padding: 8px 18px;
  text-align: center;
}

/* ===== ARTICLE ===== */
.breadcrumb {
  font-size: 0.78rem;
  margin-bottom: 1rem;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.breadcrumb li {
  align-items: center;
  color: rgba(255, 255, 255, 0.55);
  display: flex;
  gap: 6px;
}

.breadcrumb li + li::before {
  color: rgba(255, 123, 0, 0.5);
  content: "/";
}

.breadcrumb a {
  color: var(--primary-light);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: #fff;
  text-decoration: underline;
}

.breadcrumb [aria-current] {
  color: rgba(255, 255, 255, 0.75);
}

.article-block {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 32px;
  padding-top: 24px;
}

.article h1 {
  color: var(--primary-light);
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
  font-weight: 800;
  margin-bottom: 1rem;
  text-align: center;
}

.article h2 {
  color: var(--primary-light);
  font-size: 1rem;
  font-weight: 700;
  margin: 1.25rem 0 0.5rem;
}

.article p {
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.9rem;
  line-height: 1.75;
  margin-bottom: 0.8rem;
}

.article p a.article-brand {
  color: var(--primary-light);
  font-weight: 700;
  text-decoration: none;
}

.article p a.article-brand:hover {
  color: #fff;
  text-decoration: underline;
}

.toc-box {
  background: rgba(255, 107, 0, 0.08);
  border: 1px solid rgba(255, 123, 0, 0.25);
  border-radius: 10px;
  margin: 1.25rem 0 1.5rem;
  padding: 14px 16px;
}

.toc-box strong {
  color: var(--primary-light);
  display: block;
  font-size: 0.95rem;
  margin-bottom: 10px;
  text-align: center;
}

.toc-box ol {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.88rem;
  margin-left: 1.2rem;
}

.toc-box a {
  color: var(--primary-light);
  text-decoration: none;
}

.toc-box a:hover {
  color: #fff;
  text-decoration: underline;
}

.faq-list { margin-top: 12px; }

.faq-list details {
  background: rgba(255, 107, 0, 0.1);
  border: 1px solid rgba(255, 123, 0, 0.2);
  border-radius: 8px;
  margin-bottom: 8px;
}

.faq-list summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  list-style: none;
  padding: 12px 14px;
}

.faq-list summary::-webkit-details-marker { display: none; }

.faq-list details p {
  border-top: 1px solid rgba(255, 123, 0, 0.12);
  margin: 0;
  padding: 0 14px 12px;
}

.site-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 12px;
  margin-top: 28px;
  padding-top: 20px;
  text-align: center;
}

.footer-copy {
  font-size: 0.82rem;
  margin: 0;
  text-align: center;
}

.footer-copy strong {
  color: var(--primary-light);
  font-weight: 700;
}

/* ===== BOTTOM NAV ===== */
.main-panel,
.sub-main,
.sub-page {
  padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
}

.bottom-nav-ico img[data-fallback="hidden"] {
  display: none;
}

.bottom-nav {
  align-items: flex-end;
  background: linear-gradient(180deg, #222 0%, #101010 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  bottom: 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  height: calc(66px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  max-width: var(--shell-max);
  padding: 0 12px env(safe-area-inset-bottom, 0px);
  position: fixed;
  transform: translateX(-50%);
  width: 100%;
  z-index: 200;
}

.bottom-nav-item {
  align-items: center;
  box-sizing: border-box;
  color: #fff;
  display: flex;
  flex-direction: column;
  font-size: 10px;
  font-weight: 700;
  gap: 4px;
  justify-content: flex-end;
  justify-self: stretch;
  min-height: 66px;
  min-width: 0;
  padding: 8px 6px 10px;
  position: relative;
  text-align: center;
  width: 100%;
}

.bottom-nav-item.active {
  background: transparent;
}

.bottom-nav-item.active::before {
  background: rgba(255, 255, 255, 0.07);
  border-radius: 12px 12px 0 0;
  content: "";
  inset: 2px 5px 0;
  position: absolute;
  z-index: 0;
}

.bottom-nav-item.active .bottom-nav-ico,
.bottom-nav-item.active .bottom-nav-label {
  position: relative;
  z-index: 1;
}

.bottom-nav-item.active::after {
  background: var(--primary-light);
  border-radius: 3px 3px 0 0;
  bottom: 0;
  box-shadow: 0 0 8px rgba(255, 179, 71, 0.65);
  content: "";
  height: 3px;
  left: 18%;
  position: absolute;
  right: 18%;
  z-index: 1;
}

.bottom-nav-ico {
  align-items: center;
  background: rgba(255, 179, 71, 0.08);
  border: 1px dashed rgba(255, 179, 71, 0.28);
  border-radius: 8px;
  display: flex;
  flex-shrink: 0;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.bottom-nav-ico:has(img:not([data-fallback="hidden"])) {
  background: transparent;
  border-color: transparent;
}

.bottom-nav-ico img {
  display: block;
  height: 28px;
  object-fit: contain;
  width: 28px;
}

.bottom-nav-label {
  line-height: 1.1;
  white-space: nowrap;
}

.bottom-nav-item--center {
  padding-bottom: 8px;
}

.bottom-nav-item--center .bottom-nav-ico {
  background: radial-gradient(circle at 50% 35%, rgba(255, 200, 80, 0.25), rgba(0, 0, 0, 0.35));
  border: 1px dashed rgba(255, 179, 71, 0.35);
  border-radius: 50%;
  height: 54px;
  margin-top: -26px;
  width: 54px;
}

.bottom-nav-item--center .bottom-nav-ico:has(img:not([data-fallback="hidden"])) {
  border-color: transparent;
}

.bottom-nav-item--center .bottom-nav-ico img {
  height: 46px;
  width: 46px;
}

.bottom-nav-item--center.active::after {
  left: 24%;
  right: 24%;
}

@media (min-width: 901px) {
  .bottom-nav {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
    border-radius: 18px 18px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    bottom: 0;
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.4);
    grid-template-columns: repeat(5, minmax(0, 1fr));
    height: calc(72px + env(safe-area-inset-bottom, 0px));
    max-width: min(600px, calc(100vw - 32px));
    padding: 0 16px env(safe-area-inset-bottom, 0px);
    width: min(600px, calc(100vw - 32px));
  }

  .bottom-nav-item {
    font-size: 11px;
    min-height: 72px;
    padding: 10px 8px 12px;
  }

  .bottom-nav-item:not(.active) {
    color: rgba(255, 255, 255, 0.55);
    font-weight: 600;
  }

  .bottom-nav-item.active::before {
    border-radius: 10px 10px 0 0;
    inset: 4px 6px 0;
  }

  .bottom-nav-item:first-child.active::before {
    border-top-left-radius: 8px;
    left: 8px;
  }

  .bottom-nav-item:last-child.active::before {
    border-top-right-radius: 8px;
    right: 8px;
  }

  .bottom-nav-label {
    font-size: 11px;
  }
}

/* ===== SUB PAGES ===== */
.sub-page {
  margin: 0 auto;
  max-width: 860px;
  padding: 28px 20px 48px;
}

.sub-page h1 {
  color: var(--primary-light);
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  margin-bottom: 1rem;
}

.sub-page h2 {
  color: var(--primary-light);
  font-size: 1.05rem;
  margin: 1.2rem 0 0.5rem;
}

.promo-enter-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.promo-enter-item {
  align-items: center;
  background: rgba(255, 107, 0, 0.12);
  border: 1px solid rgba(255, 123, 0, 0.25);
  border-radius: var(--radius);
  display: flex;
  font-size: 15px;
  font-weight: 700;
  gap: 10px;
  padding: 18px 16px;
}

.sub-main { padding: 24px 20px 40px; }

@media (min-width: 768px) {
  .topnav { display: flex; }
}

@media (min-width: 901px) {
  .layout-body {
    column-gap: 10px;
    grid-template-columns: var(--side-menu-w) minmax(0, 1fr);
    padding: 16px 18px 32px;
  }

  .side-menu {
    position: sticky;
    top: calc(var(--header-h) + 16px);
    transform: none;
    width: var(--side-menu-w);
  }

  .side-item {
    font-size: 14px;
    gap: 10px;
    min-height: 56px;
    padding: 8px 12px 8px 10px;
    width: 100%;
  }

  .side-item .side-ico {
    flex: 0 0 48px;
    height: 48px;
    width: 48px;
  }

  .side-item .side-ico img {
    height: 48px;
    width: 48px;
  }

  .side-label {
    font-size: 14px;
    line-height: 1.2;
  }
}

@media (max-width: 1100px) {
  .game-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .provider-grid {
    gap: 6px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .layout-body {
    grid-template-columns: 1fr;
  }

  .topbar {
    gap: 8px;
    justify-content: flex-start;
    padding: 0 12px;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .side-menu {
    background: var(--bg);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    bottom: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    left: 0;
    overflow-y: auto;
    padding: 14px 10px;
    pointer-events: none;
    position: fixed;
    top: var(--header-h);
    transform: translateX(-110%);
    transition: transform 0.28s ease;
    width: min(82vw, 260px);
    z-index: 150;
  }

  .side-menu.is-open {
    pointer-events: auto;
    transform: translateX(0);
  }

  .side-item {
    box-sizing: border-box;
    width: 100%;
  }

  .side-item:hover:not(.active) {
    transform: none;
  }

  .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .menu-toggle {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 36px;
    justify-content: center;
    padding: 8px;
    width: 36px;
  }

  .menu-toggle span {
    background: #fff;
    border-radius: 2px;
    display: block;
    height: 2px;
    width: 18px;
  }
}

@media (max-width: 520px) {
  .layout-body {
    padding: 10px 10px 32px;
  }

  .side-menu {
    padding: 12px 8px;
    width: min(86vw, 240px);
  }

  .side-item {
    font-size: 11px;
    min-height: 44px;
    padding: 7px 5px;
  }

  .side-item .side-ico {
    flex: 0 0 36px;
    height: 36px;
    width: 36px;
  }

  .side-item .side-ico img {
    height: 36px;
    width: 36px;
  }

  .side-label {
    font-size: 11px;
  }

  .provider-grid,
  .game-grid {
    gap: 6px;
  }

  .provider-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .game-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .provider-tile.text-only { font-size: 11px; }

  .provider-tile.text-only span:first-child { font-size: 18px; }

  .topbar-actions .btn-pill {
    flex: 1 1 0;
    font-size: 11px;
    height: 34px;
    min-width: 0;
    padding: 0 6px;
    width: auto;
  }

  .promo-enter-grid { grid-template-columns: 1fr; }
}
