:root {
  --bg: #050505;
  --panel: #111;
  --panel-2: #191919;
  --gold: #ffcf40;
  --gold-2: #b88905;
  --cyan: #00e4ff;
  --text: #fff;
  --muted: #b7b7b7;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Kanit", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 85% 0%, #2b1b03, var(--bg) 34%);
}

a { color: inherit; }
img { max-width: 100%; display: block; }

.mobile-login-header,
.mobile-action-bar,
.mobile-menu-panel,
.mobile-drawer,
.mobile-only {
  display: none !important;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 12px 8px;
  overflow-y: auto;
  background: linear-gradient(180deg, #101010, #050505);
  border-right: 1px solid #282828;
}

.logo {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  margin-bottom: 12px;
}

.logo span {
  color: var(--gold);
  font-size: 26px;
  font-weight: 800;
}

.left-menu {
  display: grid;
  gap: 8px;
}

.menu-item {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  text-decoration: none;
  background: #171717;
  border: 1px solid #292929;
  border-radius: 8px;
  transition: .2s ease;
}

.menu-item img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex: 0 0 38px;
}

.menu-item span {
  font-size: 15px;
  font-weight: 700;
}

.menu-item.active,
.menu-item:hover {
  background: linear-gradient(180deg, #7b6500, #4a3d00);
  border-color: var(--gold-2);
}

.line-banner { display: block; margin-top: 14px; }
.line-banner img { width: 100%; border-radius: 8px; }

.content {
  min-width: 0;
  padding: 0 16px 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  width: calc(100% + 32px);
  margin-left: -16px;
  margin-right: -16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, .94);
  border-bottom: 1px solid #292929;
  backdrop-filter: blur(8px);
}

.top-icons,
.actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.top-icons {
  min-width: 0;
  overflow-x: auto;
}

.top-icons a,
.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
  font-weight: 700;
  background: #151515;
  border: 1px solid #333;
  border-radius: 8px;
  font-size: 15px;
}

.actions .btn {
  width: 108px;
  min-height: 38px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 14px;
}

.top-icons i { color: var(--gold); }

.btn.primary {
  background: linear-gradient(180deg, #806800, #4f3d00);
  border-color: var(--gold-2);
}

.ticker {
  margin: 10px 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  padding: 9px 12px;
  background: #101010;
  border: 1px solid #252525;
  border-radius: 10px;
}

.ticker i { color: var(--gold); flex: 0 0 auto; }

.ticker-track {
  display: flex;
  gap: 60px;
  white-space: nowrap;
  animation: ticker 18s linear infinite;
}

@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-45%); }
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 8px 44px;
  background: #080808;
  border: 1px solid #2b2b2b;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,.35);
}

.slides {
  display: flex;
  gap: 10px;
  transition: transform .45s ease;
}

.slide {
  min-width: calc((100% - 20px) / 3);
  overflow: hidden;
  border: 1px solid #2b2b2b;
  border-radius: 8px;
  background: #000;
}

.slide img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
}

img.image-failed { display: none !important; }

.slide.has-image-fallback,
.game-card.has-image-fallback {
  min-height: 120px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(255, 207, 64, .18), transparent 42%),
    linear-gradient(180deg, #1a1a1a, #070707);
}

.slide.has-image-fallback::before {
  content: "CAM168 โปรโมชั่นคาสิโนออนไลน์";
  padding: 18px;
  color: var(--gold);
  text-align: center;
  font-size: clamp(22px, 3vw, 40px);
  font-weight: 800;
}

.slider-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  color: #fff;
  cursor: pointer;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 999px;
}

.slider-nav.prev { left: 6px; }
.slider-nav.next { right: 6px; }

.dots {
  position: absolute;
  left: 50%;
  bottom: 10px;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
}

.dot {
  width: 8px;
  height: 8px;
  padding: 0;
  cursor: pointer;
  background: #777;
  border: 0;
  border-radius: 999px;
}

.dot.active { background: var(--gold); }

.section-head h1,
.steps h2 {
  margin: 24px 0 14px;
  text-align: center;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.15;
}

.game-grid,
.slot-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.game-card {
  position: relative;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  background: var(--panel);
  border: 1px solid #2b2b2b;
  border-radius: 8px;
}

.game-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
}

.game-card h3 {
  margin: 7px 8px 9px;
  font-size: 18px;
  line-height: 1.1;
}

.game-card.has-image-fallback h3 {
  align-self: end;
  width: 100%;
  margin: 0;
  padding: 8px;
  text-align: center;
  background: rgba(0, 0, 0, .45);
}

.game-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0,0,0,0);
  transition: .2s ease;
}

.game-card::after {
  content: "Play";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  padding: 8px 18px;
  color: #fff;
  font-weight: 700;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.92);
  background: linear-gradient(180deg, #ffbd57, #ff9217);
  border: 1px solid #ffd08a;
  border-radius: 8px;
  transition: .2s ease;
}

.game-card:hover::before { background: rgba(0,0,0,.4); }
.game-card:hover::after { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.slot-feature {
  margin-top: 20px;
  padding: 12px;
  background: linear-gradient(180deg, #0d0d0d, #060606);
  border: 1px solid #2b2b2b;
  border-radius: 10px;
}

.slot-feature h1 {
  margin: 4px 0 14px;
  text-align: center;
  font-size: clamp(20px, 2.6vw, 34px);
  line-height: 1.15;
}

.slot-head {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.slot-head img {
  width: 82px;
  height: 82px;
  object-fit: contain;
}

.menu-item.has-image-fallback img,
.slot-head.has-image-fallback img,
.line-banner.has-image-fallback img {
  display: none !important;
}

.menu-item.has-image-fallback::before {
  content: "★";
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--gold);
  background: #222;
  border-radius: 50%;
  flex: 0 0 38px;
}

.line-banner.has-image-fallback {
  min-height: 44px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  background: linear-gradient(180deg, #24d363, #0da946);
  border-radius: 8px;
}

.line-banner.has-image-fallback::before {
  content: "LINE บริการ 24 ชม.";
}

.slot-head h2 {
  margin: 0;
  color: var(--gold);
  font-size: clamp(22px, 2.8vw, 38px);
}

.steps {
  margin-top: 18px;
  padding: 10px 14px 20px;
  background: linear-gradient(180deg, #100f0d, #090909);
  border: 1px solid #292929;
  border-radius: 10px;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.step {
  padding: 14px;
  background: #111;
  border: 1px solid #303030;
  border-radius: 8px;
}

.step span {
  color: var(--gold);
  font-size: 28px;
  font-weight: 800;
}

.step h3 { margin: 0 0 8px; font-size: 22px; }
.step p { margin: 0; color: var(--muted); font-size: 16px; }

.footer {
  margin-top: 20px;
  padding: 18px 12px 0;
  text-align: center;
  border-top: 1px solid #2a2a2a;
}

.footer h4 {
  margin: 8px 0 6px;
  color: var(--gold);
  font-size: 22px;
}

.footer p { margin: 0 0 6px; color: #c3c3c3; font-size: 16px; }
.footer small { color: #8c8c8c; font-size: 14px; }

.line-backup-float {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 70;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  background: linear-gradient(180deg, #1fd35d, #12aa46);
  border: 1px solid #4cff8e;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(0,0,0,.35);
}

@media (max-width: 1024px) {
  body { background: #050505; }

  .desktop-only { display: none !important; }

  .app {
    display: block;
    min-height: 100vh;
  }

  .content {
    padding: 0 8px 96px;
  }

  .mobile-login-header {
    position: sticky;
    top: 0;
    z-index: 80;
    height: 58px;
    display: grid !important;
    grid-template-columns: 30px 96px 1fr;
    align-items: center;
    gap: 8px;
    padding: 8px;
    overflow: hidden;
    background: #070707;
    border-bottom: 1px solid #202020;
  }

  .mobile-menu-toggle {
    width: 28px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #fff;
    background: transparent;
    border: 0;
    font-size: 25px;
  }

  .mobile-header-logo {
    width: 96px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    text-decoration: none;
    font-size: 22px;
    font-weight: 800;
    background: #151515;
    border: 1px solid #3a2f0c;
    border-radius: 7px;
  }

  .mobile-header-actions {
    min-width: 0;
    display: flex;
    justify-content: flex-end;
    gap: 6px;
  }

  .mobile-header-actions a {
    width: 78px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 700;
    background: #0b0b0b;
    border: 1px solid var(--cyan);
    border-radius: 12px;
  }

  .ticker {
    margin: 8px 0;
    padding: 7px 8px;
    border-radius: 6px;
  }

  .ticker-track span { font-size: 14px; }

  .hero {
    padding: 6px 26px;
    border-radius: 8px;
  }

  .slide { min-width: 100%; }
  .slider-nav { width: 30px; height: 30px; }

  .section-head h1 {
    margin: 12px 0 8px;
    font-size: clamp(22px, 7vw, 32px);
    line-height: 1.18;
  }

  .game-grid,
  .slot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .game-card h3 {
    margin: 5px 6px 7px;
    font-size: 14px;
  }

  .game-card::before {
    background: rgba(0,0,0,.28);
  }

  .game-card::after {
    top: auto;
    bottom: 12px;
    opacity: 1 !important;
    transform: translateX(-50%) scale(1);
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 7px;
  }

  .slot-feature { padding: 8px; }
  .slot-feature h1 { font-size: clamp(18px, 5.8vw, 27px); }

  .slot-head {
    grid-template-columns: 58px 1fr;
    gap: 8px;
  }

  .slot-head img { width: 52px; height: 52px; }
  .slot-head h2 { font-size: clamp(18px, 6vw, 26px); }

  .steps-grid { grid-template-columns: 1fr; }
  .footer { padding-bottom: 84px; }

  .line-backup-float {
    right: 10px;
    bottom: 84px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .mobile-action-bar {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 8px;
    z-index: 90;
    height: 66px;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow: hidden;
    background: linear-gradient(180deg, #171717, #080808);
    border: 1px solid #353535;
    border-radius: 14px;
    box-shadow: 0 10px 26px rgba(0,0,0,.5);
  }

  .mobile-action-bar a {
    min-width: 0;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 3px;
    padding: 6px 2px;
    color: #fff;
    text-decoration: none;
    font-size: 10px;
    font-weight: 700;
    border-right: 1px solid #292929;
  }

  .mobile-action-bar a:last-child { border-right: 0; }
  .mobile-action-bar i { color: #ffd46b; font-size: 20px; }
  .mobile-action-bar a.active { background: radial-gradient(circle at 50% 10%, #4b2020, #120606 68%); }

  .mobile-menu-panel {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: none !important;
  }

  body.menu-open .mobile-menu-panel {
    display: block !important;
  }

  .mobile-menu-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(0, 0, 0, .72);
  }

  .mobile-menu-content {
    position: absolute;
    top: 0;
    left: 0;
    width: min(280px, 82vw);
    height: 100%;
    display: grid;
    align-content: start;
    gap: 8px;
    padding: 18px 12px 90px;
    overflow-y: auto;
    background: #080808;
    border-right: 1px solid var(--cyan);
    box-shadow: 18px 0 34px rgba(0, 0, 0, .5);
  }

  .mobile-menu-close {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #fff;
    background: transparent;
    border: 0;
    font-size: 28px;
  }

  .mobile-menu-content strong {
    color: var(--gold);
    font-size: 28px;
    line-height: 1;
    margin: 0 0 8px;
  }

  .mobile-menu-content a {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    background: #171717;
    border: 1px solid #2d2d2d;
    border-radius: 8px;
  }

  .mobile-menu-content i {
    color: var(--gold);
    width: 22px;
    text-align: center;
  }
}

@media (max-width: 380px) {
  .mobile-login-header {
    grid-template-columns: 26px 86px 1fr;
    gap: 5px;
  }

  .mobile-header-logo {
    width: 86px;
    font-size: 20px;
  }

  .mobile-header-actions a {
    width: 70px;
    font-size: 10px;
  }
}
