/* Crispmatic — clean, modern, overseas SaaS aesthetic */
:root {
  --bg: #fafafa;
  --bg-elev: #ffffff;
  --surface: #f4f4f5;
  --surface-2: #ececef;
  --text: #18181b;
  --text-2: #52525b;
  --text-3: #8b8b96;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --primary: #6d5efc;
  --primary-hover: #5b4bea;
  --primary-soft: #efedff;
  --shadow: 0 1px 2px rgba(24,24,27,.04), 0 8px 24px rgba(24,24,27,.04);
  --shadow-lg: 0 4px 12px rgba(24,24,27,.06), 0 24px 60px rgba(24,24,27,.10);
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Inter', 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
[data-theme="dark"] {
  --bg: #0c0c0f;
  --bg-elev: #141418;
  --surface: #1b1b21;
  --surface-2: #24242b;
  --text: #f4f4f5;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  --border: #27272c;
  --border-strong: #3a3a43;
  --primary: #8b7dff;
  --primary-hover: #9b8fff;
  --primary-soft: #1e1b36;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.4), 0 24px 60px rgba(0,0,0,.5);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; line-height: 1.6; transition: background .25s, color .25s;
}
.bg-grid {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px; opacity: .35;
  mask-image: linear-gradient(to bottom, black 0%, transparent 65%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 65%);
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.4px; color: var(--text); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #6d5efc, #9d6bff); display: grid; place-items: center; box-shadow: 0 2px 8px rgba(109,94,252,.35); }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.28); }
.nav-links { display: flex; gap: 32px; }
.nav-links a { color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 500; transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text-2); cursor: pointer; display: grid; place-items: center; transition: all .2s; }
.icon-btn:hover { border-color: var(--border-strong); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
.lang-switch { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.lang-btn { border: 0; background: transparent; color: var(--text-2); font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 6px; cursor: pointer; transition: all .2s; }
.lang-btn.active { background: var(--bg-elev); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* Hero — compact on tool-home pages: tools must be visible first */
.hero { position: relative; padding: 50px 0 26px; overflow: hidden; }
.hero-glow { position: absolute; top: -220px; left: 50%; transform: translateX(-50%); width: 620px; height: 420px; background: radial-gradient(ellipse, rgba(109,94,252,.13), transparent 65%); pointer-events: none; }
.hero-inner { position: relative; text-align: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; padding: 6px 13px; border: 1px solid var(--border); border-radius: 100px; background: var(--bg-elev); font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 16px; box-shadow: var(--shadow); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.16); }
h1 { font-size: clamp(30px, 4.4vw, 46px); line-height: 1.1; letter-spacing: -1.8px; margin: 0 0 12px; font-weight: 800; }
.grad { background: linear-gradient(100deg, #6d5efc 10%, #a855f7 55%, #ec4899 95%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { max-width: 640px; margin: 0 auto 18px; font-size: 15px; color: var(--text-2); line-height: 1.6; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 13px 22px; border-radius: 11px; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; border: 1px solid transparent; transition: all .2s; font-family: inherit; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
[data-theme="dark"] .btn-primary { background: #f4f4f5; color: #0c0c0f; }
.btn-ghost { background: var(--bg-elev); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--border-strong); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }
.trust-row { display: flex; gap: 22px; justify-content: center; margin-top: 0; flex-wrap: wrap; }
.trust-row span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.trust-row svg { width: 14px; height: 14px; }

/* Sections */
.tools-section { padding: 12px 0 80px; }
.how-section { padding: 80px 0; border-top: 1px solid var(--border); background: var(--bg-elev); }
.faq-section { padding: 90px 0; border-top: 1px solid var(--border); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 40px; }
.section-head.center { justify-content: center; text-align: center; }
.section-kicker { font-size: 11px; font-weight: 700; letter-spacing: 2px; color: var(--primary); margin-bottom: 8px; }
.section-head h2, .faq-intro h2 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -1.6px; margin: 0; font-weight: 700; }
.section-desc { max-width: 360px; color: var(--text-2); font-size: 14px; margin: 0; }

/* Tool browser: search + category filters above the grid */
.tools-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 10px 0 22px; flex-wrap: wrap; }
.tools-title-row { display: flex; align-items: center; gap: 8px; }
.tools-heading h2 { font-size: 21px; letter-spacing: -.7px; margin: 0; font-weight: 700; }
.tool-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 7px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 700; }
.tool-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-box { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-elev); color: var(--text-3); min-width: 220px; transition: border-color .2s, box-shadow .2s; }
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search-box svg { width: 16px; height: 16px; flex-shrink: 0; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-family: inherit; font-size: 13px; }
.search-box input::placeholder { color: var(--text-3); }
.filter-tabs { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.filter-tab { border: 0; background: transparent; color: var(--text-2); font-family: inherit; font-size: 12.5px; font-weight: 600; padding: 7px 13px; border-radius: 6px; cursor: pointer; transition: all .2s; }
.filter-tab:hover { color: var(--text); }
.filter-tab.active { background: var(--bg-elev); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tool-empty { padding: 60px 20px; text-align: center; color: var(--text-2); font-size: 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius); }

/* Tool grid */
.tool-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .tool-grid { grid-template-columns: 1fr; } }
.tool-card { position: relative; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px; transition: all .22s; box-shadow: var(--shadow); overflow: hidden; }
.tool-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.tool-card::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent); opacity: 0; transition: opacity .22s; }
.tool-card:hover::after { opacity: 1; }
.tool-card-main { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 20px 18px 18px; cursor: pointer; color: inherit; font-family: inherit; }
.tool-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 14px; background: var(--icon-bg); color: var(--icon-fg); }
.tool-icon svg { width: 21px; height: 21px; }
.tool-name { font-size: 15px; font-weight: 650; margin: 0 0 5px; letter-spacing: -.2px; }
.tool-tagline { font-size: 12.5px; color: var(--text-2); margin: 0; line-height: 1.45; min-height: 36px; padding-right: 14px; }
.tool-arrow { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--accent); margin-top: 12px; }
.tool-arrow svg { width: 13px; height: 13px; }
.tool-detail { position: absolute; right: 16px; bottom: 17px; font-size: 11.5px; font-weight: 600; color: var(--text-3); text-decoration: none; display: inline-flex; align-items: center; gap: 3px; }
.tool-detail:hover { color: var(--accent); }
.tool-detail svg { width: 12px; height: 12px; }
.c-violet { --accent: #8b5cf6; --icon-bg: #f3eeff; --icon-fg: #7c3aed; }
.c-cyan { --accent: #0891b2; --icon-bg: #e6f8fb; --icon-fg: #0e7490; }
.c-amber { --accent: #d97706; --icon-bg: #fff6e6; --icon-fg: #b45309; }
.c-emerald { --accent: #059669; --icon-bg: #e8f8f0; --icon-fg: #047857; }
.c-blue { --accent: #2563eb; --icon-bg: #eaf1ff; --icon-fg: #1d4ed8; }
.c-rose { --accent: #e11d48; --icon-bg: #ffedf2; --icon-fg: #be123c; }
.c-indigo { --accent: #4f46e5; --icon-bg: #eef0ff; --icon-fg: #4338ca; }
.c-orange { --accent: #ea580c; --icon-bg: #fff1e8; --icon-fg: #c2410c; }
[data-theme="dark"] .c-violet { --icon-bg: #2a1f45; --icon-fg: #b79cff; }
[data-theme="dark"] .c-cyan { --icon-bg: #14323a; --icon-fg: #5fd3e8; }
[data-theme="dark"] .c-amber { --icon-bg: #3a2c14; --icon-fg: #fbbf5c; }
[data-theme="dark"] .c-emerald { --icon-bg: #143a2c; --icon-fg: #5ee0a0; }
[data-theme="dark"] .c-blue { --icon-bg: #16294b; --icon-fg: #78a4ff; }
[data-theme="dark"] .c-rose { --icon-bg: #3d1826; --icon-fg: #fb7195; }
[data-theme="dark"] .c-indigo { --icon-bg: #20244a; --icon-fg: #9aa4ff; }
[data-theme="dark"] .c-orange { --icon-bg: #3a2514; --icon-fg: #fd9d61; }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }
.step { padding: 28px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
.step-num { font-size: 12px; font-weight: 700; color: var(--primary); margin-bottom: 16px; letter-spacing: 1px; }
.step h3 { margin: 0 0 8px; font-size: 17px; }
.step p { margin: 0; color: var(--text-2); font-size: 13.5px; }

/* FAQ */
.faq-wrap { display: grid; grid-template-columns: 320px 1fr; gap: 60px; }
@media (max-width: 800px) { .faq-wrap { grid-template-columns: 1fr; gap: 30px; } }
.faq-intro p { color: var(--text-2); font-size: 14px; margin-top: 14px; }
.faq-list { display: flex; flex-direction: column; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-q { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 0; background: none; border: 0; color: var(--text); font-size: 15px; font-weight: 550; text-align: left; cursor: pointer; font-family: inherit; }
.faq-q svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-3); transition: transform .2s; }
.faq-item.open .faq-q svg { transform: rotate(45deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .25s; color: var(--text-2); font-size: 14px; }
.faq-item.open .faq-a { max-height: 200px; }
.faq-a p { margin: 0 0 18px; padding-right: 30px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 44px 0; background: var(--bg-elev); }
.footer-inner { display: flex; flex-direction: column; gap: 12px; }
.footer-inner p { margin: 0; color: var(--text-2); font-size: 13.5px; }
.footer-meta { display: flex; gap: 20px; margin-top: 14px; font-size: 12px; color: var(--text-3); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(6px); }
.modal-panel { position: relative; width: 100%; max-width: 600px; max-height: 92vh; overflow-y: auto; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 20px; padding: 30px; box-shadow: var(--shadow-lg); animation: pop .22s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-close { position: absolute; top: 18px; right: 18px; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 22px; line-height: 1; cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; padding-right: 36px; }
.modal-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--icon-bg); color: var(--icon-fg); flex-shrink: 0; }
.modal-icon svg { width: 23px; height: 23px; }
.modal-head h2 { margin: 0 0 2px; font-size: 19px; letter-spacing: -.4px; }
.modal-head p { margin: 0; color: var(--text-2); font-size: 13px; }
.modal-desc { color: var(--text-2); font-size: 13.5px; margin: 0 0 20px; line-height: 1.6; }
.disclaimer { display: none; padding: 11px 14px; border-radius: 10px; background: var(--primary-soft); color: var(--text-2); font-size: 12.5px; margin-bottom: 18px; border: 1px solid var(--border); }
.disclaimer.show { display: block; }

/* Dropzone */
.dropzone { position: relative; border: 1.5px dashed var(--border-strong); border-radius: 14px; padding: 34px 20px; text-align: center; cursor: pointer; background: var(--bg); transition: all .2s; }
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.upload-icon { width: 30px; height: 30px; color: var(--primary); margin-bottom: 10px; }
.drop-title { font-size: 14.5px; font-weight: 600; margin-bottom: 4px; }
.drop-sub { font-size: 12.5px; color: var(--text-3); }
.file-info { display: none; margin-top: 14px; padding: 10px 14px; border-radius: 9px; background: var(--surface); font-size: 13px; align-items: center; gap: 8px; }
.file-info.show { display: flex; }
.file-info svg { width: 15px; height: 15px; color: var(--primary); }

/* Rect editor */
.rect-editor-wrap { display: none; margin-top: 20px; }
.rect-editor-wrap.show { display: block; }
.field-label { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.canvas-holder { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); max-height: 300px; background: var(--surface); }
#rectCanvas { display: block; max-width: 100%; cursor: crosshair; }
.field-hint { font-size: 12px; color: var(--text-3); margin: 8px 0 0; }

/* Options */
.options-wrap { margin-top: 20px; display: flex; flex-direction: column; gap: 16px; }
.option-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.option-row label { font-size: 13px; font-weight: 550; color: var(--text-2); }
.option-row select, .option-row input[type="number"] { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; color: var(--text); font-size: 13px; font-family: inherit; min-width: 110px; }
.option-row input[type="range"] { accent-color: var(--primary); width: 160px; }
.range-val { font-size: 12px; color: var(--text-2); min-width: 40px; text-align: right; }

.action-row { margin-top: 24px; }

/* Progress */
.progress-wrap { display: none; margin-top: 22px; }
.progress-wrap.show { display: block; }
.progress-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; }
.progress-track { height: 7px; border-radius: 100px; background: var(--surface-2); overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: 100px; background: linear-gradient(90deg, #6d5efc, #a855f7); transition: width .3s; }

/* Result */
.result-wrap { display: none; margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--border); }
.result-wrap.show { display: block; }
.result-head { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: #16a34a; margin-bottom: 16px; }
.result-head svg { width: 18px; height: 18px; }
.result-preview { margin-bottom: 16px; }
.result-preview img, .result-preview video { max-width: 100%; max-height: 320px; border-radius: 10px; border: 1px solid var(--border); display: block; }
.result-preview video { width: 100%; }
.result-text { display: none; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 14px; font-size: 13px; line-height: 1.7; max-height: 220px; overflow-y: auto; white-space: pre-wrap; color: var(--text-2); margin-bottom: 16px; }
.result-text.show { display: block; }
.result-files { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.file-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); font-size: 13px; }
.file-row span { display: inline-flex; align-items: center; gap: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row svg { width: 15px; height: 15px; color: var(--primary); flex-shrink: 0; }
.file-row a { color: var(--primary); text-decoration: none; font-weight: 600; white-space: nowrap; }
.file-row a:hover { text-decoration: underline; }
.error-box { display: none; margin-top: 18px; padding: 12px 14px; border-radius: 10px; background: #fef2f2; color: #b91c1c; font-size: 13px; border: 1px solid #fecaca; }
[data-theme="dark"] .error-box { background: #3a1618; color: #fca5a5; border-color: #5c2426; }
.error-box.show { display: block; }
