/* ============================================================
   Beatstore — dark neon UI
   ============================================================ */
@import url('/fonts/css2?family=Space+Grotesk:wght@500;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #06060b;
  --bg-2: #0b0b14;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.09);
  --text: #f2f3f7;
  --muted: #9aa0b4;
  --muted-2: #6b7186;
  --accent: #7c5cff;
  --accent-2: #00e5ff;
  --hot: #ff4d8d;
  --ok: #27e39a;
  --warn: #ffc453;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.9);
  --player-h: 96px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Space Grotesk', var(--font);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--player-h) + 12px);
  overflow-x: hidden;
}

/* ambient light */
body::before {
  content: '';
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 90vh;
  background:
    radial-gradient(45% 45% at 18% 10%, color-mix(in srgb, var(--accent) 38%, transparent), transparent 70%),
    radial-gradient(40% 40% at 85% 0%, color-mix(in srgb, var(--accent-2) 26%, transparent), transparent 70%),
    radial-gradient(35% 35% at 60% 40%, color-mix(in srgb, var(--hot) 14%, transparent), transparent 70%);
  filter: blur(40px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
  animation: drift 24s ease-in-out infinite alternate;
}
@keyframes drift {
  to { transform: translate3d(0, 4%, 0) scale(1.08); }
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

.wrap { width: min(1240px, 92vw); margin-inline: auto; position: relative; z-index: 1; }

h1, h2, h3, .display { font-family: var(--display); letter-spacing: -0.02em; }

.grad-text {
  background: linear-gradient(100deg, var(--accent-2), var(--accent) 45%, var(--hot));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
  transition: 0.18s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  color: #08080f;
  border: 0;
  font-weight: 600;
  box-shadow: 0 8px 30px -10px color-mix(in srgb, var(--accent) 80%, transparent);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-icon { padding: 9px; border-radius: 50%; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(18px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 18px; height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: 0.06em; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  box-shadow: 0 0 22px -4px var(--accent);
}
.logo-mark span { display: block; width: 3px; height: 13px; background: #07070c; border-radius: 2px; box-shadow: 5px 0 0 #07070c, -5px 0 0 #07070c; animation: eq 1.1s ease-in-out infinite; }
@keyframes eq { 50% { height: 7px; } }

.nav-links { display: flex; gap: 4px; margin-left: 8px; }
.nav-links a { padding: 8px 12px; border-radius: 999px; color: var(--muted); font-size: 14px; }
.nav-links a:hover { color: var(--text); background: var(--surface); }
.nav-spacer { flex: 1; }

.cart-btn { position: relative; }
.cart-count {
  position: absolute; top: -5px; right: -5px;
  min-width: 19px; height: 19px; padding: 0 5px;
  display: grid; place-items: center;
  background: var(--hot); color: #fff;
  border-radius: 999px; font-size: 11px; font-weight: 700;
}

/* ---------- hero ---------- */
.hero { padding: 72px 0 40px; display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(38px, 5.6vw, 68px); line-height: 1.02; margin: 14px 0 16px; }
.hero p { color: var(--muted); font-size: 17px; max-width: 46ch; margin: 0 0 26px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 999px; background: var(--surface);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 26px; margin-top: 34px; }
.hero-stats b { font-family: var(--display); font-size: 24px; display: block; }
.hero-stats span { color: var(--muted-2); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }

.hero-card {
  border-radius: 24px; border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--surface-2), transparent);
  padding: 18px; box-shadow: var(--shadow); backdrop-filter: blur(10px);
}
.hero-card .cover { aspect-ratio: 1; border-radius: 16px; overflow: hidden; position: relative; }
.hero-card .cover img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- toolbar / filters ---------- */
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 46px 0 18px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(24px, 3vw, 34px); margin: 0; }
.section-head p { color: var(--muted); margin: 6px 0 0; }

.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); backdrop-filter: blur(10px);
  position: sticky; top: 68px; z-index: 30;
}
.search {
  flex: 1 1 240px; display: flex; align-items: center; gap: 9px;
  background: rgba(0, 0, 0, 0.32); border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 14px;
}
.search input { flex: 1; background: none; border: 0; outline: none; }
.search input::placeholder { color: var(--muted-2); }

select, .field {
  background: rgba(0, 0, 0, 0.32); border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 14px; outline: none; cursor: pointer;
}
select option { background: #11111a; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: var(--surface);
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  font-size: 13px; color: var(--muted); white-space: nowrap; transition: 0.15s;
}
.chip:hover { color: var(--text); }
.chip.active {
  color: #08080f; border-color: transparent;
  background: linear-gradient(100deg, var(--accent-2), var(--accent));
  font-weight: 600;
}

/* ---------- beat grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; margin-top: 18px; }

.card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(170deg, var(--surface-2), rgba(255, 255, 255, 0.015));
  overflow: hidden; transition: 0.22s ease; position: relative;
}
.card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: var(--shadow); }
.card.playing { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2), 0 20px 50px -25px var(--accent-2); }

.card-cover { position: relative; aspect-ratio: 1; overflow: hidden; background: #12121c; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: 0.35s ease; }
.card:hover .card-cover img { transform: scale(1.06); }
.cover-fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 60%, #12121c), color-mix(in srgb, var(--accent-2) 45%, #12121c));
  font-family: var(--display); font-size: 40px; font-weight: 700; color: rgba(0, 0, 0, 0.5);
}
.play-btn {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.85);
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(10, 10, 16, 0.6); backdrop-filter: blur(6px);
  color: #fff; display: grid; place-items: center;
  opacity: 0; transition: 0.2s ease; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.card:hover .play-btn, .card.playing .play-btn { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.play-btn:hover { background: linear-gradient(100deg, var(--accent), var(--accent-2)); color: #08080f; }

.badge {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  background: rgba(8, 8, 14, 0.72); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 10px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
}
.badge.hot { background: linear-gradient(100deg, var(--hot), var(--accent)); border: 0; color: #fff; }
.badge.sold { background: rgba(0, 0, 0, 0.75); color: var(--muted); }
.badge.free { background: linear-gradient(100deg, var(--ok), var(--accent-2)); border: 0; color: #06221a; font-weight: 700; }

.card-body { padding: 13px 14px 15px; }
.card-title { font-weight: 600; font-size: 15px; margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted-2); font-size: 12px; margin-bottom: 12px; }
.meta span { background: rgba(255, 255, 255, 0.05); padding: 3px 8px; border-radius: 6px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.price { font-family: var(--display); font-weight: 700; }
.price small { color: var(--muted-2); font-weight: 400; font-size: 11px; display: block; text-transform: uppercase; letter-spacing: 0.1em; }

/* list view */
.grid.list { grid-template-columns: 1fr; gap: 8px; }
.grid.list .card { display: grid; grid-template-columns: 74px 1fr auto; align-items: center; gap: 14px; padding: 8px 14px 8px 8px; }
.grid.list .card-cover { aspect-ratio: 1; width: 74px; border-radius: 12px; }
.grid.list .card-body { padding: 0; }
.grid.list .meta { margin-bottom: 0; }
.grid.list .card-foot { flex-direction: column; align-items: end; gap: 6px; }
.grid.list .play-btn { width: 40px; height: 40px; opacity: 1; transform: translate(-50%, -50%) scale(1); background: rgba(6,6,12,.45); }

/* ---------- licensing table ---------- */
.lic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-top: 20px; }
.lic-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  background: linear-gradient(170deg, var(--surface-2), transparent); position: relative; overflow: hidden;
}
.lic-card.best { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.lic-card.best::after {
  content: 'POPULAR'; position: absolute; top: 14px; right: -34px;
  transform: rotate(35deg); background: linear-gradient(100deg, var(--accent), var(--accent-2));
  color: #08080f; font-size: 10px; font-weight: 700; letter-spacing: 0.12em; padding: 4px 40px;
}
.lic-card h3 { margin: 0 0 4px; font-size: 18px; }
.lic-price { font-family: var(--display); font-size: 30px; margin: 10px 0 14px; }
.lic-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; color: var(--muted); font-size: 13.5px; }
.lic-card li { display: flex; gap: 9px; align-items: start; }
.lic-card li::before { content: '✓'; color: var(--ok); font-weight: 700; }

/* ---------- player ---------- */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  height: var(--player-h);
  background: color-mix(in srgb, #0a0a12 88%, transparent);
  backdrop-filter: blur(22px); border-top: 1px solid var(--line);
  transform: translateY(110%); transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.player.on { transform: none; }
.player-inner { display: grid; grid-template-columns: minmax(180px, 250px) 1fr auto; align-items: center; gap: 20px; height: 100%; }
.np { display: flex; align-items: center; gap: 12px; min-width: 0; }
.np img, .np .ph { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; flex: none; background: linear-gradient(140deg, var(--accent), var(--accent-2)); }
.np-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-sub { color: var(--muted-2); font-size: 12px; }

.transport { display: flex; align-items: center; gap: 14px; }
.wave-wrap { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; }
.wave { position: relative; flex: 1; height: 46px; cursor: pointer; min-width: 0; }
.wave canvas { width: 100%; height: 100%; display: block; }
.time { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); min-width: 40px; text-align: center; }

.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 10px; display: grid; place-items: center; transition: 0.15s; }
.icon-btn:hover { color: var(--text); background: var(--surface); }
.icon-btn.active { color: var(--accent-2); }
.play-main {
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer; flex: none;
  background: linear-gradient(100deg, var(--accent), var(--accent-2)); color: #08080f;
  display: grid; place-items: center; box-shadow: 0 6px 24px -8px var(--accent);
}
.vol { display: flex; align-items: center; gap: 8px; }
.vol input { width: 84px; accent-color: var(--accent-2); }

/* ---------- drawer / modal ---------- */
.scrim { position: fixed; inset: 0; background: rgba(4, 4, 8, 0.65); backdrop-filter: blur(6px); z-index: 70; opacity: 0; pointer-events: none; transition: 0.25s; }
.scrim.on { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(430px, 100vw); z-index: 80;
  background: #0b0b14; border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex; flex-direction: column;
}
.drawer.on { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 20px; border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.drawer-foot { padding: 18px 20px; border-top: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); }

.cart-item { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.cart-item img, .cart-item .ph { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: linear-gradient(140deg, var(--accent), var(--accent-2)); }

.modal {
  position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: 0.2s;
}
.modal.on { opacity: 1; pointer-events: auto; }
.modal-box {
  width: min(880px, 100%); max-height: 86vh; overflow-y: auto;
  background: #0b0b14; border: 1px solid var(--line); border-radius: 24px;
  padding: 26px; box-shadow: var(--shadow); transform: translateY(14px); transition: 0.25s;
}
.modal.on .modal-box { transform: none; }

.lic-pick { display: grid; gap: 10px; margin-top: 16px; }
.lic-opt {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; cursor: pointer; transition: 0.15s;
}
.lic-opt:hover { background: var(--surface); }
.lic-opt.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.lic-opt input { accent-color: var(--accent); width: 18px; height: 18px; }
.lic-opt b { display: block; }
.lic-opt small { color: var(--muted); }

.input {
  width: 100%; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 14px; outline: none; transition: 0.15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
label.lbl { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted-2); margin: 14px 0 6px; }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty svg { opacity: 0.4; margin-bottom: 14px; }
.skeleton { border-radius: var(--radius); background: linear-gradient(100deg, #12121c, #1b1b28, #12121c); background-size: 200% 100%; animation: sk 1.3s linear infinite; aspect-ratio: 0.82; }
@keyframes sk { to { background-position: -200% 0; } }

.toast-host { position: fixed; bottom: calc(var(--player-h) + 18px); left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; }
.toast {
  background: #14141f; border: 1px solid var(--line); border-radius: 999px;
  padding: 11px 20px; box-shadow: var(--shadow); animation: pop 0.3s ease;
}
.toast.err { border-color: var(--hot); }
@keyframes pop { from { opacity: 0; transform: translateY(12px); } }

footer { border-top: 1px solid var(--line); margin-top: 70px; padding: 40px 0 30px; color: var(--muted-2); font-size: 13px; }
.foot-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.foot-links { display: flex; gap: 16px; }
.foot-links a:hover { color: var(--text); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 44px; }
  .hero-card { display: none; }
  .nav-links { display: none; }
  .player-inner { grid-template-columns: 1fr auto; gap: 12px; }
  .wave-wrap { display: none; }
  .vol { display: none; }
  :root { --player-h: 78px; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .toolbar { top: 68px; }
  .hero-stats { gap: 18px; }
}
