:root {
  --bg: #08090c;
  --bg-2: #0d0e13;
  --card: #12131a;
  --card-hover: #171922;
  --surface: #181a24;
  --border: #232634;
  --border-strong: rgba(255, 255, 255, 0.24);
  --white: #ffffff;
  --offwhite: #e4e4e7;
  --muted: #9ca3af;
  --dim: #6b7280;
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --amber: #f59e0b;
  --red: #f43f5e;
  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.55);
  --font-sans: 'Noto Sans Thai', 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'Noto Sans Thai', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 460px at 50% -120px, rgba(255, 255, 255, 0.065), transparent 62%),
    radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: auto, 26px 26px;
  color: var(--white);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: var(--white);
  text-decoration: none;
}

.mono {
  font-family: var(--font-mono);
}

.hidden {
  display: none !important;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 22px;
}

/* Promo Top Strip */
.promo-ribbon {
  background: var(--white);
  color: #09090b;
  font-size: 0.83rem;
  font-weight: 700;
  text-align: center;
  padding: 8px 16px;
  letter-spacing: 0.01em;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 9, 12, 0.86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.navbar-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 13px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
  color: var(--white);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--white);
  color: #08090c;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.86rem;
}

.nav-center {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-center a {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.14s ease;
}

.nav-center a:hover {
  color: var(--white);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 9px;
}

.wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--white);
}

.wallet-pill .amt {
  color: var(--green);
  font-family: var(--font-mono);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.75);
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.off {
  background: var(--red);
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.65);
}

/* Buttons (Black primary / Crisp White secondary) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--white);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: #232635;
  border-color: var(--white);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-white {
  background: var(--white);
  border-color: var(--white);
  color: #090a0f;
  font-weight: 700;
}

.btn-white:hover:not(:disabled) {
  background: #e4e4e7;
  border-color: #e4e4e7;
  color: #090a0f;
}

.btn-out {
  background: #262936;
  border-color: #323646;
  color: #9ca3af;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: transparent;
  color: var(--white);
}

/* Hero */
.hero {
  padding: 44px 0 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--offwhite);
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.hero h1 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4.8vw, 3.45rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  color: var(--white);
}

.hero p.lead {
  margin: 0 0 22px;
  max-width: 600px;
  font-size: 0.98rem;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-stats {
  margin-top: 28px;
  width: 100%;
  max-width: 720px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 15px;
  overflow: hidden;
}

.hero-stat {
  padding: 14px 16px;
  border-right: 1px solid var(--border);
}

.hero-stat:last-child {
  border-right: none;
}

.hero-stat .k {
  font-size: 0.76rem;
  color: var(--dim);
}

.hero-stat .v {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--white);
  margin-top: 2px;
}

/* Section */
.section {
  padding: 26px 0;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.48rem;
  letter-spacing: -0.025em;
}

.section-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* =========================================================
   GAME-CARD GRID (Inspired by Reference Screenshot!)
   Dark primary theme + Crisp Metallic White Frame
   ========================================================= */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.game-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.35);
}

.game-card.featured {
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 24px 65px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.18) inset;
}

/* Outer metallic white/silver frame matching reference left card */
.art-frame {
  position: relative;
  border-radius: 15px;
  padding: 5px;
  background: linear-gradient(165deg, #ffffff 0%, #c8ccd6 48%, #737784 100%);
  aspect-ratio: 1 / 0.96;
  display: flex;
}

.game-card.featured .art-frame {
  background: linear-gradient(145deg, #ffffff 0%, #f4f4f5 50%, #a1a1aa 100%);
  box-shadow: 0 0 28px rgba(255, 255, 255, 0.16);
}

.art-inner {
  position: relative;
  flex: 1;
  border-radius: 11px;
  background: radial-gradient(circle at 50% 35%, #232631 0%, #0d0e13 78%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Comic / layered split panel artwork inside frame */
.art-bg-panels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.art-bg-panels::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1px);
  background-size: 10px 10px;
  opacity: 0.55;
}

.art-custom-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%) contrast(1.12) brightness(0.75);
}

.art-panel-left {
  position: absolute;
  left: 10px;
  top: 44px;
  width: 58%;
  height: 60%;
  border-radius: 12px;
  background: linear-gradient(145deg, #1b1d26, #0b0c10);
  border: 2.5px solid rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.art-panel-right {
  position: absolute;
  right: 10px;
  top: 30px;
  width: 34%;
  height: 62%;
  border-radius: 10px;
  background: linear-gradient(180deg, #272a36, #0e1017);
  border: 1.5px solid rgba(255, 255, 255, 0.32);
  transform: skewX(-5deg);
  overflow: hidden;
  display: grid;
  place-items: center;
  opacity: 0.92;
}

.art-top-row {
  position: relative;
  z-index: 3;
  padding: 10px 11px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.art-logo {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--white);
  color: #08090c;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.72rem;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.art-map-title {
  position: relative;
  z-index: 3;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--white);
  text-shadow: 0 3px 0 #000, 0 0 16px rgba(0, 0, 0, 0.95);
  text-align: center;
  margin-top: -2px;
}

.art-promo-tag {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  background: var(--white);
  color: #08090c;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Bottom angled split ribbon bar inside frame (like reference screenshot!) */
.art-bottom-bar {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 1.18fr 0.82fr;
  align-items: stretch;
  background: linear-gradient(90deg, #0b0c10 0%, #14161e 55%, #262934 100%);
  border-top: 2px solid rgba(255, 255, 255, 0.45);
  min-height: 52px;
}

.art-duration {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  font-family: var(--font-display);
  font-size: 1.48rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--white);
  background: #0a0b0f;
  clip-path: polygon(0 0, 92% 0, 100% 100%, 0 100%);
}

.art-price {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  font-family: var(--font-display);
  font-size: 1.24rem;
  font-weight: 800;
  color: var(--white);
  line-height: 1.05;
}

.art-price-old {
  font-size: 0.7rem;
  font-weight: 600;
  color: #9ca3af;
  text-decoration: line-through;
}

/* Card Info Footer (Exact hierarchy of reference screenshot) */
.card-footer-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 2px;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.04rem;
  font-weight: 700;
  color: var(--white);
}

.card-price-stock {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.card-price-green {
  font-family: var(--font-display);
  font-size: 1.16rem;
  font-weight: 800;
  color: var(--green);
}

.card-stock-text {
  font-size: 0.82rem;
  color: var(--muted);
}

.card-mini-features {
  font-size: 0.78rem;
  color: var(--dim);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-chip {
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: #cbd5e1;
}

/* Panels / Sections */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.input {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #0a0b0f;
  color: var(--white);
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.input:focus {
  border-color: var(--white);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.angpao-banner {
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.angpao-phone {
  font-family: var(--font-mono);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.03em;
}

.steps-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--offwhite);
}

.steps-list li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.step-badge {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--white);
  color: #08090c;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.74rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #0b0c11;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 0.74rem;
  text-transform: uppercase;
  color: var(--dim);
  background: #101219;
}

tbody tr:last-child td {
  border-bottom: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--offwhite);
}

.badge-ok {
  background: var(--green-soft);
  border-color: rgba(34, 197, 94, 0.36);
  color: #86efac;
}

.badge-warn {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.36);
  color: #fde68a;
}

.badge-err {
  background: rgba(244, 63, 94, 0.14);
  border-color: rgba(244, 63, 94, 0.36);
  color: #fda4af;
}

/* Checker */
.checker-form {
  display: flex;
  gap: 10px;
}

.checker-result {
  margin-top: 14px;
  padding: 15px;
  border-radius: 12px;
  background: #0a0b0f;
  border: 1px solid var(--border);
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin-top: 12px;
}

.kv .k {
  font-size: 0.74rem;
  color: var(--dim);
}

.kv .v {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--white);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
}

.modal {
  width: 100%;
  max-width: 480px;
  background: #12131a;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.8);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-tab {
  padding: 9px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #0a0b0f;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-tab.active {
  background: var(--white);
  border-color: var(--white);
  color: #08090c;
}

/* Toast */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 11px 16px;
  border-radius: 10px;
  background: var(--white);
  color: #08090c;
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
}

.toast.err {
  background: #f43f5e;
  color: #ffffff;
}

/* Footer */
.footer {
  margin-top: 40px;
  padding: 24px 0 38px;
  border-top: 1px solid var(--border);
  color: var(--dim);
  font-size: 0.82rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 960px) {
  .cards-grid,
  .split-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .nav-center {
    display: none;
  }
  .checker-form {
    flex-direction: column;
  }
  .hero-stats {
    grid-template-columns: 1fr;
  }
  .hero-stat {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .hero-stat:last-child {
    border-bottom: none;
  }
}
