/* ==========================================================================
   Connect Heart — design tokens
   Display face (Baloo 2): brand wordmark, auth hero, dashboard greeting — used
   sparingly, for identity moments only. Body face (Figtree): everything else.
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&family=Figtree:wght@400;500;600;700;800&display=swap');

:root {
    /* brand */
    --rose: #ff5a79;
    --rose-deep: #e8415f;
    --rose-dark: #a9284a;
    --amber: #ffb648;
    --amber-deep: #ef8f16;

    /* surfaces */
    --blush: #fff3f5;
    --cream: #fffaf8;
    --ink: #2c2130;
    --muted: #8d8191;
    --border: #f6dee4;

    /* status */
    --success-bg: #e8f7ee;
    --success-text: #1f7a4d;
    --error-bg: #fdecec;
    --error-text: #c42e3e;
    --warning-bg: #fff3df;
    --warning-text: #8a5a00;

    /* elevation */
    --shadow-sm: 0 2px 10px rgba(44, 33, 48, 0.06);
    --shadow-md: 0 10px 28px rgba(44, 33, 48, 0.10);
    --shadow-rose: 0 10px 26px rgba(255, 90, 121, 0.28);

    /* radius */
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 26px;

    --font-display: 'Baloo 2', ui-rounded, 'Segoe UI', sans-serif;
    --font-body: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--blush);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--rose); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--rose-dark); outline-offset: 2px; }

h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }

/* ==========================================================================
   Auth pages
   ========================================================================== */
.auth-card {
    max-width: 400px;
    margin: 40px auto;
    background: var(--cream);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.auth-hero {
    padding: 34px 28px 26px;
    text-align: center;
    background: linear-gradient(135deg, var(--rose) 0%, var(--rose-deep) 55%, var(--amber-deep) 130%);
    color: #fff;
}
.auth-hero-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    font-size: 22px;
    margin-bottom: 10px;
}
.auth-hero h1 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 26px;
    margin: 0;
    color: #fff;
}
.auth-hero-sub { margin: 6px 0 0; color: rgba(255, 255, 255, 0.88); font-size: 14px; font-weight: 500; }
.auth-card-body { padding: 26px 28px 30px; }
.subtitle { text-align: center; color: var(--muted); margin-top: 0; margin-bottom: 18px; font-size: 14px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); line-height: 1.7; }

/* honeypot field (register.php bot protection) — invisible and unreachable to a real
   visitor (off-canvas, not display:none, since some bots specifically skip hidden ones),
   but still a normal input a script that blindly fills every field on the page will catch */
.hp-field { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; overflow: hidden; }

form label { display: block; margin: 16px 0 6px; font-size: 13px; font-weight: 700; color: var(--ink); }
form input[type="text"],
form input[type="password"],
form select,
form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    font-size: 15px;
    font-family: var(--font-body);
    background: var(--blush);
    color: var(--ink);
    transition: border-color 0.15s, background 0.15s;
}
form input[type="text"]:focus,
form input[type="password"]:focus,
form select:focus,
form textarea:focus {
    outline: none;
    border-color: var(--rose);
    background: #fff;
}
form textarea { resize: vertical; }
.checkbox-row { display: flex; align-items: flex-start; gap: 9px; font-weight: normal; font-size: 13.5px; color: var(--muted); line-height: 1.5; margin-top: 12px; }
.checkbox-row input { width: auto; margin-top: 3px; accent-color: var(--rose); }

.lang-checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 12px;
    background: var(--blush);
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    padding: 10px 14px;
    margin-top: 2px;
}
.lang-checkbox { margin-top: 8px; margin-bottom: 8px; color: var(--ink); font-size: 14px; }

.lang-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.lang-tag {
    display: inline-block;
    background: var(--blush);
    color: var(--rose-dark);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    line-height: 1.5;
}

button, .btn-small-label {
    display: inline-block;
    background: linear-gradient(135deg, var(--rose), var(--rose-deep));
    color: #fff;
    border: none;
    padding: 13px 18px;
    border-radius: var(--r-md);
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    margin-top: 22px;
    width: 100%;
    text-align: center;
    box-shadow: 0 6px 16px rgba(255, 90, 121, 0.26);
    transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
}
button:hover, .btn-small-label:hover { filter: brightness(1.04); box-shadow: 0 8px 20px rgba(255, 90, 121, 0.32); }
button:active { transform: translateY(1px); }
button:disabled { background: #e3dce0; color: var(--muted); box-shadow: none; cursor: not-allowed; }

.btn-small {
    display: inline-block;
    width: auto;
    margin-top: 0;
    background: linear-gradient(135deg, var(--rose), var(--rose-deep));
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    transition: filter 0.15s;
    box-shadow: none;
    flex-shrink: 0;
}
.btn-small:hover { filter: brightness(1.05); }
.btn-small:disabled { background: #e3dce0; color: var(--muted); cursor: not-allowed; }
.btn-small-label { width: auto; margin-top: 8px; padding: 9px 16px; font-size: 13px; border-radius: 999px; }
.file-input { display: none; }

.alert { padding: 13px 16px; border-radius: var(--r-md); margin-bottom: 16px; font-size: 14px; line-height: 1.5; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-error { background: var(--error-bg); color: var(--error-text); }
.alert-info { background: var(--success-bg); color: var(--success-text); }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); border: 1px solid #ffdfa3; }

.recovery-code {
    text-align: center;
    font-family: var(--font-display);
    font-size: 25px;
    font-weight: 700;
    letter-spacing: 2px;
    background: var(--blush);
    border: 2px dashed var(--rose);
    border-radius: var(--r-md);
    padding: 18px;
    margin: 16px 0;
    color: var(--rose-dark);
}

/* ==========================================================================
   App shell — top nav
   ========================================================================== */
.topnav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--cream);
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 25;
}
.brand {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 19px;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    letter-spacing: -0.01em;
}
.brand::before {
    content: "♥";
    color: var(--rose);
    margin-right: 7px;
    font-size: 0.92em;
}
.nav-right { display: flex; gap: 20px; align-items: center; }
.nav-link { color: var(--ink); font-size: 14px; font-weight: 600; transition: color 0.15s; white-space: nowrap; }
.nav-link:hover { color: var(--rose-dark); text-decoration: none; }
.nav-home-btn { color: var(--ink); }
.nav-home-btn:hover { color: var(--rose-dark); }
.nav-home-btn svg { width: 20px; height: 20px; }

.page { max-width: 760px; margin: 24px auto; padding: 0 16px 40px; }
.page-narrow { max-width: 480px; }

/* ==========================================================================
   Dashboard
   ========================================================================== */
.welcome-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 26px;
    padding: 22px 24px;
    border-radius: var(--r-xl);
    background: linear-gradient(120deg, var(--rose) 0%, var(--rose-deep) 55%, var(--amber-deep) 150%);
    color: #fff;
    box-shadow: var(--shadow-rose);
}
.welcome-row .avatar-sm { border: 3px solid rgba(255, 255, 255, 0.65); }
.welcome-row h2 { font-family: var(--font-display); font-weight: 800; font-size: 22px; color: #fff; }
.welcome-row .muted { color: rgba(255, 255, 255, 0.85); }

.muted { color: var(--muted); margin: 2px 0 0; font-size: 14px; }
.muted-sm { color: var(--muted); font-size: 12px; margin: 6px 0 0; }

.avatar-sm { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: #f1e3e7; flex-shrink: 0; }
.avatar-lg { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; background: #f1e3e7; }
.avatar-edit-row { display: flex; align-items: center; gap: 18px; margin-bottom: 10px; }

.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 30px; }
.feature-card {
    display: block;
    background: var(--cream);
    border-radius: var(--r-lg);
    padding: 20px;
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s, transform 0.15s;
}
.feature-card:hover { box-shadow: var(--shadow-md); text-decoration: none; transform: translateY(-2px); }
.feature-card h3 { margin: 0 0 6px; font-size: 16px; }
.feature-card p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--r-sm);
    margin-bottom: 12px;
}
.feature-icon svg { width: 20px; height: 20px; }
.feature-icon-rose { background: #ffe3e9; color: var(--rose-dark); }
.feature-icon-amber { background: #fff0db; color: var(--amber-deep); }

/* ==========================================================================
   Public landing page (index.php, logged-out visitors)
   ========================================================================== */
.home-topnav { background: transparent; border-bottom: none; position: static; box-shadow: none; }

.home-hero { max-width: 640px; margin: 0 auto; padding: 54px 20px 46px; text-align: center; }
.home-greet-cycle {
    margin: 0 0 14px;
    font-family: 'Baloo 2', 'Noto Sans Devanagari', 'Noto Sans Tamil', 'Noto Sans Telugu',
        'Noto Sans Kannada', 'Noto Sans Malayalam', 'Noto Sans Bengali', ui-rounded, 'Segoe UI', sans-serif;
    font-weight: 700;
    font-size: 34px;
    line-height: 1.25;
    min-height: 44px;
    background: linear-gradient(120deg, var(--rose-deep), var(--amber-deep));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    transition: opacity 0.3s ease;
}
.home-headline { font-family: var(--font-display); font-weight: 800; font-size: 34px; line-height: 1.3; margin: 0 0 16px; color: var(--ink); }
.home-sub { font-size: 16px; line-height: 1.65; color: var(--muted); max-width: 480px; margin: 0 auto 28px; }
.home-cta-row { display: flex; gap: 20px; align-items: center; justify-content: center; flex-wrap: wrap; }
.btn-hero {
    display: inline-block;
    background: linear-gradient(135deg, var(--rose), var(--rose-deep));
    color: #fff;
    padding: 15px 30px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 15.5px;
    box-shadow: var(--shadow-rose);
    transition: filter 0.15s, box-shadow 0.15s;
}
.btn-hero:hover { filter: brightness(1.04); text-decoration: none; }
.home-cta-secondary { font-weight: 700; font-size: 15px; color: var(--ink); }
.home-cta-secondary:hover { color: var(--rose-dark); }

.home-features {
    max-width: 920px;
    margin: 0 auto;
    padding: 44px 20px 50px;
    display: flex;
    flex-wrap: wrap;
    gap: 32px 40px;
    justify-content: center;
    border-top: 1px solid var(--border);
}
.home-feature { flex: 1 1 220px; max-width: 260px; text-align: left; }
.home-feature h3 { font-size: 15.5px; margin: 0 0 6px; }
.home-feature p { font-size: 13.5px; color: var(--muted); line-height: 1.55; margin: 0; }

.home-trust { background: var(--blush); padding: 32px 20px; text-align: center; }
.home-trust p { max-width: 540px; margin: 0 auto; font-size: 14.5px; color: var(--ink); line-height: 1.65; }

@media (max-width: 600px) {
    .home-headline, .home-greet-cycle { font-size: 26px; }
}

.badge {
    display: inline-block;
    background: var(--blush);
    color: var(--rose-dark);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 11px;
    border-radius: 999px;
}

.section-title { margin-bottom: 12px; font-size: 16px; font-weight: 700; }
.people-grid { display: flex; flex-direction: column; gap: 10px; }
.person-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 11px 14px;
    transition: box-shadow 0.15s;
}
.person-card:hover { box-shadow: var(--shadow-sm); }
.person-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.person-info strong { font-size: 14.5px; }
.status-online { color: var(--success-text); font-size: 12px; font-weight: 600; }
.status-online::before { content: "●"; margin-right: 4px; font-size: 8px; vertical-align: 1px; }
.status-offline { color: var(--muted); font-size: 12px; }

.profile-form { background: var(--cream); padding: 24px; border-radius: var(--r-lg); border: 1px solid var(--border); }

.legal-page { max-width: 640px; line-height: 1.65; }
.legal-page h2 { font-family: var(--font-display); font-weight: 800; font-size: 24px; }
.legal-page h3 { margin-top: 30px; margin-bottom: 8px; color: var(--rose-dark); font-size: 16px; }
.legal-page ul { padding-left: 20px; }
.legal-page li { margin-bottom: 8px; }
.safety-callout {
    font-size: 15px;
    line-height: 1.65;
    border: 1px solid #ffdfa3;
    position: relative;
    padding-left: 18px;
}
.safety-callout::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--amber-deep);
    border-radius: 4px 0 0 4px;
}
.site-footer { max-width: 760px; margin: 0 auto; padding: 28px 16px 48px; text-align: center; font-size: 13px; }
.site-footer a { color: var(--muted); margin: 0 8px; font-weight: 600; }
.site-footer a:hover { color: var(--rose-dark); }

.btn-muted { background: #efe6ea !important; color: var(--muted) !important; box-shadow: none !important; }
.hidden { display: none !important; }

/* thread list (messages.php) */
.thread-list { display: flex; flex-direction: column; gap: 10px; }
.thread-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 11px 14px;
    color: var(--ink);
    transition: box-shadow 0.15s;
}
.thread-row:hover { text-decoration: none; box-shadow: var(--shadow-sm); }
.thread-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.thread-info strong { font-size: 14.5px; }
.thread-preview { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread-dot {
    background: var(--rose);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

/* rooms list */
.inline-form { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.inline-form input[type="text"] { flex: 1; min-width: 160px; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--r-md); background: var(--cream); font-family: var(--font-body); font-size: 14.5px; }
.inline-form input[type="text"]:focus { outline: none; border-color: var(--rose); }
.inline-form button { margin-top: 0; width: auto; border-radius: 999px; padding: 11px 20px; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.room-card {
    display: block;
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 16px;
    color: var(--ink);
    transition: box-shadow 0.15s, transform 0.15s;
}
.room-card:hover { text-decoration: none; box-shadow: var(--shadow-md); transform: translateY(-2px); }
.room-card strong { font-size: 15px; }
.room-card p { margin: 4px 0 10px; font-size: 13.5px; color: var(--muted); }

/* ==========================================================================
   Chat shell (chat.php, room.php)
   ========================================================================== */
.chat-body {
    display: flex;
    flex-direction: column;
    height: 100vh; /* fallback for browsers without dvh support */
    height: 100dvh; /* real visible viewport — fixes the composer sitting below the fold
                        until the mobile address bar collapses on scroll */
    margin: 0;
    position: relative;
    background: var(--blush);
}
.chat-body .topnav { flex-shrink: 0; gap: 12px; position: static; }
.nav-back { font-size: 22px; color: var(--ink); padding: 0 6px; line-height: 1; }
.chat-header-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-header-info strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.menu-dots { font-size: 20px; background: none; color: var(--ink); width: auto; margin: 0; padding: 4px 10px; box-shadow: none; }
.menu-dots:hover { background: var(--blush); filter: none; box-shadow: none; }
.chat-menu {
    position: absolute;
    right: 16px;
    top: 56px;
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    z-index: 20;
    min-width: 170px;
}
.chat-menu button, .chat-menu a {
    display: block;
    width: 100%;
    background: none;
    color: var(--ink);
    border: none;
    padding: 13px 18px;
    margin: 0;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    border-radius: 0;
    box-sizing: border-box;
    box-shadow: none;
}
.chat-menu button:hover, .chat-menu a:hover { background: var(--blush); text-decoration: none; filter: none; }

.chat-shell { flex: 1; display: flex; flex-direction: column; min-height: 0; max-width: 760px; width: 100%; margin: 0 auto; }
.msg-list { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 6px; }
.chat-empty { text-align: center; margin-top: 40px; }

.typing-indicator {
    padding: 0 20px 7px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--rose-dark);
    animation: typing-pulse 1.4s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes typing-pulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

.bubble-row { display: flex; }
.bubble-row.mine { justify-content: flex-end; }
.bubble-row.theirs { justify-content: flex-start; }
.bubble {
    max-width: 72%;
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 10px 14px 7px;
    font-size: 14.5px;
    box-shadow: 0 1px 3px rgba(44, 33, 48, 0.04);
}
.bubble-row.mine .bubble { background: linear-gradient(135deg, var(--rose), var(--rose-deep)); color: #fff; border-color: transparent; }
.bubble-row.mine .msg-text { color: #fff; }
.msg-text { white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.msg-time { display: block; font-size: 10.5px; font-weight: 600; color: var(--muted); margin-top: 3px; text-align: right; }
.bubble-row.mine .msg-time { color: rgba(255, 255, 255, 0.75); }
.sticker-bubble { width: 92px; height: 92px; display: block; filter: drop-shadow(0 3px 6px rgba(44, 33, 48, 0.12)); }
.bubble audio { width: 220px; max-width: 60vw; }
.room-sender { display: block; font-size: 12px; font-weight: 700; color: var(--rose-dark); margin-bottom: 2px; }
.bubble-row.mine .room-sender { color: #ffe0e6; }

.composer-disabled {
    text-align: center;
    padding: 16px;
    color: var(--muted);
    font-size: 14px;
    background: var(--cream);
    border-top: 1px solid var(--border);
}
.composer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    background: var(--cream);
    flex-shrink: 0;
}
.composer input[type="text"] {
    flex: 1;
    padding: 11px 16px;
    border: 1.5px solid transparent;
    border-radius: 999px;
    font-size: 15px;
    font-family: var(--font-body);
    background: var(--blush);
    color: var(--ink);
    transition: border-color 0.15s, background 0.15s;
    min-width: 0;
}
.composer input[type="text"]:focus { outline: none; border-color: var(--rose); background: #fff; }
.composer.is-recording #text-input,
.composer.is-recording #sticker-toggle,
.composer.is-recording #voice-btn { display: none; }

.icon-btn {
    background: none;
    border: none;
    font-size: 19px;
    width: 42px;
    height: 42px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    box-shadow: none;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--blush); filter: none; box-shadow: none; }
.send-btn { background: linear-gradient(135deg, var(--rose), var(--rose-deep)); color: #fff; box-shadow: 0 4px 12px rgba(255, 90, 121, 0.35); }
.send-btn svg { width: 18px; height: 18px; }
.send-btn:hover { filter: brightness(1.05); background: linear-gradient(135deg, var(--rose), var(--rose-deep)); }

/* in-composer voice recording bar — replaces the old below-composer banner */
.record-bar {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 6px 0 2px;
    min-width: 0;
}
.record-cancel {
    background: none;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    box-shadow: none;
}
.record-cancel svg { width: 20px; height: 20px; }
.record-cancel:hover { background: var(--error-bg); color: var(--error-text); filter: none; }
.record-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--error-text);
    flex-shrink: 0;
    animation: record-pulse 1.1s ease-in-out infinite;
}
@keyframes record-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}
.record-timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); font-size: 14.5px; }

.sticker-picker {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    padding: 14px;
    background: var(--cream);
    border-top: 1px solid var(--border);
    max-height: 200px;
    overflow-y: auto;
    flex-shrink: 0;
}
.sticker-option { width: 100%; aspect-ratio: 1; cursor: pointer; border-radius: var(--r-sm); transition: background 0.1s; }
.sticker-option:hover { background: var(--blush); }

.members-panel {
    position: absolute;
    right: 10px;
    top: 56px;
    width: 270px;
    max-height: 70vh;
    overflow-y: auto;
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-md);
    padding: 10px;
    z-index: 20;
}
.member-actions { display: flex; gap: 6px; }

/* ==========================================================================
   Mobile bottom tab bar — floating pill, inset from the edges, SVG icons
   ========================================================================== */
.bottom-nav { display: none; }

@media (max-width: 768px) {
    .page { padding-bottom: 92px; }

    .bottom-nav {
        display: flex;
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 12px;
        z-index: 40;
        background: rgba(255, 250, 248, 0.92);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border: 1px solid var(--border);
        border-radius: var(--r-xl);
        box-shadow: 0 12px 32px rgba(44, 33, 48, 0.16);
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    }
    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 8px 4px 6px;
        color: var(--muted);
        font-size: 10.5px;
        font-weight: 700;
        text-decoration: none;
        border-radius: var(--r-lg);
        transition: background 0.15s, color 0.15s;
    }
    .bottom-nav-item:hover { text-decoration: none; }
    .bottom-nav-icon {
        position: relative;
        width: 26px;
        height: 26px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 999px;
        transition: background 0.15s, transform 0.15s;
    }
    .bottom-nav-icon svg { width: 21px; height: 21px; }
    .bottom-nav-item.active { color: var(--rose-dark); }
    .bottom-nav-item.active .bottom-nav-icon {
        background: linear-gradient(135deg, var(--rose), var(--rose-deep));
        color: #fff;
        transform: translateY(-3px);
        box-shadow: 0 6px 14px rgba(255, 90, 121, 0.4);
    }

    /* top-nav text links that just repeat a bottom tab are redundant on mobile */
    .nav-right .nav-link.hide-mobile { display: none; }
}

/* ==========================================================================
   Unread-message notification badge — small count pill, reused on the mobile
   bottom-nav Chat icon and the desktop top-nav Messages link
   ========================================================================== */
.nav-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--rose-deep);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
    border: 2px solid var(--cream);
    box-shadow: 0 2px 6px rgba(232, 65, 95, 0.4);
}
.nav-link-badge-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.nav-link-badge-wrap .nav-badge {
    top: -7px;
    right: -11px;
}

@media (max-width: 768px) {
    .nav-right { gap: 12px; }
    .topnav { padding: 12px 14px; }
}

/* ==========================================================================
   Desktop: present the chat window as one floating rounded card instead of a
   flat panel flush against the browser edges
   ========================================================================== */
@media (min-width: 769px) {
    body.chat-body {
        height: calc(100vh - 48px);
        height: calc(100dvh - 48px);
        max-width: 760px;
        margin: 24px auto;
        border-radius: var(--r-xl);
        border: 1px solid var(--border);
        box-shadow: 0 16px 48px rgba(43, 40, 50, 0.14);
        overflow: hidden;
        background: var(--cream);
    }
    .chat-body .topnav { border-radius: var(--r-xl) var(--r-xl) 0 0; }
    .chat-body .msg-list { background: linear-gradient(180deg, #fffafc 0%, var(--blush) 100%); }
    .chat-body .composer,
    .chat-body .composer-disabled { border-radius: 0 0 var(--r-xl) var(--r-xl); }
}

@media (max-width: 520px) {
    .feature-grid { grid-template-columns: 1fr; }
    .auth-card { margin: 20px 16px; }
    .auth-card-body { padding: 24px 22px 28px; }
    .bubble { max-width: 84%; }
    .sticker-picker { grid-template-columns: repeat(4, 1fr); }
    .members-panel { width: calc(100vw - 20px); right: 10px; }
}
