:root {
  --bg: #faf9ff;
  --surface: #ffffff;
  --surface-2: #f3f1fd;
  --text: #1c1a2e;
  --muted: #5d5a75;
  --line: #e3e0f5;
  --accent: #6d4aff;
  --accent-2: #8f73ff;
  --accent-ink: #ffffff;
  --ok: #138a52;
  --err: #c0362c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 26, 46, .05), 0 8px 24px rgba(28, 26, 46, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12111a; --surface: #1b1a26; --surface-2: #242233; --text: #eeedf6; --muted: #a6a3bd;
    --line: #2f2d42; --accent: #8f73ff; --accent-2: #a690ff; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
img, video, canvas { max-width: 100%; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 19px; letter-spacing: -.3px; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 34px; height: 34px; flex: none; display: block; }
.brand-accent { background: linear-gradient(90deg, var(--accent), #ff6fb5); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 15px; white-space: nowrap; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--accent); background: var(--surface-2); }
@media (max-width: 640px) {
  .site-header .wrap { padding-top: 8px; padding-bottom: 6px; gap: 4px; }
  .nav { margin-left: 0; width: 100%; }
}

/* Hero */
.hero { padding: 40px 0 16px; text-align: center; }
.hero h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.15; margin: 0 0 12px; letter-spacing: -0.02em; }
.hero p.lead { color: var(--muted); font-size: clamp(16px, 2.2vw, 19px); max-width: 720px; margin: 0 auto; }
.badges { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.badge { font-size: 13px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; }

/* Tool card */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 20px; margin: 24px 0 8px; }
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 40px 16px; text-align: center;
  background: var(--surface-2); transition: border-color .15s, background .15s; cursor: pointer;
}
.drop.drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.drop h2 { margin: 8px 0 4px; font-size: 20px; }
.drop p { margin: 0; color: var(--muted); font-size: 14px; }
.drop-icon { font-size: 40px; line-height: 1; }
.drop-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.btn {
  appearance: none; border: 1px solid transparent; border-radius: 10px; padding: 11px 18px; font: inherit; font-weight: 600;
  cursor: pointer; background: var(--accent); color: var(--accent-ink); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; justify-content: center;
}
.btn:hover { background: var(--accent-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.big { padding: 14px 24px; font-size: 17px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 12px; }

.is-mobile .desktop-only { display: none !important; }
.is-desktop .mobile-only { display: none !important; }

/* Editor */
.editor { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; margin-top: 4px; }
@media (max-width: 820px) { .editor { grid-template-columns: 1fr; } }
.preview { background: #000; border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; min-height: 200px; }
.preview video, .preview img, .preview canvas { display: block; max-height: 60vh; width: 100%; object-fit: contain; }
.controls { display: grid; gap: 14px; align-content: start; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field select, .field input[type="text"], .field input[type="number"] {
  width: 100%; padding: 9px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.trim { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; }
.trim input[type="range"] { width: 100%; accent-color: var(--accent); }
.trim-val { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); min-width: 52px; text-align: right; }
.small-btn { font-size: 12px; padding: 4px 8px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.meta { font-size: 13px; color: var(--muted); }
.estimate { font-size: 13px; background: var(--surface-2); border-radius: 9px; padding: 8px 10px; }
.estimate.warn { color: var(--err); }

.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #ff6fb5); transition: width .15s; }
.status { font-size: 14px; color: var(--muted); min-height: 1.4em; }
.status.err { color: var(--err); }

.frames { display: flex; gap: 6px; overflow-x: auto; padding: 8px 2px; margin-top: 14px; scrollbar-width: thin; }
.frames canvas { height: 64px; width: auto; border-radius: 6px; border: 2px solid var(--accent); cursor: pointer; flex: none; background: #000; }
.frames canvas.off { opacity: .3; border-color: var(--line); }
.frames-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.frames-head h3 { margin: 0; font-size: 16px; }

.result { margin-top: 20px; display: grid; gap: 12px; justify-items: center; text-align: center; }
.result img, .result video { max-width: 100%; max-height: 60vh; border-radius: var(--radius); background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 0/16px 16px; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.hidden { display: none !important; }

/* QR modal */
.modal { position: fixed; inset: 0; background: rgba(10, 8, 20, .55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-box { background: var(--surface); border-radius: 18px; padding: 24px; max-width: 380px; width: 100%; text-align: center; position: relative; }
.modal-box h2 { margin: 0 0 6px; font-size: 20px; }
.modal-box p { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.modal-close { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 24px; color: var(--muted); cursor: pointer; line-height: 1; }
.qr { background: #fff; padding: 12px; border-radius: 12px; display: inline-block; }
.qr canvas { display: block; width: 220px !important; height: 220px !important; }
.qr-url { font-size: 12px; word-break: break-all; color: var(--muted); margin-top: 10px; }

/* Content */
.section { padding: 36px 0; }
.section h2 { font-size: clamp(22px, 3.4vw, 30px); margin: 0 0 16px; letter-spacing: -0.01em; }
.section p { color: var(--muted); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; counter-reset: s; padding: 0; list-style: none; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; counter-increment: s; }
.steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; margin-bottom: 8px; }
.steps h3 { margin: 0 0 6px; font-size: 17px; }
.steps p { margin: 0; font-size: 15px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.feature h3 { margin: 0 0 6px; font-size: 17px; }
.feature p { margin: 0; font-size: 15px; }
.prose { max-width: 780px; }
.prose h3 { margin-top: 24px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.prose th { background: var(--surface-2); }

.faq { max-width: 820px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 0 16px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 20px; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 14px; color: var(--muted); }

.related { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.related a { display: block; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--text); font-weight: 600; }
.related a span { display: block; font-weight: 400; color: var(--muted); font-size: 14px; }
.related a:hover { border-color: var(--accent); }

.site-footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: 14px; margin-top: 24px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.site-footer nav { display: flex; gap: 14px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }

/* Phone upload page */
.phone-card { max-width: 460px; margin: 32px auto; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; text-align: center; }
.phone-card h1 { font-size: 24px; margin: 0 0 8px; }
.phone-card .btn { width: 100%; margin-top: 12px; }
.ok { color: var(--ok); font-weight: 700; }
