:root {
  --bg: #0b0a14;
  --bg2: #120f1e;
  --panel: #17131f;
  --panel2: #1e1929;
  --line: #2c2540;
  --text: #ece6f7;
  --muted: #a69cbd;
  --gold: #ffd36e;
  --pink: #ff8fc7;
  --lilac: #c39ff0;
  --sky: #8fd3ff;
  --green: #4cc26a;
  --danger: #ff6b81;
  --radius: 10px;
  --pixel: "Pixelify Sans", "Nunito", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 "Nunito", system-ui, sans-serif;
  min-height: 100vh;
}
#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
a { color: var(--gold); }
img { image-rendering: pixelated; }
.wrap { width: min(1140px, 100% - 32px); margin: 0 auto; }
[hidden] { display: none !important; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(11, 10, 20, .82); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { font-family: var(--pixel); font-weight: 700; font-size: 26px; letter-spacing: 2px; color: #e7d2ff; text-decoration: none; text-shadow: 3px 3px 0 #05030f; }
.logo span { font-size: 14px; color: var(--pink); margin-left: 8px; letter-spacing: 1px; }
.logo.small { font-size: 22px; }
.nav { display: flex; gap: 20px; margin-right: auto; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 700; }
.nav a:hover { color: var(--text); }
.basket-btn { position: relative; display: flex; align-items: center; gap: 8px; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; font: 700 15px "Nunito", sans-serif; cursor: pointer; }
.basket-btn:hover { border-color: var(--lilac); }
.basket-btn b { position: absolute; top: -8px; right: -8px; background: var(--pink); color: #2a1030; border-radius: 10px; min-width: 20px; height: 20px; font-size: 12px; display: grid; place-items: center; padding: 0 5px; }

/* hero */
.hero { position: relative; background: url("assets/banner_bg.png") center 60% / cover no-repeat; border-bottom: 1px solid var(--line); image-rendering: pixelated; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11, 10, 20, .15), rgba(11, 10, 20, .55) 70%, var(--bg)); }
.hero-inner { position: relative; z-index: 1; text-align: center; padding: 92px 0 72px; }
.hero-title { font-family: var(--pixel); font-size: clamp(56px, 11vw, 120px); line-height: 1; margin: 0; letter-spacing: 6px; color: #e7d2ff; text-shadow: 6px 6px 0 #05030f; }
.hero-sub { margin: 14px 0 26px; font-size: 19px; font-weight: 700; color: #f4eeff; text-shadow: 2px 2px 0 #05030f; }
.ip { display: inline-flex; align-items: center; gap: 12px; background: rgba(18, 15, 30, .85); border: 2px solid var(--gold); color: var(--text); border-radius: 999px; padding: 10px 20px; cursor: pointer; font: 700 15px "Nunito", sans-serif; box-shadow: 0 0 0 4px rgba(255, 211, 110, .12); }
.ip:hover { transform: translateY(-1px); }
.ip-text { font-family: var(--pixel); font-size: 18px; letter-spacing: 1px; color: var(--gold); }
.ip-online { color: var(--muted); font-size: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #6b6480; }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.off { background: var(--danger); }

/* account row (login box) */
.account-row { display: grid; grid-template-columns: 320px 1fr; gap: 20px; margin-top: -36px; position: relative; z-index: 2; }
.player-card, .account-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.player-card { display: flex; align-items: flex-end; gap: 18px; padding: 18px 20px 0; overflow: hidden; min-height: 132px; }
.skin-frame { width: 92px; height: 120px; overflow: hidden; flex: none; display: flex; align-items: flex-start; justify-content: center; }
.skin-frame img { width: 92px; height: auto; display: block; transform: translateY(4px); filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .45)); }
.player-info { align-self: center; padding-bottom: 18px; }
.player-name { font-size: 22px; font-weight: 800; margin-bottom: 8px; word-break: break-all; }
.account-panel { padding: 20px 24px; display: flex; align-items: center; }
.welcome h2 { margin: 0 0 6px; font-family: var(--pixel); font-size: 24px; color: var(--gold); }
.welcome p { margin: 0; color: var(--muted); }
.login-form { width: 100%; }
.login-title { display: block; color: var(--green); font-size: 22px; font-weight: 800; margin-bottom: 10px; }
.edition { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 3px; margin-bottom: 10px; }
.ed { background: none; border: 0; color: var(--muted); font: 700 14px "Nunito", sans-serif; padding: 5px 14px; border-radius: 6px; cursor: pointer; }
.ed.active { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.login-row { display: flex; gap: 10px; }
.login-row input { flex: 1; min-width: 0; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; color: var(--text); font: 600 18px "Nunito", sans-serif; padding: 12px 16px; }
.login-row input:focus { outline: 2px solid var(--lilac); outline-offset: 1px; }
.form-note { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.form-note.err { color: var(--danger); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: linear-gradient(180deg, #ffd98a, #ffb36e); color: #2a1030; border: 0; border-radius: 8px; padding: 11px 20px; font: 800 16px "Nunito", sans-serif; cursor: pointer; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.small { padding: 6px 14px; font-size: 14px; }
.btn.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--lilac); }
.btn.go { background: var(--green); color: #fff; font-size: 20px; padding: 10px 22px; }
.btn.wide { width: 100%; padding: 14px; font-size: 18px; }

/* packages */
.section-head { margin: 56px 0 22px; text-align: center; }
.section-head h2 { font-family: var(--pixel); font-size: 40px; margin: 0; color: #fff; text-shadow: 4px 4px 0 #05030f; }
.section-head p { margin: 6px auto 0; color: var(--muted); max-width: 620px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; padding-bottom: 72px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, border-color .15s; }
.card:hover { transform: translateY(-3px); border-color: var(--lilac); }
.card-img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: var(--bg2); cursor: pointer; border: 0; padding: 0; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-name { font-weight: 800; font-size: 18px; line-height: 1.25; }
.price { font-weight: 800; color: var(--lilac); font-size: 18px; }
.price s { color: var(--muted); font-weight: 600; font-size: 14px; margin-right: 6px; }
.price.big { font-size: 26px; }
.per { color: var(--muted); font-size: 13px; font-weight: 600; }
.card-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 8px; }
.card-actions .btn { flex: 1; padding: 9px 10px; font-size: 15px; background: var(--lilac); color: #1d1030; }
.card-actions .add { flex: none; width: 42px; padding: 0; background: var(--gold); }
.loading { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 40px; }

/* modal + drawer */
.modal, .drawer { position: fixed; inset: 0; z-index: 50; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5, 3, 12, .7); }
.modal-card { position: relative; width: min(860px, 100% - 32px); max-height: calc(100vh - 64px); overflow: auto; margin: 32px auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.x { position: absolute; top: 10px; right: 12px; background: none; border: 0; color: var(--muted); font-size: 30px; line-height: 1; cursor: pointer; z-index: 2; }
.x:hover { color: var(--text); }
.pkg-detail { display: grid; grid-template-columns: 300px 1fr; }
.pkg-detail > img { width: 100%; height: 100%; object-fit: cover; background: var(--bg2); }
.pkg-body { padding: 26px 28px; }
.pkg-body h3 { margin: 0 0 4px; font-size: 26px; }
.desc { color: #d6cde8; margin: 14px 0 20px; }
.desc p { margin: 0 0 12px; }
.desc strong { color: #fff; }
.pkg-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; font-size: 20px; }
.drawer-head .x { position: static; }
.drawer-user { padding: 12px 20px; color: var(--muted); font-size: 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.drawer-user img { width: 28px; height: 28px; border-radius: 4px; }
.lines { list-style: none; margin: 0; padding: 8px 20px; overflow: auto; flex: 1; }
.line { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line img { width: 48px; height: 64px; object-fit: cover; border-radius: 6px; }
.line-name { font-weight: 800; }
.line-price { color: var(--lilac); font-weight: 700; font-size: 14px; }
.line .rm { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; text-decoration: underline; }
.line .rm:hover { color: var(--danger); }
.empty { color: var(--muted); padding: 30px 0; text-align: center; }
.codes { padding: 12px 20px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.code-form { display: flex; gap: 8px; }
.code-form input { flex: 1; min-width: 0; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; color: var(--text); font: 600 14px "Nunito", sans-serif; padding: 8px 12px; }
.applied { font-size: 13px; color: var(--green); }
.applied button { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 12px; }
.drawer-foot { padding: 16px 20px 20px; border-top: 1px solid var(--line); }
.total-row { display: flex; justify-content: space-between; font-size: 20px; font-weight: 800; margin-bottom: 12px; }

/* footer + toast */
.footer { border-top: 1px solid var(--line); background: var(--bg2); padding: 32px 0; }
.footer-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; color: var(--muted); font-size: 14px; }
.footer p { margin: 8px 0 0; }
.legal { font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--lilac); color: var(--text); padding: 12px 20px; border-radius: 10px; z-index: 60; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); max-width: calc(100% - 32px); }
.toast.err { border-color: var(--danger); }

@media (max-width: 760px) {
  .account-row { grid-template-columns: 1fr; margin-top: -24px; }
  .pkg-detail { grid-template-columns: 1fr; }
  .pkg-detail > img { max-height: 360px; object-fit: contain; }
  .footer-inner { grid-template-columns: 1fr; }
  .nav { display: none; }
  .topbar-inner { justify-content: space-between; }
  .login-row { flex-direction: column; }
  .ip-online { display: none; }
}
