/* ── Nebula 3D · dark purple galaxy / liquid glass ─────────────── */
:root {
  --bg: #0b0616;
  --bg2: #120a24;
  --glass: rgba(34, 20, 66, 0.42);
  --glass-strong: rgba(40, 24, 78, 0.62);
  --stroke: rgba(160, 107, 255, 0.22);
  --stroke-bright: rgba(180, 135, 255, 0.5);
  --text: #e9e2f7;
  --text-dim: #a99ac9;
  --text-faint: #6f5f96;
  --accent: #a06bff;
  --accent2: #7b3ff2;
  --accent-glow: rgba(160, 107, 255, 0.35);
  --good: #5ee6a8;
  --bad: #ff6b8a;
  --radius: 18px;
  --font: 'Outfit', 'Segoe UI', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(1100px 700px at 15% -10%, rgba(123, 63, 242, 0.28), transparent 60%),
    radial-gradient(900px 600px at 90% 15%, rgba(64, 33, 150, 0.3), transparent 65%),
    radial-gradient(1000px 800px at 50% 110%, rgba(150, 60, 220, 0.16), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg2));
}
#starfield { position: fixed; inset: 0; z-index: -1; pointer-events: none; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: #c3a1ff; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

::selection { background: rgba(160, 107, 255, 0.4); }

/* ── layout ── */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 22px; }

/* ── nav ── */
.nav {
  position: sticky; top: 14px; z-index: 50;
  margin: 14px auto 0; max-width: 1180px; padding: 0 22px;
}
.nav-inner {
  display: flex; align-items: center; gap: 22px;
  padding: 12px 22px;
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid var(--stroke);
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(10, 4, 28, 0.55), inset 0 1px 0 rgba(255,255,255,0.06);
}
.logo { font-size: 1.25rem; font-weight: 800; letter-spacing: 2.5px; color: var(--text); white-space: nowrap; }
.logo em { font-style: normal; background: linear-gradient(135deg, #b78aff, #7b3ff2); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-links { display: flex; gap: 18px; margin-left: 8px; }
.nav-links a { color: var(--text-dim); font-size: 0.95rem; transition: color .2s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-spacer { flex: 1; }
.nav-user { color: var(--text-dim); font-size: .9rem; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 22px; border-radius: 13px; border: 1px solid var(--stroke);
  background: rgba(120, 80, 220, 0.16); color: var(--text);
  font-size: 0.95rem; font-weight: 600; line-height: 1; cursor: pointer;
  white-space: nowrap; text-align: center;
  /* animate only cheap properties — no `all`, no backdrop-filter on hover (that was the jank) */
  transition: transform .16s cubic-bezier(.2,.7,.3,1), box-shadow .2s ease,
              background-color .2s ease, border-color .2s ease, filter .2s ease, opacity .2s ease;
}
.btn:hover { border-color: var(--stroke-bright); background: rgba(140, 95, 245, 0.24); transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.97); transition-duration: .05s; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(160, 107, 255, 0.35); }
.btn:disabled, .btn.is-loading { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  border-color: transparent;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn.primary:hover { box-shadow: 0 8px 30px var(--accent-glow); filter: brightness(1.07); }
.btn.small { padding: 7px 14px; font-size: 0.85rem; border-radius: 10px; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(140, 95, 245, 0.16); }
.btn.danger { border-color: rgba(255,107,138,.4); color: var(--bad); background: rgba(255,107,138,.08); }
.btn.danger:hover { background: rgba(255,107,138,.16); border-color: var(--bad); }
@media (prefers-reduced-motion: reduce) { .btn { transition: background-color .2s ease, border-color .2s ease; } .btn:hover, .btn:active { transform: none; } }

/* ── hero ── */
.hero { text-align: center; padding: 90px 0 60px; }
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem); font-weight: 800; line-height: 1.12;
  background: linear-gradient(160deg, #f3ecff 30%, #b78aff 70%, #8a5cf0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: -1px;
}
.hero p { color: var(--text-dim); font-size: 1.15rem; max-width: 620px; margin: 18px auto 30px; }
.hero .btn-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ── section headers ── */
.section-head { display: flex; align-items: center; gap: 16px; margin: 44px 0 22px; flex-wrap: wrap; }
.section-head h2 { font-size: 1.5rem; font-weight: 700; }
.filters { display: flex; gap: 8px; margin-left: auto; }
.chip {
  padding: 7px 16px; border-radius: 999px; font-size: .85rem; cursor: pointer;
  color: var(--text-dim); background: transparent; border: 1px solid var(--stroke); transition: all .2s;
}
.chip:hover { color: var(--text); border-color: var(--stroke-bright); }
.chip.active { color: #fff; background: linear-gradient(135deg, var(--accent2), var(--accent)); border-color: transparent; }

/* ── product grid / glass cards ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; padding-bottom: 70px; }
.card {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
  box-shadow: 0 6px 30px rgba(8, 3, 24, 0.5), inset 0 1px 0 rgba(255,255,255,0.05);
  display: flex; flex-direction: column;
}
.card:hover {
  transform: translateY(-5px);
  border-color: var(--stroke-bright);
  box-shadow: 0 14px 46px rgba(90, 40, 190, 0.35), inset 0 1px 0 rgba(255,255,255,0.08);
}
.card .thumb { aspect-ratio: 8/5; background: #1a0f33; position: relative; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .thumb img { transform: scale(1.05); }
.card .body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { font-size: 1.08rem; font-weight: 700; }
.card .desc { color: var(--text-dim); font-size: .88rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 12px; }
.price { font-size: 1.15rem; font-weight: 800; color: #d9c6ff; }
.badge {
  position: absolute; top: 12px; left: 12px;
  padding: 4px 12px; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  background: rgba(15, 8, 34, 0.72); border: 1px solid var(--stroke-bright); color: #cfb3ff;
  backdrop-filter: blur(8px);
}

/* ── skeleton loaders ── */
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.skeleton { pointer-events: none; }
.sk {
  background: linear-gradient(90deg, rgba(120,80,220,.08) 25%, rgba(170,120,255,.18) 50%, rgba(120,80,220,.08) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 8px;
}
.skeleton .thumb { aspect-ratio: 8/5; }
.skeleton .sk-title { height: 20px; width: 70%; }
.skeleton .sk-line { height: 13px; width: 95%; }
.skeleton .sk-line.short { width: 55%; }
.skeleton .sk-price { height: 24px; width: 72px; }
.skeleton .sk-btn { height: 36px; width: 96px; border-radius: 12px; }

/* ── modal ── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(6, 2, 16, 0.65); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%; max-width: 430px; max-height: 90vh; overflow-y: auto;
  background: var(--glass-strong);
  backdrop-filter: blur(28px) saturate(1.6);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
  border: 1px solid var(--stroke-bright);
  border-radius: 22px; padding: 30px 28px;
  box-shadow: 0 24px 80px rgba(5, 1, 16, 0.8), inset 0 1px 0 rgba(255,255,255,0.08);
  transform: translateY(14px) scale(.98); transition: transform .25s;
}
.modal-backdrop.open .modal { transform: none; }
.modal h2 { font-size: 1.35rem; margin-bottom: 4px; }
.modal .sub { color: var(--text-dim); font-size: .9rem; margin-bottom: 20px; }
.modal.wide { max-width: 640px; }

/* ── forms ── */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: .82rem; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; letter-spacing: .3px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 15px;
  background: rgba(12, 6, 28, 0.55);
  border: 1px solid var(--stroke); border-radius: 12px;
  color: var(--text); font-size: .95rem; font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(160, 107, 255, 0.18);
}
.field textarea { resize: vertical; min-height: 90px; }
.form-msg { font-size: .88rem; margin: 10px 0; min-height: 1.2em; }
.form-msg.err { color: var(--bad); }
.form-msg.ok { color: var(--good); }
.switch-auth { text-align: center; font-size: .88rem; color: var(--text-dim); margin-top: 16px; }
.code-input { text-align: center; font-size: 1.6rem !important; letter-spacing: 12px; font-weight: 700; }

/* ── cart drawer ── */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 90; width: min(400px, 92vw);
  background: var(--glass-strong);
  backdrop-filter: blur(30px) saturate(1.6);
  -webkit-backdrop-filter: blur(30px) saturate(1.6);
  border-left: 1px solid var(--stroke-bright);
  padding: 26px; display: flex; flex-direction: column;
  transform: translateX(105%); transition: transform .3s ease;
  box-shadow: -20px 0 60px rgba(5, 1, 16, 0.6);
}
.drawer.open { transform: none; }
.drawer h2 { margin-bottom: 18px; }
.cart-items { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.cart-item {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: rgba(12, 6, 28, 0.4); border: 1px solid var(--stroke); border-radius: 14px;
}
.cart-item img { width: 64px; height: 40px; object-fit: cover; border-radius: 8px; }
.cart-item .t { flex: 1; font-size: .9rem; font-weight: 600; }
.cart-item .p { font-size: .9rem; color: #d9c6ff; white-space: nowrap; }
.cart-item .x { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 1.1rem; padding: 4px; }
.cart-item .x:hover { color: var(--bad); }
.cart-foot { border-top: 1px solid var(--stroke); padding-top: 16px; margin-top: 14px; }
.cart-total { display: flex; justify-content: space-between; font-weight: 800; font-size: 1.1rem; margin-bottom: 14px; }
.cart-empty { color: var(--text-faint); text-align: center; margin-top: 40px; }
.cart-count {
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  border-radius: 999px; font-size: .72rem; font-weight: 800; min-width: 19px; height: 19px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; color: #fff;
}

/* ── tables (account/admin) ── */
.table-card { background: var(--glass); backdrop-filter: blur(18px); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 6px 20px 12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; color: var(--text-faint); font-size: .78rem; text-transform: uppercase; letter-spacing: 1px; padding: 14px 10px 8px; }
td { padding: 12px 10px; border-top: 1px solid rgba(160, 107, 255, 0.1); vertical-align: middle; }
.status { padding: 3px 12px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.status.paid { background: rgba(94, 230, 168, .12); color: var(--good); }
.status.pending { background: rgba(255, 200, 90, .12); color: #ffc85a; }
.status.failed { background: rgba(255, 107, 138, .12); color: var(--bad); }

/* ── page shells / prose (legal pages) ── */
.page { padding: 60px 0 80px; }
.page h1 { font-size: 2rem; margin-bottom: 8px; }
.page .lede { color: var(--text-dim); margin-bottom: 34px; }
.prose { max-width: 800px; }
.prose h2 { font-size: 1.2rem; margin: 30px 0 10px; color: #dcd0f5; }
.prose p, .prose li { color: var(--text-dim); font-size: .95rem; }
.prose ul { padding-left: 22px; margin: 8px 0; }
.prose strong { color: var(--text); }
.prose .placeholder { color: #ffc85a; font-weight: 600; }
.glass-panel {
  background: var(--glass); backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--stroke); border-radius: var(--radius); padding: 28px;
}

/* ── footer ── */
footer { border-top: 1px solid rgba(160, 107, 255, 0.12); padding: 34px 0 44px; margin-top: 20px; }
.foot-inner { display: flex; flex-wrap: wrap; gap: 18px 34px; align-items: center; color: var(--text-faint); font-size: .86rem; }
.foot-inner a { color: var(--text-dim); }
.foot-inner .logo { font-size: 1rem; }

/* ── cookie banner ── */
.cookie-banner {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  z-index: 80; width: min(680px, calc(100vw - 30px));
  background: var(--glass-strong); backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid var(--stroke-bright); border-radius: 18px;
  padding: 16px 20px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  box-shadow: 0 16px 50px rgba(5, 1, 16, 0.7);
  font-size: .87rem; color: var(--text-dim);
}
.cookie-banner p { flex: 1; min-width: 240px; }
.cookie-banner.hidden { display: none; }

/* ── toast ── */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 120;
  padding: 14px 22px; border-radius: 14px; font-size: .92rem; font-weight: 600;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--stroke-bright); color: var(--text);
  box-shadow: 0 10px 40px rgba(5, 1, 16, 0.7);
  transform: translateY(80px); opacity: 0; transition: all .3s ease;
}
.toast.show { transform: none; opacity: 1; }
.toast.err { border-color: rgba(255,107,138,.5); }

/* ── admin extras ── */
.admin-grid { display: grid; grid-template-columns: 380px 1fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .admin-grid { grid-template-columns: 1fr; } }
.file-hint { font-size: .78rem; color: var(--text-faint); margin-top: 4px; }
.row-actions { display: flex; gap: 8px; }

/* ── misc ── */
.hidden { display: none !important; }
.center { text-align: center; }
.mt { margin-top: 20px; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.25); border-top-color: #fff;
  animation: spin .7s linear infinite; display: inline-block; vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── store gate / preview banner ── */
.preview-banner {
  margin: 22px 0 4px; padding: 12px 18px; border-radius: 14px;
  background: rgba(255, 200, 90, 0.1); border: 1px solid rgba(255, 200, 90, 0.35);
  color: #ffd98a; font-size: .9rem;
}
.preview-banner a { color: #ffe6ad; text-decoration: underline; }
.store-gate {
  max-width: 620px; margin: 60px auto; text-align: center;
}
.store-gate h2 { font-size: 1.8rem; margin: 6px 0 12px; }
.store-gate p { color: var(--text-dim); margin: 0 auto 20px; max-width: 460px; }
.gate-badge {
  display: inline-block; padding: 6px 16px; border-radius: 999px; font-size: .8rem; font-weight: 700;
  letter-spacing: .5px; color: #d9c6ff; background: rgba(160,107,255,.14); border: 1px solid var(--stroke-bright);
}

/* ── settings ── */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; max-width: 900px; }
.settings-grid h2 { font-size: 1.15rem; margin-bottom: 14px; }
.settings-current { color: var(--text-dim); font-size: .9rem; margin-bottom: 14px; word-break: break-all; }

/* ── admin controls ── */
.admin-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-bottom: 24px; }
.lock-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.test-products { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; }
.test-item { display: flex; align-items: center; gap: 10px; font-size: .92rem; cursor: pointer; padding: 4px 0; }
.test-item input { width: 17px; height: 17px; accent-color: var(--accent); flex-shrink: 0; }

/* ── responsive ── */
@media (max-width: 900px) {
  .admin-controls { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .nav { top: 8px; }
  .nav-inner { flex-wrap: wrap; gap: 10px 12px; padding: 11px 15px; }
  .nav-user { display: none; }              /* keep the nav compact on phones */
  .nav-spacer { display: none; }
  #navAuth { flex-wrap: wrap; justify-content: flex-end; }
  .section-head .filters { margin-left: 0; }
  .section-head { gap: 12px; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .nav-links { display: none; }
  .hero { padding: 54px 0 38px; }
  .hero p { font-size: 1.05rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
  .btn { padding: 10px 18px; }
  .btn.small { padding: 7px 12px; font-size: .8rem; }
  .modal { padding: 26px 20px; }
  .store-gate { margin: 40px auto; padding: 26px 20px; }
  .store-gate h2 { font-size: 1.45rem; }
}
@media (max-width: 400px) {
  .grid { grid-template-columns: 1fr; }
  .logo { font-size: 1.1rem; letter-spacing: 1.5px; }
}
