/* Kundun player portal. Light pages with the gold and red of the game, sized for the in-game web view
   (a wide, short frame) as well as a phone or desktop browser. */
:root {
  --bg: #f4f0e8;
  --bg-2: #fbf8f3;
  --card: #ffffff;
  --text: #1d2230;
  --muted: #6b7280;
  --line: #ece4d6;
  --line-2: #f3eee5;
  --amber: #f59e0b;
  --orange: #ea580c;
  --brown: #7c2d12;
  --green: #16a34a;
  --red: #dc2626;
  --blue: #1d4ed8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 40, 10, .06), 0 8px 22px rgba(60, 40, 10, .08);
  color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%) fixed;
  color: var(--text);
  font: 14px/1.45 "Segoe UI", Roboto, "Noto Sans", "Noto Sans Thai", Tahoma, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

button { font: inherit; cursor: pointer; }

/* ── Header ─────────────────────────────────────────────── */
#header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 54px;
  padding: 0 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(60, 40, 10, .05);
}

.brand { display: flex; align-items: center; gap: 9px; color: var(--brown); font-weight: 900; letter-spacing: 3px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(145deg, #fbbf24, #d97706);
  color: #fff;
  letter-spacing: 0;
  box-shadow: 0 4px 10px rgba(217, 119, 6, .35);
}

#header nav { display: flex; gap: 6px; flex: 1; }

#header nav a {
  padding: 7px 16px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
  transition: background .15s, color .15s;
}

#header nav a:hover { color: var(--text); background: #f6efe2; }

#header nav a.active { color: #fff; background: linear-gradient(135deg, var(--amber), var(--orange)); box-shadow: 0 4px 12px rgba(234, 88, 12, .3); }

.who { display: flex; align-items: center; gap: 8px; }

.account { padding: 4px 12px; border-radius: 999px; background: #f8f1e4; border: 1px solid var(--line); color: var(--brown); font-weight: 700; }

/* ── Layout ─────────────────────────────────────────────── */
main { max-width: 1140px; margin: 0 auto; padding: 16px 18px 28px; }

.columns { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.panel + .panel { margin-top: 14px; }

h1, h2, h3 { margin: 0 0 12px; }

h1 { font-size: 22px; font-weight: 900; }

h2 { font-size: 16px; font-weight: 800; }

h3 { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

.muted { color: var(--muted); }

.empty { color: var(--muted); padding: 24px 0; text-align: center; }

.error-box { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }

/* ── Hero: VIP and balance ──────────────────────────────── */
.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 16px;
  padding: 16px 22px;
  border-radius: 18px;
  color: #fff;
  background:
    radial-gradient(520px 180px at 88% -30%, rgba(255, 255, 255, .28), transparent 60%),
    linear-gradient(120deg, #7f1d1d 0%, #b91c1c 36%, #ea580c 72%, #f59e0b 100%);
  box-shadow: 0 12px 28px rgba(185, 28, 28, .25);
}

.hero-vip { display: flex; align-items: center; gap: 16px; flex: 1 1 320px; min-width: 0; }

.badge { position: relative; width: 82px; flex: none; }

.badge img { display: block; width: 100%; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .35)); }

.badge.inactive img { filter: grayscale(1) opacity(.65); }

.badge span { position: absolute; left: 0; right: 0; top: 46%; text-align: center; font-weight: 900; font-size: 14px; text-shadow: 0 1px 3px #000; }

.hero-info { flex: 1; min-width: 0; }

.hero-account { font-size: 12px; opacity: .85; letter-spacing: .4px; }

.hero-level { font-size: 26px; font-weight: 900; line-height: 1.1; text-shadow: 0 2px 8px rgba(0, 0, 0, .2); }

.hero-bar { position: relative; max-width: 440px; height: 12px; margin: 9px 0 5px; border-radius: 999px; background: rgba(0, 0, 0, .28); overflow: hidden; }

.hero-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: linear-gradient(90deg, #fef08a, #fbbf24); box-shadow: 0 0 10px rgba(254, 240, 138, .7); }

.hero-progress { display: flex; gap: 10px; max-width: 440px; font-size: 12px; }

.hero-progress b { margin-left: auto; }

.hero-hint { margin-top: 3px; font-size: 12px; opacity: .92; }

.hero-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

.hero-label { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; opacity: .85; }

.chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 7px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .3);
}

.chip img { width: 26px; height: 26px; }

.chip b { display: block; font-size: 16px; line-height: 1.1; }

.chip small { font-size: 11px; opacity: .85; }

.hero .primary { width: auto; padding: 9px 18px; background: #fff; color: var(--orange); box-shadow: 0 6px 14px rgba(0, 0, 0, .18); }

/* ── Packages ───────────────────────────────────────────── */
.packages { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }

.package {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 16px 10px 0;
  overflow: hidden;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff6e3 0%, #ffffff 58%);
  color: var(--text);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}

.package:hover { transform: translateY(-2px); border-color: #f7c77a; box-shadow: 0 10px 22px rgba(217, 119, 6, .16); }

.package.selected { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(234, 88, 12, .16), 0 10px 22px rgba(234, 88, 12, .18); }

.coin {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fffbeb 0%, #fde68a 45%, #f59e0b 100%);
  box-shadow: 0 6px 14px rgba(245, 158, 11, .35);
}

.coin img { width: 38px; height: 38px; }

.package .amount { font-size: 23px; font-weight: 900; letter-spacing: -.5px; }

.package .cash { font-size: 12px; color: var(--muted); }

.package .vip { margin-top: 6px; padding: 2px 9px; border-radius: 999px; background: #fef3c7; color: #b45309; font-size: 11px; font-weight: 800; }

.package .price {
  align-self: stretch;
  margin-top: 12px;
  padding: 9px 6px;
  border-top: 1px solid #fbe3bd;
  background: #fff4e3;
  color: var(--orange);
  font-size: 15px;
  font-weight: 900;
}

.package.selected .price { background: linear-gradient(135deg, var(--amber), var(--orange)); color: #fff; }

.ribbon {
  position: absolute;
  top: 12px;
  right: -34px;
  padding: 3px 36px;
  transform: rotate(35deg);
  background: var(--green);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(22, 163, 74, .35);
}

.check {
  position: absolute;
  top: 8px;
  left: 8px;
  display: none;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.package.selected .check { display: grid; }

/* ── Checkout ───────────────────────────────────────────── */
.summary-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); }

.summary-row:last-of-type { border-bottom: 0; }

.summary-row b { text-align: right; }

.summary-row.total b { color: var(--orange); font-size: 17px; }

.methods { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 14px; }

.method {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-weight: 600;
  text-align: left;
}

.method.selected { border-color: var(--orange); background: #fff7ed; }

.method .dot { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #d1d5db; }

.method.selected .dot { border-color: var(--orange); background: radial-gradient(circle, var(--orange) 45%, transparent 50%); }

.tag {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* ── Buttons ────────────────────────────────────────────── */
.primary {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--amber), var(--orange));
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .3px;
  text-align: center;
  box-shadow: 0 8px 18px rgba(234, 88, 12, .32);
  transition: filter .15s, transform .15s;
}

.primary:hover { filter: brightness(1.05); transform: translateY(-1px); }

.primary:disabled { background: #e5e7eb; color: #9ca3af; box-shadow: none; transform: none; cursor: not-allowed; }

.primary.success { background: linear-gradient(135deg, #22c55e, var(--green)); box-shadow: 0 8px 18px rgba(22, 163, 74, .3); }

.primary.danger { background: #fff; color: var(--red); border: 1.5px solid #fecaca; box-shadow: none; }

.ghost {
  display: inline-block;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.ghost:hover { border-color: #f7c77a; color: var(--orange); }

/* ── VIP levels ─────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th, td { padding: 9px 10px; text-align: center; border-bottom: 1px solid var(--line-2); white-space: nowrap; }

th { color: var(--muted); font-size: 11px; font-weight: 700; }

th img { display: block; width: 28px; height: 28px; margin: 0 auto 4px; }

td:first-child, th:first-child { text-align: left; }

tbody tr:hover td { background: #fcfaf6; }

tr.current td { background: #fff4e0; }

tr.current td:first-child { color: var(--orange); font-weight: 900; }

.plus { color: var(--green); font-weight: 800; }

/* ── Orders ─────────────────────────────────────────────── */
.status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; }

.status.Pending { background: #dbeafe; color: var(--blue); }

.status.Paid, .status.Crediting { background: #fef3c7; color: #b45309; }

.status.Credited { background: #dcfce7; color: #15803d; }

.status.Failed { background: #fee2e2; color: #b91c1c; }

.status.Cancelled, .status.Expired { background: #f3f4f6; color: var(--muted); }

.order-result { text-align: center; padding: 26px 16px; }

.order-result .icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  border-radius: 50%;
  font-size: 38px;
  font-weight: 900;
}

.order-result .icon.ok { background: #dcfce7; color: var(--green); box-shadow: 0 0 0 8px #f0fdf4; }

.order-result .icon.bad { background: #fee2e2; color: var(--red); box-shadow: 0 0 0 8px #fef2f2; }

.order-result .icon.wait { background: #fef3c7; color: #b45309; box-shadow: 0 0 0 8px #fffbeb; animation: pulse 1.2s ease-in-out infinite; }

@keyframes pulse { 50% { transform: scale(.92); opacity: .75; } }

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

.actions .primary { width: auto; min-width: 180px; }

/* ── Sign-in and sandbox ────────────────────────────────── */
body[data-page="login"] {
  background:
    radial-gradient(700px 300px at 50% -10%, rgba(255, 255, 255, .35), transparent 60%),
    linear-gradient(135deg, #7f1d1d 0%, #b91c1c 40%, #ea580c 75%, #f59e0b 100%) fixed;
}

body[data-page="login"] .brand { color: var(--brown); }

.center-card { max-width: 420px; margin: 7vh auto 0; }

.field { display: block; margin-bottom: 12px; }

.field span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 600; }

.field input {
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.field input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(245, 158, 11, .2); }

.langs { display: flex; justify-content: center; gap: 6px; margin-top: 14px; }

.langs a { padding: 3px 9px; border: 1px solid transparent; border-radius: 6px; color: var(--muted); font-weight: 700; }

.langs a.active { border-color: var(--line); color: var(--orange); }

.sandbox-banner {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px dashed #93c5fd;
  border-radius: 10px;
  background: #eff6ff;
  color: var(--blue);
  font-weight: 600;
}

/* ── Narrow and short frames (phones, the in-game window of a small game view) ── */
@media (max-width: 760px) {
  .columns { grid-template-columns: 1fr; }
  #header { gap: 10px; padding: 0 10px; }
  .brand span:last-child { display: none; }
  .hero-side { align-items: flex-start; }
  .chips { justify-content: flex-start; }
}

@media (max-height: 480px) {
  #header { height: 46px; }
  #header nav a { padding: 5px 12px; }
  main { padding-top: 10px; }
  .hero { gap: 10px 18px; margin-bottom: 10px; padding: 10px 16px; }
  .badge { width: 58px; }
  .badge span { font-size: 11px; }
  .hero-level { font-size: 19px; }
  .chip { padding: 4px 10px 4px 5px; }
  .chip img { width: 22px; height: 22px; }
  .chip b { font-size: 14px; }
}
