:root {
  color-scheme: light;
  --bg: #f5f7ff;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --text: #14213d;
  --text-muted: #5b6780;
  --border: rgba(20, 33, 61, 0.1);
  --accent: #4f46e5;
  --accent-strong: #3730a3;
  --accent-soft: rgba(79, 70, 229, 0.12);
  --shadow: 0 20px 45px rgba(17, 24, 39, 0.12);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07111f;
  --surface: rgba(10, 19, 35, 0.78);
  --surface-strong: #0f172a;
  --text: #f8fafc;
  --text-muted: #a0aec0;
  --border: rgba(148, 163, 184, 0.2);
  --accent: #8b5cf6;
  --accent-strong: #c4b5fd;
  --accent-soft: rgba(139, 92, 246, 0.18);
  --shadow: 0 20px 45px rgba(2, 6, 23, 0.45);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  background: radial-gradient(circle at top left, rgba(79, 70, 229, 0.12), transparent 28%), var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: white;
  padding: 0.8rem 1rem;
  z-index: 200;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.container {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}
.section {
  padding: 4.5rem 0;
}
.section-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin-bottom: 0.8rem;
}
.section-copy {
  color: var(--text-muted);
  max-width: 690px;
  margin-bottom: 2rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  background: rgba(245, 247, 255, 0.8);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .site-header { background: rgba(7, 17, 31, 0.8); }

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #22c55e);
  display: grid;
  place-items: center;
  color: white;
  box-shadow: var(--shadow);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
}
.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
}
.nav-actions { display: flex; align-items: center; gap: 0.6rem; }
.icon-btn,
.primary-btn,
.secondary-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1.1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.icon-btn:hover,
.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
}
.icon-btn {
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--border);
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
}
.primary-btn {
  background: linear-gradient(135deg, var(--accent), #16a34a);
  color: white;
  box-shadow: var(--shadow);
}
.secondary-btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.mobile-toggle { display: none; }

.hero {
  padding: 4.5rem 0 2.5rem;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2rem;
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.2rem, 4.2vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
  margin: 0 0 1rem;
}
.hero p { font-size: 1.05rem; color: var(--text-muted); max-width: 640px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.4rem; }
.hero-card,
.panel,
.tool-card,
.category-card,
.faq-item,
.cta-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
}
.hero-visual {
  padding: 1.2rem;
  background: linear-gradient(135deg, var(--accent-soft), transparent);
}
.hero-visual .visual-block {
  background: var(--surface-strong);
  padding: 1.2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.stat-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}
.stat-item {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem;
}
.stat-item strong { display: block; font-size: 1.1rem; }

.search-card,
.panel,
.cta-card {
  padding: 1.25rem;
}
.search-controls {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.search-controls input {
  flex: 1;
  min-width: 220px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  border-radius: 999px;
  padding: 0.9rem 1rem;
  color: var(--text);
}
.search-controls input:focus { outline: 2px solid rgba(79, 70, 229, 0.25); border-color: var(--accent); }

.grid-2,
.grid-3,
.tool-grid,
.category-grid,
.related-grid {
  display: grid;
  gap: 1.1rem;
}
.tool-grid,
.category-grid,
.related-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.tool-card,
.category-card,
.faq-item {
  padding: 1.2rem;
}
.tool-card h3,
.category-card h3,
.faq-item h3 {
  margin-top: 0.1rem;
  margin-bottom: 0.45rem;
  font-size: 1.08rem;
}
.tool-card p,
.category-card p,
.faq-item p,
.content-card p,
.content-card li {
  color: var(--text-muted);
}
.tool-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 0.9rem;
}
.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.82rem;
}
.tool-card .card-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 1rem;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  color: var(--text-muted);
  margin: 1rem 0 1.7rem;
}
.breadcrumb a { color: var(--accent); }
.breadcrumb span:last-child { color: var(--text); }

.content-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 1.3rem; }
.content-card { padding: 1.25rem; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.content-card ul { padding-left: 1.1rem; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  color: var(--text-muted);
  font-weight: 600;
}
.form-grid input,
.form-grid select,
textarea {
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
}
.button-row,
.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1rem;
}
.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.2rem;
}
.result-card {
  padding: 1rem;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent-soft), transparent);
  border: 1px solid var(--border);
}
.result-label {
  margin: 0 0 0.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.result-card h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
}
.chart-wrap {
  margin-top: 1.4rem;
  display: grid;
  gap: 0.8rem;
  justify-items: center;
}
.legend {
  display: flex;
  gap: 1rem;
  color: var(--text-muted);
}
.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 0.3rem;
}
.legend-swatch.principal { background: var(--accent); }
.legend-swatch.interest { background: #22c55e; }
.summary-table-wrap { margin-top: 1.4rem; }
.summary-table {
  width: 100%;
  border-collapse: collapse;
}
.summary-table th,
.summary-table td {
  text-align: left;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}
.faq-section { margin-top: 1.4rem; }
.related-tools-block { margin-top: 1.4rem; }
pre {
  background: rgba(79, 70, 229, 0.08);
  padding: 0.9rem;
  border-radius: 14px;
  overflow-x: auto;
}

.share-list { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1rem; }
.share-list button { border: 1px solid var(--border); background: var(--surface-strong); color: var(--text); }

.site-footer {
  padding: 2.4rem 0 2.8rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  color: var(--text-muted);
}
.footer-grid { display: grid; grid-template-columns: 1.2fr 0.8fr 0.8fr; gap: 1rem; }
.footer-links { display: grid; gap: 0.4rem; }
.footer-links a:hover { color: var(--text); }
.footer-social { margin-top: 1rem; }
.social-links { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 0.7rem; }
.social-link { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.55rem 0.8rem; border-radius: 999px; background: var(--surface-strong); border: 1px solid var(--border); }
.social-link svg { width: 16px; height: 16px; fill: currentColor; }
.consent-banner { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 110; }
.consent-banner__inner { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: 1rem 1.1rem; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface-strong); box-shadow: var(--shadow); }
.consent-banner p { margin: 0.2rem 0 0; color: var(--text-muted); }
.consent-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; }

.hidden { display: none !important; }

@media (max-width: 900px) {
  .hero-grid, .content-grid, .grid-2, .grid-3, .tool-grid, .category-grid, .related-grid, .footer-grid, .result-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .mobile-toggle { display: inline-grid; }
  .nav-open .nav-links { display: flex; position: absolute; top: 70px; left: 1rem; right: 1rem; flex-direction: column; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow); }
}

@media (max-width: 640px) {
  .section { padding: 3.3rem 0; }
  .hero { padding-top: 2.5rem; }
  .navbar { flex-wrap: wrap; }
  .stat-list { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

.pdf-tool-panel {
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.pdf-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.pdf-helper-text {
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}
.pdf-drop-zone {
  min-height: 220px;
  border: 2px dashed var(--accent-soft);
  background: var(--surface-strong);
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  gap: 0.35rem;
  text-align: center;
  padding: 1.6rem;
  color: var(--text-muted);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.pdf-drop-zone:hover,
.pdf-drop-zone:focus,
.pdf-drop-zone.active {
  border-color: var(--accent);
  background: rgba(79, 70, 229, 0.08);
  outline: none;
}
.pdf-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.65rem 0.95rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.95rem;
}
.pdf-file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}
.pdf-file-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.95rem 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-strong);
  cursor: grab;
}
.pdf-file-item.dragging {
  opacity: 0.65;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.1);
}
.pdf-file-item.drag-over {
  border-color: var(--accent);
}
.pdf-file-handle,
.pdf-remove-btn {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.pdf-file-handle {
  color: var(--accent-strong);
}
.pdf-file-remove-btn {
  color: var(--text);
}
.pdf-file-meta {
  min-width: 0;
}
.pdf-file-name {
  margin: 0 0 0.2rem;
  font-weight: 700;
  font-size: 0.98rem;
}
.pdf-file-details {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}
.loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
}
.message-box {
  border-radius: var(--radius-lg);
  padding: 1rem 1rem;
  border: 1px solid transparent;
}
.message-box.success {
  background: rgba(34, 197, 94, 0.12);
  color: #166534;
  border-color: rgba(34, 197, 94, 0.18);
}
.message-box.error {
  background: rgba(239, 68, 68, 0.12);
  color: #991b1b;
  border-color: rgba(239, 68, 68, 0.18);
}
.pdf-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.pdf-feature-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.split-tool-panel,
.extract-tool-panel {
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.split-action-bar,
.pdf-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.file-preview {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--border);
}
.file-preview-label {
  margin: 0 0 0.25rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}
.file-preview-text {
  margin: 0;
  color: var(--text);
  font-weight: 700;
}
.split-options {
  display: grid;
  gap: 1rem;
}
.split-options label {
  display: grid;
  gap: 0.5rem;
  color: var(--text-muted);
}
.split-options select,
.split-options input {
  border: 1px solid var(--border);
  background: var(--surface-strong);
  border-radius: 14px;
  padding: 0.95rem 1rem;
  color: var(--text);
}
.split-field {
  display: grid;
}
.split-field[hidden] {
  display: none !important;
}
.split-output-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}
.output-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.95rem 1rem;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--border);
}
.output-item p {
  margin: 0;
}
.output-name {
  color: var(--text);
  font-weight: 700;
}
.output-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
@media (min-width: 680px) {
  .split-options {
    grid-template-columns: 1fr 1fr;
  }
  .split-field {
    display: grid;
  }
}
@media (max-width: 900px) {
  .pdf-tool-panel,
  .split-tool-panel,
  .extract-tool-panel,
  .pdf-summary-grid {
    display: block;
  }
  .pdf-summary-grid {
    grid-template-columns: 1fr;
  }
  .pdf-file-item {
    grid-template-columns: 1fr auto;
  }
  .pdf-file-handle {
    display: none;
  }
}
@media (max-width: 640px) {
  .pdf-tool-panel,
  .split-tool-panel,
  .extract-tool-panel {
    padding: 1rem;
  }
}
@media (max-width: 640px) {
  .pdf-tool-panel {
    padding: 1rem;
  }
}
