:root {
  --black: #0D0D0D;
  --white: #FFFFFF;
  --grey-100: #F5F5F5;
  --grey-200: #E8E8E8;
  --grey-400: #A0A0A0;
  --grey-600: #606060;
  --grey-800: #2A2A2A;
  --pass: #1a1a1a;
  --pass-bg: #f0f0f0;
  --warn: #3d3000;
  --warn-bg: #fff8dc;
  --fail: #2d0000;
  --fail-bg: #ffe0e0;
  --font-main: 'Poppins', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--black);
  color: var(--white);
  font-family: var(--font-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Noise texture overlay */
.noise {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.035;
  pointer-events: none;
  z-index: 0;
}

/* Header */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  background: rgba(13,13,13,0.85);
}

.logo {
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--white);
}

.header-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--grey-400);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Hero */
main { position: relative; z-index: 1; }

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8rem 2.5rem 4rem;
  max-width: 800px;
}

.hero-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--grey-400);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.hero-label::before {
  content: '';
  display: block;
  width: 20px;
  height: 1px;
  background: var(--grey-400);
}

.hero-title {
  font-size: clamp(4rem, 12vw, 8rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.04em;
  margin-bottom: 1.5rem;
}
.hero-accent {
  color: transparent;
  -webkit-text-stroke: 1px rgba(255,255,255,0.3);
}

.hero-sub {
  font-size: 1rem;
  color: var(--grey-400);
  line-height: 1.6;
  max-width: 420px;
  margin-bottom: 2.5rem;
}

/* Form */
.audit-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 560px;
}

.input-wrap {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.input-wrap:focus-within {
  border-color: rgba(255,255,255,0.4);
}
.input-prefix {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--grey-400);
  padding: 0.9rem 0.75rem 0.9rem 1rem;
  border-right: 1px solid rgba(255,255,255,0.08);
  white-space: nowrap;
  user-select: none;
}
.input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  padding: 0.9rem 1rem;
}
.input-wrap input::placeholder { color: var(--grey-600); }

.form-row {
  display: flex;
  gap: 0.75rem;
}
.key-wrap {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
}
.key-wrap input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--grey-400);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.75rem 1rem;
}
.key-wrap input::placeholder { color: var(--grey-600); }

button {
  background: var(--white);
  color: var(--black);
  border: none;
  border-radius: 4px;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  transition: background 0.2s, transform 0.1s;
}
button:hover { background: var(--grey-200); }
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-arrow { font-size: 1rem; transition: transform 0.2s; }
button:hover .btn-arrow { transform: translateX(3px); }

/* Result section */
.result-section {
  background: var(--white);
  color: var(--black);
  min-height: 100vh;
  padding: 4rem 2.5rem;
}

.hidden { display: none !important; }

/* Loading */
.loading {
  text-align: center;
  padding: 4rem 0;
}
.loading-bar {
  width: 240px;
  height: 2px;
  background: var(--grey-200);
  border-radius: 2px;
  margin: 0 auto 1.5rem;
  overflow: hidden;
}
.loading-fill {
  height: 100%;
  background: var(--black);
  width: 30%;
  border-radius: 2px;
  animation: loadSlide 1.4s ease-in-out infinite;
}
@keyframes loadSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(500%); }
}
.loading-text {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--grey-400);
}

/* Error */
.error-state {
  background: #fff5f5;
  border: 1px solid #fcc;
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #c00;
  max-width: 600px;
  margin: 2rem auto;
}

/* Score */
.score-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}
.score-url {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--grey-400);
  margin-bottom: 0.5rem;
  word-break: break-all;
}
.score-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.score-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--grey-400);
  margin-top: 0.4rem;
}

.score-circle {
  flex-shrink: 0;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--black);
}
.score-circle.great { background: var(--black); color: var(--white); }
.score-circle.ok { background: var(--grey-200); color: var(--black); }
.score-circle.poor { background: #fff0f0; border-color: #c00; color: #c00; }
.score-num {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
}
.score-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.6;
}

/* Summary pills */
.summary-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
}
.pill-pass { background: #e8f5e9; color: #1b5e20; }
.pill-warn { background: #fff8e1; color: #6d4c00; }
.pill-fail { background: #fce4ec; color: #880e2c; }
.pill-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.pill-pass .pill-dot { background: #2e7d32; }
.pill-warn .pill-dot { background: #f57f17; }
.pill-fail .pill-dot { background: #c62828; }

/* Sections */
.section-block {
  margin-bottom: 2.5rem;
  border: 1px solid var(--grey-200);
  border-radius: 6px;
  overflow: hidden;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--grey-100);
  cursor: pointer;
  user-select: none;
}
.section-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.section-name {
  font-weight: 600;
  font-size: 0.9rem;
}
.section-toggle {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--grey-400);
  transition: transform 0.2s;
}
.section-block.open .section-toggle { transform: rotate(180deg); }
.section-body {
  display: none;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--grey-200);
}
.section-block.open .section-body { display: block; }

/* Checks */
.check-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 0.5rem 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--grey-100);
  align-items: start;
}
.check-item:last-child { border-bottom: none; }
.check-icon { font-size: 0.8rem; line-height: 1.4; }
.check-label { font-weight: 600; font-size: 0.82rem; }
.check-message { font-size: 0.8rem; color: var(--grey-600); line-height: 1.4; grid-column: 2; margin-top: -0.15rem; }
.check-value {
  grid-column: 2;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--grey-600);
  background: var(--grey-100);
  border-radius: 3px;
  padding: 0.35rem 0.6rem;
  margin-top: 0.25rem;
  word-break: break-all;
  white-space: pre-wrap;
}

/* PageSpeed */
.ps-scores {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 0.5rem;
}
.ps-score-item {
  text-align: center;
  padding: 1rem;
  border: 1px solid var(--grey-200);
  border-radius: 6px;
}
.ps-score-num {
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
}
.ps-score-num.great { color: #1b5e20; }
.ps-score-num.ok { color: #e65100; }
.ps-score-num.poor { color: #c62828; }
.ps-score-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--grey-400);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.3rem;
}
.ps-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
}
.ps-metric {
  background: var(--grey-100);
  border-radius: 4px;
  padding: 0.6rem 0.75rem;
}
.ps-metric-val { font-weight: 700; font-size: 0.95rem; }
.ps-metric-key { font-family: var(--font-mono); font-size: 0.65rem; color: var(--grey-400); margin-top: 0.1rem; }

@media (max-width: 600px) {
  .header { padding: 1rem 1.25rem; }
  .hero { padding: 7rem 1.25rem 3rem; }
  .result-section { padding: 2.5rem 1.25rem; }
  .ps-scores { grid-template-columns: repeat(2, 1fr); }
  .ps-metrics { grid-template-columns: repeat(2, 1fr); }
  .score-header { flex-direction: column-reverse; }
}
