:root {
  --bg: #0a0c12;
  --bg-2: #0f121b;
  --surface: #151a26;
  --surface-2: #1b2132;
  --line: #262d40;
  --text: #eef1f8;
  --muted: #98a2bb;
  --accent: #4cc9ff;
  --accent-2: #1f8fff;
  --gold: #ffc44d;
  --green: #4ade80;
  --red: #ff5c6c;
  --radius: 14px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --display: 'Kanit', system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -200px, #14223a 0%, var(--bg) 60%);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: 0.01em; margin: 0; }
button { font: inherit; cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px;
  background: rgba(10, 12, 18, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--display); font-weight: 700; font-size: 18px; }
.brand b { color: var(--accent); font-weight: 800; }
.topnav { display: flex; gap: 18px; margin-left: auto; }
.topnav a { color: var(--muted); font-weight: 600; }
.topnav a:hover { color: var(--text); }
.basket-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-weight: 700;
}
.basket-btn:hover { border-color: var(--accent); }
.basket-btn .count { min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--accent); color: #05131d; font-size: 12px; text-align: center; line-height: 22px; }

.testbar {
  background: #2b2200; color: #ffe7a3;
  border-bottom: 1px solid #5a4600;
  text-align: center; padding: 8px 16px; font-size: 13px;
}
.testbar code { background: rgba(255, 255, 255, 0.1); padding: 1px 6px; border-radius: 6px; }

/* Hero */
.hero { text-align: center; padding: 56px 20px 24px; }
.hero-logo { width: min(520px, 90vw); height: auto; filter: drop-shadow(0 16px 40px rgba(76, 201, 255, 0.25)); }
.sale-pill {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 22px; padding: 8px 18px; border-radius: 999px;
  background: linear-gradient(90deg, #ffb52e, #ff7a1a);
  color: #2b1500; font-family: var(--display); font-weight: 800; font-size: 16px; letter-spacing: 0.04em; text-transform: uppercase;
  box-shadow: 0 10px 30px rgba(255, 160, 40, 0.35);
}
.sale-pill .flash { font-size: 18px; }
.hero-sub { max-width: 560px; margin: 18px auto 0; color: var(--muted); font-size: 16px; }
.hero-sub b { color: var(--text); }

/* Groups and grid */
.shop { max-width: 1160px; margin: 0 auto; padding: 24px 20px 60px; }
.group { margin-top: 48px; }
.group-head { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.group-head h2 { font-size: 30px; }
.group-head p { margin: 0; color: var(--muted); }
.grid { display: grid; gap: 18px; }
.grid.ranks { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.coins { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.card {
  position: relative;
  display: flex; flex-direction: column; gap: 14px;
  padding: 22px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.card:hover { transform: translateY(-3px); border-color: #3b4666; }
.card.featured { border-color: rgba(255, 196, 77, 0.55); }
.card .badge {
  position: absolute; top: -11px; left: 18px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--gold); color: #2b1a00;
  font-family: var(--display); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
}
.card .badge.blue { background: var(--accent); color: #05131d; }
.card-top { display: flex; align-items: center; gap: 14px; }
.card-top img { width: 56px; height: 56px; image-rendering: pixelated; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5)); }
.card h3 { font-size: 22px; line-height: 1.15; }
.card .tagline { color: var(--muted); font-size: 13px; margin: 2px 0 0; }
.perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; color: #c9d1e3; font-size: 14px; }
.perks li { padding-left: 20px; position: relative; }
.perks li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 700; }
.coin-amount { font-family: var(--display); font-weight: 800; font-size: 34px; color: var(--gold); line-height: 1; }
.coin-amount small { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 6px; }
.price { margin-top: auto; display: flex; align-items: baseline; gap: 10px; }
.price .now { font-family: var(--display); font-weight: 800; font-size: 28px; }
.price .was { color: var(--muted); text-decoration: line-through; font-size: 15px; }
.price .per { color: var(--muted); font-size: 13px; }
.price .off { margin-left: auto; padding: 2px 8px; border-radius: 6px; background: rgba(74, 222, 128, 0.12); color: var(--green); font-size: 12px; font-weight: 700; }
.buy {
  width: 100%; padding: 12px 16px; border-radius: 10px; border: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #04101a; font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: 0.03em; text-transform: uppercase;
}
.buy:hover { filter: brightness(1.08); }
.buy.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.buy.secondary:hover { border-color: var(--accent); }

/* FAQ */
.faq { margin-top: 56px; max-width: 760px; }
.faq details { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 12px 16px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 700; font-family: var(--display); }
.faq p { color: var(--muted); margin: 8px 0 0; }

.foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

/* Drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 30; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 31;
  width: min(420px, 100vw);
  display: flex; flex-direction: column; gap: 16px;
  padding: 20px;
  background: var(--bg-2); border-left: 1px solid var(--line);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-head h3 { font-size: 22px; }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--muted); width: 34px; height: 34px; border-radius: 8px; }
.drawer-items { display: grid; gap: 10px; }
.drawer-empty { color: var(--muted); text-align: center; padding: 24px 0; }
.line { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.line img { width: 40px; height: 40px; image-rendering: pixelated; }
.line .name { font-weight: 700; }
.line .meta { color: var(--muted); font-size: 12px; }
.line .qty { display: flex; align-items: center; gap: 6px; }
.line .qty button { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.line .qty span { min-width: 18px; text-align: center; font-weight: 700; }
.line .qty .remove { color: var(--red); border-color: transparent; background: none; }
.drawer-user label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.user-row { display: flex; align-items: center; gap: 10px; }
.user-row img { width: 36px; height: 36px; border-radius: 6px; image-rendering: pixelated; background: var(--surface); }
.user-row input { flex: 1; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 15px; }
.user-row input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.drawer-total { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 6px; }
.drawer-total .row { display: flex; justify-content: space-between; color: var(--muted); }
.drawer-total .row.big { color: var(--text); font-size: 20px; }
.drawer-total .row.big strong { font-family: var(--display); font-weight: 800; font-size: 26px; }
.drawer-total .row.save em { color: var(--green); font-style: normal; font-weight: 700; }
.drawer-error { margin: 0; padding: 10px 12px; border-radius: 8px; background: rgba(255, 92, 108, 0.12); color: #ffb3bb; font-size: 14px; }
.checkout-btn {
  padding: 14px; border-radius: 10px; border: 0;
  background: #635bff; color: #fff; font-family: var(--display); font-weight: 800; font-size: 16px; letter-spacing: 0.03em;
}
.checkout-btn:hover { filter: brightness(1.1); }
.checkout-btn:disabled { opacity: 0.6; cursor: wait; }
.drawer-note { color: var(--muted); font-size: 12px; margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 40; padding: 10px 16px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font-weight: 600;
  box-shadow: var(--shadow);
}

/* Success page */
.receipt { max-width: 560px; margin: 40px auto; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.receipt h1 { font-size: 30px; margin-bottom: 6px; }
.receipt .sub { color: var(--muted); margin: 0 0 18px; }
.receipt .head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.receipt .head img { width: 48px; height: 48px; border-radius: 8px; image-rendering: pixelated; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.receipt td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.receipt tr.total td { border: 0; font-family: var(--display); font-weight: 800; font-size: 20px; }
.receipt .actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .topnav { display: none; }
  .hero { padding-top: 32px; }
  .group-head h2 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .card, html { transition: none; scroll-behavior: auto; }
}
