:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --ink: #0f172a;
  --muted: #526077;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --accent: #7c3aed;
  --success: #059669;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.topbar {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.brand-pill {
  font-size: 0.7rem;
  font-weight: 700;
  background: #eff6ff;
  color: var(--primary);
  border: 1px solid #bfdbfe;
  padding: 2px 8px;
  border-radius: 999px;
}
.ai-pill {
  font-size: 0.7rem;
  font-weight: 800;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  padding: 2px 8px;
  border-radius: 999px;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.16s ease;
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-ai {
  background: linear-gradient(120deg, #6d28d9, #2563eb);
  color: #fff;
  box-shadow: 0 6px 16px rgba(109, 40, 217, 0.22);
}
.btn-ai:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ai:disabled { opacity: 0.65; cursor: wait; transform: none; }
.btn-dark {
  background: var(--ink);
  color: #fff;
}
.btn-dark:hover { background: #1e293b; }
.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 7px 12px; font-size: 0.82rem; border-radius: 8px; }
.btn-full { width: 100%; }

/* Hero */
.hero {
  padding: 40px 0 24px;
  text-align: center;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  background: #eff6ff;
  border: 1px solid #dbeafe;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.hero h1 {
  font-size: clamp(1.85rem, 4vw, 2.85rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  max-width: 760px;
  margin: 0 auto 12px;
}
.hero p {
  color: var(--muted);
  font-size: 1.03rem;
  max-width: 640px;
  margin: 0 auto 22px;
}

/* Mode Tabs */
.tabs {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 5px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.tab-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 10px 20px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab-btn.active {
  background: var(--ink);
  color: #fff;
}

/* Studio Workspace */
.panel { display: none; padding: 18px 0 48px; }
.panel.active { display: block; }

.studio-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 22px;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.section-label {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.control-group {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--surface-2);
}
.control-group:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

/* Upload Dropzone */
.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  background: #f8fafc;
  transition: all 0.15s ease;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: #eff6ff;
}
.dropzone strong { display: block; font-size: 0.92rem; margin-bottom: 4px; }
.dropzone span { font-size: 0.8rem; color: var(--muted); }
.demo-row {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

/* Preset Chips */
.chip-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.chip {
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: all 0.14s ease;
}
.chip small { display: block; font-weight: 500; color: var(--muted); font-size: 0.72rem; }
.chip.active {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
}

/* Swatches */
.swatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.swatch {
  height: 34px;
  border-radius: 9px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: transform 0.14s ease;
}
.swatch:hover { transform: scale(1.06); }
.swatch.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

/* Sliders */
.slider-row {
  margin-bottom: 10px;
}
.slider-row:last-child { margin-bottom: 0; }
.slider-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.slider-head span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Select & Text Inputs */
.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.textarea { min-height: 92px; resize: vertical; }
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 6px;
}

/* Preview Stage */
.preview-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.stage {
  background-color: #eef2f6;
  background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
  background-size: 16px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  min-height: 460px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
#previewCanvas {
  max-width: 100%;
  max-height: 520px;
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
  background: #fff;
}
.stage-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.download-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
}
.download-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.meta-note { font-size: 0.8rem; color: var(--muted); }

/* Copy Generator */
.copy-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 22px;
  align-items: start;
}
.output-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.output-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.output-head h3 { font-size: 0.9rem; }
.output-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
}
.output-list li {
  background: #fff;
  border: 1px solid var(--border);
  padding: 9px 12px;
  border-radius: 8px;
}
.tag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.tag-pill {
  background: #fff;
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
}

/* Pricing */
.pricing {
  padding: 48px 0 64px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.pricing-head {
  text-align: center;
  max-width: 620px;
  margin: 0 auto 32px;
}
.pricing-head h2 { font-size: 1.75rem; letter-spacing: -0.02em; margin-bottom: 8px; }
.pricing-head p { color: var(--muted); }
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.price-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--surface);
}
.price-card.featured {
  border: 2px solid var(--primary);
  box-shadow: 0 18px 40px rgba(37, 99, 235, 0.1);
  position: relative;
}
.popular-tag {
  position: absolute;
  top: -12px;
  right: 18px;
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
}
.price-amount {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 10px 0 6px;
}
.price-amount span { font-size: 0.9rem; font-weight: 500; color: var(--muted); }
.price-features {
  list-style: none;
  margin: 16px 0 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--muted);
}
.price-features li::before {
  content: "✓ ";
  color: var(--success);
  font-weight: 800;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: 18px;
  max-width: 440px;
  width: 100%;
  padding: 26px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}
.modal h3 { font-size: 1.25rem; margin-bottom: 8px; }
.modal p { font-size: 0.92rem; color: var(--muted); margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

footer {
  border-top: 1px solid var(--border);
  padding: 26px 0;
  text-align: center;
  font-size: 0.84rem;
  color: var(--muted);
}
footer a { color: var(--primary); text-decoration: none; font-weight: 600; }

.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: var(--ink);
  color: #fff;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 120;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 920px) {
  .studio-grid, .copy-grid, .pricing-grid {
    grid-template-columns: 1fr;
  }
  .stage { min-height: 340px; }
}
