*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --navy: #0B1D3A; --navy-light: #122B52;
  --blue: #2E6BD6; --blue-light: #EBF2FF;
  --cyan: #22B8CF; --cyan-light: #E6FAFB;
  --amber: #F59E0B; --amber-light: #FFF8E6;
  --red: #EF4444; --red-light: #FEF2F2;
  --green: #10B981; --green-light: #ECFDF5;
  --white: #FFFFFF; --gray-50: #F8FAFC; --gray-100: #F1F5F9;
  --gray-200: #E2E8F0; --gray-300: #CBD5E1; --gray-400: #94A3B8;
  --gray-500: #64748B; --gray-600: #475569; --gray-700: #334155;
  --gray-800: #1E293B; --gray-900: #0F172A;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.06);
  --radius: 12px; --radius-lg: 20px; --radius-full: 9999px;
}
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; color: var(--gray-700); background: var(--gray-50); line-height: 1.6; overflow-x: hidden; min-height: 100vh; }
h1, h2, h3, h4 { font-family: 'Plus Jakarta Sans', sans-serif; color: var(--gray-900); line-height: 1.2; }
a { color: var(--blue); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--navy); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* Nav */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; background: rgba(255,255,255,0.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--gray-100); transition: box-shadow 0.3s; }
.nav.scrolled { box-shadow: var(--shadow-md); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.nav-logo { display: flex; align-items: center; gap: 10px; font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; font-size: 1.2rem; color: var(--gray-900); text-decoration: none; }
.nav-logo:hover { color: var(--gray-900); }
.nav-logo-icon { width: 32px; height: 32px; border-radius: 6px; }
.nav-links { display: flex; align-items: center; gap: 32px; list-style: none; }
.nav-links a { font-size: 0.95rem; font-weight: 500; color: var(--gray-600); transition: color 0.2s; }
.nav-links a:hover { color: var(--blue); }
.nav-links a.active { color: var(--blue); font-weight: 600; }
.nav-cta { background: var(--blue); color: white !important; padding: 8px 20px; border-radius: var(--radius-full); font-weight: 600; font-size: 0.9rem; transition: background 0.2s, transform 0.2s; cursor: pointer; }
.nav-cta:hover { background: var(--navy); color: white !important; transform: translateY(-1px); }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--gray-700); margin: 6px 0; transition: transform 0.3s, opacity 0.3s; border-radius: 2px; }
.nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 6px); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -6px); }
.nav-download { position: relative; }
.nav-download-menu { display: none; position: absolute; top: calc(100% + 8px); right: 0; background: white; border-radius: 12px; box-shadow: var(--shadow-xl); border: 1px solid var(--gray-100); padding: 8px; min-width: 220px; z-index: 1001; }
.nav-download-menu.open { display: block; }
.nav-download-menu a { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 8px; color: var(--gray-700) !important; font-weight: 500; font-size: 0.95rem; transition: background 0.15s; }
.nav-download-menu a:hover { background: var(--blue-light); color: var(--blue) !important; }
.nav-download-menu svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-download-menu .store-label { display: flex; flex-direction: column; line-height: 1.3; }
.nav-download-menu .store-label small { font-size: 0.7rem; color: var(--gray-400); font-weight: 400; }

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; background: rgba(255,255,255,0.98); backdrop-filter: blur(12px); padding: 16px 24px 24px; gap: 4px; border-bottom: 1px solid var(--gray-100); box-shadow: var(--shadow-lg); }
  .nav-links.open { display: flex; }
  .nav-links li { width: 100%; }
  .nav-links a { display: block; padding: 12px 0; font-size: 1.05rem; }
  .nav-cta { display: inline-block; margin-top: 8px; text-align: center; }
}

/* Page */
.page-wrapper { margin-top: 64px; min-height: calc(100vh - 64px); display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.page-card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); max-width: 720px; width: 100%; overflow: hidden; }
.screen { display: none; }
.screen.active { display: block; }

/* Intro */
.intro { text-align: center; padding: 48px 40px; }
.intro-icon { width: 80px; height: 80px; background: var(--blue-light); border-radius: 20px; display: flex; align-items: center; justify-content: center; margin: 0 auto 24px; }
.intro-icon svg { color: var(--blue); }
.intro h1 { font-size: clamp(1.4rem, 4vw, 1.9rem); font-weight: 800; margin-bottom: 12px; }
.intro p.subtitle { color: var(--gray-500); font-size: 1.05rem; line-height: 1.7; margin-bottom: 32px; max-width: 500px; margin-left: auto; margin-right: auto; }
.zip-input-group { max-width: 360px; margin: 0 auto 16px; }
.zip-input { width: 100%; padding: 16px 20px; border: 2px solid var(--gray-200); border-radius: var(--radius); font-family: 'Inter', sans-serif; font-size: 1.1rem; font-weight: 600; text-align: center; letter-spacing: 4px; color: var(--gray-900); outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.zip-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(46, 107, 214, 0.1); }
.zip-input::placeholder { letter-spacing: 2px; color: var(--gray-300); font-weight: 400; }
.btn-check { display: block; width: 100%; max-width: 360px; margin: 0 auto 24px; padding: 16px 40px; background: var(--navy); color: white; font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; font-size: 1.1rem; border: none; border-radius: var(--radius-full); cursor: pointer; transition: background 0.2s, transform 0.2s, box-shadow 0.2s; }
.btn-check:hover { background: var(--blue); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.privacy-note { font-size: 0.8rem; color: var(--gray-400); margin-bottom: 24px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.trust-badges { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }
.trust-badge { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.3px; }
.trust-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }

/* Loading */
.loading { text-align: center; padding: 80px 40px; }
.spinner { width: 48px; height: 48px; border: 4px solid var(--gray-100); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 20px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading p { color: var(--gray-500); font-size: 1rem; font-weight: 500; }

/* Results */
.results { padding: 40px; }
.results-header { text-align: center; margin-bottom: 28px; }
.results-header h2 { font-size: clamp(1.3rem, 3.5vw, 1.75rem); font-weight: 800; margin-bottom: 6px; }
.results-subtitle { font-size: 0.9rem; color: var(--gray-500); margin-bottom: 12px; }
.rating-badge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 20px; border-radius: var(--radius-full); font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.5px; }
.rating-SEVERE, .rating-EXTREME { background: var(--red-light); color: var(--red); }
.rating-HIGH { background: var(--amber-light); color: #D97706; }
.rating-MODERATE { background: #FFF8E6; color: #B45309; }
.rating-LOW { background: var(--green-light); color: var(--green); }

/* Share */
.share-bar { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 28px; }
.btn-share { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius-full); font-size: 0.8rem; font-weight: 600; color: var(--gray-600); cursor: pointer; font-family: 'Inter', sans-serif; transition: all 0.2s; }
.btn-share:hover { background: var(--blue-light); color: var(--blue); border-color: var(--blue); }
.btn-share svg { width: 14px; height: 14px; }
.btn-share.copied { background: var(--green-light); color: var(--green); border-color: var(--green); }

/* Legend */
.legend { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; padding: 12px 16px; background: var(--gray-50); border-radius: var(--radius); border: 1px solid var(--gray-100); }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.3px; }
.legend-bar { width: 24px; height: 6px; border-radius: 3px; }
.legend-bar.bar-data { background: var(--blue); }
.legend-bar.bar-derived { background: var(--amber); background-image: repeating-linear-gradient(90deg, transparent, transparent 4px, rgba(255,255,255,0.4) 4px, rgba(255,255,255,0.4) 8px); }
.legend-bar.bar-estimated { background: var(--gray-400); background-image: repeating-linear-gradient(90deg, transparent, transparent 3px, rgba(255,255,255,0.5) 3px, rgba(255,255,255,0.5) 6px); }

/* Sections */
.risk-section { margin-bottom: 24px; }
.section-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 14px 18px; background: var(--gray-50); border: 1px solid var(--gray-100); border-radius: var(--radius); cursor: pointer; font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; font-size: 0.95rem; color: var(--gray-900); transition: background 0.2s; }
.section-toggle:hover { background: var(--gray-100); }
.section-toggle svg { width: 20px; height: 20px; color: var(--gray-400); transition: transform 0.3s; }
.section-toggle.open { border-radius: var(--radius) var(--radius) 0 0; }
.section-toggle.open svg { transform: rotate(180deg); }
.section-toggle .section-count { font-size: 0.75rem; font-weight: 500; color: var(--gray-400); margin-left: 8px; }
.section-content { display: none; padding: 16px 18px; background: var(--white); border: 1px solid var(--gray-100); border-top: none; border-radius: 0 0 var(--radius) var(--radius); }
.section-content.open { display: block; }

/* Risk bars */
.risk-item { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.risk-item:last-child { margin-bottom: 0; }
.risk-icon { width: 32px; height: 32px; min-width: 32px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; background: var(--gray-50); border-radius: 8px; }
.risk-info { flex: 1; min-width: 0; }
.risk-name { font-weight: 600; font-size: 0.85rem; color: var(--gray-800); margin-bottom: 2px; display: flex; align-items: center; gap: 6px; }
.confidence-tag { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 1px 6px; border-radius: 4px; }
.confidence-data { background: var(--green-light); color: var(--green); }
.confidence-derived { background: var(--amber-light); color: #B45309; }
.confidence-estimated { background: var(--red-light); color: var(--red); }
.risk-bar-bg { height: 8px; background: var(--gray-100); border-radius: 4px; overflow: hidden; }
.risk-bar-fill { height: 100%; border-radius: 4px; transition: width 0.8s ease-out; }
.risk-bar-fill.bar-data { background: var(--blue); }
.risk-bar-fill.bar-derived { background: var(--amber); background-image: repeating-linear-gradient(90deg, transparent, transparent 4px, rgba(255,255,255,0.4) 4px, rgba(255,255,255,0.4) 8px); }
.risk-bar-fill.bar-estimated { background: var(--gray-400); background-image: repeating-linear-gradient(90deg, transparent, transparent 3px, rgba(255,255,255,0.5) 3px, rgba(255,255,255,0.5) 6px); }
.risk-score { min-width: 48px; text-align: right; font-size: 0.8rem; font-weight: 700; color: var(--gray-500); }

/* Community */
.community-section { margin-bottom: 24px; }
.community-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.community-card { background: var(--gray-50); border-radius: var(--radius); padding: 16px; text-align: center; border: 1px solid var(--gray-100); }
.community-value { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.3rem; font-weight: 800; color: var(--gray-900); line-height: 1.1; margin-bottom: 4px; }
.community-label { font-size: 0.75rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.3px; }
.community-sublabel { font-size: 0.7rem; color: var(--gray-400); margin-top: 2px; }
.community-bar { height: 4px; background: var(--gray-200); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.community-bar-fill { height: 100%; border-radius: 2px; }

/* Customize */
.customize-section { margin-bottom: 24px; }
.customize-content { padding: 20px 18px !important; }
.slider-item { margin-bottom: 18px; }
.slider-item:last-child { margin-bottom: 0; }
.slider-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.slider-label { font-size: 0.85rem; font-weight: 600; color: var(--gray-700); }
.slider-value { font-size: 0.8rem; font-weight: 700; color: var(--blue); min-width: 40px; text-align: right; }
.slider-input { width: 100%; height: 6px; -webkit-appearance: none; appearance: none; background: var(--gray-200); border-radius: 3px; outline: none; }
.slider-input::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--blue); cursor: pointer; border: 3px solid white; box-shadow: var(--shadow-sm); }
.slider-input::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--blue); cursor: pointer; border: 3px solid white; box-shadow: var(--shadow-sm); }
.btn-reset-weights { display: block; width: 100%; padding: 10px; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius); cursor: pointer; font-family: 'Inter', sans-serif; font-size: 0.85rem; font-weight: 600; color: var(--gray-500); margin-top: 16px; transition: all 0.2s; }
.btn-reset-weights:hover { background: var(--gray-100); color: var(--gray-700); }

/* CTA */
.result-cta { background: var(--gray-900); border-radius: var(--radius); padding: 28px 24px; text-align: center; margin-bottom: 20px; }
.result-cta h3 { color: white; font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.result-cta p { color: rgba(255,255,255,0.6); font-size: 0.9rem; margin-bottom: 20px; line-height: 1.6; }
.cta-buttons { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.btn-download { display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; background: var(--cyan); color: var(--gray-900); font-weight: 700; font-size: 0.95rem; border-radius: var(--radius-full); text-decoration: none; transition: all 0.2s; }
.btn-download:hover { background: white; color: var(--gray-900); transform: translateY(-2px); }
.btn-download svg { width: 18px; height: 18px; }
.btn-download-secondary { display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; background: transparent; color: rgba(255,255,255,0.8); font-weight: 600; font-size: 0.95rem; border-radius: var(--radius-full); border: 1px solid rgba(255,255,255,0.3); text-decoration: none; transition: all 0.2s; }
.btn-download-secondary:hover { background: rgba(255,255,255,0.1); color: white; border-color: rgba(255,255,255,0.6); transform: translateY(-2px); }
.btn-download-secondary svg { width: 18px; height: 18px; }

/* Disclaimer */
.disclaimer { margin-bottom: 24px; padding: 16px 18px; background: var(--gray-50); border-radius: var(--radius); border: 1px solid var(--gray-100); }
.disclaimer h4 { font-size: 0.8rem; font-weight: 700; color: var(--gray-600); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.3px; }
.disclaimer p { font-size: 0.78rem; color: var(--gray-400); line-height: 1.6; margin-bottom: 8px; }
.disclaimer p:last-child { margin-bottom: 0; }
.disclaimer a { color: var(--gray-500); text-decoration: underline; }

.btn-try-another { display: inline-block; font-size: 0.9rem; font-weight: 500; color: var(--gray-400); cursor: pointer; background: none; border: none; font-family: 'Inter', sans-serif; transition: color 0.2s; }
.btn-try-another:hover { color: var(--gray-700); }

/* Error */
.error-screen { text-align: center; padding: 60px 40px; }
.error-icon { width: 64px; height: 64px; background: var(--red-light); border-radius: 16px; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; }
.error-icon svg { color: var(--red); }
.error-screen p { color: var(--gray-500); font-size: 1.05rem; margin-bottom: 24px; line-height: 1.6; }
.btn-retry { display: inline-block; padding: 14px 36px; background: var(--blue); color: white; font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; font-size: 1rem; border: none; border-radius: var(--radius-full); cursor: pointer; transition: background 0.2s, transform 0.2s; }
.btn-retry:hover { background: var(--navy); transform: translateY(-2px); }

/* Footer */
.footer { padding: 48px 0 32px; background: var(--gray-900); color: rgba(255,255,255,0.5); }
.footer-inner { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 32px; }
.footer-brand { display: flex; align-items: center; gap: 10px; font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; font-size: 1.1rem; color: white; margin-bottom: 8px; }
.footer-brand .nav-logo-icon { width: 28px; height: 28px; }
.footer-links { display: flex; gap: 24px; list-style: none; flex-wrap: wrap; }
.footer-links a { color: rgba(255,255,255,0.5); font-size: 0.9rem; transition: color 0.2s; }
.footer-links a:hover { color: white; }
.footer-bottom { margin-top: 32px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,0.1); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: 0.85rem; }
.footer-bottom a { color: rgba(255,255,255,0.4); }
.footer-bottom a:hover { color: white; }

@media (max-width: 768px) {
  .footer-inner { flex-direction: column; gap: 24px; }
  .footer-links { flex-direction: column; gap: 12px; }
  .footer-bottom { flex-direction: column; gap: 8px; }
}
@media (max-width: 480px) {
  .intro { padding: 32px 24px; }
  .results { padding: 28px 20px; }
  .community-grid { grid-template-columns: 1fr; }
  .error-screen { padding: 40px 24px; }
  .loading { padding: 60px 24px; }
  .cta-buttons { flex-direction: column; align-items: center; }
  .btn-download, .btn-download-secondary { width: 100%; justify-content: center; }
  .legend { gap: 10px; }
}
