:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --canvas-bg: #0f172a;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #475569;
  --text-soft: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --accent: #0d9488;
  --danger: #ef4444;
  --amber: #f59e0b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.08);
  --max-w: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb 0%, #0d9488 100%);
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 5px;
}
.brand-mark span {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 1.5px;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.nav-links a {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s ease;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
  background: var(--primary-soft);
}
.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--text);
  color: #fff !important;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}
.nav-cta:hover { opacity: 0.9; background: #1e293b !important; }

/* Hero */
.hero {
  padding: 36px 0 22px;
  text-align: center;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 14px;
}
.hero h1 {
  margin: 0 auto 12px;
  max-width: 820px;
  font-size: clamp(28px, 4.2vw, 44px);
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 800;
}
.hero p {
  margin: 0 auto;
  max-width: 680px;
  color: var(--text-muted);
  font-size: 16.5px;
}

/* Workspace Layout */
.workspace {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 22px;
  margin: 20px 0 44px;
  align-items: start;
}
@media (max-width: 940px) {
  .workspace { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}
.mobile-tool-tabs {
  display: none;
  overflow-x: auto;
  gap: 8px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
@media (max-width: 940px) {
  .mobile-tool-tabs { display: flex; }
}
.mobile-tool-tabs a {
  white-space: nowrap;
  font-size: 13px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text-muted);
  font-weight: 500;
}
.mobile-tool-tabs a.active {
  background: var(--primary);
  color: #fff;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.panel-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 22px 16px;
  text-align: center;
  background: var(--surface-alt);
  cursor: pointer;
  transition: all 0.15s ease;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.dropzone strong {
  display: block;
  font-size: 14.5px;
  margin-bottom: 4px;
}
.dropzone span {
  font-size: 12.5px;
  color: var(--text-soft);
}

.control-group {
  margin-top: 16px;
}
.control-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--text);
}
.control-hint {
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 400;
}

.seg-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 6px;
}
.seg-btn {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s;
}
.seg-btn:hover { border-color: var(--primary); color: var(--primary); }
.seg-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.select-input, .text-input, .textarea-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  font-size: 14px;
  background: #fff;
  color: var(--text);
}
.textarea-input {
  min-height: 180px;
  resize: vertical;
  line-height: 1.55;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
}
.toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #d97706;
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  background: #fff;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover { background: var(--surface-alt); }
.btn-pro {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  color: #fff;
}
.btn-pro:hover { opacity: 0.93; }
.btn-sm {
  width: auto;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
}
.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 18px;
}

/* Preview Stage */
.stage-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.stage-meta {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}
.stage-body {
  background: var(--canvas-bg);
  min-height: 440px;
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.stage-body.light-stage {
  background: #f1f5f9;
}

/* Slide Strip & Grid Tiles */
.slides-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 10px;
}
.slide-tile {
  flex: 0 0 auto;
  background: #1e293b;
  border-radius: 8px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
  position: relative;
}
.slide-tile img, .slide-tile canvas {
  display: block;
  height: 250px;
  width: auto;
  border-radius: 4px;
}
.slide-tile-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-size: 11.5px;
  color: #cbd5e1;
}
.slide-dl-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
}
.slide-dl-btn:hover { background: var(--primary); }

/* Instagram 3-column Grid Preview */
.ig-phone-frame {
  width: 100%;
  max-width: 430px;
  background: #000;
  color: #fff;
  border-radius: 22px;
  padding: 18px 14px;
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 20px 45px rgba(0,0,0,0.45);
}
.ig-phone-frame.light {
  background: #fff;
  color: #0f172a;
  border-color: #cbd5e1;
}
.ig-profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 6px 14px;
  border-bottom: 1px solid rgba(148,163,184,0.22);
  margin-bottom: 10px;
}
.ig-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #ec4899, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 20px;
  flex-shrink: 0;
}
.ig-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}
.ig-cell {
  position: relative;
  overflow: hidden;
  background: #1e293b;
  aspect-ratio: 3 / 4;
  cursor: grab;
}
.ig-cell.ratio-1-1 { aspect-ratio: 1 / 1; }
.ig-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ig-badge {
  position: absolute;
  top: 5px;
  left: 5px;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
.crop-danger-left, .crop-danger-right {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3.125%;
  background: rgba(239, 68, 68, 0.38);
  border-right: 1px dashed #fca5a5;
  pointer-events: none;
}
.crop-danger-right {
  right: 0;
  border-right: none;
  border-left: 1px dashed #fca5a5;
}

/* Content / SEO Sections */
.seo-section {
  max-width: 900px;
  margin: 0 auto 56px;
}
.seo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin: 24px 0 36px;
}
.feature-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}
.feature-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}
.feature-card p {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}
.faq-list details {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 10px;
}
.faq-list summary {
  font-weight: 700;
  cursor: pointer;
  font-size: 15px;
}
.faq-list p {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 14.5px;
}

/* Cross-tool internal links bar */
.tools-cross-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin: 28px 0;
}
.cross-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 14px 16px;
  transition: all 0.15s;
}
.cross-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.cross-card strong {
  display: block;
  font-size: 14.5px;
  margin-bottom: 4px;
  color: var(--primary);
}
.cross-card span {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal-card {
  background: #fff;
  border-radius: 16px;
  max-width: 480px;
  width: 100%;
  padding: 26px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
.modal-card h3 { margin: 0 0 8px; font-size: 21px; }
.plan-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}
.plan-box {
  border: 2px solid var(--border);
  border-radius: 11px;
  padding: 12px;
  cursor: pointer;
}
.plan-box.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.plan-box .price {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 34px 0;
  color: var(--text-soft);
  font-size: 13.5px;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 18px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-links a:hover { color: var(--primary); }
