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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
}

/* ── Nav ── */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #2d6a4f;
    color: white;
}
nav a { color: white; text-decoration: none; }
.logo { font-size: 1.5rem; font-weight: bold; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }

/* ── Layout ── */
main { max-width: 960px; margin: 2rem auto; padding: 0 1rem; }

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}
.btn-primary { background: #2d6a4f; color: white; }
.btn-primary:hover { background: #1b4332; }
.btn-secondary { background: white; color: #2d6a4f; border: 2px solid #2d6a4f; }
.btn-small { background: none; border: 1px solid #aaa; padding: 0.3rem 0.6rem; font-size: 0.8rem; border-radius: 4px; cursor: pointer; margin-top: 0.3rem; }

/* ── Hero ── */
.hero { text-align: center; padding: 4rem 1rem 2rem; }
.hero h1 { font-size: 2.5rem; color: #2d6a4f; margin-bottom: 1rem; }
.hero p { font-size: 1.2rem; color: #666; margin-bottom: 2rem; }
.hero-stats { margin-bottom: 2rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; }

/* ── Features ── */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-top: 3rem; }
.feature { background: white; padding: 1.5rem; border-radius: 8px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.feature-icon { font-size: 2rem; display: block; margin-bottom: 0.5rem; }
.feature h3 { color: #2d6a4f; margin-bottom: 0.5rem; }

/* ── Stats Grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: white; padding: 1.5rem; border-radius: 8px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.stat-number { display: block; font-size: 2rem; font-weight: bold; color: #2d6a4f; }
.stat-label { display: block; font-size: 0.85rem; color: #666; margin-top: 0.3rem; }
.streak-card { background: #fff8e1; }

/* ── Walk Cards ── */
.walks-list { display: flex; flex-direction: column; gap: 0.75rem; }
.walk-card { background: white; padding: 1rem 1.5rem; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.walk-info strong { color: #2d6a4f; font-size: 1.1rem; margin-right: 0.5rem; }
.walk-meta { display: flex; gap: 1rem; font-size: 0.85rem; color: #666; }
.empty { color: #999; text-align: center; padding: 2rem; }

/* ── Auth Pages ── */
.auth-page { max-width: 340px; margin: 2.5rem auto; display: flex; flex-direction: column; align-items: center; gap: 0.9rem; }
.auth-brand { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; }
.auth-brand-icon { font-size: 1.8rem; }
.auth-brand-name { font-size: 1.3rem; font-weight: 700; color: #2d6a4f; }
.auth-page h1 { color: #111; font-size: 1.5rem; margin: 0; text-align: center; }
.auth-sub { color: #666; font-size: 0.95rem; text-align: center; margin: 0; }
.auth-loading { display: flex; align-items: center; gap: 0.6rem; font-size: 0.9rem; color: #555; }
.error { color: #d32f2f; font-size: 0.9rem; text-align: center; background: #fff0f0; padding: 0.6rem 1rem; border-radius: 6px; width: 100%; }
.auth-page form { display: flex; flex-direction: column; gap: 1rem; width: 100%; }
.auth-page input { padding: 0.75rem; border: 1px solid #ddd; border-radius: 6px; font-size: 1rem; width: 100%; }
.auth-page a { color: #2d6a4f; }
.auth-footer-link { font-size: 0.88rem; color: #555; text-align: center; margin: 0; }

/* Apple button wrapper */
.apple-signin-wrap { width: 300px; }

/* Social buttons */
.social-btn { display: flex; align-items: center; justify-content: center; gap: 0.6rem; width: 300px; padding: 0 1rem; height: 44px; border: 1px solid #ddd; border-radius: 6px; background: white; font-size: 0.95rem; cursor: pointer; position: relative; color: #333; }
.social-btn:disabled { opacity: 0.55; cursor: not-allowed; background: #f9f9f9; }
.badge-soon { position: absolute; right: 10px; font-size: 0.65rem; background: #e5e7eb; color: #555; border-radius: 4px; padding: 1px 5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

/* Divider */
.auth-divider { display: flex; align-items: center; gap: 0.75rem; width: 300px; color: #bbb; font-size: 0.85rem; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: #e5e7eb; }

/* Email fallback */
.email-fallback { width: 300px; border: 1px solid #e5e7eb; border-radius: 8px; padding: 0 0.9rem; }
.email-fallback summary { padding: 0.7rem 0; font-size: 0.9rem; color: #555; cursor: pointer; list-style: none; text-align: center; }
.email-fallback summary::-webkit-details-marker { display: none; }
.email-fallback[open] summary { border-bottom: 1px solid #f0f0f0; margin-bottom: 0.75rem; }
.email-form { display: flex; flex-direction: column; gap: 0.75rem; padding-bottom: 0.9rem; }
.email-form input { padding: 0.65rem 0.75rem; border: 1px solid #ddd; border-radius: 6px; font-size: 0.95rem; }

/* QR login */
.qr-section { width: 300px; }
.qr-toggle-btn { display: flex; align-items: center; justify-content: center; gap: 0.5rem; width: 100%; padding: 0.6rem; background: none; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 0.88rem; color: #555; cursor: pointer; }
.qr-toggle-btn:hover { background: #f9f9f9; }
.qr-panel { margin-top: 0.75rem; text-align: center; }
.qr-hint { font-size: 0.85rem; color: #666; margin-bottom: 0.75rem; line-height: 1.5; }
.qr-container { display: inline-flex; align-items: center; justify-content: center; width: 200px; height: 200px; border: 1px solid #e5e7eb; border-radius: 8px; margin: 0 auto; overflow: hidden; }
.qr-status-text { font-size: 0.82rem; color: #999; margin-top: 0.5rem; }

/* ── Compare Page ── */
.compare-page { max-width: 700px; margin: 0 auto; }
.compare-page h1 { color: #2d6a4f; margin-bottom: 0.5rem; }
.form-row { display: flex; gap: 1rem; margin: 1.5rem 0; }
.form-group { flex: 1; display: flex; flex-direction: column; gap: 0.3rem; }
.form-group label { font-weight: 600; font-size: 0.9rem; }
.form-group input { padding: 0.75rem; border: 1px solid #ddd; border-radius: 6px; font-size: 1rem; }
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin: 1.5rem 0; }
.compare-card { padding: 2rem; border-radius: 8px; text-align: center; }
.walk-side { background: #e8f5e9; }
.drive-side { background: #fce4ec; }
.compare-card h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.compare-value { font-size: 2.5rem; font-weight: bold; }
.compare-label { color: #666; margin-bottom: 1rem; }
.compare-detail { font-size: 0.95rem; margin-top: 0.3rem; }
.nudge { background: #fff8e1; padding: 1.5rem; border-radius: 8px; text-align: center; font-size: 1.1rem; margin-top: 1rem; }
.nudge strong { color: #2d6a4f; }

/* ── Achievements ── */
.achievements-page h1 { color: #2d6a4f; margin-bottom: 1.5rem; }
.badges-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.badge-card { background: white; padding: 1.5rem; border-radius: 8px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.badge-card.locked { opacity: 0.5; }
.badge-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.badge-name { font-weight: bold; color: #2d6a4f; }
.badge-desc { font-size: 0.8rem; color: #666; margin-top: 0.3rem; }
.badge-date { font-size: 0.75rem; color: #999; margin-top: 0.5rem; }

/* ── Footer ── */
.site-footer { margin-top: 4rem; border-top: 1px solid #e5e7eb; padding: 1.5rem 2rem; }
.footer-inner { max-width: 960px; margin: 0 auto; display: flex; gap: 1.5rem; align-items: center; font-size: 0.85rem; color: #666; }
.footer-inner a { color: #666; text-decoration: none; }
.footer-inner a:hover { color: #2d6a4f; }

/* ── Moments feed ── */
.moments-page { max-width: 640px; margin: 0 auto; }
.moments-header { text-align: center; padding: 2rem 1rem 1.5rem; }
.moments-header h1 { color: #2d6a4f; font-size: 2rem; margin-bottom: 0.5rem; }
.moments-header p { color: #666; font-size: 1.05rem; }
.section-sub { color: #666; margin-bottom: 1.5rem; }

.moment-card { background: white; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); overflow: hidden; margin-bottom: 1.5rem; }
.moment-card-img { width: 100%; max-height: 480px; object-fit: cover; display: block; }
.moment-card-body { padding: 0.9rem 1rem; }
.moment-card-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.moment-username { font-weight: 600; color: #111; }
.moment-time { font-size: 0.8rem; color: #999; }
.moment-caption { font-size: 0.95rem; color: #333; margin-bottom: 0.6rem; line-height: 1.5; }
.moment-card-actions { display: flex; gap: 1rem; align-items: center; font-size: 0.85rem; color: #666; margin-top: 0.3rem; }
.moment-stat { display: flex; align-items: center; gap: 0.25rem; }
.moment-view-link { margin-left: auto; color: #2d6a4f; text-decoration: none; font-weight: 500; }
.moment-view-link:hover { text-decoration: underline; }

/* ── Moments loading/sentinel ── */
.moments-loading { display: flex; justify-content: center; padding: 2rem 0; }
.loading-spinner { width: 28px; height: 28px; border: 3px solid #e5e7eb; border-top-color: #2d6a4f; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Homepage moments preview ── */
.moments-preview { margin-top: 3rem; text-align: center; }
.moments-preview h2 { color: #2d6a4f; margin-bottom: 0.4rem; }
.moments-preview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 1rem; }
.moment-thumb { display: block; aspect-ratio: 1; overflow: hidden; border-radius: 6px; }
.moment-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s; }
.moment-thumb:hover img { transform: scale(1.05); }

/* ── Individual photo page ── */
.photo-page { max-width: 680px; margin: 0 auto; padding-bottom: 3rem; }
.photo-page-img-wrap { border-radius: 12px; overflow: hidden; margin-bottom: 1.2rem; background: #f3f4f6; }
.photo-page-img { width: 100%; display: block; max-height: 560px; object-fit: contain; }
.photo-page-body { background: white; border-radius: 12px; padding: 1.2rem 1.4rem; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.photo-page-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; }
.photo-page-author { display: flex; align-items: center; gap: 0.75rem; }
.avatar-circle { width: 38px; height: 38px; border-radius: 50%; background: #2d6a4f; color: white; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 1rem; flex-shrink: 0; }
.photo-page-stats { display: flex; gap: 1rem; font-size: 0.85rem; color: #666; }
.photo-page-caption { font-size: 1rem; color: #222; line-height: 1.6; margin-bottom: 1rem; }
.photo-page-comments { border-top: 1px solid #f0f0f0; padding-top: 1rem; margin-bottom: 1rem; }
.photo-page-comments h2 { font-size: 0.95rem; color: #666; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; }
.comment-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; font-size: 0.9rem; line-height: 1.5; }
.comment-row strong { color: #111; white-space: nowrap; }
.photo-page-cta { border-top: 1px solid #f0f0f0; padding-top: 1rem; text-align: center; }
.photo-page-cta p { color: #666; margin-bottom: 0.75rem; }

/* ── Responsive ── */
@media (max-width: 600px) {
    .form-row { flex-direction: column; }
    .compare-grid { grid-template-columns: 1fr; }
    .hero-actions { flex-direction: column; align-items: center; }
    nav { flex-direction: column; gap: 0.5rem; }
    .moments-preview-grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
    .photo-page-meta { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}
