/* ============================================
   DrawForge AI — Premium Dark Theme
   Inspired by contrarianthinking.co
   Mobile-first, utility-driven
   ============================================ */

/* --- Reset & Variables --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Core Palette */
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: #16161f;
  --bg-card-hover: #1c1c28;
  --bg-elevated: #1e1e2a;

  /* Accent Colors */
  --accent: #c9485b;
  --accent-light: #e05a6e;
  --accent-dark: #a13a4a;
  --gold: #d4a853;
  --gold-light: #e6c478;

  /* Text */
  --text-primary: #f0ece4;
  --text-secondary: #9a9aab;
  --text-muted: #5a5a6e;

  /* Borders */
  --border: #2a2a3a;
  --border-hover: #3a3a4e;

  /* Status */
  --success: #4ade80;
  --error: #f87171;
  --warning: #fbbf24;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;

  /* Misc */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(201, 72, 91, 0.15);
}

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

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

/* --- Utility --- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.hidden {
  display: none !important;
}

.accent {
  color: var(--accent);
}

.accent-italic {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--accent-light);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 4px 16px rgba(201, 72, 91, 0.3);
}

.btn--primary:hover {
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  box-shadow: 0 6px 24px rgba(201, 72, 91, 0.4);
  transform: translateY(-1px);
}

.btn--outline {
  border: 1px solid var(--border);
  color: var(--text-primary);
  background: transparent;
}

.btn--outline:hover {
  border-color: var(--accent);
  color: var(--accent-light);
  background: rgba(201, 72, 91, 0.05);
}

.btn--accent {
  background: var(--accent);
  color: #fff;
}

.btn--accent:hover {
  background: var(--accent-light);
}

.btn--sm {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

.btn--lg {
  padding: 1rem 2rem;
  font-size: 1rem;
}

.btn--full {
  width: 100%;
  justify-content: center;
  padding: 1rem;
  font-size: 1rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: var(--space-md) 0;
  transition: all var(--transition);
  background: transparent;
}

.nav--scrolled {
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: var(--space-sm) 0;
}

.nav__container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__logo {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.nav__logo-icon {
  color: var(--accent);
  font-size: 1.5rem;
}

.nav__links {
  display: none;
  align-items: center;
  gap: var(--space-xl);
}

.nav__links a:not(.btn) {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition);
  letter-spacing: 0.02em;
}

.nav__links a:not(.btn):hover {
  color: var(--text-primary);
}

.nav__toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: var(--space-sm);
  background: none;
  border: none;
}

.nav__toggle span {
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  transition: all var(--transition);
  border-radius: 2px;
}

.nav__toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav__toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav__toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.nav__status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot--ready {
  background: var(--success);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
  animation: pulse-dot 2s ease-in-out infinite;
}

.status-dot--warning {
  background: var(--warning);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}

.status-dot--locked {
  background: var(--error);
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.4);
}

/* --- Nav User Display --- */
.nav__user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 4px 4px 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.8rem;
}

.nav__user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.nav__user-name {
  color: var(--text-secondary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav__user-logout {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  background: transparent;
}

.nav__user-logout:hover {
  color: var(--error);
  background: rgba(248, 113, 113, 0.1);
}

@media (max-width: 768px) {
  .nav__user-name {
    display: none;
  }
}

/* --- Modal --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  animation: modal-fade 0.3s ease;
}

@keyframes modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  max-width: 440px;
  width: 100%;
  padding: var(--space-2xl) var(--space-xl);
  position: relative;
  animation: modal-rise 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(201, 72, 91, 0.1);
}

@keyframes modal-rise {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 160px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.modal__close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: 50%;
  transition: all var(--transition);
}

.modal__close:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.modal__content {
  text-align: center;
}

.modal__icon {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(201, 72, 91, 0.08);
  border: 1px solid rgba(201, 72, 91, 0.2);
  border-radius: 50%;
  color: var(--accent-light);
  margin: 0 auto var(--space-lg);
}

.modal h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
  letter-spacing: -0.02em;
}

.modal p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-xl);
}

.modal__features {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
  padding: var(--space-md);
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  text-align: left;
}

.modal__feature {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.modal__feature-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(74, 222, 128, 0.12);
  color: var(--success);
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.modal__google {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-md);
  min-height: 44px;
}

.modal__note {
  font-size: 0.7rem !important;
  color: var(--text-muted) !important;
  margin: 0 !important;
}

/* Fallback button when Google Client ID not configured */
.modal__setup-warning {
  padding: var(--space-md);
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: var(--radius-md);
  color: var(--warning);
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: left;
  margin-bottom: var(--space-md);
}

.modal__setup-warning code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
}

/* ==== Pricing Modal ==== */
.modal--pricing {
  max-width: 480px;
}

.pricing__badge {
  display: inline-block;
  padding: 4px 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
  box-shadow: 0 4px 16px rgba(201, 72, 91, 0.3);
}

.pricing__price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-md);
  margin-bottom: 2px;
}

.pricing__price-original {
  font-size: 1.1rem;
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

.pricing__price-current {
  font-family: 'Playfair Display', serif;
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.02em;
}

.pricing__price-save {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--success);
  background: rgba(74, 222, 128, 0.12);
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}

.pricing__price-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
  margin-top: 4px !important;
}

.pricing__tokens {
  background: linear-gradient(135deg, rgba(201, 72, 91, 0.08), rgba(201, 72, 91, 0.02));
  border: 1px solid rgba(201, 72, 91, 0.25);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  text-align: center;
}

.pricing__tokens-big {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin-bottom: 4px;
}

.pricing__tokens-big strong {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-light);
  letter-spacing: -0.01em;
}

.pricing__tokens-big span {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.pricing__tokens-math {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.pricing__tokens-math strong {
  color: var(--text-primary);
  font-weight: 600;
}

.pricing__features {
  margin-bottom: var(--space-lg);
}

.pricing__cta {
  margin-bottom: var(--space-md);
  font-size: 1rem !important;
  padding: 14px 20px !important;
}

/* ==== Token indicator in nav ==== */
.status-dot--pro {
  background: var(--accent-light);
  box-shadow: 0 0 8px rgba(224, 90, 110, 0.5);
}

.status-dot--low {
  background: var(--warning);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Mobile nav */
@media (max-width: 768px) {
  .nav__links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 75%;
    max-width: 300px;
    height: 100vh;
    background: var(--bg-secondary);
    flex-direction: column;
    align-items: flex-start;
    padding: 5rem var(--space-xl) var(--space-xl);
    gap: var(--space-lg);
    transition: right var(--transition);
    border-left: 1px solid var(--border);
  }

  .nav__links.open {
    display: flex;
    right: 0;
  }
}

@media (min-width: 769px) {
  .nav__links {
    display: flex;
  }

  .nav__toggle {
    display: none;
  }
}

/* --- Hero --- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 8rem 0 var(--space-4xl);
  overflow: hidden;
}

.hero__bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(201, 72, 91, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 72, 91, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black, transparent);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black, transparent);
}

.hero__content {
  max-width: 640px;
  margin-bottom: var(--space-3xl);
}

.hero__badge {
  display: inline-block;
  padding: 0.4rem 1rem;
  background: rgba(201, 72, 91, 0.1);
  border: 1px solid rgba(201, 72, 91, 0.25);
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-light);
  margin-bottom: var(--space-lg);
}

.hero__title {
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-lg);
}

.hero__subtitle {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-xl);
  max-width: 540px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-3xl);
}

.hero__stats {
  display: flex;
  gap: var(--space-2xl);
}

.hero__stat {
  display: flex;
  flex-direction: column;
}

.hero__stat-number {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero__stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: var(--space-xs);
}

/* Hero Visual */
.hero__visual {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  justify-content: center;
  flex-wrap: wrap;
}

.hero__card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  width: 100%;
  max-width: 260px;
  transition: all var(--transition);
}

.hero__card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.hero__card--sketch {
  opacity: 0.8;
}

.hero__card--output {
  border-color: rgba(201, 72, 91, 0.3);
  box-shadow: var(--shadow-glow);
}

.hero__card-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.hero__card-content {
  color: var(--text-secondary);
}

.hero__card-content svg {
  width: 100%;
  height: auto;
}

.hero__arrow {
  color: var(--accent);
  animation: arrow-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes arrow-pulse {
  0%, 100% { transform: translateX(0); opacity: 0.5; }
  50% { transform: translateX(8px); opacity: 1; }
}

.sketch-svg {
  opacity: 0.6;
}

/* --- Sections Common --- */
.section-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.section-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--space-md);
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* --- Features --- */
.features {
  padding: var(--space-4xl) 0;
  background: var(--bg-secondary);
}

.features__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition);
}

.feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.feature-card__icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: rgba(201, 72, 91, 0.08);
  color: var(--accent-light);
  margin-bottom: var(--space-lg);
}

.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

@media (min-width: 640px) {
  .features__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .features__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* --- How It Works --- */
.how-it-works {
  padding: var(--space-4xl) 0;
}

.steps {
  max-width: 700px;
  margin: 0 auto;
}

.step {
  display: flex;
  gap: var(--space-xl);
  align-items: flex-start;
}

.step__number {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.4;
  flex-shrink: 0;
  line-height: 1;
  min-width: 56px;
}

.step__content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.step__content p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.step__connector {
  width: 2px;
  height: 40px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  margin: var(--space-md) 0 var(--space-md) 27px;
  opacity: 0.3;
}

/* --- Use Cases --- */
.use-cases {
  padding: var(--space-4xl) 0;
  background: var(--bg-secondary);
}

.use-cases__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

.use-case-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition);
  text-align: left;
  position: relative;
  overflow: hidden;
}

.use-case-card:hover {
  border-color: var(--gold);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.use-case-card--featured {
  border-color: rgba(201, 72, 91, 0.4);
  background: linear-gradient(135deg, var(--bg-card), rgba(201, 72, 91, 0.04));
}

.use-case-card--featured:hover {
  border-color: var(--accent);
}

.use-case-card__badge {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(212, 168, 83, 0.08);
  border: 1px solid rgba(212, 168, 83, 0.25);
  padding: 3px 8px;
  border-radius: 100px;
}

.use-case-card--featured .use-case-card__badge {
  color: var(--accent-light);
  background: rgba(201, 72, 91, 0.12);
  border-color: rgba(201, 72, 91, 0.35);
}

.use-case-card__icon {
  font-size: 1.8rem;
  margin-bottom: var(--space-md);
  display: block;
}

.use-case-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  letter-spacing: -0.01em;
}

.use-case-card__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.use-case-card__list li {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
  padding-left: var(--space-md);
  position: relative;
}

.use-case-card__list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 6px;
  height: 1px;
  background: var(--accent);
}

@media (min-width: 640px) {
  .use-cases__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .use-cases__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1280px) {
  .use-cases__grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* --- CTA --- */
.cta {
  padding: var(--space-4xl) 0;
}

.cta__content {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-3xl) var(--space-xl);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
}

.cta__content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.cta__content h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  margin-bottom: var(--space-md);
}

.cta__content p {
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
}

/* --- Footer --- */
.footer {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--border);
}

.footer__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  align-items: center;
  text-align: center;
}

.footer__brand {
  font-size: 1.2rem;
  font-weight: 700;
}

.footer__tagline {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
  font-weight: 400;
}

.footer__links {
  display: flex;
  gap: var(--space-xl);
}

.footer__links a {
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: color var(--transition);
}

.footer__links a:hover {
  color: var(--text-primary);
}

.footer__bottom {
  text-align: center;
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
}

.footer__bottom p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

@media (min-width: 769px) {
  .footer__content {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

/* ============================================
   APP PAGE STYLES
   ============================================ */

.app-page {
  background: var(--bg-primary);
}

.app {
  padding-top: 6rem;
  padding-bottom: var(--space-3xl);
  min-height: 100vh;
}

.app__header {
  margin-bottom: var(--space-2xl);
}

.app__header h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.app__header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.app__layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}

@media (min-width: 1024px) {
  .app__layout {
    grid-template-columns: 1fr 1fr;
  }
}

.app__panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.app__panel--output {
  min-height: 500px;
  display: flex;
  flex-direction: column;
}

/* --- Input Mode Toggle --- */
.input-mode {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 4px;
}

.input-mode__btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.input-mode__btn.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.input-mode__btn:hover:not(.active) {
  color: var(--text-primary);
}

/* --- Language Toggle --- */
.lang-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: var(--space-md);
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}

.lang-btn.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dark);
}

.lang-btn:hover:not(.active) {
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.lang-btn__flag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--gold);
}

/* --- Action Buttons (Brainstorm + Generate) --- */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.btn--accent.btn--full {
  background: linear-gradient(135deg, #1a6dd4, #2196f3);
  box-shadow: 0 4px 16px rgba(33, 150, 243, 0.25);
}
.btn--accent.btn--full:hover {
  background: linear-gradient(135deg, #1976d2, #42a5f5);
  box-shadow: 0 6px 24px rgba(33, 150, 243, 0.35);
  transform: translateY(-1px);
}
.btn--accent.btn--full .btn__text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* --- Brainstorm Brief Panel --- */
.brief-panel {
  margin-top: var(--space-lg);
  border: 1px solid #1a73e8;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(26,115,232,0.08), rgba(33,150,243,0.04));
  overflow: hidden;
  animation: briefSlideIn 0.35s ease-out;
}
@keyframes briefSlideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.brief-panel.hidden { display: none; }

.brief-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(26,115,232,0.12);
  border-bottom: 1px solid rgba(26,115,232,0.2);
}
.brief-panel__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #64b5f6;
}
.brief-panel__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}
.brief-panel__close:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }

.brief-panel__body {
  padding: 1rem;
  max-height: 420px;
  overflow-y: auto;
}
.brief-panel__body::-webkit-scrollbar { width: 4px; }
.brief-panel__body::-webkit-scrollbar-thumb { background: #2a2a3a; border-radius: 2px; }

.brief-panel__actions {
  display: flex;
  gap: var(--space-sm);
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(26,115,232,0.15);
  align-items: center;
}
.brief-panel__actions .btn--primary {
  flex: 1;
}

/* Brief content styles */
.brief__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}
.brief__summary {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.55;
}

.brief__section {
  margin-bottom: var(--space-md);
}
.brief__section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.brief__section-title svg { width: 14px; height: 14px; }

.brief__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.brief__table th {
  text-align: left;
  padding: 0.35rem 0.5rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #1e1e2e;
}
.brief__table td {
  padding: 0.35rem 0.5rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(30,30,46,0.5);
}
.brief__table tr:hover td { background: rgba(255,255,255,0.02); }
.brief__table .td-highlight {
  color: var(--text-primary);
  font-weight: 500;
}

.brief__tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 500;
  background: rgba(26,115,232,0.15);
  color: #64b5f6;
  margin: 2px 3px 2px 0;
}

.brief__note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
  line-height: 1.45;
}
.brief__note::before {
  content: "\\2022";
  color: #64b5f6;
  flex-shrink: 0;
  margin-top: 1px;
}

.brief__enhanced-prompt {
  background: rgba(0,0,0,0.25);
  border: 1px solid #1e1e2e;
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  cursor: text;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.brief__enhanced-prompt:focus {
  outline: none;
  border-color: var(--accent);
}

/* --- Input Sections --- */
.input-section {
  margin-bottom: var(--space-xl);
}

.input-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.input-hint {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
}

/* --- Textarea with Mic --- */
.textarea-wrap {
  position: relative;
}

.input-textarea {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  padding-right: 52px;
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 120px;
  transition: border-color var(--transition);
}

.input-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 72, 91, 0.1);
}

.input-textarea::placeholder {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Mic Button */
.mic-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 2;
}
.mic-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
  transform: scale(1.05);
}
.mic-btn.recording {
  background: rgba(244, 67, 54, 0.15);
  border-color: #f44336;
  color: #f44336;
  animation: micGlow 1.5s ease-in-out infinite;
}
@keyframes micGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.4); }
  50%      { box-shadow: 0 0 0 8px rgba(244, 67, 54, 0); }
}

.mic-btn__icon--active.hidden { display: none; }
.mic-btn.recording .mic-btn__icon { display: none; }
.mic-btn.recording .mic-btn__icon--active { display: block !important; }

.mic-btn__pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid #f44336;
  animation: micPulseRing 1.2s ease-out infinite;
}
.mic-btn__pulse.hidden { display: none; }
@keyframes micPulseRing {
  0%   { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Mic Status */
.mic-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 0.35rem 0.65rem;
  background: rgba(244, 67, 54, 0.08);
  border: 1px solid rgba(244, 67, 54, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: #ef9a9a;
  animation: briefSlideIn 0.25s ease-out;
}
.mic-status.hidden { display: none; }
.mic-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f44336;
  animation: micDotBlink 1s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes micDotBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}
.mic-status--unsupported {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.2);
  color: var(--warning);
}
.mic-status--unsupported .mic-status__dot {
  background: var(--warning);
  animation: none;
}

/* --- Upload Zone --- */
.upload-zone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-primary);
  overflow: hidden;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(201, 72, 91, 0.03);
}

.upload-zone__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-muted);
}

.upload-zone__content p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.upload-zone__content span {
  font-size: 0.8rem;
}

.upload-zone__formats {
  font-size: 0.7rem !important;
  color: var(--text-muted) !important;
  margin-top: var(--space-sm);
}

.upload-zone__preview {
  width: 100%;
  max-height: 250px;
  object-fit: contain;
  border-radius: var(--radius-md);
}

.upload-zone__remove {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--transition);
}

.upload-zone__remove:hover {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}

/* --- Type Selector --- */
.type-selector {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.type-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.5rem 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.type-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.type-btn.active {
  border-color: var(--accent);
  color: var(--accent-light);
  background: rgba(201, 72, 91, 0.08);
}

.type-btn__icon {
  font-size: 1rem;
}

/* --- Dynamic Forms --- */
.dynamic-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

@media (min-width: 480px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 72, 91, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235a5a6e'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  padding-right: 2rem;
  cursor: pointer;
}

.form-group select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* --- SKU Info Card --- */
.sku-info {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: linear-gradient(135deg, rgba(201, 72, 91, 0.06), rgba(212, 168, 83, 0.04));
  border: 1px solid rgba(201, 72, 91, 0.2);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}

.sku-info::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(to bottom, var(--accent), var(--gold));
}

.sku-info__header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: var(--space-sm);
}

.sku-info__text {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.sku-info__text strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* --- Format Selector --- */
.format-selector {
  display: flex;
  gap: var(--space-md);
}

.format-option {
  flex: 1;
  cursor: pointer;
}

.format-option input {
  display: none;
}

.format-option__box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0.8rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.format-option__box strong {
  font-size: 0.9rem;
}

.format-option__box small {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.format-option input:checked + .format-option__box {
  border-color: var(--accent);
  background: rgba(201, 72, 91, 0.08);
  color: var(--accent-light);
}

/* --- Output Panel --- */
.output-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  text-align: center;
  padding: var(--space-3xl);
}

.output-placeholder p {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.output-placeholder span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.output-result {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.output-result__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.output-result__header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.output-result__actions {
  display: flex;
  gap: var(--space-sm);
}

.output-result__canvas {
  flex: 1;
  background: #fff;
  border-radius: var(--radius-md);
  min-height: 450px;
  overflow: hidden;
  position: relative;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.output-result__canvas:active {
  cursor: grabbing;
}

.canvas-inner {
  transform-origin: 0 0;
  transition: none;
  display: inline-block;
  min-width: 100%;
  min-height: 100%;
}

.canvas-inner svg {
  display: block;
}

/* --- Zoom Controls --- */
.zoom-controls {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}

.zoom-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.zoom-btn:hover {
  border-color: var(--accent);
  color: var(--accent-light);
  background: rgba(201, 72, 91, 0.05);
}

.zoom-level {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 44px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.zoom-hint {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  letter-spacing: 0.03em;
}

.output-error {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  text-align: center;
  padding: var(--space-3xl);
}

.output-error p {
  color: var(--error);
  font-size: 0.9rem;
}

/* --- Spinner --- */
.spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Design Tabs --- */
.design-tabs {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  padding-bottom: var(--space-xs);
}

.design-tab {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0.75rem 0.5rem;
  background: var(--bg-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.design-tab:hover {
  border-color: var(--border-hover);
}

.design-tab.active {
  border-color: var(--accent);
  background: rgba(201, 72, 91, 0.08);
}

.design-tab.ready {
  border-color: var(--success);
}

.design-tab.failed {
  border-color: var(--error);
  opacity: 0.5;
}

.design-tab__label {
  font-size: 0.85rem;
  font-weight: 600;
}

.design-tab__style {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Design Progress --- */
.design-progress {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  background: var(--bg-primary);
  border-radius: var(--radius-md);
}

.design-progress__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: var(--space-sm) 0;
}

.design-progress__item.done {
  color: var(--success);
}

.design-progress__item.done .spinner {
  animation: none;
}

.design-progress__item.error {
  color: var(--error);
}

.design-progress__item.error .spinner {
  animation: none;
}

/* --- Scroll Animations --- */
.feature-card,
.step,
.use-case-card {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.feature-card.visible,
.step.visible,
.use-case-card.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered animation delays */
.feature-card:nth-child(2), .use-case-card:nth-child(2) { transition-delay: 0.1s; }
.feature-card:nth-child(3), .use-case-card:nth-child(3) { transition-delay: 0.2s; }
.feature-card:nth-child(4), .use-case-card:nth-child(4) { transition-delay: 0.3s; }
.feature-card:nth-child(5) { transition-delay: 0.4s; }
.feature-card:nth-child(6) { transition-delay: 0.5s; }

/* --- Responsive Fine-tuning --- */
@media (max-width: 480px) {
  .hero__stats {
    gap: var(--space-lg);
  }

  .hero__stat-number {
    font-size: 1.5rem;
  }

  .hero__actions {
    flex-direction: column;
  }

  .hero__actions .btn {
    width: 100%;
    justify-content: center;
  }

  .app__panel {
    padding: var(--space-lg);
  }
}

/* Selection color */
::selection {
  background: rgba(201, 72, 91, 0.3);
  color: var(--text-primary);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* --- Drafting Studio (loading) --- */
.studio {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  background: linear-gradient(180deg, #0f1117 0%, #151824 100%);
  border: 1px solid rgba(201, 72, 91, 0.18);
  border-radius: var(--radius-md);
  color: #dfe3ef;
  overflow: hidden;
  position: relative;
}
.studio::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(600px 140px at 20% -10%, rgba(201, 72, 91, 0.18), transparent 60%);
  pointer-events: none;
}
.studio__header {
  display: flex; justify-content: space-between; align-items: center;
  position: relative;
}
.studio__title {
  display: flex; align-items: center; gap: 0.55rem;
  font-family: var(--font-display, serif);
  font-size: 1rem; letter-spacing: 0.02em; color: #f1f3f9;
}
.studio__pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-light);
  box-shadow: 0 0 0 0 rgba(224, 90, 110, 0.7);
  animation: studioPulse 1.6s ease-out infinite;
}
@keyframes studioPulse {
  0%   { box-shadow: 0 0 0 0 rgba(224, 90, 110, 0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(224, 90, 110, 0); }
  100% { box-shadow: 0 0 0 0 rgba(224, 90, 110, 0); }
}
.studio__timer {
  font-family: 'Courier New', ui-monospace, monospace;
  font-size: 0.78rem; color: #8a93ad;
  display: flex; align-items: center; gap: 0.45rem;
}
.studio__timer #studioElapsed {
  color: var(--accent-light); font-weight: 600;
  min-width: 2.5em; text-align: right;
}
.studio__timer-sep { opacity: 0.5; }

.studio__chips {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-sm);
  position: relative;
}
.studio-chip {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
}
.studio-chip__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #6b7a99;
  box-shadow: 0 0 8px rgba(107, 122, 153, 0.5);
  flex-shrink: 0;
  animation: chipIdle 1.8s ease-in-out infinite;
}
@keyframes chipIdle {
  0%, 100% { opacity: 0.45; transform: scale(0.85); }
  50%      { opacity: 1;    transform: scale(1.1);  }
}
.studio-chip__body { display: flex; flex-direction: column; min-width: 0; }
.studio-chip__name {
  font-size: 0.72rem; color: #c7cde0; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.studio-chip__label {
  font-size: 0.72rem; color: #8a93ad;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.studio-chip.done {
  background: rgba(76, 175, 80, 0.08);
  border-color: rgba(76, 175, 80, 0.35);
}
.studio-chip.done .studio-chip__dot {
  background: #4caf50; box-shadow: 0 0 10px rgba(76, 175, 80, 0.6);
  animation: none;
}
.studio-chip.done .studio-chip__label { color: #9ddfa0; }
.studio-chip.error {
  background: rgba(244, 67, 54, 0.08);
  border-color: rgba(244, 67, 54, 0.35);
}
.studio-chip.error .studio-chip__dot {
  background: #ef5350; box-shadow: 0 0 10px rgba(239, 83, 80, 0.6);
  animation: none;
}
.studio-chip.error .studio-chip__label { color: #ef9a9a; }

.studio__canvas {
  position: relative;
  background: #0a0d14;
  border: 1px solid rgba(201, 72, 91, 0.22);
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 600 / 280;
  max-height: 240px;
}
.studio-blueprint {
  display: block; width: 100%; height: 100%;
  color: #5b6fa8;
}
.studio-blueprint .bp-draw path,
.studio-blueprint .bp-draw line,
.studio-blueprint .bp-draw rect,
.studio-blueprint .bp-draw circle {
  fill: none; stroke: #89a8ff; stroke-width: 1.2;
  stroke-linecap: round; stroke-linejoin: round;
}
.studio-blueprint .bp-draw .solid { fill: #89a8ff; stroke: none; opacity: 0.7; }
.studio-blueprint .bp-draw .dim { stroke: #c9485b; stroke-width: 0.8; }
.studio-blueprint .bp-draw .label {
  fill: #c7cde0; font-family: 'Courier New', monospace;
  font-size: 8px; stroke: none;
}
.bp-scan { animation: bpScan 3.2s linear infinite; }
@keyframes bpScan {
  0%   { transform: translateX(0); opacity: 0.1; }
  50%  { opacity: 0.45; }
  100% { transform: translateX(600px); opacity: 0.1; }
}
@keyframes bpDraw {
  from { stroke-dashoffset: var(--len, 400); }
  to   { stroke-dashoffset: 0; }
}
@keyframes bpFade {
  from { opacity: 0; }
  to   { opacity: 0.7; }
}

.studio__stages {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem 1.2rem;
  position: relative;
}
.studio-stage {
  display: flex; align-items: center; gap: 0.55rem;
  font-size: 0.78rem; color: #6b7590;
  transition: color 0.4s ease;
}
.studio-stage__mark {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid #3a4158;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.4s ease;
}
.studio-stage.active { color: #f1f3f9; }
.studio-stage.active .studio-stage__mark {
  border-color: var(--accent-light);
  background: radial-gradient(circle, var(--accent-light) 30%, transparent 32%);
  animation: stageActive 1.2s ease-in-out infinite;
}
@keyframes stageActive {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 90, 110, 0.4); }
  50%      { box-shadow: 0 0 0 5px rgba(224, 90, 110, 0); }
}
.studio-stage.done { color: #9ddfa0; }
.studio-stage.done .studio-stage__mark {
  border-color: #4caf50; background: #4caf50;
}
.studio-stage.done .studio-stage__mark::after {
  content: ""; width: 4px; height: 7px;
  border: solid #0a0d14; border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) translate(-0.5px, -0.5px);
}

.studio__tip {
  display: flex; align-items: center; gap: 0.5rem;
  padding-top: var(--space-sm);
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  font-size: 0.75rem; color: #8a93ad;
  position: relative;
  min-height: 22px;
}
.studio__tip svg { color: var(--accent-light); flex-shrink: 0; }
.studio__tip #studioTip {
  transition: opacity 0.4s ease;
}
.studio__tip #studioTip.fading { opacity: 0; }

@media (max-width: 640px) {
  .studio__chips { grid-template-columns: 1fr; }
  .studio__stages { grid-template-columns: 1fr; }
  .studio__canvas { max-height: 180px; }
}

/* ============================================
   DESIGN STUDIO — Interactive SVG Editor
   ============================================ */

/* Full-screen overlay */
.df-editor {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0d0d14;
  display: flex;
  flex-direction: column;
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, sans-serif;
}
.df-editor.hidden { display: none; }
body.editor-open { overflow: hidden; }

/* Top Bar */
.df-editor__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 0.45rem 0.75rem;
  background: #111119;
  border-bottom: 1px solid #1e1e2e;
  flex-shrink: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
}
.df-editor__topbar-left,
.df-editor__topbar-center,
.df-editor__topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.df-editor__logo {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-right: var(--space-md);
  white-space: nowrap;
}
.df-editor__logo-icon {
  color: var(--accent);
  margin-right: 4px;
}
.df-editor__tool-group {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #16161f;
  border-radius: 8px;
  padding: 3px;
}
.df-tool-sep {
  width: 1px;
  height: 22px;
  background: #2a2a3a;
  margin: 0 4px;
  flex-shrink: 0;
}

/* Tool Buttons */
.df-tool {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: #8a93ad;
  cursor: pointer;
  transition: all 0.15s;
}
.df-tool:hover { background: #1e1e2e; color: #d0d4e0; }
.df-tool.active { background: var(--accent-dark); color: #fff; }

/* Action Buttons (undo/redo/grid/snap) */
.df-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: #8a93ad;
  cursor: pointer;
  transition: all 0.15s;
}
.df-action:hover:not(:disabled) { background: #1e1e2e; color: #d0d4e0; }
.df-action:disabled { opacity: 0.3; cursor: not-allowed; }
.df-action.active { color: var(--accent-light); border-color: var(--accent-dark); }

/* Standard Buttons */
.df-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
  white-space: nowrap;
}
.df-btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.df-btn--primary:hover { background: var(--accent-light); }
.df-btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: #2a2a3a;
}
.df-btn--ghost:hover { background: #1e1e2e; color: var(--text-primary); border-color: #3a3a4e; }
.df-btn--sm { padding: 0.3rem 0.55rem; font-size: 0.72rem; }
.df-btn--danger { background: transparent; color: var(--error); border-color: rgba(248,113,113,0.3); }
.df-btn--danger:hover { background: rgba(248,113,113,0.1); }

/* Editor Body */
.df-editor__body {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* Sidebars */
.df-editor__sidebar {
  width: 220px;
  background: #111119;
  border-right: 1px solid #1e1e2e;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}
.df-editor__sidebar--right {
  border-right: none;
  border-left: 1px solid #1e1e2e;
  width: 240px;
}
.df-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #1e1e2e;
  flex-shrink: 0;
}
.df-panel__toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.65rem;
}
.df-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.df-panel__body::-webkit-scrollbar { width: 4px; }
.df-panel__body::-webkit-scrollbar-track { background: transparent; }
.df-panel__body::-webkit-scrollbar-thumb { background: #2a2a3a; border-radius: 2px; }

/* Canvas Area */
.df-editor__canvas-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.df-editor__canvas {
  flex: 1;
  background: #ffffff;
  overflow: auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.df-editor__canvas svg {
  max-width: 100%;
  max-height: 100%;
}
.df-editor__canvas svg .df-selected {
  outline: none; /* We handle selection with the selection box */
}

/* Status Bar */
.df-editor__statusbar {
  padding: 0.35rem 0.75rem;
  background: #111119;
  border-top: 1px solid #1e1e2e;
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Layers Panel */
.df-layer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid #16161f;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.df-layer:hover { background: #1a1a26; }
.df-layer--selected { background: rgba(74,144,217,0.15); color: var(--text-primary); }
.df-layer--info { color: var(--text-muted); font-style: italic; cursor: default; }
.df-layer__vis {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.6rem;
  flex-shrink: 0;
}
.df-layer__vis:hover { color: var(--text-primary); }
.df-layer__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.df-layers__empty {
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Properties Panel */
.df-props__empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.df-props__section {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid #1e1e2e;
}
.df-props__title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}
.df-props__row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.df-props__label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  width: 50px;
  flex-shrink: 0;
}
.df-props__value {
  font-size: 0.75rem;
  color: var(--text-primary);
  font-weight: 500;
}
.df-props__input {
  flex: 1;
  background: #16161f;
  border: 1px solid #2a2a3a;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.75rem;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}
.df-props__input:focus { border-color: var(--accent); }
.df-props__input--sm { width: 55px; flex: 0 0 55px; }
.df-props__input--full { width: 100%; }
.df-props__unit {
  font-size: 0.68rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.df-props__color-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.df-props__color {
  width: 28px;
  height: 28px;
  border: 1px solid #2a2a3a;
  border-radius: 4px;
  padding: 1px;
  cursor: pointer;
  background: transparent;
  flex-shrink: 0;
}
.df-props__color::-webkit-color-swatch-wrapper { padding: 0; }
.df-props__color::-webkit-color-swatch { border: none; border-radius: 3px; }
.df-props__checkbox {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}
.df-props__checkbox input { width: 14px; height: 14px; cursor: pointer; }
.df-props__select {
  flex: 1;
  background: #16161f;
  border: 1px solid #2a2a3a;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 0.75rem;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  outline: none;
  cursor: pointer;
  min-width: 0;
}
.df-props__select:focus { border-color: var(--accent); }
.df-props__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Edit Studio Button (shown on output result) */
.btn--studio {
  background: linear-gradient(135deg, #1a73e8, #4a90d9);
  color: #fff;
  border: none;
}
.btn--studio:hover {
  background: linear-gradient(135deg, #1557b0, #3a7bc8);
}

/* Responsive */
@media (max-width: 900px) {
  .df-editor__sidebar--left { display: none; }
  .df-editor__sidebar--right { width: 200px; }
  .df-editor__topbar { padding: 0.35rem 0.5rem; }
}
@media (max-width: 640px) {
  .df-editor__sidebar--right { display: none; }
  .df-editor__topbar { flex-wrap: wrap; gap: 4px; }
  .df-editor__topbar-center { order: 3; width: 100%; justify-content: center; }
}
