/* Designer-i — Apple-grade glassmorphism.
 * Deep blur, inner highlights, spring physics, micro-interactions.
 * Every detail considered: the way messages land, buttons press,
 * light catches glass edges, and color breathes behind it all. */

* { box-sizing: border-box; }

:root {
  --ink: #f2f5fa;
  --ink-dim: #8e9bb3;
  --ink-faint: #5d6a84;
  --accent1: #5b8cff;
  --accent2: #3b5fe3;
  --accent-glow: rgba(91, 140, 255, 0.45);
  --good: #34d399;
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --spring-bounce: cubic-bezier(0.34, 1.4, 0.44, 1);
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-bright: rgba(255, 255, 255, 0.11);
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background: #05070d;
  color: var(--ink);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  letter-spacing: -0.011em;
}

::selection { background: rgba(91, 140, 255, 0.4); }

/* ------- ambient aurora: slow-drifting color, film grain, vignette ------- */
.bg-blobs { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bg-blobs::after {
  /* film grain */
  content: ""; position: absolute; inset: 0; opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.bg-blobs::before {
  /* vignette */
  content: ""; position: absolute; inset: 0; z-index: 2;
  background: radial-gradient(ellipse 90% 75% at 50% 42%, transparent 55%, rgba(0, 0, 0, 0.5) 100%);
}
.blob { position: absolute; border-radius: 50%; filter: blur(110px); will-change: transform; }
.blob-1 {
  width: 480px; height: 480px; top: -140px; left: -120px; opacity: 0.5;
  background: radial-gradient(circle, #2b3f7d 0%, transparent 70%);
  animation: drift1 26s ease-in-out infinite alternate;
}
.blob-2 {
  width: 420px; height: 420px; bottom: -160px; right: -120px; opacity: 0.42;
  background: radial-gradient(circle, #17456b 0%, transparent 70%);
  animation: drift2 32s ease-in-out infinite alternate;
}
.blob-3 {
  width: 340px; height: 340px; top: 38%; left: 58%; opacity: 0.3;
  background: radial-gradient(circle, #4a5fd0 0%, transparent 70%);
  animation: drift3 24s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate(70px, 50px) scale(1.12); } }
@keyframes drift2 { to { transform: translate(-60px, -45px) scale(1.08); } }
@keyframes drift3 { to { transform: translate(-50px, 60px) scale(0.92); } }

/* ------- the Apple glass recipe -------
 * deep blur + saturation, 0.5px-feel edge, inner top highlight,
 * soft outer shadow. This is what makes glass read as glass. */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(32px) saturate(200%) brightness(1.1);
  backdrop-filter: blur(32px) saturate(200%) brightness(1.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06),
    inset 1px 0 0 rgba(255, 255, 255, 0.06),
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Enhanced glassmorphism: floating panels with deeper frost */
.glass-deep {
  background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  -webkit-backdrop-filter: blur(40px) saturate(220%) brightness(1.15);
  backdrop-filter: blur(40px) saturate(220%) brightness(1.15);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08),
    0 16px 48px rgba(0, 0, 0, 0.5);
}

/* ------- layout ------- */
.app {
  position: relative; z-index: 1;
  width: 100%; max-width: 700px;
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  padding: 14px 14px 0;
  gap: 12px;
}

/* ------- floating header pill ------- */
.header {
  display: flex; gap: 14px; align-items: center;
  padding: 12px 18px 12px 12px; border-radius: 24px;
  animation: header-in 0.7s var(--spring) backwards;
}
@keyframes header-in { from { opacity: 0; transform: translateY(-18px) scale(0.97); } }
.logo {
  width: 52px; height: 52px; flex: 0 0 52px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 16px;
  /* Glassmorphism tile — frosted glass, metallic letters float on top */
  background: linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.03));
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08),
    0 8px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.35s var(--spring-bounce);
}
.logo svg { display: block; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3)); }
.logo:hover { transform: scale(1.06) rotate(-4deg); }
.header h1 {
  margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.02em;
  background: linear-gradient(180deg, #fff 30%, #b9c6e2 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.subtitle { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-dim); font-weight: 500; }
.subtitle a { transition: color 0.2s; }
.subtitle a:hover { color: var(--ink); }

/* ------- chat ------- */
.chat {
  flex: 1; overflow-y: auto;
  padding: 8px 6px 4px;
  display: flex; flex-direction: column; gap: 10px;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
  mask-image: linear-gradient(180deg, transparent 0, #000 18px, #000 calc(100% - 8px), transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 18px, #000 calc(100% - 8px), transparent 100%);
}
.chat::-webkit-scrollbar { width: 5px; }
.chat::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 3px; }
.chat::-webkit-scrollbar-track { background: transparent; }

.msg {
  max-width: 86%; padding: 13px 17px;
  border-radius: 22px; line-height: 1.55; font-size: 15.5px;
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  animation: msg-in 0.55s var(--spring-bounce) backwards;
  overflow-wrap: break-word;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(14px) scale(0.94); filter: blur(4px); }
}
.msg.bot {
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 6px 24px rgba(0, 0, 0, 0.3);
  align-self: flex-start; border-bottom-left-radius: 7px;
}
.msg.user {
  background: linear-gradient(135deg, #6b9bff 0%, #3b5fe3 100%);
  align-self: flex-end; border-bottom-right-radius: 7px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 6px 22px var(--accent-glow);
}
.msg img.mockup {
  width: 100%; border-radius: 16px; margin-top: 12px; display: block;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  animation: mockup-reveal 0.9s var(--spring) backwards;
}
@keyframes mockup-reveal {
  from { opacity: 0; transform: scale(0.96); filter: blur(14px) saturate(0.6); }
}

/* 2D swipe gallery: horizontal = angles, vertical = variations */
.design-gallery { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.design-gallery .gallery-img-wrap { min-height: 200px; }
.design-gallery .mockup { margin-top: 12px; }
.gallery-meta { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 8px; }
.gallery-counter { font-size: 13px; opacity: 0.8; }
.gallery-dots { display: flex; gap: 8px; padding: 8px; }
.gallery-dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.25); cursor: pointer; }
.gallery-dot.active { background: rgba(255,255,255,0.9); }
.gallery-hint { text-align: center; font-size: 12px; opacity: 0.5; margin-top: 4px; }

/* iPhone-style carousel: drag follows finger, snaps with spring */
.carousel-viewport {
  overflow: hidden; border-radius: 16px; margin-top: 12px;
  touch-action: pan-y; cursor: grab;
}
.carousel-viewport:active { cursor: grabbing; }
.carousel-track {
  display: flex; will-change: transform;
  /* Width set inline via JS: n * 100% */
}
.carousel-slide {
  flex: 0 0 100%; /* Each slide = 100% of viewport */
  width: 100%; min-width: 100%;
  max-width: 100%;
}
.carousel-slide .mockup { margin-top: 0; }
.carousel-slide .composite-wrap { margin-top: 0; }

/* Instant composite mockups: design overlaid on blank template */
/* Positioning is set inline per-angle (see renderGallery). */
.composite-wrap { position: relative; }
.composite-design {
  position: absolute;
  transform: translate(-50%, -50%);
  max-height: 32%;
  object-fit: contain;
  pointer-events: none;
}

/* iMessage-style typing indicator */
.typing-dots { display: inline-flex; gap: 5px; padding: 4px 2px; align-items: center; }
.typing-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-dim);
  animation: typing-bounce 1.3s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ------- quick replies: staggered spring chips ------- */
.quick-replies { display: flex; flex-wrap: wrap; gap: 9px; padding: 2px 6px; }
.quick-replies:empty { display: none; }
.quick-replies button {
  background: rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  border-radius: 999px; padding: 11px 20px; cursor: pointer;
  font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; min-height: 44px;
  transition: transform 0.3s var(--spring), background 0.25s, box-shadow 0.25s, border-color 0.25s;
  animation: chip-in 0.5s var(--spring-bounce) backwards;
}
.quick-replies button:nth-child(1) { animation-delay: 0.03s; }
.quick-replies button:nth-child(2) { animation-delay: 0.09s; }
.quick-replies button:nth-child(3) { animation-delay: 0.15s; }
.quick-replies button:nth-child(4) { animation-delay: 0.21s; }
.quick-replies button:nth-child(5) { animation-delay: 0.27s; }
@keyframes chip-in { from { opacity: 0; transform: translateY(10px) scale(0.9); } }
.quick-replies button:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 8px 22px rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.25);
}
.quick-replies button:active { transform: scale(0.94); transition-duration: 0.1s; }
/* Hero actions (Reimagine / Buy now): bigger and bolder than the edit chips. */
.quick-replies button.big-reply {
  flex: 1 1 44%;
  font-size: 17px;
  font-weight: 700;
  padding: 15px 24px;
  min-height: 56px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(79, 124, 255, 0.35), rgba(47, 95, 224, 0.35));
  border: 1px solid rgba(120, 160, 255, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 6px 18px rgba(47, 95, 224, 0.25);
}
.quick-replies button.big-reply:hover {
  background: linear-gradient(135deg, rgba(79, 124, 255, 0.5), rgba(47, 95, 224, 0.5));
  border-color: rgba(140, 175, 255, 0.6);
}

/* ------- progress card with shimmer ------- */
.progress-card {
  background: rgba(255, 255, 255, 0.07);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 30px rgba(0, 0, 0, 0.35);
  align-self: stretch; max-width: 100%;
  border-radius: 22px; padding: 18px 22px;
  font-size: 15.5px; position: relative; overflow: hidden;
}
.progress-card::before {
  /* traveling shimmer */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.07) 50%, transparent 60%);
  animation: shimmer 2.4s linear infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.progress-card .step-row { padding: 7px 0; color: var(--ink-dim); font-weight: 500; transition: color 0.3s; display: flex; align-items: center; gap: 10px; }
.progress-card .step-row.done { color: var(--good); font-weight: 700; }
.progress-card .step-row.working { color: var(--ink); font-weight: 600; }
.step-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px;
  background: var(--ink-faint); transition: background 0.3s, box-shadow 0.3s;
}
.step-row.done .step-dot { background: var(--good); box-shadow: 0 0 8px rgba(52, 211, 153, 0.6); }
.step-row.working .step-dot { background: var(--accent1); box-shadow: 0 0 8px var(--accent-glow); animation: dot-pulse 1.2s ease-in-out infinite; }
@keyframes dot-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.35); opacity: 0.7; } }
.progress-card .step-row.working::after {
  content: "…";
  display: inline-block; width: 1.2em; text-align: left;
  animation: dots 1.2s steps(4) infinite;
}
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* ------- buy button ------- */
.buy-link {
  display: block; text-align: center;
  margin-top: 14px; padding: 16px 20px; border-radius: 18px;
  background: linear-gradient(135deg, #2fe38a 0%, #34d399 50%, #22c55e 100%);
  background-size: 200% 200%;
  color: #03240f; font-weight: 800; font-size: 17px; letter-spacing: -0.01em; text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 8px 28px rgba(52, 211, 153, 0.35);
  transition: transform 0.3s var(--spring), box-shadow 0.3s, background-position 0.6s;
  min-height: 56px;
}
.buy-link:hover {
  transform: translateY(-2px) scale(1.015);
  background-position: 100% 50%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 12px 36px rgba(52, 211, 153, 0.5);
}
.buy-link:active { transform: scale(0.97); transition-duration: 0.1s; }

/* ------- composer: the hero element ------- */
.composer {
  display: flex; gap: 10px; padding: 10px;
  border-radius: 28px; margin-bottom: 14px;
  transition: box-shadow 0.35s, border-color 0.35s;
}
.composer:focus-within {
  border-color: rgba(91, 140, 255, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 0 0 4px rgba(91, 140, 255, 0.14),
    0 12px 40px rgba(0, 0, 0, 0.4),
    0 0 32px rgba(91, 140, 255, 0.12);
}
.composer input {
  flex: 1; padding: 13px 20px; border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.32); color: var(--ink);
  font-size: 16px; outline: none; min-height: 50px;
  font-family: inherit; letter-spacing: -0.011em;
  transition: background 0.25s;
}
.composer input::placeholder { color: var(--ink-faint); }
.composer input:focus { background: rgba(0, 0, 0, 0.45); }
.composer button {
  width: 52px; height: 50px; flex: 0 0 52px;
  border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, #6b9bff 0%, #3b5fe3 100%);
  color: #fff; font-size: 20px; font-weight: 800;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 4px 18px var(--accent-glow);
  transition: transform 0.3s var(--spring-bounce), box-shadow 0.25s, filter 0.25s;
  display: flex; align-items: center; justify-content: center;
}
.composer button:hover { transform: scale(1.1) rotate(-8deg); filter: brightness(1.1); }
.composer button:active { transform: scale(0.88); transition-duration: 0.08s; }
.composer button:disabled { opacity: 0.35; cursor: default; transform: none; filter: grayscale(0.4); }

.error { color: #ff9d9d; font-size: 14.5px; }
.demo-note { display: block; margin-top: 8px; font-size: 12.5px; color: var(--ink-dim); }

/* ------- confetti ------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti-piece {
  position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 3px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0.8; }
}

/* ------- product cards (legacy) ------- */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 10px; border-radius: 22px; cursor: pointer;
  background: rgba(255, 255, 255, 0.07);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: var(--ink); font-size: 15px; font-weight: 700;
  transition: transform 0.3s var(--spring), box-shadow 0.3s, border-color 0.3s;
  min-height: 110px; justify-content: center;
  animation: chip-in 0.5s var(--spring-bounce) backwards;
}
.card:nth-child(2) { animation-delay: 0.06s; }
.card:nth-child(3) { animation-delay: 0.12s; }
.card:nth-child(4) { animation-delay: 0.18s; }
.card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(91, 140, 255, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 12px 32px rgba(91, 140, 255, 0.25);
}
.card:active { transform: scale(0.96); transition-duration: 0.1s; }
.card .card-emoji { font-size: 44px; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4)); }
.card .card-hint { font-size: 12px; font-weight: 500; color: var(--ink-dim); }

/* ------- storefront ------- */
.shop-wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 120px; position: relative; z-index: 1; }
.shop-card { border-radius: 24px; padding: 22px; margin-bottom: 16px; animation: msg-in 0.6s var(--spring) backwards; }
.product-img { width: 100%; border-radius: 16px; display: block; background: #141821; box-shadow: 0 12px 36px rgba(0,0,0,0.45); }
.product-title { font-size: 25px; margin: 16px 0 4px; letter-spacing: -0.02em; font-weight: 700; }
.product-price { font-size: 22px; font-weight: 800; color: var(--good); margin: 6px 0 12px; letter-spacing: -0.01em; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-dim); margin: 14px 0 7px; text-transform: uppercase; letter-spacing: 0.06em; }
.field select, .field input { width: 100%; padding: 13px 15px; border-radius: 14px; border: 1px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.35); color: var(--ink); font-size: 16px; font-family: inherit; transition: border-color 0.25s, box-shadow 0.25s; }
.field select:focus, .field input:focus { outline: none; border-color: rgba(91,140,255,0.5); box-shadow: 0 0 0 3px rgba(91,140,255,0.15); }
.field select option { background: #141821; }
.btn-primary { display: block; width: 100%; text-align: center; padding: 16px; border: none; border-radius: 16px; font-size: 17px; font-weight: 800; letter-spacing: -0.01em; color: #fff; background: linear-gradient(135deg, #6b9bff, #3b5fe3); cursor: pointer; margin-top: 16px; text-decoration: none; box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 6px 24px var(--accent-glow); transition: transform 0.3s var(--spring), filter 0.25s; }
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.08); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.55; cursor: wait; transform: none; }
.btn-ghost { display: block; width: 100%; text-align: center; padding: 14px; border-radius: 16px; font-size: 15px; font-weight: 700; color: var(--ink); background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1); cursor: pointer; margin-top: 10px; text-decoration: none; transition: transform 0.3s var(--spring), background 0.25s; }
.btn-ghost:hover { background: rgba(255,255,255,0.12); transform: translateY(-1px); }
.btn-ghost:active { transform: scale(0.98); }
.qty-row { display: flex; align-items: center; gap: 14px; }
.qty-row button { width: 42px; height: 42px; border-radius: 14px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.07); color: var(--ink); font-size: 20px; cursor: pointer; transition: transform 0.2s var(--spring), background 0.2s; }
.qty-row button:hover { background: rgba(255,255,255,0.14); }
.qty-row button:active { transform: scale(0.9); }
.qty-row span { font-size: 18px; font-weight: 800; min-width: 30px; text-align: center; }
.back-link { display: inline-block; color: var(--ink-dim); text-decoration: none; margin-bottom: 12px; font-size: 14px; font-weight: 600; transition: color 0.2s; }
.back-link:hover { color: var(--ink); }

/* cart drawer */
.cart-fab { position: fixed; right: 18px; bottom: 18px; width: 62px; height: 62px; border-radius: 50%; font-size: 26px; cursor: pointer; z-index: 60; transition: transform 0.3s var(--spring-bounce); }
.cart-fab:hover { transform: scale(1.08); }
.cart-fab:active { transform: scale(0.92); }
.cart-count { position: absolute; top: -4px; right: -4px; background: linear-gradient(135deg, #6b9bff, #3b5fe3); color: #fff; font-size: 12px; font-weight: 800; min-width: 22px; height: 22px; border-radius: 11px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 10px var(--accent-glow); }
.cart-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity 0.3s; z-index: 70; }
.cart-overlay.show { opacity: 1; pointer-events: auto; }
.cart-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 92vw); z-index: 71; transform: translateX(105%); transition: transform 0.45s var(--spring); display: flex; flex-direction: column; padding: 20px; border-radius: 24px 0 0 24px; }
.cart-drawer.show { transform: none; }
.cart-head { display: flex; justify-content: space-between; align-items: center; }
.cart-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }
.cart-close { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1); color: var(--ink-dim); font-size: 16px; cursor: pointer; width: 34px; height: 34px; border-radius: 50%; transition: transform 0.25s var(--spring), background 0.2s; }
.cart-close:hover { background: rgba(255,255,255,0.15); transform: rotate(90deg); }
.cart-items { flex: 1; overflow-y: auto; margin: 12px 0; }
.cart-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.08); animation: msg-in 0.4s var(--spring) backwards; }
.cart-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; background: #141821; }
.cart-item-info { flex: 1; }
.cart-item-title { font-weight: 700; font-size: 14px; letter-spacing: -0.01em; }
.cart-item-variant { color: var(--ink-dim); font-size: 12px; margin: 2px 0 6px; }
.cart-item-row { display: flex; align-items: center; gap: 10px; }
.cart-item-row button { width: 28px; height: 28px; border-radius: 9px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.07); color: var(--ink); cursor: pointer; transition: transform 0.2s var(--spring); }
.cart-item-row button:active { transform: scale(0.88); }
.cart-item-right { text-align: right; font-weight: 700; font-size: 14px; }
.cart-rm { background: none; border: none; color: var(--ink-dim); font-size: 12px; cursor: pointer; text-decoration: underline; margin-top: 6px; }
.cart-empty { color: var(--ink-dim); text-align: center; margin-top: 40px; }
.cart-foot { border-top: 1px solid rgba(255,255,255,0.08); padding-top: 14px; }
.cart-total { display: flex; justify-content: space-between; font-size: 17px; margin-bottom: 4px; font-weight: 700; }

/* checkout */
.order-line { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 14px; }
.order-line .dim { color: var(--ink-dim); font-size: 12px; }
.totals { margin-top: 10px; }
.totals .order-line { border: none; padding: 5px 0; }
.totals .grand { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.demo-banner { background: rgba(255, 190, 60, 0.1); border: 1px solid rgba(255,190,60,0.35); border-radius: 14px; padding: 13px 15px; font-size: 13px; color: #ffd98a; margin-bottom: 14px; }
.secure-note { font-size: 12px; color: var(--ink-dim); text-align: center; margin-top: 10px; }
.error-box { background: rgba(255,90,90,0.1); border: 1px solid rgba(255,90,90,0.4); color: #ff9d9d; border-radius: 14px; padding: 13px 15px; font-size: 14px; margin-top: 12px; display: none; animation: msg-in 0.4s var(--spring) backwards; }
.checkmark { font-size: 64px; text-align: center; animation: chip-in 0.7s var(--spring-bounce) backwards; }
.success-title { text-align: center; font-size: 25px; margin: 14px 0 4px; letter-spacing: -0.02em; font-weight: 700; }
.order-id { text-align: center; color: var(--ink-dim); font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  .blob, .bg-blobs::after { display: none; }
  .progress-card .step-row.working::after, .progress-card::before { animation: none; }
  .msg, .quick-replies button, .card, .header { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

@media (max-width: 420px) {
  .header h1 { font-size: 17px; }
  .logo { width: 46px; height: 46px; flex-basis: 46px; font-size: 26px; border-radius: 14px; }
  .msg { font-size: 15px; max-width: 90%; }
  .app { padding: 10px 10px 0; gap: 10px; }
}

/* ------- auth (Supabase login) ------- */
.auth-btn {
  margin-left: auto; flex: 0 0 auto;
  font: inherit; font-size: 13px; font-weight: 600;
  color: var(--ink);
  background: var(--glass-bright);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  max-width: 45%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: transform 0.15s var(--spring), background 0.2s, box-shadow 0.2s;
}
.auth-btn:hover { background: rgba(255, 255, 255, 0.16); box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.12); }
.auth-btn:active { transform: scale(0.96); }
.auth-btn.signed-in { color: var(--ink-dim); font-weight: 500; }

.auth-modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(3, 5, 10, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 0.18s ease;
}
.auth-modal[hidden] { display: none; }
.auth-modal.open { opacity: 1; }

/* My Creations log */
.creations-list {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 60vh; overflow-y: auto;
}
.creation-card {
  display: flex; gap: 12px; align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px; padding: 10px;
}
.creation-card img {
  width: 56px; height: 56px; border-radius: 10px;
  object-fit: cover; flex: none; background: rgba(255, 255, 255, 0.08);
}
.creation-meta { min-width: 0; }
.creation-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.creation-sub { color: var(--ink-dim); font-size: 12.5px; margin-top: 2px; }
.creation-link { color: var(--accent, #7db3ff); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.creation-link:hover { text-decoration: underline; }
.auth-card {
  position: relative;
  width: 100%; max-width: 360px;
  border-radius: 24px;
  padding: 26px 24px 22px;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.22s var(--spring);
}
.auth-modal.open .auth-card { transform: none; }
.auth-card h2 { margin: 0 0 16px; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.auth-close {
  position: absolute; top: 10px; right: 12px;
  font: inherit; font-size: 22px; line-height: 1;
  color: var(--ink-dim);
  background: none; border: none; cursor: pointer;
  padding: 6px 8px; border-radius: 10px;
}
.auth-close:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); }
.auth-card form { display: flex; flex-direction: column; gap: 10px; }
.auth-card input {
  font: inherit; font-size: 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-card input::placeholder { color: var(--ink-faint); }
.auth-card input:focus { border-color: var(--accent1); box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.18); }
.auth-hint { margin: 0 0 14px; font-size: 14px; color: var(--ink-dim); word-break: break-word; }
.auth-msg { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-dim); }
.auth-submit {
  font: inherit; font-size: 15px; font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, var(--accent1), var(--accent2));
  border: none; border-radius: 14px;
  padding: 12px 14px; width: 100%;
  cursor: pointer;
  box-shadow: 0 6px 20px var(--accent-glow);
  transition: transform 0.15s var(--spring), opacity 0.2s;
}
.auth-submit:hover { opacity: 0.94; }
.auth-submit:active { transform: scale(0.98); }
.auth-submit:disabled { opacity: 0.55; cursor: default; }
.auth-buy { margin: 10px 0 4px; }
.buy-card-el { margin: 10px 0; padding: 12px; border-radius: 12px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.18); }
.auth-redeem { display: flex; gap: 8px; margin: 10px 0 4px; }
.auth-redeem .auth-input { flex: 1; min-width: 0; }
.auth-redeem .auth-submit { width: auto; padding-left: 16px; padding-right: 16px; white-space: nowrap; }
.auth-toggle {
  font: inherit; font-size: 13.5px; font-weight: 500;
  color: var(--accent1);
  background: none; border: none; cursor: pointer;
  display: block; margin: 14px auto 0; padding: 4px 6px;
}
.auth-toggle:hover { text-decoration: underline; }
