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

:root {
  --red:   #CC0000;
  --dark:  #111111;
  --mid:   #555555;
  --light: #f5f5f5;
  --border:#e0e0e0;
  --white: #ffffff;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--light);
  color: var(--dark);
  min-height: 100vh;
}

/* ── NAV ────────────────────────────────────────────────────── */
.nav {
  background: var(--dark);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  color: var(--white);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-decoration: none;
}
.nav-logo span { color: var(--red); }
.nav-link {
  color: rgba(255,255,255,.7);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: .3px;
  transition: color .15s;
}
.nav-link:hover { color: var(--white); }

/* ── DASHBOARD GRID ─────────────────────────────────────────── */
.page-wide {
  max-width: 1060px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.page-wide .page-title { font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.page-wide .page-sub   { color: var(--mid); margin-bottom: 32px; }
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.card-tile {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--dark);
  transition: box-shadow .15s, transform .15s;
  display: block;
  cursor: pointer;
}
.card-tile:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
  transform: translateY(-2px);
}
.card-tile-img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
  background: var(--light);
}
.card-tile-body {
  padding: 12px 14px 14px;
}
.card-tile-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-tile-date {
  font-size: 12px;
  color: var(--mid);
}
/* ── CAROUSEL DOTS ──────────────────────────────────────────── */
.carousel-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  margin: 0 4px;
  transition: background .2s;
}
.carousel-dot.active { background: var(--red); }
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--mid);
}
.empty-state p   { font-size: 16px; margin-bottom: 20px; }

/* ── FIX PANEL ──────────────────────────────────────────────── */
.fix-panel {
  display: none;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-top: 20px;
  text-align: center;
}
.fix-panel.open { display: block; }

.fix-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--white);
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--mid);
  margin-bottom: 4px;
  background-size: cover;
  background-position: center;
  transition: border-color .2s;
  position: relative;
  overflow: hidden;
}
.fix-upload-zone:hover { border-color: var(--red); }
.fix-upload-zone.drag-over { border-color: var(--red); background-color: #fff5f5; }
.fix-upload-zone.has-photo { border-style: solid; border-color: var(--red); }
.fix-upload-zone.has-photo .fix-upload-hint { display: none; }
.fix-upload-hint { pointer-events: none; display: flex; align-items: center; gap: 8px; }
.fix-photo-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.5);
  display: none;
  align-items: center; justify-content: center;
  color: white; font-size: 13px; font-weight: 600;
}
.fix-upload-zone.has-photo:hover .fix-photo-overlay { display: flex; }

.fix-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0; color: var(--mid); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
}
.fix-divider::before, .fix-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── HERO (landing) ─────────────────────────────────────────── */
.hero {
  max-width: 1060px;
  margin: 0 auto;
  padding: 64px 24px 48px;
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 56px;
  align-items: center;
}
.hero-copy h1 {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -1px;
  margin-bottom: 20px;
}
.hero-copy h1 em { font-style: normal; color: var(--red); }
.hero-copy p {
  font-size: 17px;
  color: var(--mid);
  line-height: 1.6;
  margin-bottom: 32px;
  max-width: 460px;
}
.hero-img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: 0 12px 48px rgba(0,0,0,0.18);
}

/* ── CTA BOX ────────────────────────────────────────────────── */
.cta-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 380px;
}
.cta-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--mid);
}

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s;
  white-space: nowrap;
}
.btn:hover { opacity: .85; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-red     { background: var(--red);  color: var(--white); }
.btn-dark    { background: var(--dark); color: var(--white); }
.btn-ghost   { background: transparent; color: var(--dark); border: 2px solid var(--border); }
.btn-outline { background: transparent; color: var(--dark); border: 1.5px solid var(--dark); }
.btn-full    { width: 100%; }

/* ── PAGE SHELL ─────────────────────────────────────────────── */
.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.page-title {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
}
.page-sub {
  color: var(--mid);
  margin-bottom: 32px;
}

/* ── UPLOAD ZONE ────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--white);
  height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  text-align: center;
  background-size: cover;
  background-position: center;
  transition: border-color .2s;
  position: relative;
  overflow: hidden;
}
.upload-zone:hover { border-color: var(--red); }
.upload-zone.drag-over { border-color: var(--red); background-color: #fff5f5; }
.upload-zone.has-photo { border-style: solid; border-color: var(--red); }
.upload-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--mid);
  font-size: 14px;
  pointer-events: none;
}
.upload-hint svg { opacity: .4; }
.upload-zone.has-photo .upload-hint { display: none; }
.photo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 600;
}
.upload-zone.has-photo:hover .photo-overlay { display: flex; }

/* ── MIC BUTTON ─────────────────────────────────────────────── */
.mic-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 32px 0;
}
.mic-btn {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--dark);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, transform .1s;
  box-shadow: 0 4px 16px rgba(0,0,0,.22);
}
.mic-btn:hover { transform: scale(1.05); }
.mic-btn.recording { background: var(--red); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(204,0,0,.5); }
  50%       { box-shadow: 0 0 0 18px rgba(204,0,0,0); }
}
.mic-hint { font-size: 14px; color: var(--mid); }

/* ── STATUS ─────────────────────────────────────────────────── */
.status-bar {
  text-align: center;
  padding: 14px;
  font-size: 14px;
  color: var(--mid);
  min-height: 48px;
}
.status-bar.active { color: var(--dark); font-weight: 600; }

/* ── RESULT ─────────────────────────────────────────────────── */
.card-preview {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  display: block;
  margin-bottom: 24px;
}
.result-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

/* ── STRIPE CTA ─────────────────────────────────────────────── */
.stripe-cta {
  display: none;
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 24px;
}
.stripe-cta h3 { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.stripe-cta p  { color: var(--mid); font-size: 14px; margin-bottom: 16px; }
.stripe-email  {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  margin-bottom: 10px;
  font-family: var(--font);
}
.stripe-email:focus { outline: 2px solid var(--red); outline-offset: 2px; }

/* ── PROGRESS BAR ───────────────────────────────────────────── */
.progress-section {
  display: none;
  margin-top: 32px;
  padding: 24px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.progress-section.active { display: block; }
.progress-msg {
  font-size: 15px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 14px;
  min-height: 22px;
  transition: opacity 0.3s ease;
}
.progress-msg.fading { opacity: 0; }
.progress-track {
  background: var(--border);
  border-radius: 100px;
  height: 8px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--red);
  border-radius: 100px;
  width: 0%;
  transition: width 0.6s ease-out;
}
.progress-pct {
  font-size: 12px;
  color: var(--mid);
  text-align: right;
  margin-top: 8px;
}

/* ── PAYWALL ────────────────────────────────────────────────── */
.paywall-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  padding: 32px 28px;
  margin-top: 8px;
}
.paywall-headline {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 8px;
}
.paywall-sub {
  color: var(--mid);
  font-size: 15px;
  margin-bottom: 20px;
}

/* ── DESCRIBE TEXTAREA ──────────────────────────────────────── */
.describe-area {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  font-family: var(--font);
  line-height: 1.5;
  resize: vertical;
  min-height: 100px;
  margin-bottom: 4px;
  display: block;
}
.describe-area:focus { outline: 2px solid var(--red); outline-offset: 2px; }
.describe-area:disabled { opacity: .5; }

/* ── ALERT ──────────────────────────────────────────────────── */
.alert {
  display: none;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
}
.alert.error   { background: #fff0f0; border: 1px solid #ffcccc; color: #990000; display: block; }
.alert.success { background: #f0fff4; border: 1px solid #b2f5c8; color: #1a6b3a; display: block; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 720px) {
  /* Layout */
  .hero { grid-template-columns: 1fr; padding: 32px 20px; gap: 32px; }
  .hero-img { max-width: 320px; margin: 0 auto; display: block; }
  .page { padding-left: 16px; padding-right: 16px; max-width: 100vw; }
  .page-wide { padding-left: 16px; padding-right: 16px; max-width: 100vw; overflow-x: hidden; }

  /* Images */
  .card-preview { max-width: 100%; width: 100%; }

  /* Buttons */
  .result-actions { flex-direction: column; align-items: stretch; }
  .result-actions .btn { width: 100%; max-width: 100%; }
  .btn-full { max-width: 100%; }

  /* Carousel: 2+ cards swipe on mobile */
  .cards-grid.has-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    gap: 16px;
    padding: 4px 0 16px 4vw;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .cards-grid.has-carousel::-webkit-scrollbar { display: none; }
  .cards-grid.has-carousel .card-tile {
    flex: 0 0 85vw;
    scroll-snap-align: start;
    min-width: 0;
  }
}
