:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --text: #0f172a;
  --muted: #475569;
  --border: #e2e8f0;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --pro: #d97706;
  --pro-bg: #fef3c7;
  --green: #059669;
  --green-bg: #ecfdf5;
  --yellow: #b45309;
  --yellow-bg: #fffbeb;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(15, 23, 42, 0.06);
}

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

.container { max-width: 1220px; margin: 0 auto; padding: 0 20px; }

/* Header */
.topbar {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: 800;
}
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.86rem;
  padding: 6px 10px;
  border-radius: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
}
.nav-link:hover { color: var(--text); background: var(--surface-alt); }

.google-btn, .lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.84rem;
  cursor: pointer;
}
.google-btn:hover, .lang-btn:hover { border-color: var(--primary); }

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 4px 10px 4px 5px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}
.user-pill img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }

/* Hero */
.hero { text-align: center; padding: 30px 0 18px; }
.badge-local {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid #a7f3d0;
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.hero h1 {
  margin: 0 auto 10px;
  max-width: 780px;
  font-size: clamp(1.65rem, 3.1vw, 2.4rem);
  letter-spacing: -0.03em;
  line-height: 1.18;
}
.hero p { margin: 0 auto; max-width: 690px; color: var(--muted); font-size: 1rem; }

.steps-bar { display: flex; justify-content: center; gap: 10px; margin: 20px auto 16px; flex-wrap: wrap; }
.step-pill {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}
.step-pill.active { background: var(--primary-soft); border-color: #c7d2fe; color: var(--primary); }

/* Dropzone */
.dropzone {
  background: var(--surface);
  border: 2px dashed #c7d2fe;
  border-radius: 18px;
  padding: 40px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: all 0.18s;
  margin: 12px auto 28px;
  max-width: 840px;
}
.dropzone.dragover { border-color: var(--primary); background: var(--primary-soft); transform: scale(1.01); }
.drop-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 1.5rem;
}
.dropzone h2 { margin: 0 0 6px; font-size: 1.25rem; }
.dropzone p { margin: 0 0 22px; color: var(--muted); font-size: 0.9rem; }
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 17px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-pro { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.btn-pro:hover { filter: brightness(0.95); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-alt); border-color: #cbd5e1; }

/* Queue Strip */
.queue-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.queue-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 0.85rem; font-weight: 700; gap: 8px; flex-wrap: wrap; }
.queue-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.queue-item {
  flex: 0 0 132px;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  background: var(--bg);
  cursor: pointer;
  position: relative;
}
.queue-item.active { border-color: var(--primary); background: var(--primary-soft); }
.queue-item img { width: 100%; height: 68px; object-fit: cover; border-radius: 6px; display: block; }
.queue-item .q-name { font-size: 0.72rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.queue-item .q-dim { font-size: 0.68rem; color: var(--muted); }
.queue-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  font-size: 0.75rem;
  cursor: pointer;
}
.queue-add {
  flex: 0 0 132px;
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--surface);
  cursor: pointer;
}
.queue-add:hover { background: var(--primary-soft); border-color: var(--primary); }

/* Toolbar */
.toolbar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.preset-chips { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.chip-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}
.chip-btn:hover { border-color: var(--primary); color: var(--primary); }
.mat-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 0.8rem; font-weight: 600; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; }
.swatch.active { border-color: var(--primary); box-shadow: 0 0 0 2px #c7d2fe; }

/* Workspace */
.workspace { display: grid; grid-template-columns: 335px 1fr; gap: 20px; align-items: start; margin-bottom: 24px; }
@media (max-width: 940px) { .workspace { grid-template-columns: 1fr; } }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.panel h3 { margin: 0 0 14px; font-size: 1rem; }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 0.82rem; font-weight: 700; margin-bottom: 5px; }
.field input[type="text"], .field input[type="url"], .field select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; font-size: 0.88rem; background: var(--surface);
}
.field small { display: block; color: var(--muted); font-size: 0.76rem; margin-top: 4px; }
.check-row { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 12px; font-size: 0.85rem; }
.check-row input { margin-top: 3px; }
.pro-badge {
  display: inline-block;
  background: var(--pro-bg);
  color: var(--pro);
  font-size: 0.66rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 5px;
  margin-left: 5px;
  vertical-align: middle;
}
.progress-bar { height: 7px; background: var(--surface-alt); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress-fill { height: 100%; width: 0%; background: var(--primary); transition: width 0.2s; }

/* Sharpness & Ratio Cards */
.sharpness-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-yellow { background: var(--yellow-bg); color: var(--yellow); }
.pill-red { background: var(--red-bg); color: var(--red); }

.ratios-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 14px; }
.ratio-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 9px; }
.ratio-card.selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.ratio-card.disabled { opacity: 0.62; }
.ratio-card.locked { border-style: dashed; background: #fafafa; }
.ratio-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.ratio-head label { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.88rem; cursor: pointer; }
.preview-stage { background: #e2e8f0; border-radius: 9px; height: 180px; display: flex; align-items: center; justify-content: center; overflow: hidden; user-select: none; }
.preview-frame { background: #ffffff; box-shadow: 0 3px 12px rgba(0, 0, 0, 0.14); overflow: hidden; cursor: grab; }
.preview-frame:active { cursor: grabbing; }
.preview-frame canvas { display: block; width: 100%; height: 100%; }
.ratio-meta { font-size: 0.74rem; color: var(--muted); }
.fit-toggle { display: flex; gap: 6px; }
.fit-toggle button { flex: 1; font-size: 0.74rem; padding: 5px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface-alt); cursor: pointer; font-weight: 600; }
.fit-toggle button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Custom Workflows Builder */
.wf-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin: 26px 0;
  box-shadow: var(--shadow);
}
.wf-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.wf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 860px) { .wf-grid { grid-template-columns: 1fr; } }
.wf-builder { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.wf-ratio-checks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; font-size: 0.82rem; font-weight: 600; }
.wf-ratio-checks label { display: inline-flex; align-items: center; gap: 5px; background: var(--surface); border: 1px solid var(--border); padding: 4px 9px; border-radius: 7px; cursor: pointer; }
.wf-list { display: flex; flex-direction: column; gap: 10px; }
.wf-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: var(--surface);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.wf-card h4 { margin: 0 0 3px; font-size: 0.94rem; }
.wf-card p { margin: 0; font-size: 0.78rem; color: var(--muted); }

/* AdSense Slot */
.ad-slot-wrapper {
  margin: 12px auto 28px;
  background: var(--surface);
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
}

/* Pricing */
.pricing-section { padding: 24px 0 34px; text-align: center; }
.pricing-section h2 { margin: 0 0 8px; font-size: 1.65rem; }
.pricing-section .sub { color: var(--muted); max-width: 630px; margin: 0 auto 24px; font-size: 0.94rem; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 18px; text-align: left; }
.price-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; justify-content: space-between; }
.price-card.featured { border: 2px solid var(--primary); }
.price-amount { font-size: 2rem; font-weight: 800; margin: 8px 0 2px; }
.price-amount span { font-size: 0.88rem; font-weight: 600; color: var(--muted); }
.price-list { list-style: none; padding: 0; margin: 14px 0 20px; font-size: 0.86rem; }
.price-list li { padding: 5px 0; color: #334155; }

/* Tutorial Video / Animated Walkthrough */
.tut-tabs { display: flex; gap: 8px; margin: 14px 0; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.tut-tab { padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-alt); font-weight: 700; font-size: 0.84rem; cursor: pointer; }
.tut-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.demo-video-box {
  background: #0f172a;
  color: #fff;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  position: relative;
}
.demo-video-box iframe { width: 100%; height: 100%; border: 0; }
.walkthrough-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; margin-top: 14px; }
@media (max-width: 600px) { .walkthrough-steps { grid-template-columns: 1fr; } }
.wt-card { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 10px; padding: 12px; text-align: left; font-size: 0.8rem; }
.wt-card strong { display: block; color: #93c5fd; margin-bottom: 4px; font-size: 0.85rem; }

/* SEO Section */
.seo-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin: 12px 0 36px; }
.seo-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; margin: 12px 0 18px; }
.seo-table th, .seo-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.seo-table th { background: var(--surface-alt); font-weight: 700; }
.tool-links { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-links a { text-decoration: none; color: var(--primary); background: var(--primary-soft); border: 1px solid #c7d2fe; padding: 7px 12px; border-radius: 8px; font-size: 0.82rem; font-weight: 600; }

/* Modal & Toast */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); display: grid; place-items: center; padding: 16px; z-index: 70; }
.modal { background: var(--surface); border-radius: 16px; max-width: 680px; width: 100%; padding: 24px; box-shadow: 0 22px 60px rgba(0, 0, 0, 0.28); max-height: 92vh; overflow-y: auto; }
.aff-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 12px 0 18px; }
.aff-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; background: var(--bg); }
.aff-badge { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; color: var(--primary); }
.aff-card h4 { margin: 0; font-size: 0.88rem; }
.aff-card p { margin: 0; font-size: 0.76rem; color: var(--muted); }
.aff-card a { text-decoration: none; font-weight: 700; font-size: 0.8rem; color: var(--primary); }

.toast { position: fixed; bottom: 22px; right: 22px; background: #0f172a; color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 0.85rem; font-weight: 600; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25); z-index: 90; }
.hidden { display: none !important; }
footer { text-align: center; padding: 18px 0 32px; color: var(--muted); font-size: 0.8rem; }
