:root {
  --bg: #090a0f;
  --bg-elevated: #11131b;
  --bg-panel: #151822;
  --bg-input: #0e1018;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f3f5f9;
  --text-muted: #9aa3b8;
  --text-dim: #667085;
  --accent: #6366f1;
  --accent-hover: #7c7ff8;
  --accent-soft: rgba(99, 102, 241, 0.16);
  --cyan: #22d3ee;
  --emerald: #10b981;
  --amber: #f59e0b;
  --danger: #ef4444;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.55);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button, input, select {
  font-family: inherit;
  color: inherit;
}

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(9, 10, 15, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1 0%, #22d3ee 100%);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.45);
  font-size: 15px;
  color: #fff;
}

.badge-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.28);
}

.badge-pro {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 5px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  background: #1d2130;
  border-color: rgba(255, 255, 255, 0.24);
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  border-color: rgba(129, 140, 248, 0.5);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #7477f7 0%, #5b52ee 100%);
  transform: translateY(-1px);
}

.btn-pro {
  background: linear-gradient(135deg, #f59e0b 0%, #ec4899 55%, #8b5cf6 100%);
  border: none;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 18px rgba(236, 72, 153, 0.28);
}

.btn-pro:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

/* Studio Workspace */
.studio-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: calc(100vh - 58px);
  border-bottom: 1px solid var(--border);
}

.sidebar {
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
  max-height: calc(100vh - 58px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

.panel-section {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.dropzone {
  border: 1.5px dashed rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.06);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.09);
}

.dropzone-main {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.dropzone-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.sample-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.chip-btn {
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
  text-align: center;
  position: relative;
}

.chip-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #fff;
}

.chip-btn.locked::after {
  content: "PRO";
  position: absolute;
  top: -5px;
  right: -4px;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 4px;
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  color: #fff;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
}

.swatch {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  transition: transform 0.12s ease, border-color 0.12s ease;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.swatch:hover {
  transform: scale(1.08);
}

.swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--accent);
}

.swatch.locked::after {
  content: "★";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

.control-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.control-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.control-header strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.text-input {
  width: 100%;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 12.5px;
  outline: none;
}

.text-input:focus {
  border-color: var(--accent);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-muted);
}

.toggle-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Stage Area */
.stage-column {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.08), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(34, 211, 238, 0.06), transparent 45%),
    #0b0d14;
  min-width: 0;
}

.stage-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(17, 19, 27, 0.72);
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.stage-canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  overflow: auto;
  position: relative;
}

.canvas-frame {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  background-image:
    linear-gradient(45deg, #1a1d2a 25%, transparent 25%),
    linear-gradient(-45deg, #1a1d2a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1d2a 75%),
    linear-gradient(-45deg, transparent 75%, #1a1d2a 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #131622;
  max-width: 100%;
}

#previewCanvas {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 230px);
  width: auto;
  height: auto;
  border-radius: 10px;
  cursor: crosshair;
}

.stage-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  background: rgba(17, 19, 27, 0.78);
  font-size: 12px;
  color: var(--text-muted);
}

.slide-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
}

.slide-pill {
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}

.slide-pill.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #fff;
}

/* Landing / Pro Section Below Studio */
.landing-section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 64px 24px 80px;
}

.section-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 44px;
}

.section-header h2 {
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 12px 0;
}

.section-header p {
  color: var(--text-muted);
  font-size: 15px;
  margin: 0;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 56px;
}

.feature-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.feature-icon {
  font-size: 22px;
  margin-bottom: 10px;
}

.feature-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.feature-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13.5px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1.12fr;
  gap: 22px;
  align-items: stretch;
}

.price-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.price-card.featured {
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.14) 0%, rgba(17, 19, 27, 0.96) 55%);
  border-color: rgba(129, 140, 248, 0.45);
  box-shadow: 0 20px 54px rgba(99, 102, 241, 0.16);
}

.price-amount {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.03em;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.price-amount span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}

.check-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  color: var(--text-muted);
  font-size: 13.5px;
}

.check-list li::before {
  content: "✓ ";
  color: var(--emerald);
  font-weight: 700;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12.5px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 6, 10, 0.78);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h3 {
  margin: 0;
  font-size: 20px;
}

.key-box {
  display: flex;
  gap: 8px;
}

.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 120;
  padding: 11px 16px;
  border-radius: 10px;
  background: #171b29;
  border: 1px solid rgba(99, 102, 241, 0.5);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 960px) {
  .studio-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .feature-grid, .pricing-grid {
    grid-template-columns: 1fr;
  }
}
