@property --corner {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 80%;
}

/* Smooth cross-fade between pages (Chromium; ignored elsewhere) */
@view-transition {
  navigation: auto;
}

/* ==========================================================================
   THEME TOKENS
   Dark is the default. Light is applied with <html data-theme="light">.
   The pink + black button treatment is identical in both themes.
   ========================================================================== */
:root {
  --pink: #ff3e6c;
  --pink-hover: #ff6489;
  --ink: #000;
  --btn-grad: linear-gradient(110deg, #ff3e6c 0%, #c9184a 38%, #000 100%);

  --bg: #000;
  --surface: #101012;
  --surface-2: #1b1b1f;
  --border: #2b2b30;
  --text: #f6f3f4;
  --muted: #a0989c;
  --danger: #ff6b8a;
  --header-bg: rgba(0, 0, 0, 0.85);
  --logo-end: #8b8b94;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  --glow-1: rgba(255, 62, 108, 0.20);
  --glow-2: rgba(201, 24, 74, 0.16);
  --price: #ff5a82;
  --ok: #2fd07a;
  --tint: rgba(255, 62, 108, 0.10);
  --tint-border: rgba(255, 62, 108, 0.35);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f7f4f5;
  --surface: #ffffff;
  --surface-2: #efeaec;
  --border: #e3dbde;
  --text: #140f11;
  --muted: #6a6064;
  --danger: #c4183f;
  --header-bg: rgba(247, 244, 245, 0.88);
  --logo-end: #000000;
  --shadow: 0 10px 30px rgba(20, 15, 17, 0.12);
  --glow-1: rgba(255, 62, 108, 0.16);
  --glow-2: rgba(201, 24, 74, 0.10);
  --price: #d3164a;
  --ok: #14834a;
  --tint: rgba(255, 62, 108, 0.08);
  --tint-border: rgba(201, 24, 74, 0.35);
  color-scheme: light;
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 460px at 12% -120px, var(--glow-1), transparent 70%),
    radial-gradient(760px 420px at 92% -100px, var(--glow-2), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease, color 0.2s ease;
}

body > main,
body > .container {
  flex: 1;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

ul {
  list-style: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 3px;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
header {
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  max-width: 1100px;
  margin: 0 auto;
  gap: 16px;
}

.logo,
.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.logo-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.logo-text {
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1;
  background: linear-gradient(90deg, var(--pink) 0%, var(--logo-end) 100%);
  transition: filter 0.3s ease;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.logo-text {
  font-size: 20px;
}

.logo:hover {
  filter: brightness(1.2);
}

nav ul {
  display: flex;
  gap: 28px;
}

nav a {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

nav a:hover,
nav a.active {
  color: var(--text);
}

.cart-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  padding: 7px 8px 7px 14px;
  border-radius: 24px;
  transition: border-color 0.15s ease;
}

.cart-link:hover {
  border-color: var(--pink);
}

@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.5); }
  100% { transform: scale(1); }
}

.cart-count.bump {
  animation: bump 0.4s ease;
}

.cart-count {
  background: var(--pink);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  transition: border-color 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--pink);
}

.theme-toggle:hover svg {
  transform: rotate(25deg) scale(1.1);
}

.theme-toggle svg {
  transition: transform 0.3s ease;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Show the icon for the mode you'd switch TO */
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* ==========================================================================
   BUTTONS — two-tone gradient: reddish pink fading into black
   ========================================================================== */
.btn {
  position: relative;
  overflow: hidden;
  display: inline-block;
  background: var(--btn-grad);
  background-size: 160% 100%;
  background-position: 60% 0;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(255, 62, 108, 0.35);
  transition: background-position 0.35s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -70%;
  width: 45%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
}

.btn:hover::before {
  left: 130%;
  transition: left 0.6s ease;
}

.btn:hover {
  background-position: 0 0;
  box-shadow: 0 0 0 1px var(--pink), 0 6px 18px rgba(255, 62, 108, 0.25);
}

.btn:active {
  transform: translateY(1px);
}

.btn.added {
  background: #1a7f37;
  box-shadow: none;
}

.btn-full {
  width: 100%;
}

.pay-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* PayPal's brand gold so people recognise it */
.btn-pay-paypal {
  background: #ffc439;
  color: #111;
  box-shadow: none;
}
.btn-pay-paypal:hover {
  background: #f2ba36;
  box-shadow: 0 6px 18px rgba(255, 196, 57, 0.25);
}
.btn-pay-paypal::before {
  display: none;
}

/* ==========================================================================
   SECTION HEADINGS
   ========================================================================== */
.section {
  padding-top: 56px;
  padding-bottom: 56px;
}

.section-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
}

/* ==========================================================================
   PRODUCT GRID
   ========================================================================== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 24px;
}

.product-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 12px;
  transition: border-color 0.2s ease, transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

.product-card:hover {
  border-color: var(--pink);
  transform: translateY(-5px);
  box-shadow: 0 14px 34px rgba(255, 62, 108, 0.2);
}

.product-media {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background:
    linear-gradient(135deg, transparent 0 var(--corner), var(--pink) var(--corner) 100%),
    radial-gradient(circle at 50% 42%, rgba(255, 62, 108, 0.28), transparent 65%),
    var(--surface-2);
  transition: --corner 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-card:hover .product-media {
  --corner: 68%;
}

.product-media img {
  width: 52%;
  height: auto;
  object-fit: contain;
}

.media-cart {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
}

.media-cart svg {
  width: 16px;
  height: 16px;
}

.badge-variants {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(110deg, #e02a5a, #b3123f);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 8px;
}

.product-info {
  padding: 16px 6px 6px;
}

.product-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.product-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--price);
}

.stock {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ok);
  white-space: nowrap;
}

.stock svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stock.out {
  color: var(--danger);
}

/* ==========================================================================
   CATEGORY FILTERS
   ========================================================================== */
.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.filter-tag {
  position: relative;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--muted);
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.25s ease;
}

.filter-tag:hover {
  border-color: var(--pink);
  color: var(--text);
  transform: translateY(-1px);
}

.filter-tag.active {
  background: var(--btn-grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 0 0 1px rgba(255, 62, 108, 0.4), 0 6px 16px rgba(255, 62, 108, 0.22);
}

.grid-empty {
  grid-column: 1 / -1;
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

/* ==========================================================================
   MOTION
   ========================================================================== */
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.product-card,
.cart-item,
.grid-empty,
.cart-empty {
  animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
  animation-delay: calc(var(--i, 0) * 70ms);
}

.section-title,
.cart-page h1,
.product-detail-img,
.product-detail-info,
.product-description,
.order-summary,
.auth-card,
.store-card {
  animation: rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

.product-detail-info { animation-delay: 0.08s; }
.product-description { animation-delay: 0.16s; }
.order-summary { animation-delay: 0.1s; }

/* Smooth colour change when switching dark/light */
header, footer, .cart-item, .order-summary, .auth-card, .qty-control,
.cart-link, .theme-toggle, .auth-form input {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

/* ==========================================================================
   PRODUCT DETAIL PAGE
   ========================================================================== */
.product-detail {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  align-items: start;
  gap: 48px;
  padding: 40px 0 48px;
}

.product-detail:hover .product-detail-img {
  --corner: 68%;
}

.product-detail-img {
  --corner: 82%;
  transition: --corner 0.4s ease;
  aspect-ratio: 1 / 1;
  background:
    linear-gradient(135deg, transparent 0 var(--corner), var(--pink) var(--corner) 100%),
    radial-gradient(circle at 50% 42%, rgba(255, 62, 108, 0.28), transparent 65%),
    var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: var(--text);
  font-size: 28px;
  font-weight: 800;
  position: relative;
  overflow: hidden;
}

.product-detail-img img {
  width: 50%;
  height: auto;
  object-fit: contain;
}

.product-detail-info h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.product-detail-price {
  font-size: 26px;
  font-weight: 800;
  color: var(--price);
  margin-bottom: 8px;
}

.product-detail-desc {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 28px;
  max-width: 52ch;
}

.product-description {
  max-width: 70ch;
  padding: 8px 0 24px;
  border-top: 1px solid var(--border);
}

.product-description h2 {
  font-size: 18px;
  font-weight: 800;
  margin: 24px 0 12px;
}

.product-description p {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 12px;
}

.qty-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.qty-control {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.qty-control button {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  font-size: 16px;
}

.qty-control button:hover {
  color: var(--pink);
}

.qty-control span {
  min-width: 32px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}

.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  padding: 20px 0 0;
}

.breadcrumb a:hover {
  color: var(--pink);
}

/* ==========================================================================
   CART PAGE
   ========================================================================== */
.cart-page {
  padding: 48px 20px;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 40px;
  align-items: start;
  align-content: start;
}

.cart-page h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.4px;
  grid-column: 1 / -1;
  margin-bottom: -12px;
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-item {
  display: flex;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  align-items: center;
}

.cart-item-img {
  width: 64px;
  height: 64px;
  background:
    linear-gradient(135deg, transparent 0 70%, var(--pink) 70% 100%),
    var(--surface-2);
  border-radius: 8px;
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.cart-item-price {
  font-size: 13px;
  color: var(--price);
  font-weight: 600;
}

.cart-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.cart-item-actions .qty-control button {
  width: 30px;
  height: 30px;
}

.cart-item-remove {
  background: none;
  border: none;
  font-size: 13px;
  color: var(--danger);
  text-decoration: underline;
}

.cart-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  grid-column: 1 / -1;
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.cart-empty a {
  color: var(--pink);
  text-decoration: underline;
}

.order-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  position: sticky;
  top: 90px;
}

.order-summary h2 {
  font-size: 16px;
  margin-bottom: 16px;
}

.order-summary.hidden {
  display: none;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 10px;
}

.summary-total {
  display: flex;
  justify-content: space-between;
  font-size: 17px;
  font-weight: 800;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 14px;
  margin-bottom: 20px;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
footer {
  background: var(--surface);
  border-top: 1px solid var(--tint-border);
  color: var(--muted);
  padding: 24px 20px;
  margin-top: 40px;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  font-size: 13px;
  color: var(--muted);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-links a {
  color: var(--muted);
  font-weight: 500;
  transition: color 0.15s ease;
}

.footer-links a:hover {
  color: var(--pink);
}

/* ==========================================================================
   AUTH / LOGIN PAGE
   ========================================================================== */
.auth-body {
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-theme {
  position: fixed;
  top: 16px;
  right: 16px;
}

.auth-wrapper {
  width: 100%;
  max-width: 400px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
}

.auth-logo {
  text-align: center;
  font-size: 28px;
  margin-bottom: 24px;
}

.auth-tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  border-radius: 7px;
}

.auth-tab.active {
  background: var(--btn-grad);
  color: #fff;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-form label {
  font-size: 13px;
  font-weight: 600;
  margin-top: 10px;
}

.auth-form input {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
}

.auth-form input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--pink);
}

.auth-form button[type="submit"] {
  margin-top: 20px;
}

.auth-error {
  font-size: 13px;
  color: var(--danger);
  min-height: 16px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-greeting {
  font-size: 13px;
  color: var(--muted);
}

.logout-link {
  font-size: 13px;
  color: var(--danger);
  text-decoration: underline;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
  nav {
    display: none;
  }

  .user-greeting {
    display: none;
  }

  .user-menu {
    gap: 10px;
  }

  .product-detail {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .cart-page {
    grid-template-columns: 1fr;
  }

  .order-summary {
    position: static;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ==========================================================================
   HEADER EXTRAS: online pill, dashboard, cart icon
   ========================================================================== */
.online-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.online-pill strong {
  color: var(--text);
  font-weight: 700;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(47, 208, 122, 0.18);
}

.dashboard-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--tint-border);
  border-radius: 12px;
  background: var(--tint);
  font-size: 14px;
  font-weight: 600;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dashboard-link:hover {
  border-color: var(--pink);
  background: rgba(255, 62, 108, 0.18);
}

.dashboard-link svg,
.cart-link svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ==========================================================================
   STORE CARD (under the header on the homepage)
   ========================================================================== */
.store-wrap {
  padding-top: 28px;
}

.store-wrap + .section {
  padding-top: 36px;
}

.store-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 24px;
  border: 1px solid var(--tint-border);
  border-radius: 28px;
  background:
    radial-gradient(600px 220px at 0% 0%, rgba(255, 62, 108, 0.22), transparent 70%),
    linear-gradient(120deg, rgba(255, 62, 108, 0.08), transparent 60%),
    var(--surface);
  box-shadow: 0 12px 40px rgba(255, 62, 108, 0.08);
}

.store-id {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.store-avatar {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #ff3e6c 0%, #c9184a 55%, #6d0b28 100%);
  box-shadow: 0 8px 24px rgba(255, 62, 108, 0.35);
}

.store-avatar img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.store-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.store-tagline {
  font-size: 14px;
  color: var(--muted);
  margin-top: 2px;
}

.store-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #ff3e6c, #c9184a);
  color: #fff;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stat-value {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.2;
}

.stars {
  display: inline-flex;
  gap: 1px;
}

.stars svg {
  width: 12px;
  height: 12px;
  fill: var(--border);
}

.stars svg.on {
  fill: var(--pink);
}

/* ==========================================================================
   VARIANTS + STOCK (product page)
   ========================================================================== */
.detail-stock {
  margin-bottom: 20px;
  font-size: 14px;
}

.variant-label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}

.variant-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.variant-option {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 120px;
  text-align: left;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.2s ease;
}

.variant-option:hover:not(:disabled) {
  border-color: var(--pink);
}

.variant-option.active {
  border-color: var(--pink);
  background: var(--tint);
  box-shadow: 0 0 0 1px var(--pink), 0 6px 16px rgba(255, 62, 108, 0.18);
}

.variant-option:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.v-name {
  font-size: 14px;
  font-weight: 700;
}

.v-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--price);
}

.v-stock {
  font-size: 11px;
  color: var(--muted);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cart-item-variant {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--tint);
  border: 1px solid var(--tint-border);
  color: var(--price);
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

/* ==========================================================================
   EMAIL NOTE
   ========================================================================== */
.email-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 20px;
  border: 1px dashed var(--tint-border);
  border-radius: 12px;
  background: var(--tint);
  font-size: 13px;
  color: var(--muted);
  max-width: 52ch;
}

.email-note svg {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  fill: none;
  stroke: var(--pink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.email-note strong {
  color: var(--text);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.order-summary .email-note {
  margin-bottom: 16px;
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
}

/* ==========================================================================
   DASHBOARD + LEGAL PAGES
   ========================================================================== */

.legal {
  max-width: 760px;
  padding-top: 48px;
  padding-bottom: 64px;
}

.legal h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.legal h2 {
  font-size: 18px;
  font-weight: 750;
  margin-top: 36px;
  margin-bottom: 10px;
  color: var(--text);
}

.legal p {
  font-size: 15px;
  line-height: 1.75;
  color: var(--muted);
  margin-bottom: 16px;
}

.legal-updated {
  font-size: 13px !important;
  color: var(--muted);
  opacity: 0.7;
  margin-bottom: 32px !important;
}

.legal ul {
  list-style: disc;
  padding-left: 24px;
  margin: 8px 0 20px;
  color: var(--muted);
}

.legal li {
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 8px;
}

.legal li::marker {
  color: var(--pink);
}

.dash-page {
  padding-top: 40px;
  padding-bottom: 40px;
}

.dash-page h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin-bottom: 24px;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

.panel h2 {
  font-size: 16px;
  margin-bottom: 16px;
}

.panel-wide {
  grid-column: 1 / -1;
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.info-row:last-child {
  border-bottom: none;
}

.info-row span:first-child {
  color: var(--muted);
}

.info-row span:last-child {
  font-weight: 600;
  word-break: break-all;
  text-align: right;
}

.panel-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
}

/* ==========================================================================
   NOTICE BANNER (checkout status messages)
   ========================================================================== */
.notice {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 14px;
  border: 1px solid var(--tint-border);
  background: var(--tint);
  color: var(--text);
}

.notice-ok {
  border-color: rgba(47, 208, 122, 0.35);
  background: rgba(47, 208, 122, 0.10);
}

.auth-error.success {
  color: var(--ok);
}

/* ==========================================================================
   ORDER / KEY HISTORY (dashboard)
   ========================================================================== */
.order-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  background: var(--surface-2);
}

.order-card + .order-card {
  margin-top: 14px;
}

.order-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}

.order-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
}

.order-pill.order-paid {
  color: var(--ok);
  border-color: rgba(47, 208, 122, 0.35);
  background: rgba(47, 208, 122, 0.10);
}

.order-pill.order-pending {
  color: var(--price);
  border-color: var(--tint-border);
  background: var(--tint);
}

.order-pill.order-refunded {
  color: var(--muted);
}

.order-line + .order-line {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.order-line-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
}

.key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border: 1px dashed var(--tint-border);
  border-radius: 10px;
  background: var(--tint);
  font-size: 13px;
}

.key-row + .key-row {
  margin-top: 8px;
}

.key-row code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--price);
  letter-spacing: 0.4px;
  word-break: break-all;
}

.copy-btn {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.copy-btn:hover {
  border-color: var(--pink);
}

.key-pending {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* ==========================================================================
   REVIEWS (product page)
   ========================================================================== */
.product-reviews {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.product-reviews h2 {
  font-size: 20px;
  margin-bottom: 18px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.review-avg {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.review-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.rating-pick {
  display: flex;
  gap: 4px;
}

.rate-star {
  background: none;
  border: none;
  padding: 2px;
  width: 26px;
  height: 26px;
}

.rate-star svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
}

.rate-star.on svg {
  fill: var(--pink);
  stroke: var(--pink);
}

.review-form textarea {
  width: 100%;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.review {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.review:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.review-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 14px;
}

.review-head .stars {
  display: inline-flex;
  gap: 1px;
}

.review-head .stars svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
}

.review-head .stars svg.on {
  fill: var(--pink);
  stroke: var(--pink);
}

.review-date {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.review p {
  font-size: 14px;
  color: var(--muted);
}

/* ==========================================================================
   RESTRICTED PANEL
   ========================================================================== */
.pf-page h1 {
  margin-bottom: 24px;
}

.pf-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pf-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 480px;
}

.pf-form input,
.pf-form select,
.pf-form textarea {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.pf-form textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  resize: vertical;
}

.pf-row {
  display: flex;
  gap: 10px;
}

.hint-ok {
  font-size: 13px;
  color: var(--ok);
  min-height: 18px;
}

.pf-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 14px;
}

.pf-stat {
  text-align: center;
  padding: 16px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.pf-stat b {
  display: block;
  font-size: 22px;
  margin-bottom: 4px;
}

.pf-stat span {
  font-size: 12px;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

.pf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

.pf-table th,
.pf-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.pf-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.pf-table td.flag {
  color: var(--danger);
  font-weight: 600;
}

.mini-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.mini-btn:hover {
  border-color: var(--pink);
  color: var(--pink);
}

.legal {
  max-width: 70ch;
  padding-top: 48px;
  padding-bottom: 48px;
}

.legal h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 20px;
}

.legal h2 {
  font-size: 18px;
  margin: 24px 0 8px;
}

.legal p {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 12px;
}

.auth-logo {
  display: flex;
  justify-content: center;
}

.auth-logo .logo-img {
  width: 32px;
  height: 32px;
}

.auth-logo .logo-text {
  font-size: 28px;
}

.logout-link {
  white-space: nowrap;
}

@media (max-width: 768px) {
  .store-card {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .store-stats {
    justify-content: flex-start;
  }

  .stat {
    flex: 1 1 auto;
  }

  .dash-grid {
    grid-template-columns: 1fr;
  }

  .header-inner {
    padding: 12px 14px;
    gap: 10px;
  }

  .online-pill {
    padding: 0 10px;
  }

  .online-pill .online-word,
  .dashboard-link .btn-label {
    display: none;
  }

  .dashboard-link {
    padding: 0;
    width: 36px;
    justify-content: center;
  }
}

.logo {
  flex-shrink: 0;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  margin-top: 4px;
  color: var(--pink);
  font-size: 13px;
  text-align: center;
  cursor: pointer;
}
  .link-btn:hover { text-decoration: underline; }

/* ==========================================================================
   INLINE-STYLE REPLACEMENTS
   Every rule here replaces a style="..." attribute that used to live in the
   markup (or in a template string built by cart.js). They exist so the pages
   need no inline styles at all, which is what lets the Content-Security-Policy
   drop 'unsafe-inline' from style-src.

   These are last in the file on purpose: they share specificity (0,1,0) with
   the base rules they override (.btn, .email-note, .logout-link, .pf-stack)
   and win by source order. Do not move them above those rules.

   .is-hidden is used for the initially-hidden restricted panel and the unused
   login forms. It must stay display:none WITHOUT !important, because the page
   scripts reveal those elements by setting .style.display via the CSSOM, and
   an inline declaration has to be able to beat this class.
   ========================================================================== */
.is-hidden { display: none; }
.terms-list { list-style: disc; color: var(--muted); font-size: 15px; margin-bottom: 13px; display: flex; flex-direction: column; gap: 6px; }
.email-note-full { max-width: none; margin-bottom: 0; }
.btn-start { align-self: flex-start; }
.btn-detail { min-width: 240px; }

/* ==========================================================================
   ADMIN EDITOR
   Labeled form fields, repeatable variant rows, and the key manager. The panel
   used to be a single raw-JSON textarea, which meant editing a product
   description meant hand-writing valid JSON and a stray comma could take the
   whole product down. These styles support plain labelled inputs instead.
   ========================================================================== */
.pf-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.pf-field > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.pf-field textarea {
  font-family: inherit;
  font-size: 14px;
  line-height: 1.55;
  resize: vertical;
}

.pf-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}

.pf-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--pink);
  margin: 0;
}

.pf-sub {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pf-variants {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pf-variant {
  display: grid;
  grid-template-columns: minmax(70px, 0.8fr) minmax(90px, 1.4fr) minmax(80px, 0.9fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.pf-variant input[type="text"],
.pf-variant input[type="number"],
.pf-variant select {
  min-width: 0;
  font-family: inherit;
  font-size: 14px;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.pf-variant select:disabled,
.pf-variant .mini-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pf-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.pf-raw {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

.pf-raw summary {
  cursor: pointer;
  font-weight: 600;
}

.pf-raw textarea {
  width: 100%;
  margin-top: 10px;
}

.pf-keyval {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
}

.pf-keyrow-sold td {
  color: var(--muted);
}

.pf-preview {
  margin-top: 6px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.pf-preview h4 {
  margin: 0 0 6px;
  font-size: 15px;
}

.pf-preview p {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

/* ==========================================================================
   FREE KEY LINK
   Sits immediately left of the online pill in the header and points at the
   keygen on the bloom worker (/GetFreeKey). Styled as an outline chip so it
   reads as a call to action next to the pill without competing with it.
   ========================================================================== */
.freekey-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--tint-border);
  background: var(--tint);
  color: var(--pink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.15s, border-color 0.15s;
}

.freekey-btn:hover {
  filter: brightness(1.15);
  border-color: var(--pink);
}

.freekey-btn::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 8px var(--pink);
}

@media (max-width: 640px) {
  .freekey-btn { padding: 6px 10px; font-size: 11px; }
}
