*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --muted: #888;
  --accent: #7c6af7;
  --font: system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', monospace;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  padding-top: 40px;
  min-height: 100dvh;
}

/* ── Shop list header ── */
.shop-header {
  padding: 2rem 1.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.shop-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.shop-header p {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* ── Product grid ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
}

/* ── Product card ── */
.product-card {
  background: var(--surface);
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.product-card:hover { background: #222; }

/* ── Product thumbnail — the hero element ── */
.product-thumb {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  contain: layout style;
}

.product-thumb-emoji {
  font-size: 3.5rem;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 2px 12px rgba(0,0,0,0.6));
  line-height: 1;
  user-select: none;
}

/* ── Card body ── */
.product-card-body {
  padding: 0.9rem 1rem 1rem;
}

.product-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  margin-bottom: 0.4rem;
}

.badge-sale        { background: #3a1a1a; color: #e05252; border: 1px solid #5a2a2a; }
.badge-new         { background: #1a2a3a; color: #6ab4f7; border: 1px solid #2a4a6a; }
.badge-best-seller { background: #1a3a28; color: #52c07a; border: 1px solid #2a5a3a; }

.product-name {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.5rem;
}

.product-price {
  font-size: 1rem;
  font-weight: 700;
  color: #52c07a;
  font-family: var(--mono);
}

/* ── Detail view ── */
.shop-detail {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: 2rem;
}

.detail-back:hover { color: var(--text); border-color: #555; }

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: start;
}

@media (max-width: 600px) {
  .detail-layout { grid-template-columns: 1fr; }
}

/* Hero thumb in detail context — larger */
.detail-layout .product-thumb {
  height: 320px;
  border-radius: 12px;
  overflow: hidden;
  contain: layout style;
}

.detail-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 0.5rem;
}

.detail-name {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.detail-price {
  font-size: 2rem;
  font-weight: 700;
  color: #52c07a;
  font-family: var(--mono);
}

.detail-desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
}

.detail-btn {
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s;
  align-self: flex-start;
}

.detail-btn:hover { background: #6a58e0; }

/* ─── Demo hint variants (used inline, themed via class) ──────── */
.demo-hint-before {
  background: #2a1a1a;
  border: 1px solid #5a2a2a;
  color: #e8a0a0;
  font-size: 0.8rem;
  padding: 0.6rem 1rem;
  margin: 0;
  line-height: 1.5;
}

.demo-hint-before strong { color: #e05252; }

.demo-hint-after {
  background: #1a2e1a;
  border: 1px solid #2a5a2a;
  color: #a0e8a0;
  font-size: 0.8rem;
  padding: 0.6rem 1rem;
  margin: 0;
  line-height: 1.5;
}

.demo-hint-after strong { color: #aaeaaa; }

/* ─── Light theme ────────────────────────────────────────────── */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f8f8f8;
    --surface: #ffffff;
    --border: #e2e2e2;
    --text: #111111;
    --muted: #777777;
    --accent: #6c5ce7;
  }

  :root:not([data-theme="dark"]) .product-card:hover { background: #f5f5f5; }
  :root:not([data-theme="dark"]) .detail-back:hover { border-color: #bbb; }

  :root:not([data-theme="dark"]) .badge-sale        { background: #fde8e8; border-color: #f5b8b8; }
  :root:not([data-theme="dark"]) .badge-new         { background: #e8f2fd; border-color: #b8d4f5; }
  :root:not([data-theme="dark"]) .badge-best-seller { background: #e8f5ee; border-color: #b8e5c8; }

  :root:not([data-theme="dark"]) .demo-hint-before {
    background: #fde8e8;
    border-color: #f5b8b8;
    color: #8a2020;
  }
  :root:not([data-theme="dark"]) .demo-hint-before strong { color: #c94040; }

  :root:not([data-theme="dark"]) .demo-hint-after {
    background: #e8f5ee;
    border-color: #b8e5c8;
    color: #1a5a30;
  }
  :root:not([data-theme="dark"]) .demo-hint-after strong { color: #389a5e; }
}

:root[data-theme="light"] {
  --bg: #f8f8f8;
  --surface: #ffffff;
  --border: #e2e2e2;
  --text: #111111;
  --muted: #777777;
  --accent: #6c5ce7;
}

html[data-theme="light"] .product-card:hover { background: #f5f5f5; }
html[data-theme="light"] .detail-back:hover { border-color: #bbb; }
html[data-theme="light"] .badge-sale        { background: #fde8e8; border-color: #f5b8b8; }
html[data-theme="light"] .badge-new         { background: #e8f2fd; border-color: #b8d4f5; }
html[data-theme="light"] .badge-best-seller { background: #e8f5ee; border-color: #b8e5c8; }

html[data-theme="light"] .demo-hint-before {
  background: #fde8e8;
  border-color: #f5b8b8;
  color: #8a2020;
}
html[data-theme="light"] .demo-hint-before strong { color: #c94040; }

html[data-theme="light"] .demo-hint-after {
  background: #e8f5ee;
  border-color: #b8e5c8;
  color: #1a5a30;
}
html[data-theme="light"] .demo-hint-after strong { color: #389a5e; }
