:root {
  --bg: #0b0e21;
  --bg-soft: #10142e;
  --card: #151a38;
  --card-hover: #1a2044;
  --border: #262d55;
  --text: #eef0ff;
  --muted: #8a91b4;
  --accent: #6c5ce7;
  --accent-2: #4a8cff;
  --gold: #f5b942;
  --danger: #ff4d6d;
  --success: #2ed573;
  --radius: 14px;
  --header-h: 72px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  background:
    radial-gradient(1200px 500px at 80% -100px, rgba(108, 92, 231, 0.18), transparent 60%),
    radial-gradient(900px 400px at 10% 0, rgba(74, 140, 255, 0.10), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { display: block; }

.container { max-width: 1420px; margin: 0 auto; padding: 0 28px; }

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  backdrop-filter: blur(14px);
  background: rgba(11, 14, 33, 0.82);
  border-bottom: 1px solid rgba(38, 45, 85, 0.6);
}

.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 28px;
}

.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo img { height: 44px; }

.main-nav { display: flex; gap: 6px; }

.main-nav a {
  padding: 10px 16px;
  font-weight: 600;
  color: var(--muted);
  border-radius: 10px;
  position: relative;
  transition: color 0.15s;
}
.main-nav a:hover { color: var(--text); }
.main-nav a.active { color: var(--text); }
.main-nav a.active::after {
  content: '';
  position: absolute;
  left: 16px; right: 16px; bottom: 2px;
  height: 3px;
  border-radius: 2px;
  background: #fff;
}

.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
#userArea { display: flex; align-items: center; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }

.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 6px 18px rgba(108, 92, 231, 0.35);
}

.btn-gold {
  background: linear-gradient(120deg, #f5b942, #ff8a3d);
  color: #221500;
  box-shadow: 0 6px 18px rgba(245, 185, 66, 0.25);
}

.btn-block { width: 100%; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* balance chip + user menu */
.balance-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(245, 185, 66, 0.1);
  border: 1px solid rgba(245, 185, 66, 0.35);
  color: var(--gold);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.balance-chip .plus {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  background: var(--gold);
  color: #221500;
  border-radius: 50%;
  font-weight: 800;
}

.user-menu { position: relative; }
.user-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.user-menu-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 190px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  display: none;
}
.user-menu.open .user-menu-dropdown { display: block; }
.user-menu-dropdown a,
.user-menu-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
}
.user-menu-dropdown a:hover,
.user-menu-dropdown button:hover { background: rgba(255, 255, 255, 0.07); }
.user-menu-dropdown .danger { color: var(--danger); }

/* ===== Hero (trang chủ) ===== */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  margin-top: 26px;
  padding: 64px 56px;
  background:
    radial-gradient(600px 300px at 85% 20%, rgba(74, 140, 255, 0.35), transparent 65%),
    radial-gradient(500px 320px at 70% 90%, rgba(255, 77, 109, 0.22), transparent 65%),
    linear-gradient(120deg, #1b1440, #101637 55%, #0d1130);
  border: 1px solid var(--border);
}
.hero h1 {
  font-size: 44px;
  line-height: 1.15;
  max-width: 620px;
  letter-spacing: -0.5px;
}
.hero h1 .grad {
  background: linear-gradient(120deg, #9d8cff, #4a8cff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { margin: 18px 0 30px; color: var(--muted); font-size: 17px; max-width: 520px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-badges { display: flex; gap: 26px; margin-top: 40px; flex-wrap: wrap; }
.hero-badges .hb { display: flex; flex-direction: column; gap: 2px; }
.hero-badges .hb b { font-size: 22px; }
.hero-badges .hb span { color: var(--muted); font-size: 13px; }

/* ===== Section ===== */
.section { margin-top: 52px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}
.section-head h2 { font-size: 26px; letter-spacing: -0.3px; }
.section-head .see-all { color: var(--accent-2); font-weight: 600; font-size: 14px; }

.page-title { font-size: 30px; margin: 34px 0 22px; letter-spacing: -0.4px; }

/* ===== Filter bar (danh sách game) ===== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.chip {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { color: var(--text); border-color: #3a437e; }
.chip.active { background: #fff; color: #10142e; border-color: #fff; }

.search-box {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 18px;
  min-width: 300px;
}
.search-box svg { flex-shrink: 0; opacity: 0.55; }
.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  width: 100%;
}
.search-box input::placeholder { color: var(--muted); }

/* ===== Game grid ===== */
.game-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 26px 22px;
}
@media (max-width: 1200px) { .game-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 980px) { .game-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .game-grid { grid-template-columns: repeat(2, 1fr); } }

.game-card { display: block; }
.game-card .cover-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 3 / 4;
  border: 1px solid transparent;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.game-card:hover .cover-wrap {
  transform: translateY(-5px);
  border-color: rgba(108, 92, 231, 0.6);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.game-card .cover-wrap img { width: 100%; height: 100%; object-fit: cover; }

.cover-wrap.square { aspect-ratio: 1 / 1; }

/* ribbon giảm giá chéo góc trên trái icon */
.ribbon {
  position: absolute;
  top: 22px; left: -38px;
  width: 150px;
  transform: rotate(-45deg);
  text-align: center;
  padding: 6px 0;
  background: linear-gradient(120deg, #ff4d6d, #ff2e4d);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 14px rgba(255, 46, 77, 0.45);
  pointer-events: none;
}

.game-card h3 {
  margin-top: 14px;
  font-size: 16.5px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-card .meta {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}
.star { color: var(--gold); }
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); }

.empty-note {
  padding: 60px 0;
  text-align: center;
  color: var(--muted);
  grid-column: 1 / -1;
}

/* ===== Steps (trang chủ) ===== */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
@media (max-width: 980px) { .steps-grid { grid-template-columns: repeat(2, 1fr); } }
.step-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 22px;
}
.step-card .num {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  font-weight: 800;
  font-size: 17px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  margin-bottom: 16px;
}
.step-card h3 { font-size: 16px; margin-bottom: 8px; }
.step-card p { color: var(--muted); font-size: 14px; line-height: 1.55; }

/* ===== Trang chi tiết game ===== */
.game-hero {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 36px;
  margin-top: 34px;
}
@media (max-width: 860px) { .game-hero { grid-template-columns: 1fr; } }

.game-hero .cover {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 3 / 4;
}
.game-hero .cover.square { aspect-ratio: 1 / 1; align-self: start; }
.game-hero .cover img { width: 100%; height: 100%; object-fit: cover; }

.game-hero .info h1 { font-size: 34px; letter-spacing: -0.4px; }
.game-hero .info .meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 18px;
  color: var(--muted);
  font-size: 15px;
}
.game-hero .info .desc { color: var(--muted); line-height: 1.65; max-width: 640px; }

.crumb { margin-top: 26px; color: var(--muted); font-size: 14px; }
.crumb a:hover { color: var(--text); }

/* topup panel */
.topup-panel {
  margin-top: 40px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 30px;
}
.topup-panel h2 { font-size: 21px; margin-bottom: 4px; }
.topup-panel .sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }

.step-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  margin: 26px 0 14px;
}
.step-label .n {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  font-size: 13px;
  font-weight: 800;
}

.pkg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 900px) { .pkg-grid { grid-template-columns: repeat(2, 1fr); } }

.pkg-card {
  position: relative;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.pkg-card:hover { background: var(--card-hover); }
.pkg-card.selected { border-color: var(--accent-2); background: rgba(74, 140, 255, 0.08); }
.pkg-card .pkg-label { font-weight: 700; font-size: 15.5px; }
.pkg-card .pkg-price { margin-top: 8px; color: var(--gold); font-weight: 800; font-size: 17px; }
.pkg-card .pkg-old { color: var(--muted); font-weight: 600; font-size: 13.5px; margin-right: 4px; }
.pkg-card .pkg-bonus {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--success);
  background: rgba(46, 213, 115, 0.12);
  padding: 3px 10px;
  border-radius: 999px;
}
.pkg-card .pkg-hot {
  position: absolute;
  top: -9px; right: 12px;
  background: linear-gradient(120deg, #ff4d6d, #ff2e4d);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
}
.pkg-card .tick {
  position: absolute;
  bottom: 12px; right: 12px;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: none;
  place-items: center;
  background: var(--accent-2);
  font-size: 13px;
}
.pkg-card.selected .tick { display: grid; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }

.field label { display: block; font-size: 13.5px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.field input, .field select {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 13px 16px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus, .field select:focus { border-color: var(--accent-2); }

.order-summary {
  margin-top: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
}
.order-summary .total-label { color: var(--muted); font-size: 14px; }
.order-summary .total-value { font-size: 24px; font-weight: 800; color: var(--gold); }

/* ===== Bảng lịch sử ===== */
.table-wrap {
  overflow-x: auto;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 14px 18px; white-space: nowrap; }
thead th {
  color: var(--muted);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid rgba(38, 45, 85, 0.45); }
tbody tr:last-child { border-bottom: none; }
.status-pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
}
.status-success { background: rgba(46, 213, 115, 0.12); color: var(--success); }
.code-cell { font-family: Consolas, monospace; color: var(--accent-2); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 7, 18, 0.72);
  backdrop-filter: blur(6px);
}
.modal-overlay.open { display: flex; }

.modal {
  width: 100%;
  max-width: 420px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 30px;
  position: relative;
  animation: modalIn 0.18s ease;
}
.modal.wide { max-width: 520px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.modal .close-x {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}
.modal h3 { font-size: 21px; margin-bottom: 4px; }
.modal .modal-sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.modal .field { margin-bottom: 14px; }
.modal .form-error {
  display: none;
  margin-bottom: 12px;
  color: var(--danger);
  background: rgba(255, 77, 109, 0.1);
  border: 1px solid rgba(255, 77, 109, 0.3);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
}
.modal .form-error.show { display: block; }

.auth-tabs { display: flex; gap: 8px; margin-bottom: 22px; }
.auth-tabs button {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.auth-tabs button.active {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
}

.amount-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.amount-grid button {
  padding: 14px 8px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.amount-grid button.selected { border-color: var(--gold); color: var(--gold); }

.demo-note {
  font-size: 12.5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 18px;
  line-height: 1.5;
}

/* success modal */
.success-icon {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 30px;
  background: rgba(46, 213, 115, 0.14);
  border: 1px solid rgba(46, 213, 115, 0.4);
}
.order-detail-list { margin: 18px 0; }
.order-detail-list .row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(38, 45, 85, 0.7);
  font-size: 14.5px;
}
.order-detail-list .row span:first-child { color: var(--muted); }
.order-detail-list .row.code b { font-family: Consolas, monospace; color: var(--accent-2); letter-spacing: 1px; }

/* ===== Toast ===== */
#toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 13px 24px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  transition: opacity 0.25s, transform 0.25s;
}
#toast.hidden { opacity: 0; transform: translateX(-50%) translateY(16px); pointer-events: none; }

/* ===== Footer ===== */
.site-footer {
  margin-top: 80px;
  border-top: 1px solid var(--border);
  padding: 40px 0 50px;
  color: var(--muted);
  font-size: 14px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  align-items: center;
}
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-links a:hover { color: var(--text); }

/* responsive header */
@media (max-width: 760px) {
  .main-nav { display: none; }
  .hero { padding: 40px 26px; }
  .hero h1 { font-size: 32px; }
  .search-box { min-width: 0; width: 100%; margin-left: 0; }
  .container { padding: 0 18px; }
}

.hidden { display: none !important; }
