/* =========================================================
   Neighborhood Livability Scorer — Redesigned Styles
   ========================================================= */

/* ===== CSS Custom Properties ===== */
:root {
    --color-primary: #4f46e5;
    --color-primary-dark: #4338ca;
    --color-primary-light: #e0e7ff;
    --color-primary-50: #eef2ff;
    --color-secondary: #0d9488;
    --color-secondary-light: #ccfbf1;
    --color-success: #059669;
    --color-success-light: #d1fae5;
    --color-warning: #d97706;
    --color-warning-light: #fef3c7;
    --color-danger: #dc2626;
    --color-danger-light: #fee2e2;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #0f172a;
    --color-text-muted: #64748b;
    --color-text-secondary: #475569;
    --color-text-light: #94a3b8;
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px -2px rgba(0,0,0,0.08), 0 2px 6px -2px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 32px -4px rgba(0,0,0,0.12), 0 4px 8px -4px rgba(0,0,0,0.06);
    --shadow-xl: 0 20px 48px -8px rgba(0,0,0,0.15);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --container-max: 1080px;
    --transition-fast: 150ms ease;
    --transition: 250ms ease;
    --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }

/* ===== Accessibility ===== */
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; top: -100%; left: 50%; transform: translateX(-50%);
    background: var(--color-primary); color: #fff; padding: 0.5rem 1.5rem;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm); z-index: 1000;
    font-weight: 600; text-decoration: none; transition: top var(--transition-fast);
}
.skip-link:focus { top: 0; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* ===== Layout ===== */
.container { max-width: var(--container-max); margin: 0 auto; padding: 0 1.5rem; }

/* ===== Header ===== */
.site-header {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #4f46e5 70%, #6366f1 100%);
    color: #fff;
    padding: 4rem 1.5rem 4.5rem;
    text-align: center;
}
.header-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.header-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
}
.header-orb--1 {
    width: 400px; height: 400px;
    background: #818cf8;
    top: -100px; right: -80px;
    animation: float 8s ease-in-out infinite;
}
.header-orb--2 {
    width: 300px; height: 300px;
    background: #6366f1;
    bottom: -80px; left: -60px;
    animation: float 10s ease-in-out infinite reverse;
}
.header-orb--3 {
    width: 200px; height: 200px;
    background: #a78bfa;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    animation: float-center 12s ease-in-out infinite 2s;
}
@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-20px) scale(1.05); }
}
@keyframes float-center {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, calc(-50% - 20px)) scale(1.05); }
}
.header-content { position: relative; z-index: 1; }
.header-badge {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 0.3rem 1rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 1.25rem;
}
.site-title {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1.1;
}
.site-subtitle {
    margin-top: 1rem;
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    opacity: 0.85;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
    font-weight: 400;
}
.header-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.15);
}
.header-stat { text-align: center; }
.header-stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.header-stat-label {
    font-size: 0.75rem;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}
.header-stat-divider {
    width: 1px;
    height: 32px;
    background: rgba(255,255,255,0.2);
}

/* ===== How It Works ===== */
.how-it-works {
    margin-top: -1.5rem;
    position: relative;
    z-index: 1;
}
.steps-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.step {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: var(--color-surface);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    flex: 1;
    min-width: 0;
    max-width: 300px;
    border: 1px solid var(--color-border-light);
    transition: transform var(--transition), box-shadow var(--transition);
}
.step:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.step-body { min-width: 0; }
.step-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text);
}
.step-desc {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}
.step-arrow {
    flex-shrink: 0;
    color: var(--color-text-light);
    opacity: 0.5;
}

/* ===== Cards ===== */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-top: 1.75rem;
    border: 1px solid var(--color-border-light);
}
.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.card-header-left { flex: 1; min-width: 0; }
.card-header-left .section-desc { margin-bottom: 0; margin-top: 0.25rem; }
.card h2, .card h3 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.section-desc {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

/* ===== Weight Distribution Bar ===== */
.weight-distribution {
    display: flex;
    height: 8px;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    background: var(--color-border);
    gap: 2px;
}
.weight-dist-seg {
    transition: width var(--transition);
    min-width: 0;
    border-radius: 99px;
}
.weight-dist-seg[data-cat="safety"] { background: #3b82f6; }
.weight-dist-seg[data-cat="schools"] { background: #8b5cf6; }
.weight-dist-seg[data-cat="walkability"] { background: #10b981; }
.weight-dist-seg[data-cat="affordability"] { background: #f59e0b; }
.weight-dist-seg[data-cat="commute"] { background: #ef4444; }

/* ===== Priorities ===== */
.priorities-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
}
.priority-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 1rem 0.5rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
}
.priority-item label {
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    white-space: nowrap;
}
.priority-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
}
.priority-item[data-category="safety"] .priority-icon { color: #3b82f6; background: #eff6ff; }
.priority-item[data-category="schools"] .priority-icon { color: #8b5cf6; background: #f5f3ff; }
.priority-item[data-category="walkability"] .priority-icon { color: #10b981; background: #ecfdf5; }
.priority-item[data-category="affordability"] .priority-icon { color: #f59e0b; background: #fffbeb; }
.priority-item[data-category="commute"] .priority-icon { color: #ef4444; background: #fef2f2; }

/* Range sliders */
.slider-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}
.priority-item input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--slider-color, var(--color-primary)) 0%, var(--slider-color, var(--color-primary)) var(--slider-pct, 50%), var(--color-border) var(--slider-pct, 50%), var(--color-border) 100%);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}
.priority-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.05);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.priority-item input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.05);
}
.priority-item input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
/* Category-specific thumb colors */
.priority-item[data-category="safety"] input[type="range"]::-webkit-slider-thumb { background: #3b82f6; }
.priority-item[data-category="schools"] input[type="range"]::-webkit-slider-thumb { background: #8b5cf6; }
.priority-item[data-category="walkability"] input[type="range"]::-webkit-slider-thumb { background: #10b981; }
.priority-item[data-category="affordability"] input[type="range"]::-webkit-slider-thumb { background: #f59e0b; }
.priority-item[data-category="commute"] input[type="range"]::-webkit-slider-thumb { background: #ef4444; }
.priority-item[data-category="safety"] input[type="range"]::-moz-range-thumb { background: #3b82f6; }
.priority-item[data-category="schools"] input[type="range"]::-moz-range-thumb { background: #8b5cf6; }
.priority-item[data-category="walkability"] input[type="range"]::-moz-range-thumb { background: #10b981; }
.priority-item[data-category="affordability"] input[type="range"]::-moz-range-thumb { background: #f59e0b; }
.priority-item[data-category="commute"] input[type="range"]::-moz-range-thumb { background: #ef4444; }

.weight-value {
    background: var(--color-bg);
    color: var(--color-text);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    min-width: 28px;
    text-align: center;
    flex-shrink: 0;
    border: 1px solid var(--color-border);
}
.priority-item[data-category="safety"] .weight-value { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.priority-item[data-category="schools"] .weight-value { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.priority-item[data-category="walkability"] .weight-value { background: #ecfdf5; color: #059669; border-color: #a7f3d0; }
.priority-item[data-category="affordability"] .weight-value { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.priority-item[data-category="commute"] .weight-value { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.weight-pct {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    min-height: 1.1em;
    font-weight: 500;
}

/* ===== Preset Profiles ===== */
.preset-profiles {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border-light);
    flex-wrap: wrap;
}
.preset-label {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    font-weight: 500;
}
.btn-preset {
    padding: 0.35rem 0.85rem;
    font-size: 0.78rem;
    font-family: inherit;
    font-weight: 600;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
}
.btn-preset:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
}
.btn-preset.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* ===== Location Inputs ===== */
.locations-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.location-input-group label {
    font-weight: 600;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}
.location-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 0.72rem;
    font-weight: 800;
    flex-shrink: 0;
}
.optional {
    font-weight: 400;
    color: var(--color-text-light);
    font-size: 0.78rem;
}
.input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    position: relative;
}
.input-row input[type="text"] {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input-row input[type="text"]::placeholder { color: var(--color-text-light); }
.input-row input[type="text"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--color-primary-light);
}
.input-row input[type="text"].input-error {
    border-color: var(--color-danger);
    box-shadow: 0 0 0 4px var(--color-danger-light);
}
.suggestions-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
}
.suggestion-item {
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--color-text);
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--color-border-light);
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover,
.suggestion-item.active {
    background: var(--color-primary-50);
    color: var(--color-primary-dark);
}
.btn-clear-location {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    transition: color var(--transition-fast), background var(--transition-fast);
    line-height: 1;
}
.btn-clear-location:hover {
    color: var(--color-danger);
    background: var(--color-danger-light);
}
.location-actions {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

/* ===== Buttons ===== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--color-primary);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    padding: 0.8rem 2rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition-fast), box-shadow var(--transition-fast), transform 80ms ease;
    flex: 1;
    letter-spacing: -0.01em;
}
.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-dark);
    box-shadow: var(--shadow-md), 0 0 0 4px var(--color-primary-light);
}
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--color-surface);
    color: var(--color-primary);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    padding: 0.8rem 1.25rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}
.btn-secondary:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-50);
}
.btn-sm { padding: 0.45rem 1rem; font-size: 0.8rem; border-radius: var(--radius-sm); }

.btn-text {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    flex-shrink: 0;
}
.btn-text:hover { background: var(--color-bg); color: var(--color-primary); }

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.75rem;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}
.btn-icon:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-50);
    box-shadow: var(--shadow-xs);
}
.btn-icon svg { flex-shrink: 0; }

.btn-dismiss {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    padding: 0.2rem 0.5rem;
    line-height: 1;
    flex-shrink: 0;
}
.btn-dismiss:hover { opacity: 1; }

/* ===== Error Banner ===== */
.error-banner {
    background: var(--color-danger-light);
    border: 1px solid #fca5a5;
    color: #991b1b;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius);
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.9rem;
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.error-banner-content {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
}
.error-banner-content svg { flex-shrink: 0; color: #dc2626; }
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Loading ===== */
.loading-state {
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}
.loading-card {
    text-align: center;
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: 3rem 2.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border-light);
    max-width: 360px;
    width: 100%;
}
.loading-title {
    font-weight: 600;
    color: var(--color-text);
    font-size: 1rem;
}
.spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 1.25rem;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-steps {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    margin-top: 1rem;
    font-size: 0.8rem;
}
.loading-step {
    opacity: 0.35;
    transition: opacity 0.3s ease, color 0.3s ease;
}
.loading-step.active { opacity: 1; font-weight: 600; color: var(--color-primary); }
.loading-step.done { opacity: 0.5; text-decoration: line-through; }

/* ===== Results ===== */
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.results-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}
.results-actions {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

/* ===== Winner Banner ===== */
.winner-banner {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    border: 1px solid #6ee7b7;
    color: #065f46;
    padding: 1.25rem 1.75rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    font-weight: 500;
    text-align: center;
    animation: slideDown 0.4s ease;
    font-size: 0.95rem;
    line-height: 1.6;
}
.winner-banner .winner-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: #047857;
}

/* ===== Score Cards ===== */
.score-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}
.score-cards-grid:has(.score-card:only-child) {
    max-width: 380px;
}
.score-card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    border: 2px solid var(--color-border-light);
    box-shadow: var(--shadow);
    padding: 2rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-slow), box-shadow var(--transition-slow), border-color var(--transition);
}
.score-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--color-border);
}
.score-card.best {
    border-color: var(--color-success);
    box-shadow: var(--shadow-md), 0 0 0 4px var(--color-success-light);
}
.score-card-badge {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.3rem;
    text-align: center;
    z-index: 2;
}
.score-card.best .score-card-inner { margin-top: 0.5rem; }
.score-card-location {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 1.25rem;
    line-height: 1.3;
    min-height: 2.6em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.score-donut {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 1.25rem;
}
.score-donut svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.score-donut-track {
    fill: none;
    stroke: var(--color-border);
    stroke-width: 10;
}
.score-donut-fill {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    animation: donutFill 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes donutFill {
    /* 2 * PI * 52 (radius) = 326.726 — round up to fully hide at start */
    from { stroke-dashoffset: 326.726; }
}
.score-donut-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.score-donut-number {
    font-size: 2.25rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}
.score-donut-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
    font-weight: 500;
}
.score-grade {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    font-weight: 700;
}
.score-card-meta {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border-light);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* ===== Tabs ===== */
.results-detail {
    padding: 0;
    overflow: hidden;
}
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border-light);
    background: var(--color-bg);
    padding: 0 0.5rem;
}
.tab {
    flex: 1;
    padding: 0.9rem 1rem;
    background: none;
    border: none;
    font-family: inherit;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    position: relative;
    transition: color var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
.tab svg { flex-shrink: 0; opacity: 0.6; }
.tab:hover { color: var(--color-text); }
.tab:hover svg { opacity: 0.8; }
.tab.active { color: var(--color-primary); }
.tab.active svg { opacity: 1; }
.tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0.5rem;
    right: 0.5rem;
    height: 2px;
    background: var(--color-primary);
    border-radius: 1px 1px 0 0;
}
.tab-panel {
    padding: 1.75rem;
    min-height: 300px;
}
.tab-panel canvas {
    max-height: 400px;
    margin: 0 auto;
    display: block;
}

/* ===== Breakdown Table ===== */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
}
th {
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--color-bg);
    position: sticky;
    top: 0;
}
tbody tr { transition: background var(--transition-fast); }
tbody tr:hover { background: var(--color-primary-50); }
td { white-space: nowrap; }
.score-bar-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.score-bar-bg {
    flex: 1;
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    min-width: 60px;
}
.score-bar-fill {
    height: 100%;
    border-radius: 4px;
    transform-origin: left;
    animation: barGrow 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes barGrow {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}
.score-bar-value {
    min-width: 30px;
    font-weight: 700;
    text-align: right;
    font-size: 0.85rem;
}
.row-total td {
    font-weight: 700;
    border-top: 2px solid var(--color-border);
    font-size: 0.95rem;
}

/* ===== Insights Panel ===== */
.insights-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.insight-card {
    display: flex;
    gap: 0.85rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.88rem;
    line-height: 1.55;
    border-left: 4px solid transparent;
}
.insight-card.positive { border-left-color: var(--color-success); background: var(--color-success-light); color: #065f46; }
.insight-card.negative { border-left-color: var(--color-danger); background: var(--color-danger-light); color: #991b1b; }
.insight-card.neutral { border-left-color: var(--color-warning); background: var(--color-warning-light); color: #92400e; }
.insight-card.info { border-left-color: var(--color-primary); background: var(--color-primary-light); color: #1e3a8a; }
.insight-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}
.insight-text strong { display: block; margin-bottom: 0.2rem; }

/* ===== Category Detail Cards ===== */
.category-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1.75rem;
}
.category-detail-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--color-border);
    padding: 1.25rem;
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}
.category-detail-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--color-primary-light);
    transform: translateY(-1px);
}
.category-detail-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
    font-size: 0.92rem;
}
.category-detail-header svg { flex-shrink: 0; }
.category-detail-desc {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 0.85rem;
    line-height: 1.5;
}
.category-detail-scores {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.cat-score-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
}
.cat-score-label {
    min-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}
.cat-score-bar {
    flex: 1;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
}
.cat-score-bar-fill {
    height: 100%;
    border-radius: 3px;
    transform-origin: left;
    animation: barGrow 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.cat-score-val {
    min-width: 28px;
    text-align: right;
    font-weight: 700;
    font-size: 0.8rem;
}

/* ===== Saved Comparisons ===== */
.saved-section { margin-top: 1.75rem; }
.data-sources { margin-top: 1.75rem; }
.saved-list { margin-top: 0.75rem; }
.empty-state {
    text-align: center;
    color: var(--color-text-light);
    font-size: 0.85rem;
    padding: 1.5rem 1rem;
}
.saved-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 0.85rem;
}
.saved-item:last-child { border-bottom: none; }
.saved-item-info { flex: 1; min-width: 0; }
.saved-item-locations {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.saved-item-date {
    color: var(--color-text-light);
    font-size: 0.75rem;
    margin-top: 0.15rem;
}
.saved-item-actions { display: flex; gap: 0.3rem; }

/* ===== Data Sources ===== */
.source-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.source-item {
    display: flex;
    gap: 0.75rem;
    font-size: 0.85rem;
    line-height: 1.5;
    align-items: flex-start;
}
.source-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.source-icon--safety { background: #eff6ff; color: #3b82f6; }
.source-icon--schools { background: #f5f3ff; color: #8b5cf6; }
.source-icon--walkability { background: #ecfdf5; color: #10b981; }
.source-icon--affordability { background: #fffbeb; color: #f59e0b; }
.source-icon--commute { background: #fef2f2; color: #ef4444; }
.source-item strong {
    display: block;
    font-size: 0.88rem;
    margin-bottom: 0.1rem;
}
.source-item span {
    color: var(--color-text-muted);
    font-size: 0.8rem;
}
.data-disclaimer {
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    background: var(--color-warning-light);
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    font-size: 0.82rem;
    color: #92400e;
    line-height: 1.55;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--color-text);
    color: #fff;
    padding: 0.75rem 1.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: var(--shadow-xl);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== Footer ===== */
.site-footer {
    padding: 3rem 1.5rem;
    margin-top: 4rem;
    color: var(--color-text-muted);
    font-size: 0.82rem;
    border-top: 1px solid var(--color-border-light);
}
.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 1.5rem;
}
.footer-brand {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--color-text);
    margin-bottom: 0.35rem;
}
.footer-tagline {
    max-width: 420px;
    line-height: 1.6;
}
.footer-nav {
    display: flex;
    gap: 1.25rem;
    flex-shrink: 0;
}
.footer-nav a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}
.footer-nav a:hover { text-decoration: underline; }
.footer-copyright { text-align: center; }
@media (max-width: 768px) {
    .footer-content { flex-direction: column; align-items: center; text-align: center; }
    .footer-nav { flex-wrap: wrap; justify-content: center; }
}

/* ===== Scroll-Reveal Animations ===== */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 100ms; }
.reveal-delay-2 { transition-delay: 200ms; }
.reveal-delay-3 { transition-delay: 300ms; }

/* ===== Results Reveal ===== */
.results-section {
    margin-top: 2.5rem;
}
.results-section.animate-in {
    animation: resultsReveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes resultsReveal {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Score Card Accents ===== */
.score-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-accent, var(--color-border));
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    z-index: 1;
}
.score-card.best::before {
    height: 0;
}

/* ===== Card Shine Hover Effect ===== */
.card {
    position: relative;
    overflow: hidden;
}
/* Allow autocomplete dropdown to overflow the card boundary */
.locations-section { overflow: visible; }
.locations-section::after { display: none; }
/* Results-detail manages its own overflow for tab content */
.results-detail::after { display: none; }
.results-detail > * { position: static; z-index: auto; }
.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
    transform: skewX(-15deg);
    transition: left 0.6s ease;
    pointer-events: none;
    z-index: 0;
}
.card:hover::after {
    left: 125%;
}
.card > * { position: relative; z-index: 1; }

/* ===== Skeleton Loading ===== */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}
.skeleton-card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    border: 2px solid var(--color-border-light);
    box-shadow: var(--shadow);
    padding: 2rem 1.5rem;
    text-align: center;
}
.skeleton-line {
    background: linear-gradient(90deg, var(--color-border-light) 25%, var(--color-bg) 50%, var(--color-border-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
}
.skeleton-line--title {
    height: 16px;
    width: 70%;
    margin: 0 auto 1.25rem;
}
.skeleton-line--donut {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    margin: 0 auto 1.25rem;
}
.skeleton-line--grade {
    height: 14px;
    width: 50%;
    margin: 0 auto;
}
.skeleton-line--meta {
    height: 12px;
    width: 80%;
    margin: 0.5rem auto 0;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Enhanced Step Cards ===== */
.step-number {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--color-primary), #6366f1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}
.step-arrow svg {
    transition: transform var(--transition);
}
.step:hover + .step-arrow svg {
    transform: translateX(3px);
}

/* ===== Enhanced Priority Item Interaction ===== */
.priority-item {
    transition: background var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}
.priority-item:hover {
    background: var(--color-bg);
    border-color: var(--color-border);
    transform: translateY(-1px);
    box-shadow: var(--shadow-xs);
}

/* ===== Category Card Color Accent ===== */
.category-detail-card {
    position: relative;
    padding-left: calc(1.25rem + 3px);
}
.category-detail-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    background: var(--cat-accent, var(--color-border));
}

/* ===== Insight Card Hover ===== */
.insight-card {
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.insight-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-xs);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .priorities-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .site-header { padding: 3rem 1.25rem 3.5rem; }
    .site-title { font-size: 2rem; }
    .header-stats { gap: 1rem; }
    .header-stat-number { font-size: 1.25rem; }
    .score-cards-grid { grid-template-columns: 1fr; }
    .skeleton-grid { grid-template-columns: 1fr; }
    .steps-row { flex-direction: column; gap: 0.5rem; }
    .step { max-width: none; }
    .step-arrow { display: none; }
    .results-actions { width: 100%; justify-content: flex-start; }
    .btn-icon span { display: none; }
    .location-actions { flex-direction: column; }
    .saved-item { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
    .saved-item-actions { align-self: flex-end; }
    .tab-panel { min-height: 200px; padding: 1.25rem; }
    .tab svg { display: none; }
    .tabs-kbd-hint { display: none !important; }
    .btn-back-to-inputs span { display: none; }
}
@media (max-width: 480px) {
    .site-header { padding: 2rem 1rem 2.5rem; }
    .site-title { font-size: 1.6rem; }
    .header-stats { flex-direction: column; gap: 0.5rem; }
    .header-stat-divider { width: 40px; height: 1px; }
    .card { padding: 1.25rem; border-radius: var(--radius-lg); }
    .priorities-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .tab { padding: 0.7rem 0.5rem; font-size: 0.78rem; }
    .score-card-location { min-height: auto; }
    .score-card { padding: 1.5rem 1.25rem; }
}

/* ===== Geolocation Button ===== */
.btn-geolocate {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    cursor: pointer;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.btn-geolocate:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-50);
}
.btn-geolocate.loading {
    opacity: 0.5;
    pointer-events: none;
    animation: pulse-geo 1s ease-in-out infinite;
}
@keyframes pulse-geo {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ===== "Try an Example" hint ===== */
.btn-example-hint {
    display: none;
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}
@media (min-width: 600px) {
    .btn-example-hint { display: inline; margin-left: 0.15rem; }
    .btn-example-hint::before { content: '— '; }
}

/* ===== Button Loading State ===== */
.btn-primary .btn-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-primary.is-loading .btn-spinner { display: block; }
.btn-primary.is-loading .btn-label-icon { display: none; }
.btn-primary.is-loading .btn-label-text { display: none; }
.btn-primary.is-loading::after { content: 'Scoring\2026'; font-size: 1rem; }
.btn-primary.pulse-hint {
    animation: pulse-btn 0.6s ease-in-out 2;
}
@keyframes pulse-btn {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 0 8px var(--color-primary-light); }
}

/* ===== Results Preview Placeholder ===== */
.results-preview {
    text-align: center;
    padding: 3rem 1.5rem;
    margin-top: 2rem;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-xl);
    background: var(--color-surface);
}
.results-preview-icon {
    color: var(--color-text-light);
    margin-bottom: 1rem;
    opacity: 0.5;
}
.results-preview-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text-muted);
    margin-bottom: 0.35rem;
}
.results-preview-desc {
    font-size: 0.88rem;
    color: var(--color-text-light);
    max-width: 440px;
    margin: 0 auto;
    line-height: 1.55;
}
.results-preview-cards {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}
.results-preview-card {
    width: 120px;
    height: 150px;
    border-radius: var(--radius-lg);
    background: var(--color-border-light);
    border: 1px dashed var(--color-border);
    opacity: 0.6;
}
@media (max-width: 480px) {
    .results-preview-card { width: 80px; height: 110px; }
}

/* ===== Sticky Back-to-Inputs Button ===== */
.btn-back-to-inputs {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 50;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--color-surface);
    color: var(--color-primary);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    border: 2px solid var(--color-primary);
    border-radius: 999px;
    padding: 0.55rem 1.1rem 0.55rem 0.75rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-fast);
    opacity: 0;
    transform: translateY(12px);
}
.btn-back-to-inputs[hidden] { display: none; }
.btn-back-to-inputs.visible {
    opacity: 1;
    transform: translateY(0);
}
.btn-back-to-inputs:hover {
    background: var(--color-primary);
    color: #fff;
}

/* ===== Tabs Keyboard Hint ===== */
.tabs-kbd-hint {
    display: none;
    font-size: 0.7rem;
    color: var(--color-text-light);
    padding: 0.3rem 0.65rem;
    align-self: center;
    white-space: nowrap;
}
.tabs:focus-within .tabs-kbd-hint { display: block; }

/* ===== Saved Comparison Badges ===== */
.saved-score-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    color: #fff;
    line-height: 1.3;
}
.saved-score-badge.score-green { background: #059669; }
.saved-score-badge.score-amber { background: #d97706; }
.saved-score-badge.score-red { background: #dc2626; }
.saved-loc-count {
    font-size: 0.7rem;
    color: var(--color-text-light);
    font-weight: 500;
}

/* ===== Weight Distribution Clickable ===== */
.weight-dist-seg { cursor: pointer; transition: width var(--transition), opacity var(--transition-fast); }
.weight-dist-seg:hover { opacity: 0.75; }

/* ===== FAQ Section ===== */
.faq-section { margin-top: 2rem; }
.faq-section h2 { margin-bottom: 1rem; }
.faq-list { display: flex; flex-direction: column; gap: 0; }
.faq-item {
    border-bottom: 1px solid var(--color-border-light);
    padding: 0;
}
.faq-item:last-child { border-bottom: none; }
.faq-item summary {
    padding: 1rem 0;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    transition: color 0.15s ease;
}
.faq-item summary:hover { color: var(--color-primary); }
.faq-item summary::after {
    content: '+';
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--color-text-muted);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.faq-item[open] summary::after {
    content: '−';
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item p {
    padding: 0 0 1rem;
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--color-text-secondary);
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    .results-section.animate-in { animation: none; }
    .score-donut-fill { animation: none; }
    .score-bar-fill, .cat-score-bar-fill { animation: none; }
    .header-orb { animation: none; }
    .card::after { display: none; }
    .btn-geolocate.loading { animation: none; }
    .btn-back-to-inputs { transition: none; }
}

/* ===== Print ===== */
@media print {
    body { background: #fff; }
    .site-header { background: none; color: #000; padding: 1rem 0; }
    .header-bg, .header-badge, .header-stats { display: none; }
    .how-it-works, .priorities-section, .locations-section,
    .results-actions, .saved-section, .data-sources, .faq-section,
    .site-footer, .btn-primary, .btn-secondary, .error-banner,
    .loading-state, .toast, .skip-link, .preset-profiles,
    .results-preview, .btn-back-to-inputs,
    #btn-reset-weights { display: none !important; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    .score-card { break-inside: avoid; }
    .results-section { display: block !important; }
    .tab-panel { display: block !important; padding: 0.5rem 0; }
    .tabs { display: none; }
}

/* ===== Dark Mode ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #0f172a;
        --color-surface: #1e293b;
        --color-text: #f1f5f9;
        --color-text-muted: #94a3b8;
        --color-text-light: #64748b;
        --color-text-secondary: #94a3b8;
        --color-border: #334155;
        --color-border-light: #1e293b;
        --color-primary-light: rgba(79, 70, 229, 0.2);
        --color-primary-50: rgba(79, 70, 229, 0.12);
        --color-success-light: rgba(5, 150, 105, 0.2);
        --color-warning-light: rgba(217, 119, 6, 0.2);
        --color-danger-light: rgba(220, 38, 38, 0.2);
        --shadow-xs: 0 1px 2px rgba(0,0,0,0.2);
        --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
        --shadow-md: 0 4px 12px -2px rgba(0,0,0,0.4);
        --shadow-lg: 0 12px 32px -4px rgba(0,0,0,0.5);
        --shadow-xl: 0 20px 48px -8px rgba(0,0,0,0.6);
    }
    .site-header {
        background: linear-gradient(135deg, #0f0a2e 0%, #1a1650 30%, #312e81 70%, #4338ca 100%);
    }
    .priority-item[data-category="safety"] .priority-icon { background: rgba(59, 130, 246, 0.15); }
    .priority-item[data-category="schools"] .priority-icon { background: rgba(139, 92, 246, 0.15); }
    .priority-item[data-category="walkability"] .priority-icon { background: rgba(16, 185, 129, 0.15); }
    .priority-item[data-category="affordability"] .priority-icon { background: rgba(245, 158, 11, 0.15); }
    .priority-item[data-category="commute"] .priority-icon { background: rgba(239, 68, 68, 0.15); }
    .priority-item[data-category="safety"] .weight-value { background: rgba(59, 130, 246, 0.12); color: #60a5fa; border-color: rgba(59, 130, 246, 0.3); }
    .priority-item[data-category="schools"] .weight-value { background: rgba(139, 92, 246, 0.12); color: #a78bfa; border-color: rgba(139, 92, 246, 0.3); }
    .priority-item[data-category="walkability"] .weight-value { background: rgba(16, 185, 129, 0.12); color: #34d399; border-color: rgba(16, 185, 129, 0.3); }
    .priority-item[data-category="affordability"] .weight-value { background: rgba(245, 158, 11, 0.12); color: #fbbf24; border-color: rgba(245, 158, 11, 0.3); }
    .priority-item[data-category="commute"] .weight-value { background: rgba(239, 68, 68, 0.12); color: #f87171; border-color: rgba(239, 68, 68, 0.3); }
    .weight-value { background: var(--color-bg); border-color: var(--color-border); }
    .input-row input[type="text"] { background: var(--color-bg); color: var(--color-text); border-color: var(--color-border); }
    .input-row input[type="text"]::placeholder { color: var(--color-text-light); }
    .score-card { background: var(--color-surface); }
    .card::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,0.01), transparent); }
    .suggestions-dropdown { background: var(--color-surface); border-color: var(--color-border); }
    .suggestion-item:hover, .suggestion-item.active { background: rgba(79, 70, 229, 0.15); color: #a5b4fc; }
    .btn-secondary { background: var(--color-surface); border-color: var(--color-border); color: #a5b4fc; }
    .btn-preset { background: var(--color-bg); border-color: var(--color-border); color: var(--color-text-muted); }
    .btn-preset:hover { background: rgba(79, 70, 229, 0.15); border-color: var(--color-primary); color: #a5b4fc; }
    .btn-icon { background: var(--color-surface); border-color: var(--color-border); color: var(--color-text-muted); }
    .btn-icon:hover { border-color: var(--color-primary); color: #a5b4fc; background: rgba(79, 70, 229, 0.12); }
    .location-number { background: rgba(79, 70, 229, 0.2); color: #a5b4fc; }
    .step { background: var(--color-surface); border-color: var(--color-border); }
    .step-number { box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35); }
    .results-preview { background: var(--color-surface); border-color: var(--color-border); }
    .results-preview-card { background: var(--color-bg); border-color: var(--color-border); }
    .btn-back-to-inputs { background: var(--color-surface); box-shadow: var(--shadow-lg); }
    .btn-back-to-inputs:hover { background: var(--color-primary); color: #fff; }
    .skeleton-line { background: linear-gradient(90deg, var(--color-border) 25%, var(--color-surface) 50%, var(--color-border) 75%); background-size: 200% 100%; }
    .winner-banner { background: linear-gradient(135deg, rgba(5, 150, 105, 0.15), rgba(16, 185, 129, 0.1)); border-color: rgba(16, 185, 129, 0.3); }
    .error-banner { background: rgba(220, 38, 38, 0.12); border-color: rgba(220, 38, 38, 0.3); }
    .score-card-badge { background: linear-gradient(135deg, #047857, #059669); }
    .faq-item { border-color: var(--color-border); }
    .faq-item summary { color: var(--color-text); }
    .faq-item p { color: var(--color-text-muted); }
    .data-disclaimer { color: var(--color-text-muted); }
}
