* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; background: #fafafa; color: #141414; }
.container { max-width: 900px; margin: 0 auto; padding: 40px 20px; min-height: 100vh; display: flex; flex-direction: column; }

header { text-align: center; margin-bottom: 40px; }
header svg { margin-bottom: 16px; }
header h1 { font-size: 2.5rem; font-weight: 800; margin: 0 0 10px; letter-spacing: -0.02em; }
header p { color: #666; font-size: 1.1rem; }

.audit-form { display: flex; gap: 12px; max-width: 600px; margin: 0 auto 40px; }
.audit-form input {
  flex: 1; padding: 14px 20px; border: 2px solid #e5e7eb; border-radius: 12px;
  font-size: 16px; outline: none; transition: border-color 0.2s; background: white;
}
.audit-form input:focus { border-color: #141414; }
.audit-form button {
  padding: 14px 28px; background: #141414; color: white; border: none; border-radius: 12px;
  font-size: 16px; font-weight: 600; cursor: pointer; transition: background 0.2s; white-space: nowrap;
}
.audit-form button:hover { background: #333; }
.audit-form button:disabled { background: #999; cursor: not-allowed; }

#loading { text-align: center; padding: 40px 0; }
.loading-text { color: #666; font-size: 15px; }
.spinner {
  width: 48px; height: 48px; border: 4px solid #e5e7eb; border-top-color: #141414;
  border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-steps {
  display: flex; flex-direction: column; gap: 8px; max-width: 320px;
  margin: 24px auto 0; text-align: left;
}
.step {
  padding: 10px 16px; background: #f3f4f6; border-radius: 8px; color: #aaa;
  font-size: 14px; transition: all 0.3s ease;
}
.step.active { background: #141414; color: white; }

.error-box {
  max-width: 500px; margin: 0 auto; padding: 24px; background: #fef2f2;
  border: 1px solid #fecaca; border-radius: 12px; text-align: center;
}
.error-box strong { color: #dc2626; font-size: 18px; }
.error-box p { color: #991b1b; margin: 8px 0 16px; }
.error-box button {
  padding: 10px 24px; background: #141414; color: white; border: none;
  border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600;
}

.results-header { display: flex; align-items: center; gap: 24px; margin-bottom: 24px; }
.score-circle {
  width: 100px; height: 100px; border-radius: 50%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: white; flex-shrink: 0;
}
.score-good { background: #16a34a; }
.score-ok { background: #d97706; }
.score-bad { background: #dc2626; }
.score-circle span:first-child { font-size: 32px; font-weight: 800; line-height: 1; }
.score-label { font-size: 10px; text-transform: uppercase; opacity: 0.9; letter-spacing: 0.5px; }

.results-meta h2 { font-size: 1.5rem; font-weight: 700; }
.results-meta p { color: #666; font-size: 15px; }

.download-buttons { display: flex; gap: 12px; margin-bottom: 24px; }
.btn {
  padding: 12px 24px; border-radius: 10px; text-decoration: none; font-weight: 600;
  font-size: 14px; transition: all 0.2s; display: inline-block; cursor: pointer; border: none;
}
.btn-primary { background: #141414; color: white; }
.btn-primary:hover { background: #333; }
.btn-secondary { background: white; color: #141414; border: 2px solid #e5e7eb; }
.btn-secondary:hover { background: #f3f4f6; border-color: #141414; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: white; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 20px; text-align: center;
}
.stat-value { font-size: 28px; font-weight: 800; }
.stat-label { font-size: 11px; text-transform: uppercase; color: #888; margin-top: 4px; letter-spacing: 0.5px; }

.result-section { margin-bottom: 24px; }
.result-section h3 {
  font-size: 1.1rem; margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 2px solid #e5e7eb;
}
.result-section h4 {
  font-size: 0.95rem; margin: 16px 0 8px; color: #444;
}
.result-item {
  padding: 10px 16px; margin-bottom: 4px; border-radius: 8px;
  font-size: 14px; border-left: 4px solid; line-height: 1.5;
}
.result-item.issue { background: #fef2f2; border-color: #dc2626; color: #991b1b; }
.result-item.warning { background: #fffbeb; border-color: #d97706; color: #92400e; }
.result-item.pass { background: #f0fdf4; border-color: #16a34a; color: #166534; }

.overview-table table {
  width: 100%; border-collapse: collapse; background: white;
  border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden;
}
.overview-table td {
  padding: 10px 16px; border-bottom: 1px solid #f3f4f6; font-size: 14px;
}
.overview-table td:first-child { width: 180px; color: #666; }

.keyword-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.keyword-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: white; border: 1px solid #e5e7eb; border-radius: 20px;
  padding: 6px 14px; font-size: 13px;
}
.kw-pos { font-weight: 700; font-size: 12px; }
.kw-text { font-weight: 500; }
.kw-vol { font-size: 11px; color: #888; }

.data-table {
  width: 100%; border-collapse: collapse; background: white;
  border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden;
  margin-bottom: 16px;
}
.data-table th {
  background: #141414; color: white; padding: 10px 16px; text-align: left;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
}
.data-table td {
  padding: 8px 16px; border-bottom: 1px solid #f3f4f6; font-size: 14px;
}
.data-table tr:nth-child(even) td { background: #fafafa; }

.run-another { text-align: center; margin-top: 32px; }

footer {
  text-align: center; margin-top: auto; padding-top: 40px;
  color: #999; font-size: 13px;
}
footer strong { color: #666; }

@media (max-width: 640px) {
  header h1 { font-size: 1.8rem; }
  .audit-form { flex-direction: column; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .results-header { flex-direction: column; text-align: center; }
  .download-buttons { flex-direction: column; }
  .download-buttons .btn { text-align: center; }
}
