:root {
  --bg: #060a1c;
  --bg-2: #0b1130;
  --panel: rgba(16, 22, 56, 0.82);
  --panel-solid: #10163a;
  --line: rgba(120, 140, 255, 0.18);
  --text: #eef1ff;
  --muted: #9aa3c7;
  --cyan: #2fd8ff;
  --pink: #ff3fd2;
  --violet: #8b5cff;
  --gold: #ffd166;
  --ok: #3ee6a0;
  --danger: #ff6b8a;
  --grad: linear-gradient(90deg, var(--cyan), var(--violet) 55%, var(--pink));
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(47, 216, 255, 0.16), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(255, 63, 210, 0.14), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.55 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--cyan); }
button, input, select { font: inherit; color: inherit; }
img { display: block; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* header */
.site-header { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); background: rgba(6, 10, 28, 0.78); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 18px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 800; letter-spacing: 0.06em; }
.brand img { width: 38px; height: 38px; border-radius: 50%; box-shadow: 0 0 18px rgba(47, 216, 255, 0.35); }
.brand span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 18px; }
.nav { display: flex; gap: 4px; margin-left: 6px; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.nav a.active, .nav a:hover { color: var(--text); background: rgba(139, 92, 255, 0.16); }
.account { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.wallet-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255, 209, 102, 0.35); color: var(--gold); font-weight: 700; text-decoration: none; font-variant-numeric: tabular-nums; white-space: nowrap; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(47, 216, 255, 0.5); object-fit: cover; background: var(--panel-solid); }
.avatar-fallback { display: grid; place-items: center; font-weight: 800; color: var(--cyan); text-decoration: none; }

/* layout */
main { padding: 28px 0 120px; }
.hero { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: 26px; border-radius: 20px; border: 1px solid var(--line);
  background: linear-gradient(120deg, rgba(47, 216, 255, 0.10), rgba(139, 92, 255, 0.10) 50%, rgba(255, 63, 210, 0.10)), var(--panel); box-shadow: var(--shadow); }
.hero h1 { margin: 0 0 6px; font-size: clamp(24px, 4vw, 34px); line-height: 1.2; }
.hero h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0; color: var(--muted); }
.promo { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.promo strong { color: var(--gold); }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; margin-top: 22px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 12px; font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cyan); }
.side { display: flex; flex-direction: column; gap: 18px; }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.search { flex: 1 1 220px; min-width: 0; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); outline: none; }
.search:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(47, 216, 255, 0.15); }
.segmented { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.segmented button { border: 0; background: none; padding: 7px 12px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; }
.segmented button[aria-pressed="true"] { background: rgba(139, 92, 255, 0.28); color: var(--text); }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; cursor: pointer; user-select: none; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--pink); cursor: pointer; }

/* song list */
.songs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.song { display: grid; grid-template-columns: auto 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(11, 17, 48, 0.75); position: relative; overflow: hidden; transition: border-color 0.15s, background 0.15s; }
.song:hover { border-color: rgba(47, 216, 255, 0.4); }
.song.selected { border-color: var(--pink); background: rgba(255, 63, 210, 0.08); }
.cover { width: 52px; height: 52px; border-radius: 10px; position: relative; overflow: hidden; background: linear-gradient(135deg, #1b2459, #3a1756); border: 0; padding: 0; cursor: pointer; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover .play { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(6, 10, 28, 0.45); font-size: 18px; opacity: 0; transition: opacity 0.15s; }
.cover:hover .play, .cover:focus-visible .play, .song.playing .cover .play { opacity: 1; }
.song-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-meta b { color: var(--cyan); font-weight: 600; }
.song-side { display: flex; align-items: center; gap: 8px; }
.price { font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kind-tag { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 6px; vertical-align: 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--pink); border: 1px solid rgba(255, 63, 210, 0.5); }
.owned-tag { color: var(--ok); font-weight: 700; font-size: 13px; white-space: nowrap; }
.progress { position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: var(--grad); }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--cyan); }
.btn.primary { border: 0; background: var(--grad); color: #0a0d22; box-shadow: 0 6px 24px rgba(255, 63, 210, 0.3); }
.btn.small { padding: 6px 10px; border-radius: 9px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* action bar */
.action-bar { position: fixed; left: 50%; bottom: 16px; transform: translate(-50%, 140%); width: min(760px, calc(100% - 24px)); z-index: 30;
  display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 18px; border-radius: 16px; border: 1px solid rgba(255, 63, 210, 0.45);
  background: rgba(16, 22, 56, 0.96); box-shadow: 0 16px 50px rgba(0, 0, 0, 0.6); transition: transform 0.25s ease; }
.action-bar.show { transform: translate(-50%, 0); }
.action-bar .summary { flex: 1; min-width: 0; }
.action-bar .summary b { color: var(--gold); }
.action-bar .summary small { display: block; color: var(--muted); }
.action-bar .buttons { display: flex; gap: 8px; }

/* side widgets */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.feed li { display: flex; justify-content: space-between; gap: 10px; }
.feed time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.board li { display: grid; grid-template-columns: 26px 28px 1fr auto; gap: 8px; align-items: center; font-size: 14px; }
.board .rank { color: var(--muted); font-weight: 800; text-align: center; }
.board img, .board .dot { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-2); object-fit: cover; }
.board .total { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; font-weight: 700; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { border-color: var(--pink); background: rgba(255, 63, 210, 0.14); }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.field label { color: var(--muted); font-size: 13px; }
.field input { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); outline: none; }
.field input:focus { border-color: var(--cyan); }
.note { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }

/* account page */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.balance { font-size: 38px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; margin: 4px 0 12px; }
.profile { display: flex; align-items: center; gap: 14px; }
.profile .avatar { width: 56px; height: 56px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.plus { color: var(--ok); }
.minus { color: var(--danger); }
.table-wrap { overflow-x: auto; }

/* modal */
dialog { border: 1px solid rgba(47, 216, 255, 0.4); border-radius: 18px; padding: 0; background: var(--panel-solid); color: var(--text); width: min(420px, calc(100% - 24px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(3, 5, 15, 0.72); backdrop-filter: blur(3px); }
.modal { padding: 22px; text-align: center; }
.modal h3 { margin: 0 0 4px; }
.qr { width: 240px; height: 240px; margin: 16px auto; border-radius: 14px; background: #fff; padding: 8px; display: grid; place-items: center; }
.qr img { width: 100%; height: 100%; }
.status { font-weight: 700; margin: 8px 0; }
.status.paid { color: var(--ok); }
.status.failed { color: var(--danger); }
.modal .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }

/* toast */
.toast { position: fixed; top: 76px; right: 16px; z-index: 50; max-width: min(380px, calc(100% - 32px)); padding: 12px 16px; border-radius: 12px; background: var(--panel-solid);
  border: 1px solid var(--line); box-shadow: var(--shadow); opacity: 0; transform: translateY(-8px); transition: 0.2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
.toast.error { border-color: var(--danger); }
.toast.ok { border-color: var(--ok); }

/* legal & footer */
.legal { max-width: 760px; }
.legal h1 { font-size: 28px; }
.legal h2 { font-size: 17px; margin-top: 26px; color: var(--cyan); }
.legal p, .legal li { color: #d5daf3; }
.site-footer { border-top: 1px solid var(--line); padding: 22px 0 40px; color: var(--muted); font-size: 13px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; }
.site-footer a { color: var(--muted); }
.hidden { display: none !important; }

@media (max-width: 860px) {
  .grid, .cards { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .nav a { padding: 8px 8px; }
}
@media (max-width: 560px) {
  .site-header .wrap { gap: 6px 10px; flex-wrap: wrap; height: auto; padding-top: 8px; padding-bottom: 6px; }
  .nav { order: 3; width: 100%; margin-left: -12px; overflow-x: auto; }
  .nav a { white-space: nowrap; padding: 6px 12px; }
  .toast { top: 108px; }
  .song { grid-template-columns: auto 44px minmax(0, 1fr); }
  .cover { width: 44px; height: 44px; }
  .song-side { grid-column: 2 / -1; justify-content: space-between; }
  .action-bar { flex-direction: column; align-items: stretch; }
  .action-bar .buttons > * { flex: 1; }
  .balance { font-size: 32px; }
}

/* plain inputs (admin table, dev login) share the dark field look */
input[type="number"], input[type="email"], input[type="text"]:not(.search) {
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; outline: none;
}
input[type="number"]:focus, input[type="email"]:focus, input[type="text"]:focus { border-color: var(--cyan); }
.board li.note, .feed li.note { display: block; }
