/* ==========================================================================
   AI 工具箱 · design system
   ========================================================================== */
:root {
  --bg: #f5f6fb;
  --bg-2: #eef0f8;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --surface-3: #f1f3f9;
  --ink: #101426;
  --ink-2: #333a52;
  --muted: #68708a;
  --muted-2: #8b93a8;
  --line: #e6e9f1;
  --line-strong: #d8dcea;
  --brand: #6366f1;
  --brand-2: #a855f7;
  --brand-3: #ec4899;
  --brand-soft: rgba(99, 102, 241, .09);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(16, 20, 38, .04), 0 4px 14px rgba(16, 20, 38, .04);
  --shadow-md: 0 12px 34px rgba(16, 20, 38, .08), 0 2px 8px rgba(16, 20, 38, .04);
  --shadow-lg: 0 26px 70px rgba(16, 20, 38, .13);
  --radius: 20px;
  --radius-sm: 13px;
  --max: 1240px;
  --header-h: 68px;
  --sidebar-w: 236px;
  --font: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #090c15;
  --bg-2: #0d111c;
  --surface: #111624;
  --surface-2: #151b2b;
  --surface-3: #1a2133;
  --ink: #eef1f9;
  --ink-2: #c7cee0;
  --muted: #8f9ab3;
  --muted-2: #6d7892;
  --line: #1f2739;
  --line-strong: #2b3449;
  --brand-soft: rgba(129, 140, 248, .12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2), 0 4px 14px rgba(0, 0, 0, .18);
  --shadow-md: 0 14px 38px rgba(0, 0, 0, .3);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, .42);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
main { flex: 1 0 auto; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(60rem 40rem at 8% -10%, rgba(99, 102, 241, .07), transparent 60%),
    radial-gradient(50rem 34rem at 100% 0%, rgba(168, 85, 247, .06), transparent 55%);
}
[data-theme="dark"] body::before {
  background:
    radial-gradient(60rem 40rem at 8% -10%, rgba(99, 102, 241, .12), transparent 60%),
    radial-gradient(50rem 34rem at 100% 0%, rgba(168, 85, 247, .1), transparent 55%);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
::selection { background: rgba(99, 102, 241, .22); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}
.header-inner {
  max-width: var(--max);
  height: var(--header-h);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand { display: flex; align-items: center; gap: 11px; flex: none; }
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2) 55%, var(--brand-3));
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -.5px;
  box-shadow: 0 8px 20px rgba(99, 102, 241, .32);
}
.brand-mark.small { width: 32px; height: 32px; border-radius: 10px; font-size: 12px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 15px; letter-spacing: .2px; }
.brand-text small { font-size: 8.5px; letter-spacing: 2.1px; color: var(--muted-2); font-weight: 700; margin-top: 4px; }
.header-spacer { flex: 1; }
.header-actions { display: flex; align-items: center; gap: 9px; flex: none; }
.local-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--muted);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, .5);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .45); }
  50% { box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
}
.icon-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  display: grid; place-items: center;
  color: var(--muted);
  transition: .18s ease;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); transform: translateY(-1px); }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
.mobile-menu { display: none; }

/* ---------- sidebar ---------- */
.app-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .22s ease;
}
.app-content > main { flex: 1 0 auto; }
.sidebar {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: var(--sidebar-w);
  z-index: 70;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow: hidden;
  transition: width .22s ease, transform .25s ease;
}
.sidebar-top {
  height: var(--header-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--line);
}
.sidebar-top .brand { flex: 1; min-width: 0; }
.sidebar-collapse {
  width: 30px; height: 30px;
  flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  transition: .18s ease;
}
.sidebar-collapse:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface-2); }
.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px;
  scrollbar-width: thin;
}
.side-section-label {
  margin: 10px 0 2px;
  padding: 0 10px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1.8px;
  color: var(--muted-2);
  text-transform: uppercase;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
  text-align: left;
  white-space: nowrap;
  transition: .15s ease;
}
.side-link:hover { background: var(--surface-2); color: var(--ink); }
.side-link.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.side-icon { width: 20px; flex: none; text-align: center; font-size: 15px; line-height: 1; }
.side-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.side-count {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.side-link.active .side-count { background: rgba(99, 102, 241, .14); color: var(--brand); }
.side-search kbd { margin-left: auto; font-size: 9px; padding: 2px 5px; }
.sidebar-foot { flex: none; padding: 12px 10px; border-top: 1px solid var(--line); }
.sidebar-foot .local-pill { width: 100%; justify-content: center; }
.sidebar-backdrop { display: none; }

/* 首页极简入口：不显示左侧分类栏，顶栏露出品牌 */
body.home-clean .sidebar,
body.home-clean .sidebar-backdrop { display: none; }
body.home-clean .app-content { margin-left: 0; }
body.home-clean .header-brand { display: flex; }
body.home-clean .mobile-menu { display: none !important; }

@media (min-width: 1001px) {
  .header-brand { display: none; }
  html[data-sidebar="collapsed"] { --sidebar-w: 72px; }
  html[data-sidebar="collapsed"] .sidebar-top { justify-content: center; padding: 0; }
  html[data-sidebar="collapsed"] .sidebar-top .brand { display: none; }
  html[data-sidebar="collapsed"] .sidebar-collapse svg { transform: rotate(180deg); }
  html[data-sidebar="collapsed"] .sidebar-nav { padding: 10px 8px; }
  html[data-sidebar="collapsed"] .side-section-label,
  html[data-sidebar="collapsed"] .side-label,
  html[data-sidebar="collapsed"] .side-count,
  html[data-sidebar="collapsed"] .side-search kbd,
  html[data-sidebar="collapsed"] .sidebar-foot { display: none; }
  html[data-sidebar="collapsed"] .side-link { justify-content: center; padding: 9px 0; }
  html[data-sidebar="collapsed"] .site-header .brand { display: flex; }
}

/* ---------- shared ---------- */
.gradient-text {
  background: linear-gradient(92deg, #6366f1 0%, #a855f7 44%, #ec4899 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  transition: .2s ease;
  white-space: nowrap;
}
.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 24px rgba(99, 102, 241, .28);
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(99, 102, 241, .36); }
.btn.primary:disabled { opacity: .72; cursor: wait; transform: none; }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { border-color: var(--line-strong); background: var(--surface-2); }
.btn-spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; display: none; animation: spin .7s linear infinite; }
.btn.is-loading .btn-spinner { display: inline-block; }
.btn.is-loading .btn-label { opacity: .85; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- hero ---------- */
.hero { position: relative; padding: 76px 24px 34px; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(52px); opacity: .5; animation: float 14s ease-in-out infinite; }
.orb-a { width: 340px; height: 340px; background: #c7d2fe; top: -110px; left: 6%; }
.orb-b { width: 300px; height: 300px; background: #f5d0fe; top: 20px; right: 3%; animation-delay: -4s; }
.orb-c { width: 260px; height: 260px; background: #fbcfe8; bottom: -140px; left: 43%; animation-delay: -8s; }
[data-theme="dark"] .orb { opacity: .16; filter: blur(70px); }
@keyframes float { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(18px,-22px,0) scale(1.06); } }
.grid-glow {
  position: absolute; inset: 0;
  background-image: linear-gradient(to right, rgba(120,130,170,.06) 1px, transparent 1px),
                    linear-gradient(to bottom, rgba(120,130,170,.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 60% 55% at 50% 30%, #000 30%, transparent 75%);
}
.hero-inner { position: relative; max-width: 880px; margin: 0 auto; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(10px);
  font-size: 12px; font-weight: 600; color: var(--muted);
  margin-bottom: 24px;
}
.hero h1 {
  margin: 0 0 20px;
  font-size: clamp(38px, 6vw, 66px);
  line-height: 1.08;
  letter-spacing: -2.4px;
  font-weight: 800;
}
.hero-sub { max-width: 620px; margin: 0 auto 30px; color: var(--muted); font-size: 16px; line-height: 1.8; }
.hero-search {
  display: flex; align-items: center; gap: 11px;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
  height: 58px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--muted);
  transition: .2s ease;
}
.hero-search:focus-within { border-color: rgba(99,102,241,.5); box-shadow: 0 0 0 4px rgba(99,102,241,.1), var(--shadow-md); }
.hero-search input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 15px; color: var(--ink); min-width: 0; }
.hero-search input::placeholder { color: var(--muted-2); }
kbd {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  padding: 3px 7px; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 6px; background: var(--surface-2);
}
.hero-stats { display: flex; justify-content: center; gap: 38px; margin-top: 34px; }
.hero-stats div { display: flex; flex-direction: column; gap: 2px; }
.hero-stats strong { font-size: 24px; letter-spacing: -.5px; }
.hero-stats span { font-size: 11.5px; color: var(--muted-2); }
.feature-strip {
  max-width: var(--max); margin: 8px auto 0; padding: 0 24px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.feature-item {
  display: flex; gap: 13px; align-items: center;
  padding: 17px 19px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(10px);
}
.feature-icon { font-size: 22px; width: 42px; height: 42px; display: grid; place-items: center; background: var(--surface-3); border-radius: 12px; flex: none; }
.feature-item strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.feature-item small { color: var(--muted); font-size: 12px; line-height: 1.5; }

/* ---------- home landing ---------- */
.home-top { padding: 64px 24px 30px; }
.home-top.is-hidden { display: none; }
.home-top-inner { max-width: 680px; margin: 0 auto; text-align: center; }
.home-top h1 { margin: 0 0 8px; font-size: clamp(30px, 4vw, 42px); letter-spacing: -1.4px; font-weight: 800; }
.home-top p { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.home-top .hero-search { box-shadow: var(--shadow-sm); }
.category-home { max-width: var(--max); margin: 0 auto; padding: 10px 24px 50px; }
.category-home-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.category-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 20, 38, .03);
  transition: .18s ease;
}
.category-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  box-shadow: var(--shadow-sm);
}
.category-card-icon {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 21px;
}
.category-card-body { min-width: 0; }
.category-card-body strong { display: block; font-size: 14px; letter-spacing: -.2px; }
.category-card-body small {
  display: block; margin-top: 3px;
  color: var(--muted); font-size: 11.5px; line-height: 1.5;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.category-card-count {
  margin-left: auto; flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted-2);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
.back-link { display: inline-block; margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 600; }
.back-link:hover { color: var(--brand); }

/* ---------- tools section ---------- */
.tools-section { max-width: var(--max); margin: 0 auto; padding: 36px 24px 26px; }
.tools-grid-section { max-width: var(--max); margin: 0 auto; padding: 26px 24px 20px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.section-kicker { margin: 0 0 8px; font-size: 10.5px; font-weight: 800; letter-spacing: 2.4px; color: var(--brand); }
.section-head h2, .bottom-cta h2 { margin: 0 0 6px; font-size: clamp(26px, 3.4vw, 34px); letter-spacing: -1px; }
.section-sub { margin: 0; color: var(--muted); font-size: 13.5px; }
.advisor-link {
  display: flex; flex-direction: column; gap: 3px;
  padding: 13px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  flex: none;
  transition: .2s ease;
}
.advisor-link:hover { border-color: rgba(99,102,241,.4); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.advisor-link span { font-size: 13.5px; font-weight: 700; }
.advisor-link small { font-size: 11.5px; color: var(--muted); }
.category-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 45;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
}
.category-bar-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 11px 24px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.category-bar-inner::-webkit-scrollbar { display: none; }
.cat-pill {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: .18s ease;
}
.cat-pill span { font-size: 14px; }
.cat-pill:hover { color: var(--ink); border-color: var(--line-strong); }
.cat-pill.active { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 8px 20px rgba(99,102,241,.25); }
.tool-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 11px; }
.tool-card {
  position: relative;
  display: flex; flex-direction: column;
  padding: 12px 13px 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 20, 38, .03);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.tool-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(15rem 9rem at 100% 0%, var(--c-soft, rgba(99,102,241,.07)), transparent 70%);
  opacity: .45; transition: opacity .22s ease;
}
.tool-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--c1, var(--brand)) 30%, var(--line)); }
.tool-card:hover::after { opacity: 1; }
.tool-card-top { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 7px; position: relative; z-index: 1; }
.tool-icon {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  font-size: 17px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: 0 5px 12px var(--c-shadow, rgba(99,102,241,.22));
}
.tool-card-title { min-width: 0; padding-top: 1px; }
.tool-card h3 {
  margin: 0; font-size: 13.5px; line-height: 1.35; letter-spacing: -.2px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.tool-cat { display: block; margin-top: 1px; font-size: 9.5px; font-weight: 600; letter-spacing: .2px; color: var(--muted-2); }
.tool-card p {
  position: relative; z-index: 1; margin: 0;
  font-size: 11.5px; line-height: 1.55; color: var(--muted);
  min-height: calc(2 * 1.55em);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.tool-card-foot {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  gap: 6px; margin-top: auto; padding-top: 8px;
}
.tool-badge {
  font-size: 8.5px; font-weight: 700; letter-spacing: .1px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 2px 6px; border-radius: 999px;
  max-width: 74%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tool-arrow {
  display: inline-flex; align-items: center; gap: 3px; flex: none;
  font-size: 10px; font-weight: 700; color: var(--c1, var(--brand));
  opacity: .8; transition: opacity .2s ease;
}
.tool-arrow svg { transition: transform .2s ease; }
.tool-card:hover .tool-arrow { opacity: 1; }
.tool-card:hover .tool-arrow svg { transform: translateX(2px); }
.empty-state { text-align: center; padding: 60px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.empty-state > span { font-size: 40px; }
.empty-state h3 { margin: 10px 0 5px; }
.empty-state p { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; }
.empty-state a { color: var(--brand); font-weight: 600; }

/* ---------- color themes ---------- */
.color-violet { --c1: #8b5cf6; --c2: #6366f1; --c-soft: rgba(139,92,246,.1); --c-shadow: rgba(99,102,241,.3); }
.color-rose { --c1: #fb7185; --c2: #e11d48; --c-soft: rgba(244,63,94,.09); --c-shadow: rgba(225,29,72,.24); }
.color-amber { --c1: #fbbf24; --c2: #f59e0b; --c-soft: rgba(245,158,11,.1); --c-shadow: rgba(245,158,11,.24); }
.color-emerald { --c1: #34d399; --c2: #059669; --c-soft: rgba(16,185,129,.09); --c-shadow: rgba(5,150,105,.22); }
.color-green { --c1: #34d399; --c2: #059669; --c-soft: rgba(16,185,129,.09); --c-shadow: rgba(5,150,105,.22); }
.color-red { --c1: #fb7185; --c2: #e11d48; --c-soft: rgba(244,63,94,.09); --c-shadow: rgba(225,29,72,.24); }
.color-sky { --c1: #38bdf8; --c2: #0284c7; --c-soft: rgba(14,165,233,.09); --c-shadow: rgba(2,132,199,.22); }
.color-blue { --c1: #60a5fa; --c2: #2563eb; --c-soft: rgba(37,99,235,.09); --c-shadow: rgba(37,99,235,.24); }
.color-teal { --c1: #2dd4bf; --c2: #0f766e; --c-soft: rgba(13,148,136,.09); --c-shadow: rgba(13,148,136,.22); }
.color-orange { --c1: #fb923c; --c2: #ea580c; --c-soft: rgba(234,88,12,.09); --c-shadow: rgba(234,88,12,.22); }
.color-pink { --c1: #f472b6; --c2: #db2777; --c-soft: rgba(219,39,119,.09); --c-shadow: rgba(219,39,119,.22); }
.color-cyan { --c1: #22d3ee; --c2: #0891b2; --c-soft: rgba(8,145,178,.09); --c-shadow: rgba(8,145,178,.22); }
.color-lime { --c1: #a3e635; --c2: #65a30d; --c-soft: rgba(101,163,13,.09); --c-shadow: rgba(101,163,13,.2); }
.color-slate { --c1: #94a3b8; --c2: #475569; --c-soft: rgba(71,85,105,.09); --c-shadow: rgba(71,85,105,.2); }

/* ---------- bottom cta / footer ---------- */
.bottom-cta {
  max-width: var(--max); margin: 70px auto 0; padding: 0 24px;
}
.bottom-cta > div:first-child {
  position: relative;
  padding: 42px;
  border-radius: 28px;
  background: linear-gradient(120deg, #111827, #1e1b4b 55%, #312e81);
  color: #fff;
  overflow: hidden;
}
.bottom-cta > div:first-child::after {
  content: ""; position: absolute; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(168,85,247,.45), transparent 65%);
  right: -100px; top: -140px;
}
.bottom-cta .section-kicker { color: #a5b4fc; }
.bottom-cta p:not(.section-kicker) { max-width: 560px; margin: 10px 0 0; color: rgba(255,255,255,.72); font-size: 13.5px; line-height: 1.8; }
.cta-points { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.cta-points span { font-size: 11.5px; color: rgba(255,255,255,.72); padding: 6px 11px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; background: rgba(255,255,255,.05); }
.site-footer { margin-top: 70px; border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { max-width: var(--max); margin: 0 auto; padding: 28px 24px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.footer-brand { display: flex; gap: 11px; align-items: center; font-size: 12.5px; }
.footer-brand strong { font-size: 13.5px; }
.footer-brand span { color: var(--muted); }
.footer-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted-2); font-size: 11.5px; }
.footer-meta a { color: var(--brand); }

/* ---------- palette ---------- */
.palette { position: fixed; inset: 0; z-index: 100; display: none; }
.palette.open { display: block; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(8, 10, 20, .45); backdrop-filter: blur(5px); }
.palette-box {
  position: relative;
  width: min(620px, calc(100vw - 32px));
  margin: 14vh auto 0;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop .18s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.985); } }
.palette-input-row { display: flex; align-items: center; gap: 11px; padding: 0 17px; height: 58px; border-bottom: 1px solid var(--line); color: var(--muted); }
.palette-input-row input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 15px; color: var(--ink); }
.palette-results { max-height: 48vh; overflow-y: auto; padding: 8px; }
.palette-item { display: flex; align-items: center; gap: 11px; padding: 10px 11px; border-radius: 12px; cursor: pointer; }
.palette-item:hover, .palette-item.active { background: var(--surface-2); }
.palette-item .palette-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: linear-gradient(135deg, var(--c1), var(--c2)); font-size: 16px; flex: none; }
.palette-item strong { display: block; font-size: 13px; }
.palette-item small { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 430px; }
.palette-item em { margin-left: auto; font-style: normal; font-size: 10px; color: var(--muted-2); }
.palette-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line); color: var(--muted-2); font-size: 10.5px; }
.palette-empty { padding: 26px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- tool page ---------- */
.tool-page { max-width: var(--max); margin: 0 auto; padding: 26px 24px 40px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted-2); margin-bottom: 22px; flex-wrap: wrap; }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb strong { color: var(--muted); font-weight: 600; }
.tool-head { display: flex; align-items: center; gap: 20px; margin-bottom: 26px; }
.tool-head-icon {
  width: 66px; height: 66px; border-radius: 20px;
  display: grid; place-items: center; font-size: 31px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: 0 14px 30px var(--c-shadow, rgba(99,102,241,.26));
  flex: none;
}
.tool-head-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11px; color: var(--muted-2); margin-bottom: 5px; }
.mini-badge { color: var(--brand); background: var(--brand-soft); padding: 3px 8px; border-radius: 999px; font-weight: 700; }
.mini-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }
.tool-head h1 { margin: 0 0 5px; font-size: clamp(26px, 3.5vw, 34px); letter-spacing: -1px; }
.tool-head p { margin: 0; color: var(--muted); font-size: 13.5px; max-width: 760px; line-height: 1.7; }
.notice-banner { display: flex; gap: 10px; padding: 13px 16px; border: 1px solid rgba(245,158,11,.28); background: rgba(245,158,11,.08); border-radius: 13px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 20px; }
.tool-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; align-items: start; }
.tool-main { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.form-panel, .result-panel { padding: 26px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.panel-head h2 { margin: 0; font-size: 16.5px; letter-spacing: -.3px; }
.panel-hint { font-size: 11px; color: var(--muted-2); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
.field { min-width: 0; }
.field-full { grid-column: 1 / -1; }
.field-half { grid-column: span 1; }
.field-third { grid-column: span 1; }
.field-label { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 650; color: var(--ink-2); margin-bottom: 7px; }
.req { color: var(--danger); font-size: 12px; }
.field-help { margin: 6px 0 0; font-size: 11px; color: var(--muted-2); line-height: 1.6; }
.field input[type=text], .field input[type=password], .field input[type=number], .field input[type=date], .field input[type=search], .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 13px;
  color: var(--ink);
  outline: 0;
  transition: .18s ease;
}
.field textarea { line-height: 1.7; resize: vertical; min-height: 96px; font-family: var(--font); }
.field input:focus, .field textarea:focus, .field select:focus { border-color: rgba(99,102,241,.55); box-shadow: 0 0 0 3px rgba(99,102,241,.1); background: var(--surface); }
.field input::placeholder, .field textarea::placeholder { color: var(--muted-2); }
.select-wrap { position: relative; }
.select-wrap::after { content: "⌄"; position: absolute; right: 13px; top: 50%; transform: translateY(-56%); pointer-events: none; color: var(--muted); font-size: 15px; }
.field select { appearance: none; padding-right: 34px; }
.field input[type=range] { width: 100%; accent-color: var(--brand); }
.range-out { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--brand); background: var(--brand-soft); padding: 2px 7px; border-radius: 5px; font-weight: 600; }
.color-row { display: flex; align-items: center; gap: 9px; }
.field input[type=color] { width: 42px; height: 36px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); padding: 3px; }
.color-hex { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); cursor: pointer; }
.switch-row strong { display: block; font-size: 12.5px; }
.switch-row small { display: block; font-size: 10.5px; color: var(--muted-2); margin-top: 1px; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: .2s ease; }
.switch i::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .2s ease; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(16px); }
.radio-row { display: flex; flex-wrap: wrap; gap: 7px; }
.radio-chip input { position: absolute; opacity: 0; }
.radio-chip span { display: inline-block; padding: 8px 13px; border: 1px solid var(--line); border-radius: 9px; font-size: 12px; color: var(--muted); cursor: pointer; transition: .15s ease; background: var(--surface-2); }
.radio-chip input:checked + span { border-color: rgba(99,102,241,.5); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.info-box { padding: 12px 14px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 11px; font-size: 12px; color: var(--muted); line-height: 1.65; }

/* dropzone */
.file-picker { position: relative; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px;
  min-height: 140px;
  padding: 22px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: .18s ease;
}
.dropzone:hover, .dropzone.dragover { border-color: rgba(99,102,241,.55); background: var(--brand-soft); }
.dropzone-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--brand); margin-bottom: 4px; }
.dropzone-title { font-size: 13px; font-weight: 650; }
.dropzone-hint { font-size: 11px; color: var(--muted-2); }
.file-list { list-style: none; margin: 9px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.file-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; font-size: 11.5px; }
.file-item .file-type { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; background: var(--surface); border: 1px solid var(--line); font-size: 9px; font-weight: 800; color: var(--muted); flex: none; text-transform: uppercase; }
.file-item .file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .file-size { color: var(--muted-2); font-size: 10.5px; flex: none; }
.file-item .file-tools { display: flex; gap: 3px; flex: none; }
.file-item .file-tools button { width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 11px; display: grid; place-items: center; }
.file-item .file-tools button:hover { color: var(--brand); border-color: var(--brand); }
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.form-note { margin-left: auto; color: var(--muted-2); font-size: 11px; }

/* results */
.result-panel { animation: rise .3s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.result-status { font-size: 11px; color: var(--success); background: rgba(16,185,129,.1); padding: 4px 9px; border-radius: 999px; font-weight: 700; }
.result-message { margin: 0 0 16px; font-size: 13px; color: var(--ink-2); }
.result-stats { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 16px; }
.stat-chip { padding: 9px 12px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; }
.stat-chip strong { display: block; font-size: 14px; }
.stat-chip span { display: block; font-size: 10px; color: var(--muted-2); margin-top: 1px; }
.file-results { display: flex; flex-direction: column; gap: 8px; }
.file-result {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.file-result .file-type { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); font-size: 9px; font-weight: 800; color: var(--brand); flex: none; text-transform: uppercase; }
.file-result .file-meta { flex: 1; min-width: 0; }
.file-result strong { display: block; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-result small { color: var(--muted-2); font-size: 10.5px; }
.file-result .btn { height: 32px; padding: 0 12px; font-size: 11.5px; border-radius: 8px; }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 9px; margin-top: 14px; }
.preview-grid a { display: block; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.preview-grid img { width: 100%; height: 110px; object-fit: cover; }
.preview-grid span { display: block; padding: 6px 8px; font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-text-wrap { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.result-text-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 600; }
.mini-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 3px 8px; font-size: 10.5px; color: var(--muted); }
.result-text { margin: 0; padding: 13px; max-height: 360px; overflow: auto; font-family: var(--mono); font-size: 11.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; background: var(--surface); }
.result-note { color: var(--muted-2); font-size: 11px; margin: 12px 0 0; }
.result-actions { display: flex; gap: 9px; margin-top: 18px; }
.result-actions .btn { height: 38px; font-size: 12px; }

/* aside */
.tool-aside { display: flex; flex-direction: column; gap: 14px; position: sticky; top: calc(var(--header-h) + 18px); }
.aside-card { padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); }
.aside-card h3 { margin: 0 0 13px; font-size: 13px; letter-spacing: .1px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: flex; gap: 10px; }
.steps li > span { width: 20px; height: 20px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 10px; font-weight: 800; display: grid; place-items: center; flex: none; margin-top: 1px; }
.steps p { margin: 0; font-size: 11.5px; color: var(--muted); line-height: 1.65; }
.privacy-card p { margin: 0 0 10px; font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.privacy-card ul { margin: 0; padding-left: 16px; color: var(--muted-2); font-size: 11px; line-height: 1.8; }
.related-list { display: flex; flex-direction: column; gap: 6px; }
.related-item { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; transition: .15s ease; }
.related-item:hover { background: var(--surface-2); }
.related-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, var(--c1), var(--c2)); font-size: 16px; flex: none; }
.related-item strong { display: block; font-size: 11.5px; }
.related-item small { display: block; font-size: 10px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }

/* toasts */
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: flex-start; gap: 9px;
  min-width: 250px; max-width: 380px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  line-height: 1.55;
  animation: toast-in .24s ease;
}
.toast.error { border-color: rgba(239,68,68,.3); }
.toast.error .toast-dot { background: var(--danger); }
.toast.success .toast-dot { background: var(--success); }
.toast-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); margin-top: 6px; flex: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* generic extra pages */
.section-wrap { max-width: var(--max); margin: 0 auto; padding: 30px 24px 50px; }
.app-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); }
.app-toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 16px; }
.app-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; align-items: start; }
.canvas-stage { position: relative; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #0f1220; display: grid; place-items: center; min-height: 360px; }
.canvas-stage canvas { max-width: 100%; max-height: 64vh; display: block; }
.thumb-strip { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0; }
.thumb-strip button { flex: none; width: 62px; height: 62px; border: 2px solid transparent; border-radius: 9px; overflow: hidden; padding: 0; background: var(--surface-2); }
.thumb-strip button.active { border-color: var(--brand); }
.thumb-strip img { width: 100%; height: 100%; object-fit: cover; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.mono { font-family: var(--mono); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* responsive */
@media (max-width: 1000px) {
  .app-content { margin-left: 0; }
  .sidebar { width: min(280px, 86vw); transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 69;
    background: rgba(8, 10, 20, .42);
    backdrop-filter: blur(3px);
  }
  body.sidebar-open { overflow: hidden; }
  .mobile-menu { display: grid; }
  .sidebar-collapse { display: none; }
}
@media (max-width: 1120px) {
  .tool-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .tool-layout { grid-template-columns: minmax(0, 1fr) 280px; }
}
@media (max-width: 900px) {
  .tool-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .category-home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature-strip { grid-template-columns: 1fr; }
  .tool-layout, .app-grid { grid-template-columns: 1fr; }
  .tool-aside { position: static; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .header-actions .local-pill { display: none; }
}
@media (max-width: 760px) {
  .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .header-inner { padding: 0 15px; gap: 12px; }
  .brand-text small { display: none; }
  .hero { padding: 48px 16px 24px; }
  .hero h1 { letter-spacing: -1.2px; }
  .home-top { padding: 42px 16px 22px; }
  .category-home { padding: 8px 16px 36px; }
  .hero-stats { gap: 22px; }
  .hero-stats strong { font-size: 19px; }
  .tools-section { padding: 28px 16px 18px; }
  .tools-grid-section { padding: 18px 16px 10px; }
  .category-bar-inner { padding: 9px 14px; }
  .tool-grid { gap: 9px; }
  .tool-card { padding: 11px 12px 10px; }
  .tool-page { padding: 18px 14px 30px; }
  .tool-head { gap: 13px; align-items: flex-start; }
  .tool-head-icon { width: 52px; height: 52px; border-radius: 15px; font-size: 24px; }
  .form-panel, .result-panel { padding: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .field-half, .field-third { grid-column: 1 / -1; }
  .form-note { width: 100%; margin-left: 0; }
  .hero-search kbd { display: none; }
  .hero-search { height: 52px; }
  .bottom-cta { padding: 0 14px; }
  .bottom-cta > div:first-child { padding: 28px 22px; }
  .footer-inner { padding: 24px 16px; }
  .preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-home-grid { grid-template-columns: 1fr; }
}
@media (max-width: 440px) {
  .tool-grid { grid-template-columns: 1fr; }
  .tool-card p { min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
