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

:root {
  --bg: #f8f6ff;
  --surface: #ffffff;
  --surface2: #f0ecf9;
  --border: #e0d9f0;
  --text: #1a1a2e;
  --text2: #6b6580;
  --accent: #6c5ce7;
  --accent2: #a78bfa;
  --green: #10b981;
  --red: #ef4444;
  --orange: #f59e0b;
  --yellow: #eab308;
  --radius: 12px;
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  z-index: 0;
}

#tech-bg {
  position: fixed;
  top: 50%; left: 50%;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  transform: translate(-50%, -50%);
  z-index: -1;
  opacity: 0.25;
  pointer-events: none;
}

.container { max-width: 720px; margin: 0 auto; padding: 0 1.5rem; }

/* Hero */
.hero {
  padding: 4rem 0 3rem;
  text-align: center;
  background: linear-gradient(180deg, #ede6ff 0%, var(--bg) 100%);
}

.hero-badge {
  display: inline-block;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(108,92,231,0.15);
  color: var(--accent2);
  border: 1px solid rgba(108,92,231,0.25);
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  color: var(--text2);
  font-size: 1.05rem;
  max-width: 520px;
  margin: 0 auto 2rem;
}

.hero-note {
  color: var(--text2);
  font-size: 0.8rem;
  margin-top: 0.75rem;
}

/* Form */
#audit-form { max-width: 560px; margin: 0 auto; }

.input-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.input-wrap { flex: 1; }

.input-wrap label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 0.35rem;
  text-align: left;
}

.input-wrap input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-wrap input:focus { border-color: var(--accent); }
.input-wrap input::placeholder { color: #aaa; }

#submit-btn {
  width: 100%;
  padding: 0.85rem;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

#submit-btn:hover { opacity: 0.9; }
#submit-btn:active { transform: scale(0.98); }
#submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Results */
#results-section { padding: 2rem 0 4rem; }

.result-header {
  text-align: center;
  margin-bottom: 2rem;
}

.result-header h2 { font-size: 1.5rem; font-weight: 600; }

.result-url {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.25rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text2);
  word-break: break-all;
}

/* Score section */
.score-section {
  display: flex;
  gap: 2rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.score-ring-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}

.score-ring { width: 100%; height: 100%; transform: rotate(-90deg); }

.ring-bg {
  fill: none;
  stroke: var(--surface2);
  stroke-width: 8;
}

.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 1s ease, stroke 0.5s;
}

.score-value {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-value span:first-child {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
}

.score-value .score-label { font-size: 0.75rem; color: var(--text2); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  text-align: center;
  min-width: 100px;
}

.stat-icon { display: block; font-size: 1rem; margin-bottom: 0.25rem; }
.stat-card.pass .stat-icon { color: var(--green); }
.stat-card.fail .stat-icon { color: var(--red); }
.stat-card.major .stat-icon { color: var(--red); }
.stat-card.moderate .stat-icon { color: var(--orange); }
.stat-card.minor .stat-icon { color: var(--yellow); }

.stat-num { display: block; font-size: 1.5rem; font-weight: 700; }
.stat-desc { display: block; font-size: 0.7rem; color: var(--text2); margin-top: 0.15rem; }

/* Checks */
.checks-section, .issues-section { margin-bottom: 2rem; }

.checks-section h3, .issues-section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.checks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
}

.check-item .check-icon { font-size: 0.9rem; flex-shrink: 0; }
.check-item .check-icon.pass { color: var(--green); }
.check-item .check-icon.fail { color: var(--red); }
.check-item .check-icon.warn { color: var(--orange); }

.check-item .check-label { color: var(--text2); }
.check-item .check-value {
  margin-left: auto;
  font-weight: 500;
  font-size: 0.8rem;
}

/* Issues */
.issue-category { margin-bottom: 1rem; }

.issue-category h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.issue-category h4 .badge {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}

.issue-category h4 .badge.major-badge { background: rgba(239,68,68,0.15); color: var(--red); }
.issue-category h4 .badge.moderate-badge { background: rgba(245,158,11,0.15); color: var(--orange); }
.issue-category h4 .badge.minor-badge { background: rgba(234,179,8,0.15); color: var(--yellow); }

.issue-items { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.issue-tag {
  padding: 0.25rem 0.6rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--text2);
}

.issue-item {
  width: 100%;
  margin-bottom: 0.35rem;
}

.issue-details {
  margin: 0.35rem 0 0 0.5rem;
  padding: 0.6rem 0.75rem;
  background: rgba(108,92,231,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.5;
}

.issue-details p { margin-bottom: 0.35rem; }
.issue-details p:last-child { margin-bottom: 0; }
.issue-why { color: var(--text2); }
.issue-fix { color: var(--text); }

.issue-toggle {
  margin: 0.25rem 0 0 0.5rem;
  padding: 0.2rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.7rem;
  color: var(--accent2);
  cursor: pointer;
}

.issue-toggle:hover { background: var(--surface2); }

.issue-items {
  display: flex;
  flex-direction: column;
}

.results-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.btn-download {
  padding: 0.75rem 2rem;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent2);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-download:hover {
  background: rgba(108,92,231,0.1);
  border-color: var(--accent2);
}

.cta-link {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s;
}

.cta-link:hover { opacity: 0.9; }

/* Error */
#error-box {
  text-align: center;
  padding: 3rem 1rem;
}

.error-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
#error-box h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
#error-box p { color: var(--text2); margin-bottom: 1rem; }

.btn-secondary {
  padding: 0.6rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-secondary:hover { background: var(--surface2); }

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--text2);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

.footer-link {
  color: var(--accent2);
  text-decoration: none;
  transition: color 0.2s;
}

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

/* Responsive */
@media (max-width: 640px) {
  .hero h1 { font-size: 1.75rem; }
  .input-row { flex-direction: column; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .score-section { flex-direction: column; }
  .checks-grid { grid-template-columns: 1fr; }
}
