:root {
  --accent: #1447E6;
  --accent-ink: #ffffff;
  --danger: #E63946;
  --good: #16A34A;
  --warn: #E6A317;

  --bg: #F6F7FB;
  --surface: #FFFFFF;
  --surface-2: #F1F3F9;
  --border: #E4E7F0;
  --ink-900: #12131A;
  --ink-700: #5B5E6D;
  --ink-500: #8A8DA0;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(18,19,26,0.04), 0 8px 24px rgba(18,19,26,0.06);
}

html[data-theme="dark"] {
  --bg: #0E0F14;
  --surface: #16171F;
  --surface-2: #1D1F29;
  --border: #2A2C38;
  --ink-900: #F3F4F8;
  --ink-700: #B7B9C8;
  --ink-500: #7B7E90;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-900);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}

h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; color: var(--ink-900); }
p { margin: 0; color: var(--ink-700); line-height: 1.55; }
.mono { font-family: var(--font-mono); }
small { color: var(--ink-500); font-weight: 400; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
a { color: var(--accent); text-decoration: none; }

/* ============= TOPBAR ============= */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--ink-900); }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-mark svg { width: 18px; height: 18px; }
.brand small { display: block; font-family: var(--font-body); font-weight: 500; font-size: 11.5px; margin-top: 1px; }
.nav-actions { display: flex; gap: 8px; }
.icon-btn { width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--ink-700); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.btn-sm { width: 30px; height: 30px; font-size: 13px; }

/* ============= HERO ============= */
.hero { padding: 56px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 48px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 16px; }
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
h1 { font-size: 40px; line-height: 1.12; letter-spacing: -0.01em; }
h1 em { font-style: normal; color: var(--accent); }
.hero-sub { margin-top: 16px; font-size: 16px; max-width: 46ch; }
.hero-cta { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.hero-points { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 24px; }
.hero-points span { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink-700); }
.hero-points svg { width: 15px; height: 15px; color: var(--good); }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: var(--radius-sm); font-family: var(--font-body); font-weight: 600; font-size: 14px; border: 1px solid transparent; cursor: pointer; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #0f38b8; }
.btn-ghost { background: transparent; color: var(--ink-900); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.deck { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 26px; box-shadow: var(--shadow); }
.deck-card { position: relative; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 40px 16px; overflow: hidden; }
.deck-wm { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-30deg); font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--accent); opacity: .28; letter-spacing: .06em; white-space: nowrap; }
.deck-badge { position: absolute; bottom: -14px; right: 22px; background: var(--good); color: #fff; font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 999px; box-shadow: var(--shadow); }
.ln { height: 9px; background: var(--border); border-radius: 4px; margin-top: 10px; }
.ln.w60 { width: 60%; } .ln.w80 { width: 80%; } .ln.w40 { width: 40%; }

/* ============= CARD ============= */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ============= WORKSPACE ============= */
.workspace { padding: 8px 20px 56px; }

.dropzone { padding: 60px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; border: 1.5px dashed var(--border); }
.dropzone-icon { width: 58px; height: 58px; border-radius: 16px; background: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.dropzone-icon svg { width: 26px; height: 26px; }
.dropzone h2 { font-size: 20px; }
.dropzone p { margin-bottom: 16px; font-size: 13.5px; }
#fileInput { display: none; }
.center-state { padding: 60px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.success-check { width: 58px; height: 58px; border-radius: 50%; background: rgba(22,163,74,.14); color: var(--good); display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.success-check svg { width: 28px; height: 28px; }

.toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 16px; flex-wrap: wrap; }
.divider-v { width: 1px; height: 24px; background: var(--border); }
.divider-h { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.grow { flex: 1; }
.file-info { font-size: 13px; color: var(--ink-700); font-family: var(--font-mono); }

.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.form-card { padding: 18px; display: flex; flex-direction: column; gap: 16px; }

.tabs { display: flex; gap: 6px; background: var(--surface-2); padding: 6px; border-radius: var(--radius-sm); }
.tab-btn { flex: 1; border: none; background: transparent; padding: 10px; border-radius: 7px; font-family: var(--font-body); font-weight: 600; font-size: 13px; color: var(--ink-700); cursor: pointer; }
.tab-btn.active { background: var(--accent); color: #fff; }

.tab-panel { display: flex; flex-direction: column; gap: 14px; }

.switch-row { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--ink-900); cursor: pointer; }
.switch-row input { width: 17px; height: 17px; accent-color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-900); }
.field input[type="text"], .field select, .field input[type="file"] {
  border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 10px 13px; font-size: 14px; color: var(--ink-900); font-family: var(--font-body); width: 100%;
}
.field input[type="color"] { width: 100%; height: 40px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); padding: 3px; cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.chip { border: 1px solid var(--border); background: var(--surface-2); color: var(--ink-700); font-size: 13px; font-weight: 600; padding: 8px 15px; border-radius: 999px; cursor: pointer; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.position-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-width: 160px; }
.position-grid button { aspect-ratio: 1; border: 1px solid var(--border); background: var(--surface-2); border-radius: 7px; cursor: pointer; position: relative; }
.position-grid button::after { content: ""; position: absolute; inset: 30%; background: var(--ink-500); border-radius: 2px; }
.position-grid button.active { background: var(--accent); border-color: var(--accent); }
.position-grid button.active::after { background: #fff; }

.preview-card { padding: 16px; position: sticky; top: 80px; }
.preview-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--ink-900); margin-bottom: 12px; }
.preview-nav { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-700); }
.preview-canvas-wrap { position: relative; width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; display: flex; align-items: center; justify-content: center; min-height: 320px; }
.preview-canvas-wrap canvas { max-width: 100%; height: auto; }
#overlayCanvas { position: absolute; top: 0; left: 0; pointer-events: none; }

/* ============= SECTIONS ============= */
.section { padding: 48px 0; }
.section-head { max-width: 640px; margin-bottom: 30px; }
.section-head h2 { font-size: 27px; margin-top: 8px; }
.section-head p { margin-top: 10px; font-size: 15px; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.step-card { padding: 20px; }
.step-num { font-family: var(--font-mono); font-size: 13px; color: var(--accent); font-weight: 600; margin-bottom: 10px; }
.step-card h3 { font-size: 16px; margin-bottom: 6px; }
.step-card p { font-size: 13.5px; }

.features-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.feature-card { padding: 20px; }
.feature-card svg { width: 22px; height: 22px; color: var(--accent); margin-bottom: 12px; }
.feature-card h4 { font-size: 15px; margin-bottom: 6px; }
.feature-card p { font-size: 13px; }

.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq-item { overflow: hidden; }
.faq-q { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; background: transparent; border: none; text-align: left; font-family: var(--font-body); font-weight: 600; font-size: 14.5px; color: var(--ink-900); cursor: pointer; }
.faq-q svg { width: 16px; height: 16px; color: var(--ink-500); transition: transform .2s ease; flex-shrink: 0; }
.faq-q[aria-expanded="true"] svg { transform: rotate(45deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .2s ease; padding: 0 18px; }
.faq-a p { font-size: 13.5px; padding-bottom: 16px; }
.faq-item.open .faq-a { max-height: 220px; }

footer { border-top: 1px solid var(--border); padding: 24px 0 60px; }
footer p { font-size: 13px; text-align: center; }

.toast-stack { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 80; }
.toast { background: var(--ink-900); color: var(--bg); padding: 11px 16px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow); animation: toast-in .2s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ============= RESPONSIVE ============= */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  h1 { font-size: 30px; }
  .steps { grid-template-columns: 1fr 1fr; }
  .features-grid { grid-template-columns: 1fr 1fr; }
  .editor-grid { grid-template-columns: 1fr; }
  .preview-card { position: static; }
}
@media (max-width: 540px) {
  .steps, .features-grid { grid-template-columns: 1fr; }
  .brand small { display: none; }
  .field-row { flex-direction: column; }
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}