/* Mobile-first, no framework. Tokens first, dark mode via prefers-color-scheme. */
:root {
  --accent: #2563eb;
  --bg: #f7f7f8;
  --surface: #ffffff;
  --text: #111318;
  --muted: #6b7280;
  --line: #e5e7eb;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg:#0e0f12; --surface:#17181c; --text:#f3f4f6; --muted:#9ca3af; --line:#26272c; --shadow:0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35); }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin:0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; display: block; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .25rem; }
code { font-size: .85em; background: var(--line); padding: 2px 6px; border-radius: 6px; }

.wrap { max-width: 680px; margin: 0 auto; padding: 20px 16px 120px; }
.foot { max-width: 680px; margin: 0 auto; padding: 16px; display: flex; flex-wrap: wrap; gap: 12px 18px; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line); }
.foot a { color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.back { display: inline-block; margin-bottom: 12px; font-size: .9rem; }

/* Hero / link-in-bio header */
.hero { text-align: center; padding: 12px 0 24px; }
.avatar { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; margin: 0 auto 12px; box-shadow: var(--shadow); }
.avatar-fallback { display:flex; align-items:center; justify-content:center; background: var(--accent); color:#fff; font-size: 2rem; font-weight: 700; }
.tagline { margin: 0; color: var(--muted); }
.bio { margin: 8px auto 0; max-width: 460px; font-size: .95rem; }
.social { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.social a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font-size: .85rem; }

/* Product grid */
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 560px) { .grid { grid-template-columns: 1fr 1fr; } }
.card { display:flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); color: var(--text); transition: transform .15s ease; }
.card:active { transform: scale(.985); }
.card-media { aspect-ratio: 4 / 3; background: var(--line); }
.card-media img { width:100%; height:100%; object-fit: cover; }
.card-media-fallback { width:100%; height:100%; display:flex; align-items:center; justify-content:center; font-size: 3rem; font-weight: 700; color: var(--muted); background: linear-gradient(135deg, var(--line), var(--surface)); }
.card-body { padding: 14px 14px 16px; display:flex; flex-direction:column; gap: 6px; }
.card-body p { margin: 0; font-size: .9rem; }
.card-foot { display:flex; justify-content: space-between; align-items:center; margin-top: 6px; }
.price { font-weight: 700; font-variant-numeric: tabular-nums; }
.price-lg { font-size: 1.5rem; }

/* Buttons */
.btn { display:inline-flex; align-items:center; justify-content:center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .9rem; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-danger { background: transparent; color: #dc2626; border-color: #dc2626; margin-top: 24px; }
.btn[disabled] { opacity: .6; cursor: progress; }
button.link { background:none; border:0; color: var(--accent); font: inherit; cursor:pointer; padding:0; }

/* Product page */
.product { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.product > :not(.product-cover) { margin-left: 18px; margin-right: 18px; }
.product h1 { margin-top: 18px; }
.product-cover { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.buy-row { display:flex; align-items:center; justify-content: space-between; gap: 12px; margin: 16px 18px; }
.buy-row form { display: none; }
@media (min-width: 560px) { .buy-row form { display:block; } .sticky-buy { display:none !important; } }
.rich { padding-bottom: 8px; }
.rich p { margin: 0 0 12px; }
.rich ul { margin: 0 0 12px; padding-left: 20px; }
.facts { list-style: none; padding: 0 0 18px; margin: 0; color: var(--muted); font-size: .9rem; }
.facts li { padding: 6px 0; border-top: 1px solid var(--line); }
.facts li::before { content: "✓ "; color: var(--accent); }
.sticky-buy { position: fixed; left:0; right:0; bottom:0; display:flex; align-items:center; justify-content:space-between; gap: 12px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0,0,0,.08); }
.sticky-buy .btn { min-width: 160px; }

/* Panels (thanks page, login, admin) */
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 18px; }
.panel.narrow { max-width: 420px; margin: 40px auto; }
.check { width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color:#fff; display:flex; align-items:center; justify-content:center; font-size: 1.6rem; font-weight: 700; margin-bottom: 12px; }
.downloads { list-style:none; padding:0; margin: 16px 0; }
.downloads li { display:flex; align-items:center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.error { color: #dc2626; }
.warn { color: #d97706; }

/* Forms */
.form { display:flex; flex-direction: column; gap: 14px; }
.form label { display:flex; flex-direction: column; gap: 6px; font-size: .9rem; font-weight: 600; }
.form input, .form select, .form textarea { font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); min-height: 44px; }
.form input[type=file] { padding: 8px; }
.form input[type=color] { padding: 4px; width: 64px; }
.form textarea { min-height: 120px; resize: vertical; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .check-label { flex-direction: row; align-items: center; gap: 10px; align-self: end; min-height: 44px; }
.form .check-label input { min-height: auto; width: 20px; height: 20px; }

/* Admin */
body.admin .wrap { max-width: 860px; }
.adminbar { display:flex; flex-wrap: wrap; gap: 14px 18px; align-items:center; padding: 10px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; font-size: .95rem; }
.adminbar form { margin-left: auto; }
.stats { display:grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 22px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); display:flex; flex-direction: column; }
.stat strong { font-size: 1.25rem; }
.list { list-style:none; padding:0; margin: 0 0 24px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.list li { display:flex; align-items:center; justify-content:space-between; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list-main { min-width: 0; }
.right { text-align: right; }
.pill { font-size: .75rem; padding: 3px 9px; border-radius: 999px; background: var(--line); color: var(--muted); text-transform: capitalize; }
.pill.ok { background: #dcfce7; color: #166534; }
.pill.bad { background: #fee2e2; color: #991b1b; }

/* Legal pages */
.legal h2 { margin-top: 22px; font-size: 1rem; }
.legal p, .legal li { font-size: .95rem; }
.legal ul { padding-left: 20px; }
