/* CardBloom — kawaii Japanese graphic style.
 * Soft pastel palette (sakura pink, cream, sky blue, mint), generous rounded
 * corners, rounded typography, and tasteful sakura / washi touches.
 */
:root {
  --bg: #fff6f8;
  --card: #ffffff;
  --ink: #4a3b47;
  --muted: #9b8a94;
  --line: #f6dce6;
  --accent: #f2789f;
  --accent-dark: #d95d84;
  --accent-soft: #ffedf3;
  --sky: #7ec3e8;
  --sky-soft: #e8f6ff;
  --mint: #5ec99a;
  --mint-soft: #eafaf1;
  --cream: #fff3d6;
  --red: #d94f4f;
  --red-soft: #fff0f0;
  --radius: 22px;
  --shadow: 0 8px 28px rgba(214, 120, 155, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Maru Gothic ProN", "Zen Maru Gothic", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  background-color: var(--bg);
  background-image: radial-gradient(#ffe3ec 1.5px, transparent 1.5px);
  background-size: 28px 28px;
  color: var(--ink);
  line-height: 1.6;
}

.container { max-width: 760px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.linklike { color: var(--accent-dark); text-decoration: underline; cursor: pointer; font-weight: 700; }

/* Header */
.site-header {
  background: linear-gradient(135deg, #ffb3c8, #f78fb3 55%, #ff9e7d);
  color: #fff;
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 4px 16px rgba(217, 93, 132, 0.25);
  border-radius: 0 0 24px 24px;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.logo {
  color: #fff;
  font-size: 1.55rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 6px rgba(180, 60, 100, 0.35);
}
.header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.price-badge {
  background: rgba(255, 255, 255, 0.28);
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  padding: 4px 13px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
}
/* Test-mode badge: shown in the header when IMAGE_PROVIDER=test, so mock
 * cards are never mistaken for AI cards. Amber so it stands out. */
.test-badge {
  background: #ffd43b;
  color: #5c3d00;
  padding: 4px 13px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.85rem;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(92, 61, 0, 0.2);
}
.test-note {
  background: #fff9db;
  border: 1.5px dashed #fab005;
  color: #5c3d00;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 0.92rem;
}
.lang-toggle { display: flex; background: rgba(255, 255, 255, 0.25); border-radius: 999px; padding: 3px; }
.lang-toggle button {
  border: 0;
  background: transparent;
  color: #fff;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  opacity: 0.8;
}
.lang-toggle button.active { background: #fff; color: var(--accent-dark); opacity: 1; }

/* Hero + steps */
.hero { text-align: center; padding: 26px 0 6px; }
.hero h1 { font-size: 1.35rem; margin: 0; color: #6b4a5e; }
.petals {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 1.35rem;
  margin-bottom: 6px;
  line-height: 1;
}
.petal { display: inline-block; animation: float 3.2s ease-in-out infinite; }
.petal:nth-child(2) { animation-delay: 0.4s; }
.petal:nth-child(3) { animation-delay: 0.8s; }
.petal:nth-child(4) { animation-delay: 1.2s; }
.petal:nth-child(5) { animation-delay: 1.6s; }
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50% { transform: translateY(-8px) rotate(8deg); }
}
.steps {
  list-style: none;
  display: flex;
  gap: 6px;
  padding: 0;
  margin: 20px 0;
  justify-content: space-between;
}
.steps li {
  flex: 1;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  border-top: 3px solid var(--line);
  padding-top: 8px;
}
.steps li.active { color: var(--accent-dark); border-top-color: var(--accent); font-weight: 800; }
.steps li.done { color: var(--mint); border-top-color: var(--mint); }
.step-num {
  display: inline-block;
  width: 22px; height: 22px; line-height: 22px;
  border-radius: 50%;
  background: var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  margin-right: 5px;
}
.steps li.active .step-num { background: var(--accent); color: #fff; }
.steps li.done .step-num { background: var(--mint); color: #fff; }

/* Panels — washi tape strip on top of each panel */
.panel {
  position: relative;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 26px 26px;
  margin: 16px 0 28px;
}
.panel::before {
  content: "";
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 118px;
  height: 26px;
  background: repeating-linear-gradient(45deg, #ffd6e7 0 10px, #fff0f5 10px 20px);
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(214, 120, 155, 0.2);
  opacity: 0.95;
}
.panel h2 { margin-top: 0; font-size: 1.25rem; color: #6b4a5e; }
.panel h3 { font-size: 1.05rem; margin: 22px 0 8px; color: #6b4a5e; }

/* Notice / error */
.notice {
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 0.95rem;
  font-weight: 600;
}
.notice.error { background: var(--red-soft); color: var(--red); border: 1.5px solid #ffc9c9; }
.notice.info { background: var(--mint-soft); color: #2b8a5e; border: 1.5px solid #b2f2d5; }

/* Upload */
.dropzone {
  border: 2.5px dashed #f4a7c3;
  border-radius: 20px;
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  background: #fff8fb;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { font-size: 2.4rem; }
.photo-preview {
  max-width: 100%;
  max-height: 320px;
  border-radius: 16px;
  display: block;
  margin: 0 auto;
  border: 3px solid #fff;
  box-shadow: 0 4px 16px rgba(214, 120, 155, 0.18);
}

/* Forms */
.field-label { display: block; font-weight: 800; margin: 18px 0 8px; color: #6b4a5e; }
input[type="text"], input[type="email"], textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  font-size: 1rem;
  font-family: inherit;
  background: #fffafc;
  color: var(--ink);
}
input:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; background: #fff; }
textarea { resize: vertical; }
.blessing-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 10px; }

/* Style grid */
.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}
.style-card {
  border: 2px solid var(--line);
  border-radius: 18px;
  background: #fff;
  padding: 12px 6px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.style-card .emoji { font-size: 1.7rem; display: block; margin-bottom: 4px; }
.style-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.style-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(242, 120, 159, 0.25);
}

/* Summary + price */
.summary { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.summary-photo { width: 90px; height: 120px; object-fit: cover; border-radius: 14px; border: 2px solid var(--line); }
.summary dl { margin: 0; }
.summary dl div { margin-bottom: 10px; }
.summary dt { font-size: 0.8rem; color: var(--muted); }
.summary dd { margin: 0; font-weight: 700; word-break: break-word; }
.price-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1.5px dashed var(--line);
}
.price-row.total { font-size: 1.15rem; }

/* Buttons */
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 26px;
  font-size: 1rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
}
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(242, 120, 159, 0.4); }
.btn.primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn.primary:disabled { background: #f4b8cc; cursor: wait; box-shadow: none; }
.btn.secondary { background: #fff; color: var(--ink); border: 2px solid var(--line); }
.btn.secondary:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn.small { padding: 8px 16px; font-size: 0.88rem; }
.btn.whatsapp { background: #34d17b; color: #fff; box-shadow: 0 4px 14px rgba(52, 209, 123, 0.35); }
.btn.whatsapp:hover { background: #22b566; transform: translateY(-1px); }

/* Generating */
.generating { text-align: center; padding: 24px 0 8px; }
.spinner {
  width: 46px; height: 46px;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Results */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}
.result-card {
  border: 3px solid transparent;
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  background: none;
  position: relative;
  box-shadow: 0 4px 14px rgba(214, 120, 155, 0.14);
  transition: transform 0.15s;
}
.result-card:hover { transform: translateY(-2px); }
.result-card img { width: 100%; display: block; aspect-ratio: 2 / 3; object-fit: cover; }
.result-card.selected { border-color: var(--accent); }
.result-card.selected::after {
  content: "✓";
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px; line-height: 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 2px 6px rgba(217, 93, 132, 0.4);
}
.email-row { display: flex; gap: 10px; }
.email-row input { flex: 1; }

/* Unlock panel (step 4, locked state) — the preview is free; US$1 unlocks
 * download / email / WhatsApp for the 3 previewed cards. */
.unlock-panel {
  background: var(--cream);
  border: 2px dashed #f4c95d;
  border-radius: 18px;
  padding: 18px 20px;
  margin: 18px 0;
  text-align: center;
}
.unlock-panel h3 { margin: 0 0 6px; }
.unlock-panel .price-row { border-top-color: #f4d98c; }
.unlock-panel .actions { justify-content: center; }
.unlocked-note {
  background: var(--mint-soft);
  border: 1.5px solid #b2f2d5;
  color: #2b8a5e;
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 700;
  text-align: center;
}
/* Locked share actions: dimmed and disabled until the cards are unlocked. */
#share-actions.locked { opacity: 0.55; }
#share-actions.locked .btn:disabled { cursor: not-allowed; }
.btn.secondary:disabled { background: #fdf2f5; color: var(--muted); box-shadow: none; }
.btn.whatsapp.disabled {
  background: #a8dba8;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
input:disabled { background: #f8f0f3; color: var(--muted); }

hr { border: 0; border-top: 1.5px dashed var(--line); margin: 24px 0; }

/* Footer */
.site-footer { text-align: center; padding: 10px 0 36px; }
.footer-deco { font-size: 1.1rem; letter-spacing: 6px; margin: 0 0 8px; }

@media (max-width: 560px) {
  .panel { padding: 24px 18px 18px; }
  .steps li { font-size: 0.72rem; }
  .step-num { margin-right: 0; display: block; margin: 0 auto 4px; }
  .email-row { flex-direction: column; }
  .summary { flex-direction: column; }
  .hero h1 { font-size: 1.2rem; }
}
