*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root { --radius: 10px; }

/* Light values live on :root too, so the page stays readable if JS never sets a theme class. */
:root,
.light {
  --bg: #f8f8fb;
  --surface: #ffffff;
  --border: #e2e2ea;
  --text: #1a1a2e;
  --muted: #8a8a9a;
  --accent: #0d9488;
  --accent-glow: rgba(13, 148, 136, 0.08);
  --green: #16a34a;
  --red: #dc2626;
  --amber: #b45309;
  --badge-ok-bg: rgba(22,163,74,0.1);
  --badge-err-bg: rgba(220,38,38,0.1);
  --badge-warn-bg: rgba(180,83,9,0.1);
}

.dark {
  --bg: #0f0f13;
  --surface: #1a1a24;
  --border: #2a2a3a;
  --text: #e0e0e8;
  --muted: #6a6a7a;
  --accent: #5eead4;
  --accent-glow: rgba(94, 234, 212, 0.15);
  --green: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
  --badge-ok-bg: rgba(52,211,153,0.15);
  --badge-err-bg: rgba(248,113,113,0.15);
  --badge-warn-bg: rgba(251,191,36,0.15);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
}

h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 32px;
}

.dropzone {
  display: block;
  width: 100%;
  max-width: 800px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--surface);
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

/* The file input carries the focus; the label shows the ring. */
.dropzone:has(input:focus-visible) {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dropzone-icon {
  display: block;
  width: 40px;
  height: 40px;
  margin: 0 auto 14px;
  color: var(--muted);
  transition: color 0.2s;
}

.dropzone:hover .dropzone-icon,
.dropzone.dragover .dropzone-icon { color: var(--accent); }
.dropzone-text { display: block; font-size: 15px; color: var(--text); }
.dropzone-hint { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; }

/* Hidden from sight, still reachable by keyboard — display:none would not be. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.filename {
  margin-top: 12px;
  font-size: 13px;
  color: var(--accent);
  text-align: center;
  max-width: 800px;
  word-break: break-all;
}

.results {
  width: 100%;
  max-width: 800px;
  margin-top: 24px;
  display: none;
}

.results.visible { display: block; }

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 36px;
  overflow-x: auto;
  transition: box-shadow 0.3s, border-color 0.3s;
}

.result-card.glow-ok {
  border-color: var(--green);
  box-shadow: 0 0 12px rgba(22,163,74,0.25);
}

.result-card.glow-err {
  border-color: var(--red);
  box-shadow: 0 0 12px rgba(220,38,38,0.25);
}

.result-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
  line-height: 1.5;
}

.result-item + .result-item { border-top: 1px solid var(--border); }
.result-item > div { flex: 1; }

.result-label {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-weight: 500;
  justify-content: space-between;
}

.result-detail {
  font-size: 12px;
  color: var(--muted);
  margin-top: 0;
}

.badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.badge.ok { background: var(--badge-ok-bg); color: var(--green); }
.badge.err { background: var(--badge-err-bg); color: var(--red); }
.badge.warn { background: var(--badge-warn-bg); color: var(--amber); }

.summary-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.summary-status {
  display: flex;
  align-items: center;
  gap: 14px;
}

.summary-icon {
  flex-shrink: 0;
  line-height: 0;
}

.summary-icon .icon { width: 40px; height: 40px; stroke-width: 1.75; }
.summary-icon.ok { color: var(--green); }
.summary-icon.err { color: var(--red); }
.summary-icon.busy { color: var(--muted); }

.summary-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.summary-sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

.summary-details { margin-top: 24px; }

.progress {
  width: 100%;
  max-width: 320px;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  animation: progress 1.5s ease-out forwards;
}

@keyframes progress { to { width: 100%; } }

.summary-icon.busy .icon { animation: spin 1.6s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .progress-fill { animation-duration: 0.01s; }
  .summary-icon.busy .icon { animation: none; }
}

.fix-block {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.fix-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}

.fix-list {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.fix-list li { margin-bottom: 6px; }
.fix-list li::marker { color: var(--accent); font-weight: 600; }

.fix-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
  color: var(--accent);
}

.fix-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  z-index: 10;
}

.theme-btn:hover { background: var(--accent-glow); color: var(--accent); }

.icon {
  width: 18px;
  height: 18px;
  display: block;
}

.theme-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
