/* ============================================================
   Toolkit — shared base (theme, layout, header, footer, UI shell)
   Loaded on every page. Page-specific rules live in each page's
   own CSS file.
   Light theme.
   ============================================================ */
:root {
  /* Light palette */
  --bg: #f5f7fb;
  --bg-2: #eef2fb;
  --surface: #ffffff;      /* panels / cards */
  --surface-2: #f3f5fb;    /* inputs / list items */
  --surface-3: #e8ecf7;    /* hover */
  --border: #e2e6f0;
  --border-strong: #cbd2e4;
  --text: #1c2439;
  --muted: #4a5473;
  --faint: #5e6885;
  --accent: #4f6ef0;
  --accent-2: #8b5cf6;
  --accent-3: #12b3a0;
  --accent-ink: #ffffff;
  --success: #12a870;
  --danger: #e0455e;
  --warning: #c67c12;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 18px 44px rgba(43, 54, 90, 0.14);
  --shadow-soft: 0 8px 24px rgba(43, 54, 90, 0.09);
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --grad-3: linear-gradient(135deg, var(--accent-3), var(--accent), var(--accent-2));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(680px 440px at 6% -12%, rgba(79, 110, 240, 0.14), transparent 60%),
    radial-gradient(620px 420px at 98% -6%, rgba(139, 92, 246, 0.13), transparent 58%),
    radial-gradient(560px 420px at 50% 108%, rgba(18, 179, 160, 0.12), transparent 60%),
    radial-gradient(520px 380px at 90% 60%, rgba(240, 135, 30, 0.07), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  background-attachment: fixed;
}

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 22px; }

a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: #3a56d4; }

h1, h2, h3 { line-height: 1.2; }

/* ---------- Icons ---------- */
/* Inline SVGs inherit color via currentColor and size via em. */
.icon { width: 1em; height: 1em; display: inline-block; vertical-align: middle; fill: none;
  stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark .icon { width: 20px; height: 20px; stroke: #fff; }
.tool-icon .icon { width: 26px; height: 26px; }
.th-icon .icon { width: 28px; height: 28px; stroke: #fff; }
.dz-icon .icon { width: 40px; height: 40px; }
.fi-badge .icon { width: 18px; height: 18px; }
.feature .fi .icon { width: 24px; height: 24px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
}
@supports (backdrop-filter: blur(1px)) {
  .site-header { background: rgba(255, 255, 255, 0.78); backdrop-filter: blur(14px) saturate(140%); }
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 0; gap: 14px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); font-size: 1.18rem; }
.brand-mark {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  color: #fff;
}
.brand-mark .brand-logo { width: 30px; height: 30px; display: block; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.nav a {
  color: var(--muted); font-weight: 600; font-size: 0.9rem;
  padding: 8px 13px; border-radius: 10px; transition: all 0.15s ease;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--accent); background: var(--surface-2); border: 1px solid var(--border); }

/* Mobile menu toggle (hidden on desktop) */
.nav-toggle {
  display: none; flex-direction: column; gap: 5px; justify-content: center;
  width: 42px; height: 40px; padding: 0 10px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 10px;
}
.nav-toggle span {
  display: block; height: 2px; width: 100%; background: var(--text); border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .nav {
    display: none; width: 100%; flex-direction: column; align-items: stretch; gap: 2px;
    padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--border);
  }
  .nav.open { display: flex; }
  .nav a { padding: 11px 12px; }
}

/* ---------- Tool page header ---------- */
.tool-page { padding: 32px 22px 70px; }
.crumbs { color: var(--faint); font-size: 0.9rem; margin-bottom: 18px; }
.crumbs a { color: var(--muted); }
.tool-head { display: flex; align-items: center; gap: 16px; margin-bottom: 4px; }
.tool-head .th-icon {
  width: 56px; height: 56px; display: grid; place-items: center; flex: none;
  border-radius: 16px; background: var(--grad); box-shadow: 0 10px 24px rgba(79, 110, 240, 0.3); color: #fff;
}
.tool-head h1 { margin: 0; font-size: clamp(1.6rem, 3.2vw, 2.2rem); }
.tool-head p { color: var(--muted); margin: 4px 0 0; }

/* ---------- Panel / card ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  margin-top: 24px;
  box-shadow: var(--shadow-soft);
}

/* ---------- Form controls ---------- */
.field { margin-top: 20px; }
.field > label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 0.9rem; font-weight: 600; }
.input, .select, textarea.input {
  width: 100%; background: var(--surface); border: 1px solid var(--border-strong);
  color: var(--text); border-radius: 11px; padding: 12px 13px; font-size: 1rem; font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder { color: var(--faint); }
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 110, 240, 0.18);
}

/* Keyboard accessibility focus indicators */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.icon-btn:focus-visible,
.radio-pill:has(input:focus-visible),
.dropzone:focus-visible,
.mode-tab:focus-visible,
.thumb:focus-visible,
.row-del:focus-visible,
.filter-pill:focus-visible,
details summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.hint { color: var(--faint); font-size: 0.85rem; margin-top: 7px; }

.radio-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.radio-pill {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 10px 16px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--muted); font-weight: 600; font-size: 0.92rem;
  transition: all 0.15s ease;
}
.radio-pill:hover { color: var(--text); border-color: var(--accent); }
.radio-pill input { accent-color: var(--accent); }
.radio-pill:has(input:checked) { color: var(--accent); border-color: var(--accent); background: rgba(79, 110, 240, 0.08); }

/* ---------- Buttons ---------- */
.actions { margin-top: 24px; display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  border: none; border-radius: 12px; padding: 13px 24px; font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: transform 0.1s ease, box-shadow 0.2s ease, opacity 0.15s ease, background 0.15s ease;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:not(:disabled):hover { transform: translateY(-2px); }
.btn:not(:disabled):active { transform: translateY(0); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 24px rgba(79, 110, 240, 0.32); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--surface-3); }

/* ---------- Status & Progress ---------- */
.status { margin-top: 20px; font-size: 0.96rem; min-height: 1.3em; display: flex; align-items: center; gap: 8px; }
.status.error { color: var(--danger); }
.status.success { color: var(--success); }
.status.working { color: var(--accent); width: 100%; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(79, 110, 240, 0.3); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite; flex: none;
}
.progress-box {
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 12px; padding: 14px 16px; margin-top: 8px; width: 100%; box-shadow: var(--shadow-soft);
}
.progress-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; font-size: 0.92rem; font-weight: 600; color: var(--text); gap: 12px;
}
.progress-msg { display: flex; align-items: center; gap: 8px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-num { font-weight: 700; color: var(--accent); font-size: 0.9rem; flex: none; }
.progress-track {
  width: 100%; height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%; background: var(--grad); border-radius: 999px;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.result { margin-top: 20px; display: grid; gap: 10px; }

/* ---------- Dropzone (file tools) ---------- */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  padding: 44px 22px; text-align: center; color: var(--muted); cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
  outline: none; background: var(--surface-2);
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent); background: rgba(79, 110, 240, 0.06); transform: translateY(-2px);
}
.dropzone .dz-icon { color: var(--accent); }
.dropzone strong { color: var(--text); }
.dropzone .dz-sub { display: block; font-size: 0.86rem; color: var(--faint); margin-top: 6px; }
.dropzone input[type="file"] { display: none; }

/* ---------- File list ---------- */
.file-list { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; }
.file-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 11px 13px; animation: pop 0.18s ease;
}
.file-item .fi-badge {
  width: 34px; height: 34px; flex: none; border-radius: 9px; display: grid; place-items: center;
  background: rgba(79, 110, 240, 0.12); color: var(--accent);
}
.file-item .fi-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.file-item .fi-size { color: var(--muted); font-size: 0.84rem; flex: none; }
.file-item .fi-actions { display: flex; gap: 6px; flex: none; }
.icon-btn {
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--muted);
  border-radius: 9px; width: 32px; height: 32px; cursor: pointer; font-size: 0.95rem; line-height: 1;
  transition: all 0.15s ease; display: inline-grid; place-items: center;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--surface-2); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0 24px;
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 60px;
  background: var(--surface);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 32px;
  text-align: left;
}
.footer-brand p {
  margin-top: 12px;
  color: var(--faint);
  font-size: 0.88rem;
  line-height: 1.5;
  max-width: 280px;
}
.footer-col h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.footer-col a {
  color: var(--muted);
  font-size: 0.9rem;
  transition: color 0.15s ease;
}
.footer-col a:hover {
  color: var(--accent);
}
.footer-bottom {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--faint);
  font-size: 0.85rem;
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Article & Guide Typography ---------- */
.article-page { padding: 36px 22px 70px; }
.article-header { text-align: left; margin-bottom: 30px; max-width: 820px; }
.article-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin: 14px 0 20px; font-size: 0.88rem; color: var(--faint);
}
.badge-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px;
  border-radius: 999px; background: rgba(79, 110, 240, 0.1); color: var(--accent);
  font-weight: 600; font-size: 0.82rem;
}
.article-body { max-width: 820px; color: var(--text); line-height: 1.75; font-size: 1.05rem; }
.article-body h2 { font-size: 1.5rem; margin: 38px 0 14px; color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.article-body h3 { font-size: 1.2rem; margin: 26px 0 10px; color: var(--text); }
.article-body p { color: var(--muted); margin-bottom: 18px; }
.article-body ul, .article-body ol { color: var(--muted); margin-bottom: 20px; padding-left: 24px; }
.article-body li { margin-bottom: 8px; }

/* Guide Step Card */
.step-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px; margin: 20px 0;
  display: flex; gap: 18px; align-items: flex-start; box-shadow: var(--shadow-soft);
}
.step-number {
  width: 38px; height: 38px; border-radius: 50%; background: var(--grad);
  color: #fff; font-weight: 800; font-size: 1.1rem; display: grid; place-items: center; flex: none;
}
.step-content h4 { margin: 0 0 6px; font-size: 1.1rem; color: var(--text); }
.step-content p { margin: 0; font-size: 0.95rem; color: var(--muted); }

/* Guide CTA Box */
.guide-cta-box {
  background: linear-gradient(135deg, rgba(79, 110, 240, 0.08), rgba(139, 92, 246, 0.08));
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  padding: 28px; margin: 36px 0; text-align: center;
}
.guide-cta-box h3 { margin: 0 0 10px; font-size: 1.35rem; color: var(--text); }
.guide-cta-box p { color: var(--muted); margin: 0 0 20px; max-width: 560px; margin-left: auto; margin-right: auto; }

/* TOC Box */
.toc-box {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 22px; margin: 24px 0 32px;
}
.toc-box h4 { margin: 0 0 10px; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text); }
.toc-box ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.toc-box a { color: var(--muted); font-size: 0.92rem; }
.toc-box a:hover { color: var(--accent); }

/* ---------- Tool page SEO content (how-to + FAQ) ---------- */
.tool-content { max-width: 780px; margin: 40px auto 0; }
.tool-content h2 { font-size: 1.35rem; margin: 34px 0 10px; }
.tool-content p { color: var(--muted); margin: 0 0 14px; }
.tool-content ol { color: var(--muted); padding-left: 20px; margin: 0 0 14px; }
.tool-content ol li { margin-bottom: 8px; }
.tool-content .faq { display: grid; gap: 12px; margin-top: 8px; }
.tool-content details {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 4px 16px; transition: border-color 0.15s ease;
}
.tool-content details[open] { border-color: var(--accent); }
.tool-content summary {
  cursor: pointer; font-weight: 700; padding: 12px 0; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text);
}
.tool-content summary::-webkit-details-marker { display: none; }
.tool-content summary::after { content: "+"; color: var(--accent); font-size: 1.3rem; font-weight: 700; }
.tool-content details[open] summary::after { content: "\2212"; }
.tool-content details p { margin: 0 0 14px; }

