/* =============================================================================
   Pastime — shared styles
   Design approach: Apple's Human Interface ideas, translated for the web
   (system type, translucent chrome, instant press feedback, light/dark,
   reduced-motion / reduced-transparency / high-contrast support).
   Phones: frosted top bar + bottom tab bar.  ≥768px: top bar only.
   ============================================================================= */

/* ---------- Design tokens (light) ---------- */
:root {
    --accent: #007aff;               /* iOS system blue */
    --accent-pressed: #0062cc;
    --accent-rgb: 0, 122, 255;
    --green: #34c759;
    --green-rgb: 52, 199, 89;
    --indigo: #5856d6;
    --indigo-rgb: 88, 86, 214;
    --red: #ff3b30;

    --page-bg: #f2f2f7;              /* iOS grouped background */
    --surface: #ffffff;              /* cards, rows */
    --label: #000000;
    --label-2: rgba(60, 60, 67, 0.62);   /* secondary text */
    --separator: rgba(60, 60, 67, 0.18);
    --fill: rgba(118, 118, 128, 0.12);   /* search field, segmented control track */

    --material: rgba(249, 249, 249, 0.78);   /* translucent bars */
    --material-blur: saturate(180%) blur(20px);

    --radius-card: 1rem;
    --radius-control: 0.75rem;
    --bottom-nav-height: 3.5rem;
    --press-scale: 0.97;

    /* Motion tokens (animate skill): strong ease-out for UI, short durations */
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --press-time: 120ms;             /* press feedback: 100–160ms */
    --hover-time: 150ms;             /* hover / color changes */

    /* Hand our palette to Bootstrap so its components match */
    --bs-primary: var(--accent);
    --bs-primary-rgb: var(--accent-rgb);
    --bs-link-color: var(--accent);
    --bs-link-color-rgb: var(--accent-rgb);
    --bs-link-hover-color: var(--accent-pressed);
    --bs-body-color: var(--label);
    --bs-secondary-color: var(--label-2);
    --bs-border-color: var(--separator);
}

/* ---------- Design tokens (dark) — set by the script in partials/head ---------- */
[data-bs-theme="dark"] {
    --accent: #0a84ff;
    --accent-pressed: #409cff;
    --accent-rgb: 10, 132, 255;
    --green: #30d158;
    --green-rgb: 48, 209, 88;
    --indigo: #5e5ce6;
    --indigo-rgb: 94, 92, 230;
    --red: #ff453a;

    --page-bg: #000000;
    --surface: #1c1c1e;
    --label: #ffffff;
    --label-2: rgba(235, 235, 245, 0.6);
    --separator: rgba(84, 84, 88, 0.6);
    --fill: rgba(118, 118, 128, 0.24);
    --material: rgba(28, 28, 30, 0.78);

    --bs-body-bg: var(--surface);    /* inputs, dropdowns */
}

/* ---------- Base (mobile-native baseline) ---------- */
html {
    -webkit-tap-highlight-color: transparent;   /* no gray flash on tap; :active styles replace it */
    -webkit-text-size-adjust: 100%;             /* no font inflation in landscape */
    /* overscroll-behavior left alone: Pastime is a scrolling feed, pull-to-refresh is welcome */

    /* When the browser scrolls something into view (keyboard Tab, focus, #links),
       keep it clear of the sticky top bar and the fixed bottom tab bar, so a
       focused button is never hidden underneath them. */
    scroll-padding-top: 4.5rem;
    scroll-padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 1rem);
}
@media (min-width: 768px) {
    html { scroll-padding-bottom: 1rem; }       /* no bottom tab bar on tablet/desktop */
}

/* Fire taps immediately (no double-tap-zoom wait) */
a, button, summary, [role="button"] { touch-action: manipulation; }

/* Controls shouldn't select their label on long-press; content text stays selectable */
.btn, button, summary, .bottom-nav a, .desk-item, .nav-icon, .segmented a, .chip, .sidebar-links a {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

body {
    background-color: var(--page-bg);
    color: var(--label);
    line-height: 1.5;
    /* leave room so the bottom tab bar never covers content */
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    -webkit-font-smoothing: antialiased;
}
@media (min-width: 768px) {
    body { padding-bottom: 0; }
}

.text-muted, .text-secondary { color: var(--label-2) !important; }
.min-w-0 { min-width: 0; }          /* lets flex children truncate with … */
a { text-decoration: none; }

/* ---------- Typography: size-specific tracking & leading ---------- */
h1, h2, h3, h4, h5 { color: var(--label); }

.page-title {                        /* iOS "Large Title" */
    font-size: clamp(1.75rem, 7vw, 2.25rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.022em;
    margin-bottom: 1rem;
}
.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.015em;
    margin: 1.75rem 0 0.75rem;
}
.page-container h3 { font-size: clamp(1.15rem, 4.5vw, 1.4rem); letter-spacing: -0.015em; line-height: 1.25; }
.page-container h4 { font-size: 1.1rem; letter-spacing: -0.01em; line-height: 1.3; }
.footnote { font-size: 0.8125rem; letter-spacing: 0.005em; color: var(--label-2); }

/* ---------- Page container ---------- */
.page-container {
    padding-top: 1rem;
    padding-bottom: 1.5rem;
}
@media (min-width: 768px) {
    .page-container { padding-top: 2rem; }
}

/* ---------- Surfaces ---------- */
.card {
    --bs-card-bg: var(--surface);
    --bs-card-color: var(--label);
    border: 0;
    border-radius: var(--radius-card);
}
.shadow-sm { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.02) !important; }
[data-bs-theme="dark"] .shadow-sm { box-shadow: none !important; }

@media (max-width: 575.98px) {
    .card.p-4 { padding: 1.1rem !important; }
    .card.p-3 { padding: 0.9rem !important; }
}
.card p, .card h2, .card h3, .card h4, .card h5 { overflow-wrap: anywhere; }

.list-group {
    --bs-list-group-bg: var(--surface);
    --bs-list-group-color: var(--label);
    --bs-list-group-border-color: var(--separator);
    --bs-list-group-action-hover-bg: var(--fill);
    --bs-list-group-action-active-bg: var(--fill);
    border-radius: var(--radius-card);
}
.list-group-item { border-left: 0; border-right: 0; }

/* ---------- Buttons ---------- */
.btn {
    min-height: 2.75rem;             /* 44px: Apple's minimum touch target */
    border-radius: var(--radius-control);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
.btn-sm { min-height: 2.25rem; border-radius: 0.6rem; font-size: 0.9rem; }

.btn-primary {
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-bg: var(--accent-pressed);
    --bs-btn-hover-border-color: var(--accent-pressed);
    --bs-btn-active-bg: var(--accent-pressed);
    --bs-btn-active-border-color: var(--accent-pressed);
    --bs-btn-disabled-bg: var(--accent);
    --bs-btn-disabled-border-color: var(--accent);
}
/* "Tinted" button: secondary actions without a heavy outline */
.btn-tinted, .btn-outline-primary, .btn-outline-secondary {
    --bs-btn-color: var(--accent);
    --bs-btn-bg: rgba(var(--accent-rgb), 0.12);
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--accent);
    --bs-btn-hover-bg: rgba(var(--accent-rgb), 0.18);
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: var(--accent);
    --bs-btn-active-bg: rgba(var(--accent-rgb), 0.24);
    --bs-btn-active-border-color: transparent;
}
.btn-outline-danger, .btn-danger {
    --bs-btn-color: var(--red);
    --bs-btn-bg: rgba(255, 59, 48, 0.1);
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--red);
    --bs-btn-hover-bg: rgba(255, 59, 48, 0.16);
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: var(--red);
    --bs-btn-active-bg: rgba(255, 59, 48, 0.22);
    --bs-btn-active-border-color: transparent;
}
.btn-success {
    --bs-btn-bg: var(--green);
    --bs-btn-border-color: var(--green);
    --bs-btn-hover-bg: var(--green);
    --bs-btn-active-bg: var(--green);
}

/* ---------- Press feedback: instant, on touch-down ---------- */
.btn,
.bottom-nav a,
.segmented a,
.list-group-item-action,
.tap-card {
    transition:
        transform var(--press-time) var(--ease-out),
        background-color var(--hover-time) ease,
        box-shadow var(--hover-time) ease;
}
.btn:active,
.bottom-nav a:active,
.segmented a:active { transform: scale(var(--press-scale)); }
.list-group-item-action:active { background-color: var(--fill); }
/* Whole-card links: scale the card when its (stretched) link is pressed */
.tap-card:has(.stretched-link:active) { transform: scale(0.985); }

/* Controls inside a tappable card must sit above its stretched link */
.tap-card .card-actions { position: relative; z-index: 2; }

/* ---------- Forms ---------- */
.form-control, .form-select {
    min-height: 2.75rem;
    font-size: 16px;                 /* 16px stops iOS zoom-on-focus */
    border-radius: var(--radius-control);
    background-color: var(--surface);
    border-color: var(--separator);
    color: var(--label);
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.25);
}
.form-label { font-weight: 600; font-size: 0.9rem; }

/* ---------- Top bar (translucent material) ---------- */
.top-nav {
    padding-top: calc(0.5rem + env(safe-area-inset-top));
    padding-bottom: 0.5rem;
    background: var(--material);
    -webkit-backdrop-filter: var(--material-blur);
    backdrop-filter: var(--material-blur);
    /* scroll-edge effect: hairline only once content scrolls underneath */
    box-shadow: 0 0.5px 0 transparent;
    transition: box-shadow 150ms ease-out;
}
.top-nav.is-scrolled { box-shadow: 0 0.5px 0 var(--separator); }
.top-nav .navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--accent);
}
.top-nav .nav-link { color: var(--label-2); font-weight: 500; }
.top-nav .nav-link.active { color: var(--label); font-weight: 600; }

/* iOS-style search field */
.search-field {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 26rem;
}
.search-field i {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--label-2);
    pointer-events: none;
}
.search-field input {
    width: 100%;
    min-height: 2.25rem;
    padding: 0.35rem 0.75rem 0.35rem 2rem;
    border: 0;
    border-radius: 0.6rem;
    background: var(--fill);
    color: var(--label);
    font-size: 16px;
}
.search-field input::placeholder { color: var(--label-2); }
.search-field input:focus { outline: 2px solid rgba(var(--accent-rgb), 0.5); outline-offset: 0; }

/* ---------- Bottom tab bar (translucent material, phones) ---------- */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    display: flex;
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--material);
    -webkit-backdrop-filter: var(--material-blur);
    backdrop-filter: var(--material-blur);
    box-shadow: 0 -0.5px 0 var(--separator);
}
.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--label-2);
}
.bottom-nav a i { font-size: 1.4rem; line-height: 1; }
.bottom-nav a.active { color: var(--accent); }

/* ---------- Segmented control (feed switcher) ---------- */
.segmented {
    display: flex;
    padding: 2px;
    margin-bottom: 1rem;
    border-radius: 0.6rem;
    background: var(--fill);
}
.segmented a {
    flex: 1;
    padding: 0.4rem 0.5rem;
    border-radius: 0.5rem;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--label);
}
.segmented a.active {
    background: var(--surface);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.04);
}
[data-bs-theme="dark"] .segmented a.active { background: #636366; }

/* ---------- Post card ---------- */
.post-card .card-body { padding: 1rem 1.1rem; }
.post-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}
.post-title {
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin-bottom: 0.25rem;
}
.post-title a { color: var(--label); }
.post-body { color: var(--label-2); margin-bottom: 0.6rem; }
.post-card .card-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0 1.1rem 1rem;
}

/* ---------- Avatars & chips ---------- */
.avatar {
    --size: 2rem;
    flex: 0 0 auto;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: calc(var(--size) * 0.45);
    color: #fff;
    background: hsl(var(--hue, 210), 55%, var(--avatar-l, 38%));   /* lightness per hue: see avatarLightness() */
}
.avatar-lg { --size: 4rem; }
/* Profile picture fills the circle */
.avatar.has-photo { background: var(--fill); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
    background: var(--fill);
    color: var(--label-2);
}
.chip-accent { background: rgba(var(--accent-rgb), 0.12); color: var(--accent); }
.chip-do     { background: rgba(var(--green-rgb), 0.15);  color: #248a3d; }   /* iOS accessible green for text */
[data-bs-theme="dark"] .chip-do { color: var(--green); }
.chip-learn  { background: rgba(var(--indigo-rgb), 0.15); color: var(--indigo); }
.chip-pending { background: transparent; color: var(--label-2); box-shadow: inset 0 0 0 1px var(--separator, rgba(60, 60, 67, 0.29)); border: 0; }  /* outlined = not live yet */

/* ---------- Admin: pastime suggestion review ---------- */
.review-card .review-actions { display: grid; gap: 0.75rem; }
@media (min-width: 768px) {
    .review-card .review-actions { grid-template-columns: 1fr 1fr; }
    .review-card .review-approve { grid-column: 1 / -1; }
}

/* ---------- Back link (wayfinding on detail pages) ---------- */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    margin-bottom: 0.5rem;
    min-height: 2.75rem;
    font-size: 1.0625rem;
    color: var(--accent);
}

/* ---------- Empty states ---------- */
.empty-state {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--label-2);
}
.empty-state i { font-size: 2.25rem; display: block; margin-bottom: 0.5rem; }

/* ---------- Auth pages (login / sign up) ---------- */
.auth-page { padding-bottom: 0; min-height: 100svh; }  /* svh: never cut off by the URL bar */
/* Flat form on the white page (like New post), no card */
.auth-card { width: 100%; max-width: 24rem; }
.auth-title { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; text-align: center; margin: 0 0 0.35rem; }
.auth-sub { text-align: center; color: var(--label-muted); margin-bottom: 1.75rem; }
.auth-icon { display: block; font-size: 2.5rem; color: var(--accent); margin-bottom: 0.5rem; }
/* Header: same box as the app's header so the logo doesn't move when you log in
   (desktop: 1128px container, 36px row, 8px padding → logo at the same x/y; phones: where the page title sits) */
.auth-nav {
    padding: calc(0.5rem + env(safe-area-inset-top)) 0 0.5rem;
    background: var(--material);
    -webkit-backdrop-filter: var(--material-blur);
    backdrop-filter: var(--material-blur);
    box-shadow: 0 0.5px 0 var(--separator);
}
.auth-nav-inner { max-width: 1128px; min-height: 36px; display: flex; align-items: center; }
.auth-nav .navbar-brand { margin: 0; padding: 0; }
@media (max-width: 767.98px) {
    .auth-nav { background: #f9f9f9; -webkit-backdrop-filter: none; backdrop-filter: none; }
    [data-bs-theme="dark"] .auth-nav { background: #1c1c1e; }
    .auth-nav-inner { min-height: 2.9rem; padding: 0 1rem; }
}

/* ---------- Nav: Messages icon + unread badge ---------- */
.nav-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2.75rem;                  /* 44px touch target */
    height: 2.75rem;
    margin-right: -0.5rem;
    font-size: 1.4rem;
    color: var(--label);
}
.nav-icon.active { color: var(--accent); }
.icon-wrap { position: relative; display: inline-flex; }
.nav-badge {
    position: absolute;
    top: 0.3rem;
    right: 0.2rem;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.1rem;
    text-align: center;
    box-shadow: 0 0 0 2px var(--surface);
}
.icon-wrap .nav-badge { top: -0.35rem; right: -0.7rem; }

/* ---------- Messages: inbox ---------- */
.inbox-preview { color: var(--label-2); font-size: 0.9375rem; }
.is-unread .inbox-preview { color: var(--label); font-weight: 600; }
.unread-dot {
    flex: 0 0 auto;
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
    background: var(--accent);
}

/* ---------- Messages: compose (New message) ---------- */
.compose-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-width: 2.75rem;                /* 44px touch target */
    height: 2.75rem;
    padding: 0 0.6rem;
    border-radius: 999px;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.95rem;
    -webkit-user-select: none;
    user-select: none;
    transition: transform var(--press-time) var(--ease-out), background-color var(--hover-time) ease;
}
.compose-btn i { font-size: 1.35rem; line-height: 1; }
.compose-btn:active { transform: scale(var(--press-scale)); background: rgba(var(--accent-rgb), 0.12); }
@media (min-width: 768px) {
    .compose-btn { background: rgba(var(--accent-rgb), 0.12); padding: 0 0.9rem; height: 2.25rem; }
    .compose-btn i { font-size: 1.05rem; }
}
@media (hover: hover) and (pointer: fine) { .compose-btn:hover { background: rgba(var(--accent-rgb), 0.18); } }

.compose-search { max-width: none; }
.compose-search input { min-height: 2.75rem; }

.compose-list .list-group-item { border-left: 0; border-right: 0; }
.compose-person {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    min-height: 3.75rem;
    padding: 0.6rem 1rem;
    border: 0;
    background: transparent;
    color: var(--label);
    font: inherit;
    text-align: left;
    -webkit-user-select: none;
    user-select: none;
    transition: background-color var(--hover-time) ease;
}
.compose-person:active { background: var(--fill); }
.compose-person:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) { .compose-person:hover { background: var(--fill); } }

/* ---------- Messages: conversation ---------- */
body.no-tabbar { padding-bottom: 0; }

.thread-container {
    display: flex;
    flex-direction: column;
    /* fill the visible screen so the composer sits at the bottom; dvh tracks the URL bar & keyboard */
    min-height: calc(100dvh - 3.5rem - env(safe-area-inset-top, 0px));
    padding-top: 0.5rem;
}
.thread-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0 0.75rem;
    border-bottom: 1px solid var(--separator);
}
.thread-header .back-link { margin: 0 0 0 -0.4rem; font-size: 1.4rem; min-width: 2.25rem; }

.thread {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
}
.thread-empty { margin: auto; padding: 2rem 1rem; text-align: center; }
.thread-time { text-align: center; margin: 1rem 0 0.5rem; }

.bubble-row { display: flex; margin-top: 0.5rem; }
.bubble-row.continued { margin-top: 0.15rem; }
.bubble-row.mine { justify-content: flex-end; }
.bubble {
    max-width: min(78%, 30rem);
    padding: 0.5rem 0.85rem;
    border-radius: 1.15rem;
    font-size: 1rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.bubble-text { white-space: pre-wrap; }   /* keep line breaks the sender typed */

/* Photo bubbles: the photo fills the bubble; any text sits underneath */
.bubble.has-photo { padding: 0.2rem; max-width: min(70%, 17rem); }
/* Photo with no text: just the photo, no colored frame (like iMessage) */
.bubble.has-photo:not(:has(.bubble-text)) { padding: 0; background: none; box-shadow: none; }
.bubble.has-photo .bubble-text { display: block; padding: 0.3rem 0.65rem 0.3rem; }
.bubble-photo-link { display: block; }
.bubble-photo {
    display: block;
    width: 100%;
    height: auto;                    /* width/height attributes reserve the space (no jump) */
    max-height: 22rem;
    object-fit: cover;
    border-radius: 0.95rem;
    background: var(--fill);
}

/* ---------- Photos on posts ---------- */
.post-photo {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;             /* consistent cards in the feed */
    object-fit: cover;
    border-radius: 0.75rem;
    background: var(--fill);
}
.post-photo-full {
    display: block;
    width: 100%;
    height: auto;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 0.75rem;
    background: var(--fill);
}
.post-content { white-space: pre-line; overflow-wrap: anywhere; }

/* ---------- Photo pop-up (lightbox, public/js/lightbox.js) ----------
   animate skill: occasional (tens/day) → standard modal motion.
   Purpose: spatial consistency (the photo grows into view).
   CSS transition + @starting-style, transform/opacity only, 200ms strong ease-out.
   Modals stay centered (no trigger-anchored origin). */
.lightbox-trigger { cursor: zoom-in; }

.lightbox {
    width: auto;
    max-width: min(92vw, 1100px);
    max-height: 88dvh;
    padding: 0;
    border: 0;
    border-radius: 0.875rem;
    background: transparent;
    overflow: visible;
    /* Fade the dialog, scale the photo. (A transform on the dialog itself would make the
       fixed-position × button position against the dialog instead of the screen.) */
    opacity: 1;
    transition: opacity 200ms var(--ease-out);
}
/* Center the photo inside the dialog (when the photo is shrunk to fit the screen height,
   the dialog can be wider than it). Only while open: a closed <dialog> must stay display:none. */
.lightbox[open] {
    display: flex;
    align-items: center;
    justify-content: center;
}
@starting-style {
    .lightbox[open] { opacity: 0; }
    .lightbox[open] .lightbox-img { transform: scale(0.96); }
}
.lightbox::backdrop {
    background: rgba(0, 0, 0, 0.82);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.lightbox-img {
    display: block;
    width: auto;
    height: auto;
    max-width: min(92vw, 1100px);
    max-height: 88dvh;
    object-fit: contain;
    border-radius: 0.875rem;
    background: rgba(255, 255, 255, 0.06);
    transform: scale(1);
    transition: transform 200ms var(--ease-out);
}
.lightbox-close {
    position: fixed;
    top: calc(0.75rem + env(safe-area-inset-top, 0px));
    right: 0.75rem;
    z-index: 1;
    width: 2.75rem;                  /* 44px touch target */
    height: 2.75rem;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 1.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-user-select: none;
    user-select: none;
    transition: transform var(--press-time) var(--ease-out), background-color var(--hover-time) ease;
}
.lightbox-close:active { transform: scale(0.92); }
.lightbox-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .lightbox-close:hover { background: rgba(255, 255, 255, 0.28); } }
html.lightbox-open { overflow: hidden; }   /* page behind doesn't scroll while the photo is open */

@media (prefers-reduced-motion: reduce) {
    .lightbox-img { transition: none !important; }          /* keep the fade, drop the scale */
    .lightbox { transition: opacity 200ms ease !important; }
    @starting-style { .lightbox[open] .lightbox-img { transform: none; } }
}
@media (prefers-reduced-transparency: reduce) {
    .lightbox::backdrop { background: rgba(0, 0, 0, 0.92); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* Selected-photo preview (forms + composer) */
.photo-preview { position: relative; display: inline-block; max-width: 100%; }
.photo-preview img {
    display: block;
    max-width: 100%;
    max-height: 14rem;
    border-radius: 0.75rem;
    background: var(--fill);
}
.photo-remove {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.composer-photo { margin-bottom: 0.5rem; }
.composer-photo img { max-height: 7rem; }
.attach-btn {
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--accent);
    font-size: 1.3rem;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transition: transform var(--press-time) var(--ease-out), background-color var(--hover-time) ease;
}
.attach-btn:active { transform: scale(0.92); background: var(--fill); }
@media (hover: hover) and (pointer: fine) { .attach-btn:hover { background: var(--fill); } }
/* Keyboard users: the file input is visually hidden, so show its focus on the visible button/label */
.composer-row:has(#message-photo:focus-visible) .attach-btn,
div:has(> input[type="file"][data-photo-input]:focus-visible) > label.btn {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.mine .bubble   { background: var(--accent); color: #fff; border-bottom-right-radius: 0.35rem; }
.theirs .bubble { background: var(--surface); color: var(--label); border-bottom-left-radius: 0.35rem; }
[data-bs-theme="light"] .theirs .bubble { box-shadow: 0 0 0 1px var(--separator); }

/* New bubbles (sent or received live) — animate skill: tens/day → subtle.
   Purpose: feedback (sent) / prevent a jarring jump (received). CSS transition + @starting-style,
   transform+opacity only, 200ms strong ease-out. */
.bubble-row.is-new .bubble {
    transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
@starting-style {
    .bubble-row.is-new .bubble { opacity: 0; transform: translateY(0.375rem); }
}

.composer {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin: 0 calc(var(--bs-gutter-x, 1.5rem) * -0.5);
    padding: 0.5rem calc(var(--bs-gutter-x, 1.5rem) * 0.5) calc(0.5rem + env(safe-area-inset-bottom, 0px));
    background: var(--material);
    -webkit-backdrop-filter: var(--material-blur);
    backdrop-filter: var(--material-blur);
    box-shadow: 0 -0.5px 0 var(--separator);
}
.composer-row { display: flex; align-items: flex-end; gap: 0.5rem; }
.composer textarea {
    flex: 1;
    min-height: 2.5rem;
    max-height: 8.75rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--separator);
    border-radius: 1.25rem;
    background: var(--surface);
    color: var(--label);
    font-size: 16px;                 /* no iOS zoom */
    line-height: 1.4;
    resize: none;
}
.composer textarea:focus { outline: none; border-color: var(--accent); }
.composer-error { color: var(--red); margin: 0 0 0.35rem; }
.send-btn {
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 1.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--press-time) var(--ease-out), opacity var(--hover-time) ease;
}
.send-btn:active { transform: scale(0.92); }
.send-btn:disabled { opacity: 0.5; }

@media (min-width: 768px) {
    .thread-container { min-height: calc(100dvh - 3.75rem); }
    .composer { margin: 0; padding: 0.75rem 0 1rem; background: var(--page-bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* ---------- Pastime picker (suggestions while typing) ---------- */
.picker { position: relative; }
.picker-list {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 0.25rem);
    z-index: 20;
    max-height: 16rem;
    overflow-y: auto;
    overscroll-behavior: contain;      /* scrolling the list doesn't scroll the page */
    margin: 0;
    padding: 0.25rem;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--separator);
    border-radius: var(--radius-control);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.picker-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 2.75rem;               /* 44px touch target */
    padding: 0.4rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}
.picker-option.is-active { background: rgba(var(--accent-rgb), 0.12); }
.picker-option.is-new .picker-name { color: var(--accent); font-weight: 600; }
.picker-meta { font-size: 0.8125rem; color: var(--label-2); white-space: nowrap; }
@media (pointer: fine) { .picker-option { min-height: 2.25rem; } }

/* ---------- Two-option choice (I do / I want to learn) ---------- */
.choice-group { display: flex; gap: 0.5rem; }
.choice {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.75rem;
    padding: 0.5rem 0.75rem;
    border: 1.5px solid var(--separator);
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--label);
    font-weight: 600;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transition: border-color var(--hover-time) ease, background-color var(--hover-time) ease, transform var(--press-time) var(--ease-out);
}
.choice:active { transform: scale(var(--press-scale)); }
.btn-check:checked + .choice { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.1); color: var(--accent); }
.btn-check:focus-visible + .choice { box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.3); }
@media (pointer: fine) { .choice { min-height: 2.375rem; } }

/* ---------- Small bits ---------- */
.count-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}
.btn-link-plain {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    cursor: pointer;
}
.profile-bio { white-space: pre-line; overflow-wrap: anywhere; }
.premium-list { list-style: none; padding: 0; }
.premium-list li { display: flex; gap: 0.6rem; padding: 0.3rem 0; }
.premium-list i { color: var(--accent); }
fieldset legend.form-label { float: none; font-size: 0.9rem; margin-bottom: 0.5rem; }

/* ---------- Sidebars (tablet/desktop pages with 3 columns) ---------- */
.sidebar-sticky { position: sticky; top: 5rem; }
.sidebar-label {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--label);
}
.sidebar-section { padding-top: 0.9rem; }
.sidebar-links { overflow: hidden; }
.sidebar-links a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    color: var(--label);
    font-weight: 500;
    transition: background-color var(--hover-time) ease;
}
.sidebar-links a + a { border-top: 1px solid var(--separator); }
.sidebar-links a i { color: var(--label-2); font-size: 1.1rem; }
.sidebar-links a .count { margin-left: auto; color: var(--label-2); font-size: 0.875rem; }
.sidebar-links a:active { background: var(--fill); }
.suggestion {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    color: var(--label);
}

/* ---------- Desktop top-bar items (icon + label) ---------- */
.desk-nav { align-items: stretch; align-self: stretch; }
.desk-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    min-width: 4.5rem;
    padding: 0 0.5rem;
    margin-bottom: -0.5rem;          /* underline sits on the bar's bottom edge */
    border-bottom: 2px solid transparent;
    color: var(--label-2);
    font-size: 0.75rem;
    transition: color var(--hover-time) ease, border-color var(--hover-time) ease;
}
.desk-item i { font-size: 1.3rem; line-height: 1; }
.desk-item.active { color: var(--label); border-bottom-color: var(--label); }

/* =============================================================================
   Tablet & desktop (≥768px): a website, not a phone app
   - solid header with a hairline, no frosted glass
   - smaller headings, tighter corners, tabs instead of the iOS segmented control
   - no back links / row chevrons (the browser has a back button)
   ============================================================================= */
@media (min-width: 768px) {
    :root { --radius-card: 0.625rem; --radius-control: 0.5rem; }

    .top-nav {
        padding-top: 0.5rem;
        background: var(--surface);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        box-shadow: 0 1px 0 var(--separator);
    }
    .top-nav.is-scrolled { box-shadow: 0 1px 0 var(--separator); }

    .page-title { font-size: 1.5rem; letter-spacing: -0.015em; margin-bottom: 0.75rem; }
    .section-title { font-size: 1.05rem; }

    .chev { display: none; }

    /* Segmented control → underline tabs */
    .segmented {
        padding: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: inset 0 -1px 0 var(--separator);
        gap: 1.5rem;
    }
    .segmented a {
        flex: 0 0 auto;
        padding: 0.6rem 0.1rem;
        border-radius: 0;
        color: var(--label-2);
        border-bottom: 2px solid transparent;
    }
    .segmented a.active,
    [data-bs-theme="dark"] .segmented a.active {
        background: transparent;
        box-shadow: none;
        color: var(--label);
        border-bottom-color: var(--accent);
    }
    .segmented a:active { transform: none; }

    .bottom-nav { display: none; }
}

@media (max-width: 991.98px) {
    .desk-item span { display: none; }   /* tablet: icons only, labels on desktop */
    .desk-item { min-width: 3rem; }
}

/* Mouse/trackpad: normal-size controls (44px targets are for fingers) */
@media (pointer: fine) {
    .btn { min-height: 2.25rem; }
    .btn-sm { min-height: 2rem; }
    .form-control, .form-select { min-height: 2.375rem; }
    .back-link { min-height: auto; }
}

/* Hover only where a real hover exists (mobile-native: no sticky hover after a tap) */
@media (hover: hover) and (pointer: fine) {
    .tap-card:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04) !important; cursor: pointer; }
    [data-bs-theme="dark"] .tap-card:hover { background-color: #232325; }
    .tap-card:hover .post-title a { text-decoration: underline; }
    .desk-item:hover { color: var(--label); }
    .sidebar-links a:hover { background: var(--fill); }
    .suggestion:hover .fw-semibold { text-decoration: underline; }
    .segmented a:hover { color: var(--label); }
}

/* Touch: neutralize Bootstrap's built-in :hover colors so they don't stick after a tap */
@media (hover: none) {
    .btn:hover {
        color: var(--bs-btn-color);
        background-color: var(--bs-btn-bg);
        border-color: var(--bs-btn-border-color);
    }
    .list-group-item-action:hover { background-color: var(--surface); }
}

/* =============================================================================
   Accessibility preferences
   ============================================================================= */

/* Reduced motion: keep feedback, drop the movement */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
    .btn:active,
    .bottom-nav a:active,
    .segmented a:active,
    .tap-card:has(.stretched-link:active) { transform: none; opacity: 0.7; }

    /* New message bubbles: keep a gentle fade (aids comprehension), drop the movement */
    .bubble-row.is-new .bubble {
        transition-property: opacity !important;
        transition-duration: 200ms !important;
    }
}
@media (prefers-reduced-motion: reduce) {
    @starting-style {
        .bubble-row.is-new .bubble { transform: none; }
    }
}

/* Reduced transparency: solid bars instead of frosted glass */
@media (prefers-reduced-transparency: reduce) {
    .top-nav, .bottom-nav, .auth-nav {
        background: var(--surface);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

/* Increased contrast: solid surfaces with defined edges */
@media (prefers-contrast: more) {
    :root { --label-2: rgba(60, 60, 67, 0.85); --separator: rgba(60, 60, 67, 0.5); }
    [data-bs-theme="dark"] { --label-2: rgba(235, 235, 245, 0.85); --separator: rgba(235, 235, 245, 0.5); }
    .top-nav, .bottom-nav, .auth-nav { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
    .top-nav { box-shadow: 0 1px 0 var(--separator); }
    .card, .list-group { outline: 1px solid var(--separator); }
}

/* ---------- Group icons (groupIcon() in index.js) ---------- */
/* Rounded square = a group; circle = a person */
.avatar.group-icon { border-radius: 26%; font-size: calc(var(--size) * 0.38); letter-spacing: -0.01em; }
.avatar.group-icon img { border-radius: inherit; }
.avatar.group-icon.is-emoji { font-size: calc(var(--size) * 0.56); line-height: 1; }

/* Icon editor (views/partials/groupIconFields.ejs) */
.group-icon-editor { border: 0; padding: 0; min-width: 0; }
.icon-preview { display: inline-flex; }
.emoji-input { font-size: 1.0625rem; max-width: 16rem; }
.emoji-picks { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.emoji-pick {
    width: 2.75rem; height: 2.75rem;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.4rem; line-height: 1;
    border: 0; border-radius: 0.6rem; background: var(--fill);
    transition: transform 120ms var(--ease-out);
    touch-action: manipulation;
}
.emoji-pick:active { transform: scale(0.92); }
@media (hover: hover) and (pointer: fine) { .emoji-pick:hover { background: rgba(var(--accent-rgb), 0.12); } }
.swatch-row { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.swatch {
    width: 2.75rem; height: 2.75rem;                        /* 44px touch target */
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; cursor: pointer; position: relative;
    color: #fff; font-size: 1rem;
    touch-action: manipulation;
}
.swatch::before {                                         /* the visible dot */
    content: ""; position: absolute; inset: 0.3rem; border-radius: 50%;
    background: var(--swatch, var(--fill));
    transition: transform 120ms var(--ease-out);
}
.swatch > i { position: relative; }
.btn-check:checked + .swatch::before { box-shadow: 0 0 0 2px var(--bs-body-bg, #fff), 0 0 0 4px var(--accent); }
.btn-check:focus-visible + .swatch::before { box-shadow: 0 0 0 2px var(--bs-body-bg, #fff), 0 0 0 4px rgba(var(--accent-rgb), 0.5); }
.swatch:active::before { transform: scale(0.9); }
@media (prefers-reduced-motion: reduce) { .emoji-pick, .swatch::before { transition: none; } }

/* "Run by @owner" on the group page */
.owner-link { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; color: var(--label); text-decoration: none; min-height: 2.75rem; }
@media (hover: hover) and (pointer: fine) { .owner-link:hover { text-decoration: underline; } }

/* Count inside a segmented tab ("Do together 3") */
.seg-count { font-size: 0.75em; font-weight: 600; opacity: 0.65; margin-left: 0.15rem; }

/* ---------- Page tabs (Discover: Feed | People) — underlined on every screen size ---------- */
.page-tabs {
    display: flex;
    gap: 1.5rem;
    border-bottom: 1px solid var(--separator);
    margin-bottom: 0.75rem;
}
.page-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;                    /* 44px touch target */
    margin-bottom: -1px;                    /* the underline sits on the border */
    padding: 0 0.1rem;
    border-bottom: 2px solid transparent;
    color: var(--label-2);
    font-size: 1.0625rem;
    font-weight: 600;
    text-decoration: none;
    transition: color var(--hover-time) ease, border-color var(--hover-time) ease;
    touch-action: manipulation;
}
.page-tabs a.active { color: var(--label); border-bottom-color: var(--accent); }
@media (hover: hover) and (pointer: fine) { .page-tabs a:hover { color: var(--label); } }

/* ---------- Filter chips (second-level choices under page tabs) ---------- */
.filter-chips {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    overflow-x: auto;                        /* scrolls sideways on very narrow phones instead of wrapping */
    scrollbar-width: none;
    overscroll-behavior-x: contain;
}
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chips a {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0 0.95rem;
    border-radius: 999px;
    background: var(--fill);
    color: var(--label);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    transition: transform var(--press-time) var(--ease-out), background-color var(--hover-time) ease;
    touch-action: manipulation;
    user-select: none;
}
.filter-chips a:active { transform: scale(var(--press-scale)); }
.filter-chips a.active { background: var(--accent); color: #fff; }
.filter-chips a.active .seg-count { opacity: 0.85; }
@media (pointer: fine) { .filter-chips a { min-height: 2.25rem; } }
@media (prefers-reduced-motion: reduce) { .filter-chips a, .page-tabs a { transition: none; } }
.filter-chips a { gap: 0.35rem; }
.filter-chips a .seg-count { margin-left: 0; font-size: 0.8em; line-height: 1; }

/* A pastime you share with this person (Near You → People) */
.shared-pastime { color: #248a3d; font-weight: 600; }
[data-bs-theme="dark"] .shared-pastime { color: var(--green); }

/* ---------- Discover feed tiers ---------- */
.feed-divider { margin: 1.5rem 0 0.75rem; }
.feed-divider-done {
    display: flex; align-items: center; justify-content: center; gap: 0.4rem;
    margin-bottom: 1rem; padding-bottom: 1rem;
    border-bottom: 1px solid var(--separator);
    color: var(--label-2); font-size: 0.875rem;
}
.feed-divider-done i { color: var(--green); }
.feed-divider-title { font-size: 0.8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--label-2); margin: 0; }
.feed-hint i { font-size: 1.25rem; color: var(--accent); }
.feed-divider-done { flex-direction: column; gap: 0.25rem; text-align: center; }
.feed-divider-done i { font-size: 1.5rem; }

/* =============================================================================
   PHONE HEADER — "Capsule" (chosen Nov 26 from a 3-way prototype)
   Title left, frosted capsule right (search · messages · requests), page tabs under it.
   Stays fixed while scrolling (sticky .top-nav). Desktop keeps the website header.
   ============================================================================= */
.mh { display: block; padding: 0 1rem; }
.mh-row { display: flex; align-items: center; gap: 0.75rem; min-height: 2.9rem; }
.mh > .mh-row:last-child { padding-bottom: 0.6rem; }   /* no tabs underneath: a little room under the capsule */
.mh-title {
    flex: 1; min-width: 0; margin: 0;
    font-size: 1.625rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1;   /* 26px */
    color: var(--label); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mh-brand { color: var(--accent); text-decoration: none; }
.mh-capsule {
    display: flex; align-items: center; flex: 0 0 auto; padding: 0 0.1rem; border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 0 0 1px var(--separator), 0 2px 10px rgba(0, 0, 0, 0.06);
    /* no backdrop blur: the capsule sits on the header, so a blur never showed and cost the most (nested blur) */
}
[data-bs-theme="dark"] .mh-capsule { background: #2c2c2e; }
.mh-cap-btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 2.75rem; height: 2.75rem; color: var(--label); font-size: 1.25rem; text-decoration: none;
    touch-action: manipulation; transition: transform var(--press-time) var(--ease-out);
}
.mh-cap-btn:active { transform: scale(0.9); }
.mh-cap-btn.active { color: var(--accent); }
.mh-badge {
    position: absolute; top: 0.3rem; right: 0.15rem; min-width: 1.05rem; height: 1.05rem; padding: 0 0.25rem;
    border-radius: 999px; background: var(--red); color: #fff; font-size: 0.68rem; font-weight: 700; line-height: 1.05rem; text-align: center;
}
.mh-dot { position: absolute; top: 0.6rem; right: 0.65rem; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--surface); }
.mh-tabs { display: flex; gap: 1.5rem; margin-top: 0.55rem; overflow-x: auto; scrollbar-width: none; }
.mh-tabs::-webkit-scrollbar { display: none; }
.mh-tabs a {
    flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 2.5rem;
    border-bottom: 2px solid transparent; margin-bottom: -0.5rem;     /* underline sits on the bar's bottom edge */
    color: var(--label-2); font-weight: 600; text-decoration: none; touch-action: manipulation;
}
.mh-tabs a.active { color: var(--label); border-bottom-color: var(--accent); }

/* Search screen */
.mh-search {
    position: fixed; inset: 0; z-index: 2000; background: var(--page-bg);
    padding: calc(env(safe-area-inset-top, 0px) + 0.6rem) 1rem 1rem; animation: mh-sheet 220ms var(--ease-out);
}
@keyframes mh-sheet { from { opacity: 0; transform: translateY(0.75rem); } }
.mh-search-bar { display: flex; align-items: center; gap: 0.75rem; }
.mh-search-field { flex: 1; display: flex; align-items: center; gap: 0.5rem; height: 2.5rem; margin: 0; padding: 0 0.75rem; border-radius: 0.75rem; background: var(--fill); }
.mh-search-field i { color: var(--label-2); }
.mh-search-field input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 16px; color: var(--label); }  /* 16px: no zoom */
.mh-search-cancel { border: 0; background: none; color: var(--accent); font-size: 1rem; min-height: 2.75rem; }
.mh-search-hint { margin: 1rem 0.25rem; color: var(--label-2); font-size: 0.875rem; }
@media (prefers-reduced-motion: reduce) { .mh-search { animation-name: mh-fade; } }
@keyframes mh-fade { from { opacity: 0; } }

/* =============================================================================
   FEED POST — "Edge" (chosen Nov 26 from a 3-way prototype)
   No card: white page, edge-to-edge photo (screen on phones, middle column on desktop),
   hairline between posts. Likes, comments and "I'm in" (Roster) come with those features.
   ============================================================================= */
body.page-white { --page-bg: #ffffff; background: #ffffff; }
[data-bs-theme="dark"] body.page-white { --page-bg: #000000; background: #000000; }
body.page-white .card,
body.page-white .list-group { box-shadow: none !important; border: 1px solid var(--separator); }
body.page-white .list-group .list-group-item { border-color: var(--separator); }
:root { --label-muted: #6e6e73; }                     /* ≈ 4.9:1 on white (WCAG AA) */
[data-bs-theme="dark"] { --label-muted: #98989f; }

.fp { position: relative; padding-bottom: 0.75rem; margin-bottom: 0.25rem; border-bottom: 1px solid var(--separator); }
.fp-head { display: flex; align-items: center; gap: 0.6rem; min-height: 3.25rem; }
.fp-head .avatar { flex: 0 0 auto; }
.fp-who { flex: 1; min-width: 0; line-height: 1.2; }
.fp-name-line { display: flex; align-items: baseline; gap: 0.3rem; min-width: 0; font-size: 0.875rem; }
.fp-username { font-weight: 600; color: var(--label); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-muted { color: var(--label-muted); white-space: nowrap; }
.fp-sub { color: var(--label-muted); font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.fp-icon {
    display: inline-flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem;
    padding: 0; border: 0; background: none; color: var(--label); font-size: 1.5rem; line-height: 1;
    touch-action: manipulation; transition: transform var(--press-time) var(--ease-out), opacity var(--hover-time) ease;
}
.fp-icon:active { transform: scale(0.88); }
@media (hover: hover) and (pointer: fine) { .fp-icon:hover { opacity: 0.6; } }
.fp-more { font-size: 1.15rem; margin-right: -0.6rem; }

.fp-media { display: block; aspect-ratio: 4 / 5; background: var(--fill); overflow: hidden; }
.fp-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fp-text { display: block; color: var(--label); text-decoration: none; padding: 0.1rem 0 0.2rem; }
.fp-text h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; margin: 0 0 0.35rem; }
.fp-text p { font-size: 1rem; line-height: 1.45; margin: 0; }
.fp-actions { display: flex; align-items: center; margin-inline: -0.6rem; }
.fp-caption { font-size: 0.875rem; margin: 0 0 0.15rem; color: var(--label); }
.fp-caption .fp-username { margin-right: 0.2rem; }
.fp-contact { font-size: 0.8125rem; color: var(--label-muted); margin: 0.1rem 0 0; }

/* Clamp + "more" link (added by JS only when text is actually cut off) */
.fp-clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.fp-text .fp-clamp { -webkit-line-clamp: 4; }
.fp-clamp.is-open { display: block; -webkit-line-clamp: unset; }
.fp-more-link { display: block; border: 0; background: none; padding: 0; min-height: 1.5rem; color: var(--label-muted); font-size: 0.875rem; }

/* ••• menu */
.fp-menu-wrap { position: relative; }
.fp-menu {
    position: absolute; right: -0.5rem; top: 100%; z-index: 20; min-width: 12rem; padding: 0.35rem;
    background: var(--surface); border-radius: 0.8rem; transform-origin: top right;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16), 0 0 0 1px var(--separator);
    animation: fp-pop 150ms var(--ease-out);
}
@keyframes fp-pop { from { opacity: 0; transform: scale(0.96); } }
.fp-menu a, .fp-menu button {
    display: flex; align-items: center; gap: 0.6rem; width: 100%; min-height: 2.75rem; padding: 0 0.75rem;
    border: 0; border-radius: 0.55rem; background: none; color: var(--label); text-decoration: none; font-size: 0.9375rem; text-align: left;
}
.fp-menu a:active, .fp-menu button:active { background: var(--fill); }
.fp-menu .fp-danger { color: var(--red); }
.fp-menu form { margin: 0; }

/* Phones: photo and dividers reach the screen edges */
@media (max-width: 767.98px) {
    .fp { margin-inline: calc(50% - 50vw); padding-inline: 1rem; }
    .fp-media { margin-inline: -1rem; }
}
@media (prefers-reduced-motion: reduce) { .fp-icon { transition: none; } .fp-menu { animation-name: mh-fade; } }

/* Phone header: a little more air at the top (plus the notch, automatically), a little smaller overall */
@media (max-width: 767.98px) {
    .top-nav { padding-top: calc(0.75rem + env(safe-area-inset-top, 0px)); padding-bottom: 0.4rem; }
    .mh-row { min-height: 2.6rem; }
    .mh-title { font-size: 1.5rem; }                       /* 24px */
    .mh-cap-btn { height: 2.5rem; font-size: 1.125rem; }   /* 44px wide, 40px tall */
    .mh-badge { top: 0.2rem; }
    .mh-dot { top: 0.5rem; }
    .mh-tabs a { min-height: 2.25rem; margin-bottom: -0.4rem; }
}
/* Bootstrap's ".navbar > .container" is a flex row; the phone header must stack (title row, then tabs) */
.top-nav > .mh { display: block; width: 100%; }
.fp-actions { margin-top: -0.25rem; }
.mh-tabs a, .mh-tabs a { margin-bottom: 0; }           /* keep the active underline inside the (scrollable) tab row */
@media (max-width: 767.98px) { .mh-tabs a { margin-bottom: 0; } .top-nav { padding-bottom: 0.15rem; } }

/* =============================================================================
   CONTRAST FIXES (WCAG AA), found by a dark-mode contrast sweep (Nov 26)
   ============================================================================= */
/* Solid blue fills with white text: iOS #007aff / #0a84ff only reach ~3.7:1, #0071e3 reaches 4.7:1 */
:root { --accent-fill: #0071e3; --accent-fill-pressed: #0062c4; --badge-red: #d70015; }
.btn-primary {
    --bs-btn-bg: var(--accent-fill); --bs-btn-border-color: var(--accent-fill);
    --bs-btn-hover-bg: var(--accent-fill-pressed); --bs-btn-hover-border-color: var(--accent-fill-pressed);
    --bs-btn-active-bg: var(--accent-fill-pressed); --bs-btn-active-border-color: var(--accent-fill-pressed);
    --bs-btn-disabled-bg: var(--accent-fill); --bs-btn-disabled-border-color: var(--accent-fill);
}
.filter-chips a.active, .mine .bubble { background: var(--accent-fill); }
/* Red badges with white numbers */
.nav-badge, .count-pill, .mh-badge { background: var(--badge-red); }

/* Dark mode: blue / indigo TEXT on tinted backgrounds needs a lighter shade */
[data-bs-theme="dark"] .btn-tinted,
[data-bs-theme="dark"] .btn-outline-primary,
[data-bs-theme="dark"] .btn-outline-secondary {
    --bs-btn-color: #4da3ff; --bs-btn-hover-color: #4da3ff; --bs-btn-active-color: #4da3ff;
}
[data-bs-theme="dark"] .chip-accent,
[data-bs-theme="dark"] .btn-check:checked + .choice { color: #4da3ff; }
[data-bs-theme="dark"] .chip-learn { color: #a9a7ff; }

.filter-chips a.active .seg-count { opacity: 1; }

/* Likes + comments on feed posts */
.fp-like[aria-pressed="true"] i { color: var(--accent); }
.fp-likes { font-weight: 600; font-size: 0.875rem; margin: -0.15rem 0 0.15rem; }
.fp-likes:empty { display: none; }
.fp-comments { display: inline-block; font-size: 0.875rem; color: var(--label-muted); text-decoration: none; margin-top: 0.1rem; }
@media (hover: hover) and (pointer: fine) { .fp-comments:hover { text-decoration: underline; } }

/* Comments (post page) */
.cm { display: flex; gap: 0.6rem; padding: 0.6rem 0; scroll-margin-top: 6rem; }
.cm .avatar { flex: 0 0 auto; }
.cm-reply { margin-left: 2.6rem; padding-top: 0.25rem; }
.cm-main { flex: 1; min-width: 0; }
.cm-head { display: flex; align-items: baseline; gap: 0.3rem; font-size: 0.875rem; }
.cm-body { margin: 0.1rem 0 0.15rem; font-size: 0.9375rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm-actions { display: flex; align-items: center; gap: 0.25rem; margin-left: -0.5rem; }
.cm-actions form { margin: 0; }
.cm-act { display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0 0.5rem; border: 0; background: none;
          color: var(--label-muted); font-size: 0.8125rem; font-weight: 600; text-decoration: none; touch-action: manipulation; }
.cm-act:active { opacity: 0.6; }
.cm-danger { color: var(--red); }
:target.cm { animation: cm-flash 1.6s var(--ease-out); border-radius: 0.6rem; }
@keyframes cm-flash { from { background: rgba(var(--accent-rgb), 0.14); } }
@media (prefers-reduced-motion: reduce) { :target.cm { animation: none; } }
.cm-form { margin-top: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--separator); }
.cm-form textarea { font-size: 16px; }   /* no zoom on iPhone */
.cm-replying { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.4rem; font-size: 0.8125rem; color: var(--label-muted); }
/* A little breathing room between a post's photo and its action row */
.fp-media + .fp-actions { margin-top: 0.35rem; }

/* ---------- Post page: same Edge design as the feed ---------- */
.fp-detail { border-bottom: 1px solid var(--separator); padding-bottom: 1rem; margin-bottom: 0; }
.fp-media-full { aspect-ratio: auto; background: var(--fill); }
.fp-media-full img { width: 100%; height: auto; max-height: 85svh; object-fit: contain; }
.fp-text-detail { padding: 0.2rem 0 0.1rem; }
.fp-text-detail h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.015em; line-height: 1.22; margin: 0 0 0.4rem; }
.fp-text-detail p { font-size: 1.0625rem; line-height: 1.5; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.fp-text-caption { margin-top: 0.2rem; }
.fp-text-caption h1 { font-size: 1.25rem; }
.fp-sub-link { color: var(--label-muted); text-decoration: none; font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .fp-sub-link:hover { text-decoration: underline; } }
.fp-contact { margin: 0.5rem 0 0; }
.cm-section { padding: 1rem 0 0.5rem; }
.cm-section .cm + .cm { border-top: 1px solid var(--separator); }
.cm-section .cm-reply { border-top: 0 !important; }

/* Comment box: one-line field that grows with the text (no resize handle), round blue ">" that pops in once you type */
.cm-compose { display: flex; align-items: flex-end; gap: 0.5rem; }
.cm-input { flex: 1; min-width: 0; resize: none; overflow-y: auto; min-height: 2.75rem; max-height: 8.25rem;
            line-height: 1.4; padding: 0.6rem 0.9rem; border-radius: 1.4rem; font-size: 16px; }
.cm-send {
    flex: 0 0 auto; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent-fill); color: #fff; font-size: 1.2rem;
    transition: transform 160ms var(--ease-out), opacity 160ms var(--ease-out);
    touch-action: manipulation;
}
.cm-send:active { transform: scale(0.9); }
.cm-send i { -webkit-text-stroke: 0.5px; }          /* slightly bolder chevron */
/* With JS: hidden (and out of the tab order) until there's text, then it pops in */
.js-compose .cm-send { opacity: 0; transform: scale(0.6); pointer-events: none; visibility: hidden; width: 0; margin-left: -0.5rem;
                       transition: transform 160ms var(--ease-out), opacity 160ms var(--ease-out), visibility 0s linear 160ms, width 160ms var(--ease-out), margin 160ms var(--ease-out); }
.js-compose.has-text .cm-send { opacity: 1; transform: none; pointer-events: auto; visibility: visible; width: 2.75rem; margin-left: 0;
                                transition: transform 160ms var(--ease-out), opacity 160ms var(--ease-out), visibility 0s, width 160ms var(--ease-out), margin 160ms var(--ease-out); }
@media (prefers-reduced-motion: reduce) { .cm-send, .js-compose .cm-send, .js-compose.has-text .cm-send { transition: none; } }

/* Phones: no tab bar while typing (the keyboard would otherwise push it up over the text box) */
@media (pointer: coarse) {
    html.keyboard-open .bottom-nav { display: none; }
    html.keyboard-open body { padding-bottom: 0; }
}

/* =============================================================================
   NOTIFICATIONS
   ============================================================================= */
.nt-section { font-size: 1rem; font-weight: 700; margin: 0.75rem 0 0.25rem; }
.nt-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.nt-row {
    display: flex; align-items: center; gap: 0.75rem; min-height: 3.75rem; padding: 0.55rem 0.5rem;
    margin-inline: -0.5rem; border-radius: 0.75rem; color: var(--label); text-decoration: none;
    transition: background-color var(--hover-time) ease;
}
.nt-row:active { background: var(--fill); }
@media (hover: hover) and (pointer: fine) { .nt-row:hover { background: var(--fill); } }
.nt-row.is-unread { background: rgba(var(--accent-rgb), 0.06); }
.nt-avatar { position: relative; flex: 0 0 auto; }
.nt-badge {
    position: absolute; right: -0.2rem; bottom: -0.2rem; width: 1.3rem; height: 1.3rem; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; font-size: 0.68rem; color: #fff;
    box-shadow: 0 0 0 2px var(--page-bg); background: var(--accent-fill);
}
.nt-comment, .nt-reply { background: #248a3d; }
.nt-connection_request, .nt-connection_accepted { background: #5856d6; }
.nt-text { flex: 1; min-width: 0; font-size: 0.9375rem; line-height: 1.35; }
.nt-quote { color: var(--label-muted); overflow-wrap: anywhere; }
.nt-time { color: var(--label-muted); font-size: 0.8125rem; margin-left: 0.15rem; white-space: nowrap; }
.nt-thumb { flex: 0 0 auto; width: 2.75rem; height: 2.75rem; border-radius: 0.4rem; object-fit: cover; background: var(--fill); }
.nt-dot { flex: 0 0 auto; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--accent-fill); margin-right: 0.25rem; }

.nt-invite_in { background: #c2410c; }

/* =============================================================================
   INVITES — "Roster" row (chosen Nov 26): faces of who's in + count + I'm in
   ============================================================================= */
.fp-roster { display: flex; align-items: center; gap: 0.6rem; margin: 0 0 0.5rem; padding: 0.5rem 0.6rem 0.5rem 0.75rem;
             border-radius: 0.9rem; background: var(--fill); }
.fp-faces { display: inline-flex; flex: 0 0 auto; }
.fp-faces:empty { display: none; }
.fp-face { box-shadow: 0 0 0 2px var(--page-bg); font-size: 0.65rem; }
.fp-face + .fp-face { margin-left: -0.45rem; }
.fp-roster-text { flex: 1; min-width: 0; font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-roster form { margin: 0; }
.fp-in {
    min-height: 2.25rem; padding: 0 1rem; border: 0; border-radius: 999px; background: var(--accent-fill); color: #fff;
    font-size: 0.9375rem; font-weight: 600; white-space: nowrap; touch-action: manipulation;
    transition: transform var(--press-time) var(--ease-out), background-color var(--hover-time) ease, color var(--hover-time) ease;
}
.fp-in:active { transform: scale(0.96); }
.fp-in[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
[data-bs-theme="dark"] .fp-in[aria-pressed="true"] { color: #4da3ff; box-shadow: inset 0 0 0 1.5px #4da3ff; }
.fp-roster-link { font-size: 0.875rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .fp-in { transition: none; } }
.going-list { list-style: none; margin: 0; padding: 0; }
.going-list a { display: flex; align-items: center; gap: 0.6rem; min-height: 2.75rem; padding: 0.3rem 0; color: var(--label); text-decoration: none; font-size: 0.9375rem; }
.going-list li + li { border-top: 1px solid var(--separator); }

/* Desktop header logo (public/img/logo-long.png, made from logos/long.jpg: trimmed, white knocked out to transparent) */
.brand-logo { display: inline-flex; align-items: center; padding: 0; }
.brand-logo img { height: 32px; width: auto; display: block; }

/* Post pastime (bold, first in the subtitle) + invite details */
.fp-pastime { color: var(--label); font-weight: 700; }
.fp-invite-meta { display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; margin: 0.1rem 0 0.45rem; font-size: 0.875rem; color: var(--label); }
.fp-invite-meta i { color: var(--accent); margin-right: 0.15rem; }
.fp-invite-meta .is-past { color: var(--label-muted); }
.fp-invite-meta .is-past i { color: var(--label-muted); }
.fp-enough { color: #248a3d; }
[data-bs-theme="dark"] .fp-enough { color: var(--green); }
.fp-roster.is-past { opacity: 0.75; }
.fp-past-label { font-size: 0.8125rem; font-weight: 600; color: var(--label-muted); white-space: nowrap; }

/* =============================================================================
   New post / Edit post: no card, same white "Edge" page as Discover
   ============================================================================= */
.post-form { padding-bottom: 1rem; }
.post-form .form-label { font-weight: 600; }

/* "Advanced" (preferred method + location): collapsed by default */
.form-advanced { border-top: 1px solid var(--separator); border-bottom: 1px solid var(--separator); }
.form-advanced > summary {
    list-style: none; display: flex; align-items: center; gap: 0.5rem;
    min-height: 44px; padding: 0.5rem 0; cursor: pointer; font-weight: 600; color: var(--label);
}
.form-advanced > summary::-webkit-details-marker { display: none; }
.form-advanced-hint { margin-left: auto; font-weight: 400; color: var(--label-muted); font-size: 0.9rem;
                      white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.form-advanced[open] .form-advanced-hint { visibility: hidden; }
.form-advanced > summary .bi { color: var(--label-muted); transition: transform 200ms var(--ease-out); }
.form-advanced[open] > summary .bi { transform: rotate(180deg); }
.form-advanced-body { padding: 0.25rem 0 0.5rem; }
@media (prefers-reduced-motion: reduce) { .form-advanced > summary .bi { transition: none; } }

/* Inside the desktop pop-up (iframe): just the form */
body.embed { padding: 0 !important; min-height: 0; }
body.page-white.embed { --page-bg: var(--surface); background: var(--surface); }   /* matches the dialog */
body.embed .embed-main { margin: 0 auto; padding: 0.25rem 1.5rem 1rem; }
/* A little more compact in the pop-up so the whole form fits without scrolling on a laptop screen */
body.embed #content { height: 4.25rem; min-height: 0; }                      /* ~3 lines instead of 4 */
body.embed .post-form .mb-3 { margin-bottom: 0.65rem !important; }
body.embed .post-form .form-label { margin-bottom: 0.3rem; }
body.embed .post-form .form-switch .footnote { line-height: 1.35; }
body.embed .post-form .form-advanced { margin-bottom: 1rem !important; }

/* =============================================================================
   Desktop New post pop-up: <dialog> over the page, which is blurred behind it
   ============================================================================= */
.post-dialog {
    width: min(600px, calc(100vw - 2rem)); max-height: min(92vh, 900px);
    padding: 0; border: 0; border-radius: var(--radius-card);
    background: var(--surface); color: var(--label);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
    overflow: hidden; display: flex; flex-direction: column;
}
.post-dialog:not([open]) { display: none; }
.post-dialog::backdrop {
    background: rgba(0, 0, 0, 0.28);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    backdrop-filter: blur(10px) saturate(120%);
}
.post-dialog-head {
    display: flex; align-items: center; gap: 0.5rem; flex: none;
    padding: 0.5rem 0.75rem 0.25rem 1.5rem;
}
.post-dialog-head h2 { margin: 0; font-size: 1.25rem; font-weight: 700; }
.post-dialog-close {
    margin-left: auto; width: 44px; height: 44px; border: 0; border-radius: 50%;
    background: transparent; color: var(--label-muted); font-size: 1.1rem;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background-color var(--hover-time) ease, transform var(--press-time) var(--ease-out);
}
.post-dialog-close:active { transform: scale(var(--press-scale)); }
@media (hover: hover) and (pointer: fine) { .post-dialog-close:hover { background: var(--fill); color: var(--label); } }
.post-dialog iframe { display: block; width: 100%; height: 480px; border: 0; flex: 0 1 auto; min-height: 0; background: var(--surface); }

/* Opening: a quick fade + rise (modals: 200–300ms, ease-out). Closing is instant. */
.post-dialog[open] { animation: post-dialog-in 240ms var(--ease-out); }
.post-dialog[open]::backdrop { animation: post-dialog-fade 200ms ease-out; }
@keyframes post-dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.97); } }
@keyframes post-dialog-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    .post-dialog[open] { animation: post-dialog-fade 150ms ease-out; }
}
@media (prefers-reduced-transparency: reduce) {
    .post-dialog::backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(0, 0, 0, 0.5); }
}
html.dialog-open { overflow: hidden; }     /* the page behind doesn't scroll */

/* =============================================================================
   404 / error page: logo, big number, one line, two ways out
   ============================================================================= */
.error-page main { max-width: 28rem; margin: 0 auto; }
.error-logo { display: inline-block; margin-bottom: 2.5rem; }
.error-logo img { height: 40px; width: auto; display: block; }
.error-code {
    margin: 0; font-size: clamp(5rem, 22vw, 8rem); font-weight: 800; line-height: 1;
    letter-spacing: -0.04em; color: var(--accent); opacity: 0.18;
}
.error-title { margin: 0.25rem 0 0.5rem; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; }
.error-text { color: var(--label-muted); margin-bottom: 1.75rem; }

/* =============================================================================
   Near You radius: [25] ━━━━━●────── [mi]   (blue fill up to the thumb; the button switches mi ↔ km)
   ============================================================================= */
.radius-form { display: flex; align-items: center; gap: 0.7rem; }
.radius-value {
    min-width: 2em; text-align: right; font-weight: 700; font-size: 0.95rem;
    color: var(--accent); font-variant-numeric: tabular-nums;
}
.radius-range {
    --pct: 50%;
    flex: 1; min-width: 0; height: 36px; margin: 0; background: transparent;
    -webkit-appearance: none; appearance: none; cursor: pointer;
    touch-action: pan-y;                 /* horizontal drags move the slider, vertical ones still scroll */
}
.radius-range:focus { outline: none; }
/* Track: blue up to the thumb, light gray after */
.radius-range::-webkit-slider-runnable-track {
    height: 6px; border-radius: 999px;
    background: linear-gradient(to right, var(--accent) 0 var(--pct), var(--fill-track, #e9edf2) var(--pct) 100%);
}
.radius-range::-moz-range-track { height: 6px; border-radius: 999px; background: var(--fill-track, #e9edf2); }
.radius-range::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--accent); }
/* Thumb: solid blue with a soft ring */
.radius-range::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 20px; height: 20px; margin-top: -7px;
    border-radius: 50%; background: var(--accent); border: 2.5px solid #fff;
    box-shadow: 0 0 0 1.5px rgba(var(--accent-rgb), 0.45), 0 1px 3px rgba(0, 0, 0, 0.18);
}
.radius-range::-moz-range-thumb {
    width: 15px; height: 15px; border-radius: 50%; background: var(--accent); border: 2.5px solid #fff;
    box-shadow: 0 0 0 1.5px rgba(var(--accent-rgb), 0.45), 0 1px 3px rgba(0, 0, 0, 0.18);
}
.radius-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.45); }
.radius-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.45); }
[data-bs-theme="dark"] .radius-range { --fill-track: #3a3a3c; }
[data-bs-theme="dark"] .radius-range::-webkit-slider-thumb,
[data-bs-theme="dark"] .radius-range::-moz-range-thumb { border-color: #1c1c1e; }
/* Discover → People: "☑ Only people near me" above the same slider. 44px tall row = a comfortable tap target */
.nearby-toggle { display: flex; align-items: center; gap: 0.75rem; min-height: 44px; }
.nearby-toggle .form-check { display: flex; align-items: center; gap: 0.5rem; padding-left: 0; }
.nearby-toggle .form-check-input { margin: 0; width: 1.25rem; height: 1.25rem; flex-shrink: 0; cursor: pointer; }
.nearby-toggle .form-check-label { cursor: pointer; font-size: 0.95rem; }
/* Unit button: small outlined box (slightly rounded); press to switch.
   Looks 32px tall, but the tap area is 44px (the ::before reaches past the edges). */
.radius-unit {
    position: relative; min-width: 2.6rem; height: 32px; padding: 0 0.6rem; border-radius: 6px;
    border: 1.5px solid var(--accent); background: transparent; color: var(--accent);
    font-weight: 700; font-size: 0.9rem; line-height: 1;
    transition: background-color var(--hover-time) ease, transform var(--press-time) var(--ease-out);
}
.radius-unit::before { content: ""; position: absolute; inset: -6px -2px; }
.radius-unit:active { transform: scale(var(--press-scale)); }
@media (hover: hover) and (pointer: fine) { .radius-unit:hover { background: rgba(var(--accent-rgb), 0.08); } }
.picker-option.picker-empty { color: var(--label-muted); cursor: default; }

/* =============================================================================
   Groups: flat rows with hairline dividers (same "Edge" feel as Discover posts)
   ============================================================================= */
.group-list { border-top: 1px solid var(--separator); }
.group-row {
    display: flex; align-items: center; gap: 0.85rem; padding: 0.85rem 0.25rem;
    border-bottom: 1px solid var(--separator); color: var(--label); text-decoration: none;
    transition: background-color var(--hover-time) ease;
}
.group-row:active { background: var(--fill); }
@media (hover: hover) and (pointer: fine) { .group-row:hover { background: rgba(var(--accent-rgb), 0.04); color: var(--label); } }
.group-row .chev { color: var(--label-muted); flex-shrink: 0; }
/* "Create a group": accent text with a filled plus (top right of the Groups tab) */
.create-group-btn {
    display: inline-flex; align-items: center; gap: 0.45rem; min-height: 44px; padding: 0 0.25rem;
    color: var(--accent); font-weight: 600; text-decoration: none;
    transition: opacity var(--hover-time) ease, transform var(--press-time) var(--ease-out);
}
.create-group-btn:active { transform: scale(var(--press-scale)); }
@media (hover: hover) and (pointer: fine) { .create-group-btn:hover { color: var(--accent); opacity: 0.8; } }

/* Group page header: no card */
.group-head { padding-bottom: 1rem; margin-bottom: 0.25rem; border-bottom: 1px solid var(--separator); }
@media (max-width: 767.98px) { .groups-head { margin-top: -0.6rem; margin-bottom: -0.4rem !important; } }   /* phones: just the button, keep it snug */

/* =============================================================================
   Scroll performance (Nov 27 audit). Re-blurring the page behind bars on every scroll frame was the main
   cost on phones: the tall phone header (title + tabs) and the capsule inside it both blurred.
   • Phone header + bottom tab bar: solid (they were 78% opaque, so the blur barely showed).
     Measured while scrolling the phone feed: compositor/GPU work 170–190 ms → 65–95 ms per 2 s of scrolling.
   • Desktop keeps the frosted header (desktop GPUs handle it easily)
   ============================================================================= */
@media (max-width: 767.98px) {
    .top-nav, .bottom-nav { background: #f9f9f9; -webkit-backdrop-filter: none; backdrop-filter: none; }
    [data-bs-theme="dark"] .top-nav, [data-bs-theme="dark"] .bottom-nav { background: #1c1c1e; }
}

/* Phone header capsule: the person glyph is drawn smaller and lower in its box than search/bell,
   so it reads as off at the same font size. Size it up and lift it to match. */
.mh-cap-me i { font-size: 1.4rem; transform: translateY(-1px); }
@media (max-width: 767.98px) { .mh-cap-me i { font-size: 1.3rem; } }

/* Sign-up: the two required agreements */
.agree-box { padding: 0.85rem 1rem; border-radius: var(--radius-control); background: var(--fill); font-size: 0.9rem; }
.agree-box .form-check-input { margin-top: 0.2rem; }

/* Terms / Privacy pages: easy to read */
.legal { max-width: 680px; }
.legal h2 { font-size: 1.15rem; font-weight: 700; margin: 1.75rem 0 0.5rem; }
.legal p, .legal li { color: var(--label-2); line-height: 1.6; }
.legal ul { padding-left: 1.2rem; }
.legal .legal-intro { font-style: italic; color: var(--label-2); }
.danger-link { color: var(--red); font-weight: 600; }


/* =============================================================================
   Step-by-step sign-up (public/js/signup.js). Without JavaScript every step shows: one normal form.
   ============================================================================= */
.signup-card { max-width: 30rem; padding-top: 0.5rem; }
.signup-progress { display: none; height: 4px; border-radius: 999px; background: var(--fill); overflow: hidden; margin-bottom: 1.75rem; }
.signup-progress-bar { display: block; height: 100%; width: 14%; background: var(--accent); border-radius: inherit;
                       transition: width 300ms var(--ease-out); }
.signup .signup-step { margin-bottom: 2rem; }
.signup-nav { display: flex; align-items: center; gap: 0.5rem; }
.signup-nav .signup-submit { flex: 1; }
.signup-nojs-hint { display: block; }

/* With JavaScript: one step at a time */
.signup-card:has(.signup.is-stepped) .signup-progress { display: block; }
.signup.is-stepped .signup-step { display: none; margin-bottom: 1.5rem; }
.signup.is-stepped .signup-step.is-active { display: block; }
.signup.is-stepped .signup-nojs-hint { display: none; }
.signup.is-stepped .signup-next, .signup.is-stepped .signup-submit { flex: 1; min-height: 48px; font-weight: 600; }
.signup-back, .signup-skip { min-height: 48px; }
.signup-skip { color: var(--label-muted); text-decoration: none; }

/* The step slides in from the side you're heading (forward → from the right, Back → from the left) */
.signup-step.enter-forward { animation: step-in-forward 220ms var(--ease-out); }
.signup-step.enter-back    { animation: step-in-back 220ms var(--ease-out); }
@keyframes step-in-forward { from { opacity: 0; transform: translateX(24px); } }
@keyframes step-in-back    { from { opacity: 0; transform: translateX(-24px); } }

/* Pastime pills */
.pill-selected { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.pill-selected:empty { display: none; }
.pill-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.pill-row:empty { display: none; }
.pill-heading { margin: 1.25rem 0 0; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--label-muted); }
.pill {
    display: inline-flex; align-items: center; gap: 0.3rem; min-height: 40px; padding: 0 0.95rem;
    border-radius: 999px; border: 1px solid var(--separator); background: var(--surface); color: var(--label);
    font-size: 0.95rem; line-height: 1;
    transition: background-color var(--hover-time) ease, border-color var(--hover-time) ease, transform var(--press-time) var(--ease-out);
}
.pill:active { transform: scale(var(--press-scale)); }
.pill-on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.pill-on .bi { font-size: 1.05rem; margin-right: -0.25rem; }
.pill-add { border-style: dashed; border-color: var(--accent); color: var(--accent); font-weight: 600; }
.pill-match { border-color: rgba(var(--accent-rgb), 0.45); }
@media (hover: hover) and (pointer: fine) {
    .pill-suggest:hover, .pill-match:hover { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.06); }
    .pill-on:hover { background: var(--accent-pressed); }
}
.pill.is-new { animation: pill-pop 180ms var(--ease-out); }
@keyframes pill-pop { from { opacity: 0; transform: scale(0.92); } }
.username-status.is-ok { color: var(--green); font-weight: 600; }
.username-status.is-bad { color: var(--red); }

@media (prefers-reduced-motion: reduce) {
    .signup-step.enter-forward, .signup-step.enter-back { animation: step-fade 150ms ease-out; }
    .pill.is-new { animation: none; }
    .signup-progress-bar { transition: none; }
}
@keyframes step-fade { from { opacity: 0; } }

/* Messages: inbox rows reuse the flat group rows; New message list too */
.convo-row .unread-dot { flex-shrink: 0; }
.compose-item { border-bottom: 1px solid var(--separator); }
.compose-item .compose-person { padding-left: 0.25rem; padding-right: 0.25rem; }

