:root {
  --bg: #f7f5fb;
  --surface: #ffffff;
  --text: #1e1b2e;
  --muted: #6b6580;
  --accent: #7c3aed;
  --accent-2: #d946ef;
  --border: #e6e1f0;
  --shadow: 0 1px 2px rgba(30, 27, 46, 0.05), 0 8px 24px rgba(30, 27, 46, 0.06);
  --radius: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14111f;
    --surface: #1e1a2e;
    --text: #ede9f8;
    --muted: #a49cc0;
    --accent: #a78bfa;
    --accent-2: #e879f9;
    --border: #322c48;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

/* The hidden attribute must win even over classes that set display. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

/* Header */

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 48px;
}

.logo {
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--text);
  letter-spacing: -0.01em;
}

.logo-spark {
  margin-right: 2px;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.back-link:hover {
  color: var(--accent);
}

/* Hero */

.hero {
  text-align: center;
  margin-bottom: 48px;
}

.hero h1 {
  font-size: clamp(1.7rem, 4.5vw, 2.6rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 12px;
}

.hero h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 46ch;
  margin: 0 auto;
}

.hero-tool {
  margin-bottom: 36px;
}

/* Tool cards (home) */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.tool-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

a.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.tool-card h2 {
  font-size: 1.15rem;
  margin: 14px 0 6px;
  letter-spacing: -0.01em;
}

.tool-card p {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

.tool-icon {
  font-size: 1.8rem;
}

.tool-go {
  display: inline-block;
  margin-top: 14px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
}

.tool-card.soon {
  border-style: dashed;
  box-shadow: none;
  opacity: 0.75;
}

/* Dropzone */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 56px 24px;
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dropzone:hover,
.dropzone:focus-within {
  border-color: var(--accent);
}

.dropzone.dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.dz-icon {
  font-size: 2.2rem;
  margin-bottom: 4px;
}

.dropzone strong {
  font-size: 1.1rem;
}

.dz-sub {
  color: var(--muted);
  font-size: 0.92rem;
}

.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;
}

/* Status area */

.status {
  margin-top: 24px;
}

.progress {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.2s ease;
}

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  padding: 4px 12px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.error {
  background: color-mix(in srgb, #ef4444 8%, var(--surface));
  border: 1px solid color-mix(in srgb, #ef4444 40%, var(--border));
  border-radius: var(--radius);
  padding: 16px 24px;
}

.error p {
  margin: 0;
}

/* Results */

.results {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.file-meta {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.stat {
  background: var(--bg);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-hero .stat-value {
  font-size: 2rem;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hint {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Per-file results table */

.file-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 0.95rem;
}

.file-table th {
  text-align: left;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 10px;
}

.file-table td {
  padding: 8px 10px;
  border-top: 1px solid var(--border);
}

.file-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.file-table .file-name {
  overflow-wrap: anywhere;
}

.file-table .file-error {
  color: var(--muted);
  font-size: 0.9rem;
}

.file-table tr.total td {
  font-weight: 700;
  border-top: 2px solid var(--border);
}

/* Footer */

.site-footer {
  margin-top: 64px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
