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

:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #efede8;
  --border: #dedad3;
  --border-strong: #b8b4ac;
  --text: #1c1b18;
  --text-muted: #6b6860;
  --text-subtle: #9b9890;
  --accent: #1c1b18;
  --green: #2d6a4f;
  --green-bg: #eaf4ee;
  --amber: #92540a;
  --amber-bg: #fef3e2;
  --red-bg: #fdecea;
  --red: #a32d2d;
  --radius: 10px;
  --radius-sm: 6px;
}

html { font-size: 16px; }

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 2rem 0;
}

.header-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 2rem;
}

.wordmark {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-family: 'Georgia', serif;
}

.tagline {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-family: system-ui, sans-serif;
}

/* Main layout */
main {
  flex: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  width: 100%;
}

/* Step sections */
.step-section {
  margin-bottom: 2.5rem;
}

.step-label {
  font-family: system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 1rem;
}

/* Upload grid */
.upload-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-zone {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.upload-zone:hover {
  background: var(--surface-2);
  border-color: var(--text-muted);
}

.upload-zone.optional {
  border-color: var(--border);
}

.upload-zone.has-file {
  border-style: solid;
  border-color: var(--green);
  background: var(--green-bg);
}

.upload-zone input[type="file"] {
  display: none;
}

.zone-icon {
  font-size: 1.3rem;
  color: var(--text-subtle);
  margin-top: 1px;
  flex-shrink: 0;
  line-height: 1;
}

.upload-zone.has-file .zone-icon {
  color: var(--green);
}

.zone-body {
  flex: 1;
}

.zone-title {
  font-family: system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.zone-sub {
  font-family: system-ui, sans-serif;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.zone-filename {
  font-family: system-ui, sans-serif;
  font-size: 0.78rem;
  color: var(--green);
  margin-top: 4px;
  font-weight: 500;
}

code {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--text-muted);
}

/* Badges */
.badge {
  font-family: system-ui, sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.badge-req {
  background: var(--red-bg);
  color: var(--red);
}

.badge-opt {
  background: var(--surface-2);
  color: var(--text-subtle);
}

.badge-ok {
  background: var(--green-bg);
  color: var(--green);
}

/* Run button */
#run-btn {
  font-family: system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.75rem 1.75rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity 0.15s;
}

#run-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

#run-btn:not(:disabled):hover {
  opacity: 0.8;
}

/* Results */
.results {
  display: none;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 1.5rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.stat-n {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: 'Georgia', serif;
  color: var(--text);
  line-height: 1;
}

.stat-n.warn { color: var(--amber); }
.stat-n.ok   { color: var(--green); }

.stat-lbl {
  font-family: system-ui, sans-serif;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 5px;
}

/* Download button */
.download-btn {
  display: block;
  text-align: center;
  font-family: system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.75rem;
  border: 1.5px solid var(--green);
  border-radius: var(--radius-sm);
  color: var(--green);
  text-decoration: none;
  background: var(--green-bg);
  transition: background 0.12s;
  margin-bottom: 1.5rem;
}

.download-btn:hover {
  background: #d6ece0;
}

/* Log */
.log-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.log-title {
  font-family: system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 0.75rem;
}

.log {
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.7;
  max-height: 200px;
  overflow-y: auto;
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 2rem;
  text-align: center;
  font-family: system-ui, sans-serif;
  font-size: 0.78rem;
  color: var(--text-subtle);
}

/* Responsive */
@media (max-width: 540px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wordmark { font-size: 1.4rem; }
}
