@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-main: #0b141a;
    --bg-sidebar: #111b21;
    --bg-header: rgba(32, 44, 51, 0.95);
    --bg-input: #202c33;
    --bg-panel: #111b21;
    --bg-elevated: #182229;
    --bg-soft: #101920;
    --primary: #00a884;
    --primary-hover: #0abf97;
    --text-primary: #e9edef;
    --text-secondary: #8696a0;
    --text-muted: #667781;
    --border: #222d34;
    --msg-in: #202c33;
    --msg-out: #0b6052; /* Slightly deeper, richer green */
    --system-msg: #182229;
    --highlight: #f5c518;
    --danger: #ff6b6b;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.25); /* Softer */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
    --wa-bubble-radius: 16px; /* Modern, WhatsApp-like rounding */
    --wa-meta-fs: 10.5px; /* Compact timestamps */
    --control-height: 40px;
    --control-radius: 9px;
    --popover-radius: 12px;
    --focus-ring: 0 0 0 3px rgba(0, 168, 132, 0.24);
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --icon-size-control: 18px;
    --motion-fast: 120ms;
}

body.light-theme {
    --bg-main: #f8f9fa; /* Cleaner light background */
    --bg-sidebar: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.95);
    --bg-input: #f0f2f5;
    --bg-panel: #ffffff;
    --bg-elevated: #ffffff;
    --bg-soft: #eef2f4;
    --text-primary: #111b21;
    --text-secondary: #54656f;
    --border: #e9edef;
    --msg-in: #ffffff;
    --msg-out: #d9fdd3;
    --shadow-md: 0 12px 35px rgba(17, 27, 33, 0.08); /* Extremely soft light theme shadow */
}

.landing-page, .page-layout {
    overflow-y: auto !important;
    height: auto !important;
    background: var(--bg-main);
}
.landing-nav {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 5%; border-bottom: 1px solid var(--border);
    background: var(--bg-header); backdrop-filter: blur(10px);
    position: sticky; top: 0; z-index: 1000;
}
.landing-nav .logo { font-size: 20px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 8px; text-decoration: none; }
.landing-nav .logo img { width: 28px; height: 28px; display: block; }
.landing-nav .nav-links a { margin-left: 20px; text-decoration: none; color: var(--text-secondary); font-weight: 500;}
.landing-nav .nav-links a:hover { color: var(--primary); }

.github-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: 20px;
    color: var(--text-primary) !important;
    transition: all 0.2s ease;
}
.github-nav-link:hover { border-color: var(--primary); background: rgba(0, 168, 132, 0.1); }

.hero { text-align: center; padding: 100px 5% 60px; }
.hero h1 { font-size: 56px; font-weight: 800; line-height: 1.1; margin-bottom: 20px; letter-spacing: -1px;}
.highlight { background: linear-gradient(90deg, #00a884, #0abf97); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { font-size: 18px; color: var(--text-secondary); max-width: 600px; margin: 0 auto 40px; line-height: 1.6;}
.hero-actions { display: flex; gap: 16px; justify-content: center; }

.btn-large { padding: 16px 32px; font-size: 16px; border-radius: 30px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px;}
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; padding: 40px 10%; max-width: 1200px; margin: 0 auto; }
.feature-card { background: var(--bg-sidebar); border: 1px solid var(--border); padding: 40px; border-radius: 24px; box-shadow: var(--shadow-sm); text-align: center; transition: transform 0.2s; }
.feature-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); }
.feature-card i { font-size: 48px; color: var(--primary); margin-bottom: 20px; }
.feature-card h3 { font-size: 20px; margin-bottom: 12px; }
.feature-card p { color: var(--text-secondary); line-height: 1.6;}

.landing-footer { border-top: 1px solid var(--border); padding: 60px 10% 20px; margin-top: 60px;}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 40px; margin-bottom: 40px;}
.footer-grid h4 { margin-bottom: 20px; color: var(--text-primary); }
.footer-grid a { display: block; color: var(--text-secondary); text-decoration: none; margin-bottom: 10px; font-size: 14px;}
.footer-grid a:hover { color: var(--primary); }
.footer-bottom { text-align: center; color: var(--text-muted); font-size: 13px; border-top: 1px solid var(--border); padding-top: 20px;}
.footer-bottom a { color: var(--primary); text-decoration: none; font-weight: 600; transition: opacity 0.2s ease;}
.footer-bottom a:hover { opacity: 0.8; text-decoration: underline; }

.content-container { max-width: 800px; margin: 60px auto; padding: 0 20px; min-height: 60vh;}
.article-layout h1 { margin-bottom: 24px; font-size: 36px;}
.article-layout h2, .article-layout h3 { margin: 30px 0 15px; color: var(--primary);}
.article-layout p, .article-layout li { color: var(--text-secondary); line-height: 1.8; margin-bottom: 16px; font-size: 16px;}
.article-layout ul, .article-layout ol { margin-left: 20px; margin-bottom: 20px; }

.upload-box-large { border: 2px dashed var(--border); border-radius: 24px; padding: 60px; text-align: center; background: var(--bg-sidebar);}

/* ── Global spinner ── */
.page-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    gap: 14px;
    color: var(--text-secondary);
    font-size: 14px;
}
.spin-ring {
    width: 38px;
    height: 38px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin-ring 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes spin-ring { to { transform: rotate(360deg); } }

/* ── Skeleton shimmer ── */
.skel-block {
    background: var(--bg-elevated);
    border-radius: 8px;
    animation: skel-pulse 1.4s ease infinite;
}
@keyframes skel-pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── Global button cursor ── */
button { cursor: pointer; }

@media (max-width: 800px) {
    :root { --chat-composer-height: 58px; }

    .landing-nav { flex-direction: column; gap: 16px; justify-content: center; padding: 20px 15px; }
    .landing-nav .nav-links { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; }
    .landing-nav .nav-links a { margin-left: 0; font-size: 14px; }
    .github-nav-link { padding: 4px 12px; margin-top: 4px; }
    .hero { padding: 60px 5% 40px; }
    .hero h1 { font-size: 38px; }
    .hero p { font-size: 16px; margin-bottom: 30px; }
    .hero-actions { flex-direction: column; width: 100%; max-width: 360px; margin: 0 auto; gap: 12px; }
    .hero-actions .btn-large { width: 100%; justify-content: center; }
    .features { padding: 20px 5%; gap: 20px; }
    .feature-card { padding: 30px 20px; }
    .landing-footer { padding: 40px 5% 20px; margin-top: 30px; }
    .content-container { margin: 40px auto; }
    .article-layout h1 { font-size: 28px; }
    .upload-box-large { padding: 40px 20px; }
    .setting-row { align-items: flex-start; }
    .setting-row select { width: 108px; flex-basis: 108px; }
}

.app-nav { display: none; } /* Hide landing nav inside the app */

body.page-layout .app-layout { display: none; }

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    min-height: 100dvh;
    height: 100dvh;
}

body {
    background: var(--bg-main);
    background-image: radial-gradient(circle at top, rgba(0, 168, 132, 0.08), transparent 32%);
    color: var(--text-primary);
    overflow: hidden;
    font-family: var(--font-family);
    font-size: 14.5px;
    line-height: 1.5;
}

button,
input,
textarea {
    font: inherit;
}

button {
    color: inherit;
}

img,
video {
    max-width: 100%;
}

a {
    color: inherit;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 2px solid rgba(0, 168, 132, 0.65);
    outline-offset: 2px;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(134, 150, 160, 0.4);
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(134, 150, 160, 0.6);
    border: 2px solid transparent;
    background-clip: padding-box;
}

#loader {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.loader-content {
    width: min(320px, 88vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    color: var(--text-secondary);
    text-align: center;
}

.loader-logo {
    width: 72px;
    height: 72px;
    display: block;
    margin: 0 auto;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(134, 150, 160, 0.22);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar .fill {
    width: 0;
    height: 100%;
    background: var(--primary);
    border-radius: inherit;
    transition: width 0.7s ease;
}

.loader-content p {
    font-size: 12px;
    letter-spacing: 0.2px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.app-layout {
    display: flex;
    height: 100%;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    position: relative;
    background: var(--bg-main);
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.sidebar {
    width: 400px;
    min-width: 320px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 200;
    transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.02);
}

.sidebar-header {
    height: 60px;
    background: var(--bg-header);
    backdrop-filter: blur(10px);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.profile-button,
.sidebar-nav button,
.mobile-menu,
.header-tools > button,
.drawer-close,
.chat-item,
.chat-footer button,
.search-input-group button,
.search-nav button,
.upi-display button,
.avatar-upload-trigger,
.btn-primary,
.btn-secondary,
.menu-item,
.media-modal-actions button,
.media-modal-actions a,
.media-modal-backdrop {
    border: 0;
    background: none;
    cursor: pointer;
    touch-action: manipulation;
}

.profile-thumb {
    border-radius: 50%;
}

.profile-thumb img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.sidebar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sidebar-nav button,
.header-tools > button,
.mobile-menu,
.chat-footer button {
    color: var(--text-secondary);
    font-size: 22px;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-nav button:hover,
.header-tools > button:hover,
.chat-footer button:hover,
.mobile-menu:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.sidebar-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.sidebar-footer {
    padding: 12px;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--bg-sidebar);
}

.sidebar-footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

.upload-state {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    gap: 20px;
    overflow-y: auto;
}

.load-hint {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
}

.hidden {
    display: none !important;
}

.brand-hero {
    text-align: center;
    margin-bottom: 10px;
}

.brand-hero h1 {
    font-weight: 300;
    font-size: 28px;
    color: var(--text-primary);
}

.brand-hero span {
    font-size: 12px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.input-wrapper label {
    display: block;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    margin-left: 4px;
}

.input-wrapper input,
.search-input-group input,
.date-sheet-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    background: var(--bg-input);
}

.input-wrapper input {
    padding: 12px 16px;
    transition: border-color 0.2s ease;
}

.input-wrapper input:focus,
.search-input-group input:focus,
.date-sheet-input:focus {
    border-color: var(--primary);
}

.drop-target {
    background: transparent;
    cursor: pointer;
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.drop-target:hover,
.drop-target.dragover {
    border-color: var(--primary);
    background: rgba(0, 168, 132, 0.05);
}

.drop-target.ready {
    border-color: var(--primary);
    background: rgba(0, 168, 132, 0.1);
}

.drop-target i {
    font-size: 48px;
    color: var(--text-muted);
}

.btn-secondary,
.btn-primary,
.media-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

.btn-secondary,
.media-download {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 20px;
    border-radius: 20px;
}

.btn-secondary:hover,
.media-download:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    border-radius: 24px;
    font-size: 15px;
    box-shadow: none;
}

.btn-primary[disabled],
.btn-secondary[disabled],
.drop-target[disabled] {
    opacity: 0.6;
    cursor: wait;
    pointer-events: none;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:active,
.btn-secondary:active,
.media-download:active {
    transform: scale(0.98);
}

.privacy-pill {
    background: rgba(0, 168, 132, 0.08);
    color: var(--primary);
    padding: 10px;
    border-radius: 8px;
    font-size: 11px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
}

.chat-list {
    padding: 10px;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.search-bar-sidebar {
    background: var(--bg-input);
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    border-bottom: 1px solid transparent;
}

.search-bar-sidebar:focus-within {
    border-bottom-color: var(--primary);
}

.search-bar-sidebar input {
    background: transparent;
    border: none;
    flex: 1;
    color: var(--text-primary);
}

.chat-item {
    display: flex;
    gap: 15px;
    padding: 12px;
    border-radius: 12px;
    align-items: center;
    text-align: left;
    color: inherit;
    transition: background 0.2s ease;
}

.chat-item.active,
.chat-item:hover {
    background: var(--bg-header);
}

.chat-item-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6a7175, #88939a);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 18px;
    letter-spacing: 0.5px;
}

.chat-item-info {
    flex: 1;
    min-width: 0;
}

.chat-item-info h4 {
    font-weight: 500;
    font-size: 16px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-info span {
    font-size: 13px;
    color: var(--text-secondary);
}

.drawer {
    position: absolute;
    inset: 0;
    background: var(--bg-panel);
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 300;
    display: flex;
    flex-direction: column;
}

.drawer.open {
    transform: translateX(0);
}

.drawer-header {
    height: 110px;
    background: var(--bg-header);
    display: flex;
    align-items: flex-end;
    padding: 20px;
    gap: 20px;
    border-bottom: 1px solid var(--border);
}

.drawer-header h2 {
    font-size: 19px;
    font-weight: 500;
}

.drawer-close {
    color: var(--text-primary);
    font-size: 24px;
}

.drawer-scroll {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.profile-hero {
    text-align: center;
    margin-bottom: 30px;
}

.large-avatar {
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
    position: relative;
    border-radius: 50%;
    overflow: hidden;
}

.large-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.large-avatar .overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 40px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.large-avatar:hover .overlay,
.large-avatar:focus-visible .overlay {
    opacity: 1;
}

.section-label {
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    margin: 30px 0 15px;
}

.support-card,
.stat-box,
.repo-card,
.media-doc,
.media-missing,
.media-caption {
    border: 1px solid var(--border);
}

.support-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent), var(--bg-header);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.support-text {
    margin-bottom: 15px;
    color: var(--text-secondary);
    font-size: 14px;
}

.upi-display {
    background: var(--bg-input);
    padding: 12px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    margin-bottom: 20px;
    font-size: 14px;
}

.upi-display button {
    color: var(--primary);
}

.qr-frame {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    display: inline-block;
}

.qr-frame img {
    display: block;
    width: 160px;
    height: 160px;
}

.secure-badge {
    margin-top: 10px;
    font-size: 12px;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    opacity: 0.85;
}

.settings-group {
    margin-bottom: 12px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.setting-row span {
    min-width: 0;
}

.setting-row strong {
    display: block;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

.setting-row small {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.45;
    margin-top: 3px;
}

.setting-row select {
    width: 116px;
    flex: 0 0 116px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 8px 10px;
}

.setting-row input[type="checkbox"] {
    width: 42px;
    height: 24px;
    flex: 0 0 42px;
    appearance: none;
    border-radius: 999px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    position: relative;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.setting-row input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: transform 0.2s ease, background 0.2s ease;
}

.setting-row input[type="checkbox"]:checked {
    background: rgba(0, 168, 132, 0.22);
    border-color: var(--primary);
}

.setting-row input[type="checkbox"]:checked::after {
    transform: translateX(18px);
    background: var(--primary);
}

.settings-reset {
    width: 100%;
    justify-content: center;
    margin-top: 18px;
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 30px;
}

.stat-box {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent), var(--bg-input);
    padding: 20px 15px;
    border-radius: 12px;
    text-align: center;
}

.stat-box .val {
    display: block;
    font-size: 26px;
    color: var(--primary);
    font-weight: 300;
    margin-bottom: 5px;
}

.stat-box .label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-row {
    font-size: 13px;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.stat-name {
    font-weight: 500;
    color: var(--text-primary);
}

.stat-pct {
    color: var(--text-secondary);
    text-align: right;
}

.progress-bg {
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.progress-val {
    height: 100%;
    background: var(--primary);
    border-radius: inherit;
    transition: width 0.4s ease;
}

.info-block {
    margin-bottom: 25px;
}

.info-block h3 {
    color: var(--primary);
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-block p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.feature-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}

.feature-list li i {
    color: var(--primary);
    font-size: 18px;
    margin-top: 2px;
    flex-shrink: 0;
}

.repo-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent), var(--bg-input);
    padding: 15px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.repo-card:hover {
    border-color: var(--primary);
    background: rgba(0, 168, 132, 0.05);
}

.repo-card i:first-child {
    font-size: 32px;
}

.repo-card i:last-child {
    margin-left: auto;
    color: var(--text-secondary);
}

.repo-card div {
    display: flex;
    flex-direction: column;
}

.repo-card div span {
    font-size: 12px;
    color: var(--text-secondary);
}

.chat-interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    position: relative;
    border-left: 1px solid var(--border);
    min-width: 0;
    z-index: 10;
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.01), transparent 180px);
}

.chat-bg {
    position: absolute;
    inset: 0;
    opacity: 0.06;
    background-image: url("https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png");
    pointer-events: none;
}

body.light-theme .chat-bg {
    opacity: 0.4;
}

.chat-header,
.search-toolbar,
.chat-footer {
    background: var(--bg-header);
    backdrop-filter: blur(10px);
}

.chat-header {
    height: 60px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    z-index: 20;
}

.mobile-menu {
    display: none;
    color: var(--text-primary);
    margin-right: 12px;
}

.header-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
}

.header-info { flex: 1 1 auto; min-width: 0; }

.header-pfp {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}

.header-info h2 {
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-info p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-tools {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ── Sender filter control ── */
.sender-filter-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.sender-filter-container[hidden] {
    display: none !important;
}

.sender-filter-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: var(--control-height);
    padding: 0 5px 0 8px;
    border-radius: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.sender-filter-wrapper:focus-within {
    border-color: var(--primary);
}

.sender-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    outline: none;
    min-height: var(--control-height);
}

.sender-filter-btn:focus-visible,
.sender-filter-reset-btn:focus-visible,
.sender-filter-checkbox:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.sender-filter-btn i.ph-funnel {
    font-size: 15px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.sender-filter-prefix {
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
    user-select: none;
    display: none;
}

.sender-filter-text {
    font-weight: 600;
    white-space: nowrap;
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    color: var(--text-primary);
}

.sender-filter-caret {
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.sender-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    color: #fff;
    background: var(--primary);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}
.sender-filter-badge[hidden] { display: none !important; }

.sender-filter-btn[aria-expanded="true"] .sender-filter-caret {
    transform: rotate(180deg);
}

/* ── Sender filter dropdown popover ── */
.sender-filter-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: min(300px, calc(100vw - 24px));
    min-width: min(230px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    z-index: 100;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform-origin: top right;
    animation: scaleIn 0.12s ease-out;
}

.sender-filter-dropdown[hidden] {
    display: none !important;
}

.sender-filter-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sender-filter-dropdown-actions { display: flex; align-items: center; gap: var(--space-1); }
.sender-filter-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: var(--control-radius);
    color: var(--text-secondary);
    background: transparent;
}
.sender-filter-close:hover { color: var(--text-primary); background: var(--bg-input); }

.sender-filter-reset-btn {
    border: none;
    background: transparent;
    color: var(--primary);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.sender-filter-reset-btn:hover {
    background: rgba(0, 168, 132, 0.12);
}

.sender-filter-list {
    display: flex;
    flex-direction: column;
    max-height: 250px;
    overflow-y: auto;
    padding: 4px 0;
    overscroll-behavior: contain;
}

.sender-filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    user-select: none;
    transition: background 0.15s ease;
}

.sender-filter-item:hover {
    background: var(--bg-input);
}

.sender-filter-checkbox {
    cursor: pointer;
    accent-color: var(--primary);
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.sender-filter-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.sender-filter-count {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 400;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

body.light-theme .sender-filter-count {
    background: rgba(0, 0, 0, 0.05);
}

.menu-container {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: 210px;
    background: var(--bg-sidebar);
    box-shadow: var(--shadow-md);
    border-radius: 10px;
    padding: 8px 0;
    display: none;
    z-index: 100;
    border: 1px solid var(--border);
    transform-origin: top right;
    animation: scaleIn 0.12s ease-out;
}

.dropdown-menu.show {
    display: block;
}

.menu-item {
    padding: 11px 16px;
    color: var(--text-primary);
    font-size: 14.5px;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
}

.menu-item:hover {
    background: var(--bg-input);
}

@keyframes scaleIn {
    from {
        transform: scale(0.94);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.search-toolbar {
    height: 60px;
    border-bottom: 1px solid var(--border);
    display: none;
    align-items: center;
    padding: 0 16px;
    gap: 15px;
    z-index: 19;
    animation: slideDown 0.2s ease;
}

.search-toolbar.active {
    display: flex;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

.search-input-group {
    flex: 1;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 10px;
    background: var(--bg-input);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.search-input-group input {
    border: none;
    background: transparent;
    flex: 1;
    font-size: 14px;
}

.search-input-group button {
    color: var(--text-secondary);
    font-size: 20px;
}

.search-nav {
    display: flex;
    gap: 4px;
    align-items: center;
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
}

.search-nav button {
    font-size: 20px;
    padding: 4px;
    border-radius: 50%;
}

.search-nav button:hover {
    background: rgba(255, 255, 255, 0.05);
}

.messages-viewport {
    flex: 1;
    overflow-y: auto;
    padding: 10px 5% 14px;
    position: relative;
    z-index: 10;
    scroll-behavior: auto;
    scrollbar-width: thin; /* Firefox graceful fallback */
}

/* Thin, rounded, muted scrollbar for the message view (webkit) */
.messages-viewport::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.messages-viewport::-webkit-scrollbar-thumb {
    background: rgba(134, 150, 160, 0.35);
    border: 0;
    border-radius: 999px;
}

.messages-viewport::-webkit-scrollbar-thumb:hover {
    background: rgba(134, 150, 160, 0.55);
}

.empty-placeholder {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
}

.empty-placeholder .illustration {
    font-size: 80px;
    margin-bottom: 20px;
    color: var(--border);
    opacity: 0.5;
}

.empty-placeholder h2 {
    color: var(--text-primary);
    font-weight: 300;
    margin-bottom: 10px;
}

.message-list {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.system-msg {
    align-self: center;
    background: var(--system-msg);
    color: var(--text-secondary);
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 7px;
    margin: 8px 0;
    font-weight: 500;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.sticky-date {
    position: sticky;
    top: 10px;
    z-index: 50;
    border-radius: 14px;
    background: rgba(24, 34, 41, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

body.light-theme .sticky-date {
    background: rgba(255, 255, 255, 0.82);
    color: var(--text-secondary);
    border-color: rgba(17, 27, 33, 0.06);
}

.msg-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 2px;
    position: relative;
    max-width: min(75%, 690px);
}

.msg-row.received { align-self: flex-start; align-items: flex-start; }
.msg-row.sent { align-self: flex-end; align-items: flex-end; }
.msg-row.tail { margin-top: 8px; }

.msg-row.tail.received .bubble { border-top-left-radius: 0; }
.msg-row.tail.sent .bubble { border-top-right-radius: 0; }

.bubble {
    border-radius: var(--wa-bubble-radius);
    position: relative;
    font-size: 14.2px;
    line-height: 19px;
    color: var(--text-primary);
    box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.24);
    min-width: 80px;
    max-width: 100%;
    width: fit-content;
    display: block;
    padding: 6px 9px 8px;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.bubble:hover {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.received .bubble {
    background: var(--msg-in);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.sent .bubble {
    background: var(--msg-out);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.tail-in .bubble::before,
.tail-out .bubble::after {
    content: "";
    position: absolute;
    top: 0;
    width: 9px;
    height: 12px;
}

.tail-in .bubble::before {
    left: -8px;
    background: var(--msg-in);
    clip-path: polygon(100% 0, 100% 100%, 0 0);
}

.tail-out .bubble::after {
    right: -8px;
    background: var(--msg-out);
    clip-path: polygon(0 0, 0 100%, 100% 0);
}

.sender {
    margin-bottom: 4px;
    font-size: 12.8px;
    font-weight: 600;
    line-height: 1.2;
}

.msg-text {
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    color: inherit;
    min-width: 0;
}

.msg-text::after {
    content: "\00A0\00A0\00A0\00A0\00A0\00A0\00A0\00A0\00A0\00A0"; 
    display: inline-block;
    width: 60px;
}

.msg-text a {
    color: #53bdeb;
    text-decoration: underline;
}

.sent .meta { color: rgba(233, 237, 239, 0.78); }
body.light-theme .sent .meta { color: rgba(17, 27, 33, 0.56); }

.meta i {
    font-size: 15px;
    line-height: 1;
}

.msg-media-stack {
    display: grid;
    gap: 8px;
    margin-top: 6px;
    padding-bottom: 12px; 
}

.meta {
    position: absolute;
    right: 8px;
    bottom: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--wa-meta-fs);
    line-height: 1;
    color: rgba(180, 180, 180, 0.75);
}

.msg-text + .msg-media-stack {
    margin-top: 6px; 
}

.media-button {
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.media-image,
.media-sticker,
.media-video {
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.02) 25%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.02) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite linear;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.media-image:has(img.loaded),
.media-sticker:has(img.loaded),
.media-video:has(video.loaded) {
    animation: none;
    background: rgba(255, 255, 255, 0.06);
}

.media-image img,
.media-sticker img,
.media-video video {
    display: block;
    width: 100%;
    max-width: min(320px, 60vw);
    max-height: 320px;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.media-image img.loaded,
.media-sticker img.loaded,
.media-video video.loaded {
    opacity: 1;
}

.media-sticker img {
    object-fit: contain;
    padding: 10px;
    background:
        linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.04) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.04) 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.media-audio {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-width: 200px;
}

/* Voice note waveform row */
.voice-note-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.voice-mic-icon {
    font-size: 20px;
    flex-shrink: 0;
    color: var(--primary);
}

.voice-waveform {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 2px;
    height: 28px;
    overflow: hidden;
}

.voice-waveform span {
    display: inline-block;
    width: 3px;
    border-radius: 2px;
    background: var(--primary);
    opacity: 0.65;
    flex-shrink: 0;
}

.voice-duration {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    min-width: 28px;
    text-align: right;
    flex-shrink: 0;
}

/* Instagram voice note accent */
.ig-voice-note .voice-mic-icon { color: #C13584; }
.ig-voice-note .voice-waveform span {
    background: linear-gradient(to top, #833AB4, #C13584);
}

.media-audio-head,
.media-doc-head,
.media-missing-head {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.media-audio-head i,
.media-doc-head i,
.media-missing-head i {
    font-size: 24px;
    color: var(--primary);
    flex-shrink: 0;
}

.media-audio strong,
.media-doc strong,
.media-missing strong {
    display: block;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-audio span,
.media-doc span,
.media-missing span {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
}

.media-audio audio,
.media-modal audio,
.media-modal video {
    width: 100%;
}

.media-doc,
.media-missing {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    border-radius: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.06);
}

.media-placeholder {
    width: min(320px, 60vw);
    max-width: 100%;
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    color: var(--text-secondary);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)),
        var(--bg-soft);
}

.media-placeholder i {
    font-size: 38px;
}

.media-doc-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.media-doc-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
}

.media-doc-link:hover {
    text-decoration: underline;
}

.media-caption {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.hl {
    background: rgba(245, 197, 24, 0.4);
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

.hl.focus {
    background: var(--highlight);
    color: #000;
    box-shadow: 0 0 0 2px var(--highlight);
}

.chat-footer {
    height: 62px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 12px;
    border-left: 1px solid var(--border);
    z-index: 20;
}

.fake-input {
    flex: 1;
    background: var(--bg-input);
    height: 42px;
    border-radius: 8px;
    padding: 11px 16px;
    color: var(--text-secondary);
    cursor: text;
    font-size: 15px;
}

.sidebar-backdrop {
    display: none;
}

.date-jumper-input {
    position: fixed;
    left: 10px;
    top: 10px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.date-sheet-backdrop,
.media-modal {
    position: fixed;
    inset: 0;
    z-index: 1400;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.date-sheet-backdrop.open,
.media-modal.open {
    display: flex;
}

.date-sheet,
.media-modal-dialog {
    width: min(420px, 100%);
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
}

.date-sheet {
    padding: 18px;
}

.date-sheet h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}

.date-sheet p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 12px;
}

.date-sheet-input {
    height: 42px;
    padding: 8px 10px;
    margin-bottom: 14px;
    font-size: 16px;
}

.date-sheet-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.date-sheet-actions .btn-secondary,
.date-sheet-actions .btn-primary {
    width: auto;
    margin-top: 0;
    min-width: 96px;
    padding: 10px 16px;
}

.media-modal {
    z-index: 1600;
}

.media-modal-backdrop {
    position: absolute;
    inset: 0;
}

.media-modal-dialog {
    width: min(880px, 100%);
    max-height: min(88dvh, 900px);
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.media-modal-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.media-modal-header h2 {
    font-size: 18px;
}

.media-modal-header p {
    font-size: 12px;
    color: var(--text-secondary);
}

.media-modal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.media-modal-actions button {
    font-size: 22px;
    color: var(--text-secondary);
}

.media-modal-body {
    padding: 18px;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.18);
    min-height: 260px;
}

.media-modal-body img,
.media-modal-body video {
    max-width: 100%;
    max-height: calc(88dvh - 160px);
    border-radius: 12px;
    display: block;
}

.media-modal-body .media-doc,
.media-modal-body .media-missing {
    width: min(520px, 100%);
    background: var(--bg-elevated);
}

.processing-overlay {
    position: fixed;
    inset: 0;
    z-index: 1700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(6, 12, 15, 0.68);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.processing-overlay.open {
    opacity: 1;
    visibility: visible;
}

.processing-overlay.open .processing-card {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.processing-card {
    width: min(360px, 92vw);
    transform: translateY(14px) scale(0.97);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.3s ease;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent), var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-md);
    padding: 24px 22px;
    text-align: center;
}

.processing-card h2 {
    font-size: 20px;
    margin-bottom: 8px;
}

.processing-card p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
}

.processing-spinner {
    display: inline-flex;
    font-size: 42px;
    color: var(--primary);
    margin-bottom: 14px;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#toast,
#ig-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--primary);
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9999;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

#toast.show,
#ig-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 800px) {
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(92vw, 380px);
        min-width: 0;
        max-width: 100%;
        height: 100dvh;
        z-index: 1000;
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        display: block;
        background: rgba(0, 0, 0, 0.4);
        border: 0;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 999;
    }

    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-menu {
        display: block;
    }

    .chat-header,
    .search-toolbar {
        padding-left: 10px;
        padding-right: 10px;
    }

    .header-info h2 {
        font-size: 14px;
    }

    .header-info p {
        font-size: 11px;
    }

    .header-tools {
        gap: 2px;
    }

    .sender-filter-dropdown {
        min-width: min(200px, calc(100vw - 24px));
        max-height: 55dvh;
    }

    .header-tools > button {
        padding: 7px;
    }

    .messages-viewport {
        padding: 12px 8px;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    }

    .msg-row {
        max-width: 92%;
    }

    .media-image img,
    .media-sticker img,
    .media-video video {
        max-width: min(100%, 300px);
    }

    .search-toolbar {
        height: auto;
        min-height: 54px;
        gap: 8px;
    }

    .search-input-group {
        min-width: 0;
    }

    .search-nav {
        font-size: 12px;
        gap: 2px;
    }

    .dropdown-menu {
        width: min(78vw, 220px);
    }

    .menu-item {
        padding: 12px 14px;
        font-size: 14px;
        gap: 10px;
    }

    .date-sheet-backdrop,
    .media-modal {
        padding: 12px;
    }

    .date-sheet {
        width: min(420px, 94vw);
    }

    .chat-footer {
        height: 58px;
        gap: 8px;
        padding: 0 8px calc(env(safe-area-inset-bottom, 0px) + 2px);
    }

    .chat-footer button {
        font-size: 22px;
    }

    .fake-input {
        height: 38px;
        padding: 9px 12px;
        font-size: 14px;
    }

    .input-wrapper input,
    .search-input-group input {
        font-size: 16px;
    }

    .media-modal-dialog {
        max-height: 92dvh;
    }

    .media-modal-header {
        align-items: flex-start;
    }
}

.wrapped-card {
    background: linear-gradient(135deg, #1f0b2e, #0b141a, #0b2e26);
    border: 1px solid rgba(0, 168, 132, 0.4);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 168, 132, 0.15);
}

.wrapped-card::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(0,168,132,0.1) 0%, transparent 60%);
    animation: rotate 10s linear infinite;
    pointer-events: none;
}

@keyframes rotate { 
    100% { transform: rotate(360deg); } 
}

.wrapped-card h3 { 
    color: #fff; font-size: 20px; font-weight: 600; 
    margin-bottom: 6px; position: relative;
}

.wrapped-card p { 
    color: var(--text-secondary); font-size: 13px; 
    margin-bottom: 16px; position: relative;
}

.btn-wrapped {
    background: linear-gradient(90deg, #00a884, #0abf97);
    color: #fff; border: none; padding: 10px 20px; 
    border-radius: 20px; font-weight: 600; font-size: 14px; 
    cursor: pointer; position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-wrapped:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 4px 15px rgba(0,168,132,0.4); 
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 10px;
    margin-bottom: 30px;
}

.emoji-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    display: flex; flex-direction: column; 
    align-items: center; justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}

.emoji-item:hover { 
    background: rgba(0, 168, 132, 0.1); 
    border-color: var(--primary); 
}

.emoji-char { font-size: 24px; margin-bottom: 4px; }
.emoji-count { font-size: 11px; color: var(--text-secondary); }

/* ── Wrapped Graphic (Apple-style) ── */
.wrapped-graphic-container {
    width: 540px;
    height: 960px;
    background: #000;
    border-radius: 24px;
    padding: 44px 40px 36px;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 32px;
    position: relative;
    overflow: hidden;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    box-sizing: border-box;
}

.wrapped-graphic-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 75% 8%, rgba(255,255,255,0.06) 0%, transparent 55%);
    pointer-events: none;
    z-index: 0;
}

.wrapped-graphic-container > * { position: relative; z-index: 1; }

.wg-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wg-brand-tag {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #555;
}

.wg-header h2 {
    font-size: 38px;
    font-weight: 800;
    color: #fff;
    line-height: 1.1;
    letter-spacing: -0.8px;
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.wg-header p {
    font-size: 15px;
    color: #666;
    margin: 0;
    font-weight: 400;
}

.wg-divider {
    height: 1px;
    background: #1c1c1c;
    flex-shrink: 0;
}

.wg-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.wg-stat-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 20px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wg-stat-card span {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #666;
}

.wg-stat-card h3 {
    font-size: 44px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    letter-spacing: -1.5px;
    margin: 0;
}

.wg-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.wg-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #666;
}

.wg-emoji-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.wg-emoji-cell {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 16px 8px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.wg-emoji-char {
    font-size: 34px;
    line-height: 1;
}

.wg-emoji-count {
    font-size: 13px;
    font-weight: 600;
    color: #666;
}

.wg-split {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.wg-split-bar {
    height: 10px;
    border-radius: 100px;
    display: flex;
    overflow: hidden;
    background: rgba(255,255,255,0.06);
}

.wg-split-segment {
    height: 100%;
}

.wg-split-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
}

.wg-split-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.wg-split-dot {
    font-size: 10px;
    flex-shrink: 0;
}

.wg-name {
    color: #fff;
    font-weight: 500;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wg-pct {
    color: #666;
    font-size: 12px;
}

.wg-brand-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 4px;
}

.wg-logo {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #444;
}

.wg-url {
    font-size: 12px;
    color: #3a3a3a;
    letter-spacing: 0.3px;
}

/* ── Full-window drag-and-drop overlay ── */
.drag-overlay {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(6, 12, 15, 0.78);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transform: scale(1.03);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.drag-overlay.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.drag-overlay-inner {
    text-align: center;
    color: var(--text-primary);
    border: 2px dashed var(--primary);
    border-radius: 24px;
    padding: 48px 56px;
    background: rgba(0, 168, 132, 0.06);
    max-width: 90vw;
}

.drag-overlay-inner i {
    font-size: 72px;
    color: var(--primary);
    display: block;
    margin-bottom: 16px;
}

.drag-overlay-inner p {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}

.drag-overlay-inner span {
    font-size: 14px;
    color: var(--text-secondary);
}

.drag-overlay.error .drag-overlay-inner {
    border-color: var(--danger);
    background: rgba(255, 107, 107, 0.08);
}

/* ── Mobile "tap to select" hint (touch devices only) ── */
.mobile-tap-hint {
    display: none;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

@media (hover: none) and (pointer: coarse) {
    .mobile-tap-hint {
        display: block;
    }
}

/* ── App version label ── */
.app-version-label {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    letter-spacing: 0.3px;
}

/* ── Sponsors Marquee ── */
.sponsors-marquee-container {
    width: 100%;
    overflow: hidden;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: relative;
    display: flex;
}
.sponsors-marquee-container::before,
.sponsors-marquee-container::after {
    content: '';
    position: absolute;
    top: 0;
    width: 60px;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}
.sponsors-marquee-container::before {
    left: 0;
    background: linear-gradient(to right, var(--bg-sidebar) 20%, transparent);
}
.sponsors-marquee-container::after {
    right: 0;
    background: linear-gradient(to left, var(--bg-sidebar) 20%, transparent);
}
.sponsors-marquee {
    display: flex;
    width: max-content;
    animation: marquee-scroll 30s linear infinite;
}
.sponsors-marquee:hover {
    animation-play-state: paused;
}
.sponsors-marquee-item {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-right: 24px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-sidebar);
    padding: 10px 20px 10px 12px;
    border-radius: 30px;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    cursor: pointer;
}
.sponsors-marquee-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: var(--primary);
}
.sponsors-marquee-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 14px;
    overflow: hidden;
}
.sponsors-marquee-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sponsors-marquee-amount {
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
    background: rgba(0, 168, 132, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 4px;
}
@keyframes marquee-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ── Sponsors Page Grid ── */
.sponsors-header {
    text-align: center;
    padding: 60px 20px 20px;
}
.sponsors-header h1 {
    font-size: 40px;
    font-weight: 800;
    margin-bottom: 16px;
}
.sponsors-header p {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}
.sponsors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    padding: 20px;
    max-width: 1000px;
    margin: 0 auto 60px;
}
.sponsor-card {
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s, border-color 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.sponsor-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
    border-color: rgba(0, 168, 132, 0.5);
}
.sponsor-avatar {
    width: 80px;
    height: 80px;
    background: var(--bg-elevated);
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--primary);
    border: 2px solid var(--border);
    overflow: hidden;
    flex-shrink: 0;
}
.sponsor-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sponsor-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.sponsor-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
    flex-grow: 1;
}
.sponsor-amount {
    display: inline-block;
    background: rgba(0, 168, 132, 0.1);
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid rgba(0, 168, 132, 0.2);
}
.become-sponsor-btn {
    display: flex;
    justify-content: center;
    margin-bottom: 60px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   UI POLISH LAYER
   Motion, empty states, skeletons, sponsor surfaces and landing chrome.
   Everything here degrades to "no animation" under prefers-reduced-motion.
   ═══════════════════════════════════════════════════════════════════════════ */

/* The processing overlay now fades, so `hidden` needs to win over display:flex. */
.processing-overlay[hidden] { display: none; }

/* ── Shared motion vocabulary ── */
@keyframes cl-fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes cl-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes cl-pop-in {
    0%   { opacity: 0; transform: translateY(12px) scale(0.96); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes cl-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-7px); }
}
@keyframes cl-pulse-ring {
    0%   { transform: scale(0.85); opacity: 0.55; }
    70%  { transform: scale(1.35); opacity: 0; }
    100% { transform: scale(1.35); opacity: 0; }
}
@keyframes cl-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
/* Scroll-reveal: elements start hidden and are released by IntersectionObserver.
   `.no-js`-safe — if the observer never runs, `.cl-revealed` is applied on load. */
.cl-reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.6s cubic-bezier(0.19, 1, 0.22, 1),
                transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
    transition-delay: var(--cl-delay, 0ms);
    will-change: opacity, transform;
}
.cl-reveal.cl-revealed {
    opacity: 1;
    transform: none;
}

/* One-shot entrance for above-the-fold chrome (no observer needed). */
.cl-enter { animation: cl-fade-up 0.7s cubic-bezier(0.19, 1, 0.22, 1) both; }
.cl-enter-delay-1 { animation-delay: 0.08s; }
.cl-enter-delay-2 { animation-delay: 0.16s; }
.cl-enter-delay-3 { animation-delay: 0.24s; }
.cl-enter-delay-4 { animation-delay: 0.32s; }

/* ── Button micro-interactions ── */
.btn-primary,
.btn-secondary {
    transition: transform 0.18s cubic-bezier(0.19, 1, 0.22, 1),
                box-shadow 0.18s ease,
                background 0.18s ease,
                border-color 0.18s ease,
                opacity 0.18s ease;
}
.btn-primary:not(:disabled):hover { transform: translateY(-2px); }
.btn-primary:not(:disabled):active,
.btn-secondary:not(:disabled):active { transform: translateY(0) scale(0.985); }
.btn-primary:disabled,
.btn-secondary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* Keyboard focus that is visible on every surface. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 6px;
}

/* ── Nav polish ── */
.landing-nav .logo i {
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}
.landing-nav .logo:hover i { transform: rotate(-8deg) scale(1.12); }

.landing-nav .nav-links a {
    position: relative;
    transition: color 0.2s ease;
}
.landing-nav .nav-links a::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 2px;
    border-radius: 2px;
    background: var(--primary);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.25s cubic-bezier(0.19, 1, 0.22, 1);
}
.landing-nav .nav-links a:hover::after,
.landing-nav .nav-links a[aria-current="page"]::after { transform: scaleX(1); }
.landing-nav .nav-links a[aria-current="page"] { color: var(--primary); }

/* Theme toggle that lives in the landing nav. */
.nav-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-left: 20px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    flex-shrink: 0;
    vertical-align: middle;
}
.nav-theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
    transform: rotate(18deg);
}

/* ── Hero ── */
.hero h1 .hero-accent {
    background: linear-gradient(100deg, var(--primary), #45d6b4 55%, #7ce0ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* Soft ambient glow behind the hero — purely decorative. */
.hero {
    position: relative;
    isolation: isolate;
}
.hero::before {
    content: '';
    position: absolute;
    z-index: -1;
    top: -10%;
    left: 50%;
    width: min(760px, 110vw);
    height: 420px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center, rgba(0, 168, 132, 0.16), transparent 68%);
    filter: blur(12px);
    pointer-events: none;
}
body.light-theme .hero::before {
    background: radial-gradient(ellipse at center, rgba(0, 168, 132, 0.13), transparent 68%);
}

.hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 0 auto 26px;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-sidebar);
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1;
}
.hero-badge i { font-size: 14px; color: var(--primary); }

/* Live "no uploads" dot. */
.hero-badge .live-dot {
    position: relative;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}
.hero-badge .live-dot::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--primary);
    animation: cl-pulse-ring 2s ease-out infinite;
}

/* ── Product Hunt badge ── */
.ph-badge-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
}
.ph-badge-wrap a {
    display: inline-flex;
    line-height: 0;
    border-radius: 12px;
    transition: transform 0.25s cubic-bezier(0.19, 1, 0.22, 1), filter 0.25s ease;
}
.ph-badge-wrap a:hover { transform: translateY(-3px) scale(1.02); }
.ph-badge-wrap img {
    width: 250px;
    height: 54px;
    max-width: 100%;
    display: block;
}
/* The badge art is light-on-transparent; give it a plate on dark backgrounds. */
.ph-badge-wrap a {
    padding: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
}
body.light-theme .ph-badge-wrap a {
    background: transparent;
    border-color: transparent;
}
.ph-badge-wrap a:hover { border-color: rgba(218, 85, 47, 0.5); }

/* ── Platform picker cards (moved out of inline styles) ── */
.platform-picker {
    max-width: 680px;
    margin: 0 auto 16px;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.platform-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 28px 20px;
    text-decoration: none;
    color: var(--text-primary);
    overflow: hidden;
    isolation: isolate;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s cubic-bezier(0.19, 1, 0.22, 1);
}
.platform-card::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.25s ease;
    background: radial-gradient(circle at 50% 0%, var(--platform-glow, rgba(0, 168, 132, 0.18)), transparent 70%);
}
.platform-card:hover {
    transform: translateY(-4px);
    border-color: var(--platform-accent, var(--primary));
    box-shadow: 0 12px 28px var(--platform-shadow, rgba(0, 168, 132, 0.14));
}
.platform-card:hover::before { opacity: 1; }
.platform-card > i {
    font-size: 40px;
    transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
}
.platform-card:hover > i { transform: scale(1.12) translateY(-2px); }
.platform-card .platform-title { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.platform-card .platform-sub { font-size: 13px; color: var(--text-secondary); }
.platform-card .platform-text { text-align: center; }

.platform-card.is-whatsapp {
    --platform-accent: #25D366;
    --platform-glow: rgba(37, 211, 102, 0.16);
    --platform-shadow: rgba(0, 168, 132, 0.16);
}
.platform-card.is-instagram {
    --platform-accent: #C13584;
    --platform-glow: rgba(193, 53, 132, 0.16);
    --platform-shadow: rgba(193, 53, 132, 0.16);
}
.platform-card.is-whatsapp > i { color: #25D366; }
.platform-card.is-instagram > i {
    background: linear-gradient(135deg, #833AB4, #C13584, #E1306C);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

@media (max-width: 560px) {
    .platform-picker { grid-template-columns: 1fr; }
}

/* ── Feature cards ── */
.feature-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}
.feature-card:hover { border-color: rgba(0, 168, 132, 0.4); }
.feature-card i {
    display: inline-block;
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}
.feature-card:hover i { transform: translateY(-4px) scale(1.08); }

/* ── Sponsors: marquee ── */
/* Duration is set per-render from the item count so speed stays constant. */
.sponsors-marquee { animation-duration: var(--marquee-duration, 30s); }
.sponsors-marquee-container:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.sponsors-marquee-item {
    /* The whole strip is one link target; don't fight it with per-item cursors. */
    cursor: inherit;
    white-space: nowrap;
}
.sponsors-marquee-item.is-skeleton {
    border-color: var(--border);
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-input) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: cl-shimmer 1.6s linear infinite;
    color: transparent;
    min-width: 170px;
    height: 48px;
}
.sponsors-marquee-item.is-skeleton .sponsors-marquee-avatar { background: rgba(255, 255, 255, 0.05); }
.sponsors-marquee-item.is-cta {
    border-style: dashed;
    border-color: rgba(0, 168, 132, 0.45);
    color: var(--primary);
}
.sponsors-marquee-item.is-cta .sponsors-marquee-avatar {
    background: rgba(0, 168, 132, 0.12);
}

/* ── Sponsors: page ── */
.sponsors-hero-tagline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    margin-bottom: 18px;
    border: 1px solid rgba(0, 168, 132, 0.3);
    border-radius: 999px;
    background: rgba(0, 168, 132, 0.08);
    color: var(--primary);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.sponsor-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    max-width: 1000px;
    margin: 28px auto 0;
    padding: 0 20px;
}
.sponsor-summary-item {
    flex: 1 1 150px;
    max-width: 220px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px 16px;
    text-align: center;
}
.sponsor-summary-item .val {
    display: block;
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.sponsor-summary-item .label {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.sponsor-card {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.sponsor-card::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: 0;
    background: radial-gradient(circle at 50% 0%, rgba(0, 168, 132, 0.16), transparent 70%);
    transition: opacity 0.3s ease;
}
.sponsor-card:hover::before { opacity: 1; }
.sponsor-card:hover { border-color: rgba(0, 168, 132, 0.5); }
.sponsor-avatar {
    transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1), border-color 0.3s ease;
}
.sponsor-card:hover .sponsor-avatar {
    transform: scale(1.06);
    border-color: var(--primary);
}

.sponsor-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 12px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}
.sponsor-link:hover { color: var(--primary); }

/* Skeleton card that matches the real card's footprint exactly. */
.sponsor-card.is-skeleton {
    pointer-events: none;
    border-color: var(--border);
}
.sponsor-card.is-skeleton .skel-line,
.sponsor-card.is-skeleton .skel-circle {
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-input) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: cl-shimmer 1.6s linear infinite;
    border-radius: 7px;
}
.sponsor-card.is-skeleton .skel-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 16px;
}
.sponsor-card.is-skeleton .skel-line { height: 12px; width: 70%; margin-bottom: 8px; }
.sponsor-card.is-skeleton .skel-line.short { width: 45%; }
.sponsor-card.is-skeleton .skel-line.pill { width: 60px; height: 26px; border-radius: 12px; margin-top: 8px; }

/* ── Shared empty / error states ── */
.state-panel {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    padding: 56px 24px;
    border: 1px dashed var(--border);
    border-radius: 20px;
    background: var(--bg-sidebar);
    animation: cl-fade-up 0.5s cubic-bezier(0.19, 1, 0.22, 1) both;
}
.state-panel .state-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    margin-bottom: 14px;
    border-radius: 50%;
    background: rgba(0, 168, 132, 0.1);
    color: var(--primary);
    font-size: 32px;
    animation: cl-float 3.6s ease-in-out infinite;
}
.state-panel.is-error .state-icon {
    background: rgba(255, 107, 107, 0.12);
    color: var(--danger);
    animation: none;
}
.state-panel h3 {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-primary);
}
.state-panel p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 380px;
}
.state-panel .state-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 16px;
}

/* ── Sponsor CTA card (replaces the bare GitHub iframe) ── */
.sponsor-cta {
    max-width: 640px;
    margin: 0 auto 60px;
    padding: 32px 28px;
    text-align: center;
    background: linear-gradient(180deg, rgba(0, 168, 132, 0.07), transparent), var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 22px;
}
.sponsor-cta h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.sponsor-cta p {
    color: var(--text-secondary);
    font-size: 14.5px;
    line-height: 1.65;
    max-width: 460px;
    margin: 0 auto 22px;
}
.sponsor-cta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: center;
}
.sponsor-cta-actions .btn-primary,
.sponsor-cta-actions .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}
.sponsor-cta-actions .btn-secondary {
    border: 1px solid var(--border);
    color: var(--text-primary);
    background: transparent;
}
.sponsor-cta-actions .btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.sponsor-perks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    justify-content: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-secondary);
}
.sponsor-perks span { display: inline-flex; align-items: center; gap: 6px; }
.sponsor-perks i { color: var(--primary); }

/* ── In-app empty states (viewer + Instagram) ── */
.empty-placeholder {
    gap: 4px;
    animation: cl-fade-up 0.5s cubic-bezier(0.19, 1, 0.22, 1) both;
}
.empty-placeholder .illustration {
    animation: cl-float 4.5s ease-in-out infinite;
}
.empty-placeholder p { line-height: 1.65; }

.empty-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 22px;
    max-width: 420px;
}
.empty-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-sidebar);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
}
.empty-hint i { font-size: 13px; color: var(--primary); }

.empty-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 18px;
    padding: 9px 18px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.empty-cta:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }

/* Search "no matches" state, layered over the message list. */
.search-empty {
    position: absolute;
    inset: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    padding: 24px;
    /* Translucent so the chat wallpaper still reads behind it. */
    background: color-mix(in srgb, var(--bg-main) 88%, transparent);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: cl-fade-in 0.25s ease both;
}
/* Fallback for browsers without color-mix(). */
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
    .search-empty { background: var(--bg-main); }
}
.search-empty[hidden] { display: none; }
.search-empty i {
    font-size: 52px;
    color: var(--border);
    margin-bottom: 12px;
}
.search-empty h3 { font-size: 17px; color: var(--text-primary); font-weight: 600; }
.search-empty p { font-size: 13.5px; color: var(--text-secondary); max-width: 300px; line-height: 1.6; }
.search-empty .query {
    color: var(--primary);
    font-weight: 600;
    word-break: break-word;
}
.messages-viewport { position: relative; }

/* ── Sidebar chat-list skeleton shown while an export is parsing ── */
.chat-skeleton { padding: 4px 0; }
.chat-skeleton-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
}
.chat-skeleton-row .sk-avatar,
.chat-skeleton-row .sk-line {
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-input) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: cl-shimmer 1.6s linear infinite;
    border-radius: 6px;
}
.chat-skeleton-row .sk-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    flex-shrink: 0;
}
.chat-skeleton-row .sk-body { flex: 1; min-width: 0; }
.chat-skeleton-row .sk-line { height: 11px; margin-bottom: 8px; }
.chat-skeleton-row .sk-line.w70 { width: 70%; }
.chat-skeleton-row .sk-line.w40 { width: 40%; margin-bottom: 0; height: 9px; }

/* Stagger the rows so the shimmer reads as a wave. */
.chat-skeleton-row:nth-child(2) .sk-avatar,
.chat-skeleton-row:nth-child(2) .sk-line { animation-delay: 0.12s; }
.chat-skeleton-row:nth-child(3) .sk-avatar,
.chat-skeleton-row:nth-child(3) .sk-line { animation-delay: 0.24s; }
.chat-skeleton-row:nth-child(4) .sk-avatar,
.chat-skeleton-row:nth-child(4) .sk-line { animation-delay: 0.36s; }

/* ── Toast variants ── */
/* The toast was always success-green, including for failures. */
#toast.is-error,
#ig-toast.is-error {
    background: var(--danger);
    color: #2a0d0d;
}
#toast.is-warn,
#ig-toast.is-warn {
    background: var(--highlight);
    color: #23200a;
}
#toast.is-info,
#ig-toast.is-info {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

/* ── Modal entrances ── */
.media-modal.open .media-modal-dialog,
.date-sheet-backdrop.open .date-sheet {
    animation: cl-pop-in 0.28s cubic-bezier(0.19, 1, 0.22, 1) both;
}
.media-modal.open { animation: cl-fade-in 0.2s ease both; }

/* ── Drawer content stagger ── */
.drawer.open .drawer-scroll > * {
    animation: cl-fade-up 0.45s cubic-bezier(0.19, 1, 0.22, 1) both;
}
.drawer.open .drawer-scroll > *:nth-child(1) { animation-delay: 0.04s; }
.drawer.open .drawer-scroll > *:nth-child(2) { animation-delay: 0.08s; }
.drawer.open .drawer-scroll > *:nth-child(3) { animation-delay: 0.12s; }
.drawer.open .drawer-scroll > *:nth-child(4) { animation-delay: 0.16s; }
.drawer.open .drawer-scroll > *:nth-child(n+5) { animation-delay: 0.2s; }

/* ── Stat boxes count-up polish ── */
.stat-box {
    transition: transform 0.25s cubic-bezier(0.19, 1, 0.22, 1), border-color 0.25s ease;
}
.stat-box:hover { transform: translateY(-3px); border-color: rgba(0, 168, 132, 0.4); }
.stat-box .val { font-variant-numeric: tabular-nums; }

/* ── Drop target ── */
.drop-target {
    transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s cubic-bezier(0.19, 1, 0.22, 1);
}
.drop-target:not(:disabled):hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}
.drop-target i { transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1); }
.drop-target:not(:disabled):hover i { transform: translateY(-3px) scale(1.06); }

/* ── Thread filter (Instagram multi-conversation exports) ── */
.thread-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-input);
}
.thread-filter i { color: var(--text-secondary); font-size: 16px; flex-shrink: 0; }
.thread-filter input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
}
.thread-filter:focus-within { border-color: var(--primary); }
.thread-empty {
    padding: 28px 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13.5px;
    line-height: 1.6;
}
.thread-empty i { display: block; font-size: 30px; margin-bottom: 10px; color: var(--border); }
.thread-count {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 10px 2px;
}

/* ── Footer link polish ── */
.landing-footer a { transition: color 0.2s ease; }

/* ── Back-to-top button ── */
.to-top {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 900;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg-sidebar);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease, border-color 0.2s ease, color 0.2s ease;
    box-shadow: var(--shadow-sm);
}
.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { border-color: var(--primary); color: var(--primary); }

/* ── Respect the user's motion preference ── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    .cl-reveal { opacity: 1; transform: none; }
    .sponsors-marquee { animation: none; }
    .btn-primary:not(:disabled):hover,
    .platform-card:hover,
    .feature-card:hover,
    .sponsor-card:hover { transform: none; }
}

/* Error copy is longer than a confirmation — let the toast wrap instead of
   stretching past the viewport. */
#toast,
#ig-toast {
    max-width: min(520px, calc(100vw - 40px));
    text-align: center;
    line-height: 1.45;
    white-space: normal;
}

/* ── Drawer empty states (analytics before a chat is loaded) ── */
.drawer-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 34px 18px;
    border: 1px dashed var(--border);
    border-radius: 16px;
    background: var(--bg-soft);
}
.drawer-empty i {
    font-size: 34px;
    color: var(--text-muted);
    animation: cl-float 4.5s ease-in-out infinite;
}
.drawer-empty p {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 250px;
}

/* Per-sender bars grow from zero when the drawer opens, staggered by row. */
.progress-val {
    transition: width 0.85s cubic-bezier(0.19, 1, 0.22, 1);
}
.stats-list .stat-row:nth-child(2) .progress-val { transition-delay: 0.06s; }
.stats-list .stat-row:nth-child(3) .progress-val { transition-delay: 0.12s; }
.stats-list .stat-row:nth-child(4) .progress-val { transition-delay: 0.18s; }
.stats-list .stat-row:nth-child(n+5) .progress-val { transition-delay: 0.24s; }

/* The emoji tiles pop in with the drawer. */
.emoji-item {
    animation: cl-pop-in 0.4s cubic-bezier(0.19, 1, 0.22, 1) both;
    transition: transform 0.2s cubic-bezier(0.19, 1, 0.22, 1);
}
.emoji-item:hover { transform: translateY(-3px) scale(1.04); }
.emoji-item:nth-child(2) { animation-delay: 0.03s; }
.emoji-item:nth-child(3) { animation-delay: 0.06s; }
.emoji-item:nth-child(4) { animation-delay: 0.09s; }
.emoji-item:nth-child(5) { animation-delay: 0.12s; }
.emoji-item:nth-child(6) { animation-delay: 0.15s; }
.emoji-item:nth-child(n+7) { animation-delay: 0.18s; }

/* ── One-shot conversation reveal ──
   Applied once when a chat finishes loading. The message list is virtualised
   and re-renders on scroll, so only the container animates. */
.messages-viewport.chat-revealed .message-list {
    animation: cl-fade-up 0.5s cubic-bezier(0.19, 1, 0.22, 1) both;
}
.chat-header .header-profile.chat-revealed {
    animation: cl-fade-up 0.45s cubic-bezier(0.19, 1, 0.22, 1) both;
}

/* ── Responsive tidy-ups for the new landing chrome ── */
@media (max-width: 800px) {
    .nav-theme-toggle { margin-left: 0; }
    .hero { padding-top: 60px; }
    .hero-badges { margin-bottom: 20px; }
    .hero-badge { font-size: 11.5px; padding: 5px 11px; }
    .sponsor-summary { gap: 10px; }
    .sponsor-summary-item { flex-basis: 130px; padding: 14px 12px; }
    .sponsor-summary-item .val { font-size: 22px; }
    .sponsor-cta { padding: 26px 20px; margin-bottom: 40px; }
    .sponsor-cta-actions { flex-direction: column; align-items: stretch; }
    .sponsor-cta-actions .btn-primary,
    .sponsor-cta-actions .btn-secondary { justify-content: center; }
    .to-top { right: 16px; bottom: 16px; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 38px; }
    .hero p { font-size: 16px; }
    .empty-hints { gap: 6px; }
    .empty-hint { font-size: 11px; padding: 5px 10px; }
    .sponsors-grid { grid-template-columns: 1fr; }
}

/* ── Brand mark ──
   The logo is a self-contained green tile, so it never sits inside another
   coloured plate — it replaces those wrappers outright. */
.brand-mark {
    display: block;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.footer-brand .brand-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Empty-state illustration when it carries the logo instead of a glyph. */
.empty-placeholder .illustration img {
    width: 84px;
    height: 84px;
    display: block;
    opacity: 0.75;
}

/* The Wrapped card mark is rasterised by html2canvas — keep it plain. */
.wg-logo img {
    width: 18px;
    height: 18px;
    display: block;
}

/* ── PWA install prompt ──
   Replaces Chrome's mini-infobar; only rendered when the browser fires
   `beforeinstallprompt`, and never again once installed or dismissed. */
.install-prompt {
    position: fixed;
    left: 50%;
    bottom: 20px;
    z-index: 3000;
    display: flex;
    align-items: center;
    gap: 14px;
    width: min(460px, calc(100vw - 32px));
    padding: 14px 16px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
    transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
}
.install-prompt.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.install-prompt-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: block;
}
.install-prompt-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.install-prompt-text strong {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-primary);
}
.install-prompt-text span {
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--text-secondary);
}
.install-prompt-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.install-prompt-actions button {
    border: 0;
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.install-prompt-no {
    background: transparent;
    color: var(--text-secondary);
    padding: 9px 10px;
}
.install-prompt-no:hover { color: var(--text-primary); }
.install-prompt-yes {
    background: var(--primary);
    color: #fff;
}
.install-prompt-yes:hover { background: var(--primary-hover); transform: translateY(-1px); }

@media (max-width: 560px) {
    .install-prompt {
        flex-wrap: wrap;
        gap: 10px 12px;
        bottom: 12px;
    }
    .install-prompt-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* The back-to-top button must not sit under the install card. */
.install-prompt.show ~ .to-top { bottom: 96px; }

/* ── Jump-to-latest ──
   A chat that has been scrolled back needs a one-tap way home. "Jump to
   Bottom" existed only inside the header's overflow menu, which is two taps
   and easy to miss; this pill fades in over the message list as soon as the
   conversation is scrolled away from the newest message. */
.scroll-latest {
    position: absolute;
    right: 22px;
    bottom: 24px;
    z-index: 40;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 19px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transform: translateY(10px) scale(0.94);
    transition: opacity 0.18s ease, transform 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.scroll-latest[hidden] { display: none; }
.scroll-latest.show { opacity: 1; transform: translateY(0) scale(1); }
.scroll-latest:hover { border-color: var(--primary); color: var(--primary); }
.scroll-latest:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

body.light-theme .scroll-latest { box-shadow: 0 6px 20px rgba(17, 27, 33, 0.12); }

/* Shared interaction and spacing refinements for the chat viewers. */
:where(button, input, select, a):focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    box-shadow: var(--focus-ring);
}

.chat-header .header-tools > button,
.chat-header .menu-container > button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 var(--control-height);
    width: var(--control-height);
    height: var(--control-height);
    min-width: var(--control-height);
    min-height: var(--control-height);
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--control-radius);
    color: var(--text-secondary);
    background: transparent;
    transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.chat-header .header-tools > button i,
.chat-header .menu-container > button i { font-size: var(--icon-size-control); }

.chat-header .header-tools > button:hover,
.chat-header .menu-container > button:hover,
.chat-header .header-tools > button[aria-expanded="true"],
.chat-header .menu-container > button[aria-expanded="true"] {
    color: var(--text-primary);
    background: var(--bg-input);
    border-color: var(--border);
}

.chat-header .header-tools > button:active,
.chat-header .menu-container > button:active,
.menu-item:active { background: var(--bg-soft); }

.dropdown-menu {
    width: 216px;
    max-width: calc(100vw - 16px);
    max-height: min(420px, calc(100dvh - 32px));
    padding: 4px;
    border-radius: var(--popover-radius);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.menu-item {
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 8px;
    gap: 10px;
    font-size: 14px;
    line-height: 1.35;
    cursor: pointer;
    transition: background-color var(--motion-fast) ease, color var(--motion-fast) ease;
}

.menu-item i { width: 18px; flex: 0 0 18px; text-align: center; font-size: 17px; color: var(--text-secondary); }
.menu-item:hover,
.menu-item:focus-visible { background: var(--bg-input); color: var(--text-primary); }
.menu-item:focus-visible { outline-offset: -2px; box-shadow: none; }

.sender-filter-wrapper { min-height: var(--control-height); border-radius: var(--control-radius); }
.sender-filter-btn { min-height: var(--control-height); }
.sender-filter-container.has-filter .sender-filter-wrapper {
    border-color: color-mix(in srgb, var(--primary) 56%, var(--border));
    background: color-mix(in srgb, var(--primary) 8%, var(--bg-input));
}

.sender-filter-dropdown {
    width: min(320px, calc(100vw - 16px));
    min-width: min(240px, calc(100vw - 16px));
    max-width: calc(100vw - 16px);
    max-height: min(480px, calc(100dvh - 24px));
    border-radius: var(--popover-radius);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.sender-filter-dropdown-header {
    min-height: 44px;
    padding: 7px 12px;
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
    color: var(--text-primary);
}

.sender-filter-reset-btn {
    min-width: 44px;
    min-height: 36px;
    padding: 6px 8px;
    font-size: 13px;
}

.sender-filter-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    margin: 10px 10px 6px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    background: var(--bg-input);
}

.sender-filter-search-wrap:focus-within { border-color: var(--primary); box-shadow: var(--focus-ring); }
.sender-filter-search-wrap > i { flex: 0 0 auto; font-size: 16px; }
.sender-filter-search {
    min-width: 0;
    width: 100%;
    height: 40px;
    padding: 0;
    border: 0;
    outline: 0;
    color: var(--text-primary);
    background: transparent;
    font-size: 14px;
}
.sender-filter-search:focus-visible { outline: 0; box-shadow: none; }
.sender-filter-search-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}
.sender-filter-search-clear:hover { background: var(--bg-soft); color: var(--text-primary); }
.sender-filter-list { max-height: min(300px, 42dvh); }
.sender-filter-item { min-height: 44px; padding: 6px 12px; }
.sender-filter-item[hidden] { display: none !important; }
.sender-filter-checkbox { width: 18px; height: 18px; }
.sender-filter-count { min-width: 34px; text-align: center; }
.sender-filter-no-results { margin: 0; padding: 12px; color: var(--text-secondary); font-size: 13px; }
.sender-filter-no-results[hidden] { display: none !important; }

.search-toolbar { min-width: 0; }
.search-input-group:focus-within { outline: 1px solid var(--primary); outline-offset: 1px; }
.search-input-group button,
.search-nav button { min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
.search-nav button:disabled { opacity: .45; cursor: default; }

.date-sheet-backdrop { padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px)); }
.date-sheet { width: min(420px, 100%); border-radius: var(--popover-radius); }
.date-sheet-input { width: 100%; }

.msg-row,
.bubble,
.msg-text,
.msg-media-stack { min-width: 0; }
.system-msg { max-width: min(92%, 680px); overflow-wrap: anywhere; word-break: break-word; }
.msg-media-stack img,
.msg-media-stack video { max-width: 100%; }
.msg-text a { overflow-wrap: anywhere; word-break: break-word; }

@media (max-width: 800px) {
    .chat-header {
        height: auto;
        min-height: 64px;
        padding: calc(6px + env(safe-area-inset-top, 0px)) 8px 6px;
        gap: 4px;
        /* Keep viewport-fixed popovers anchored to the viewport, not this blurred header. */
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .mobile-menu {
        flex: 0 0 40px;
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        margin: 0 2px 0 0;
        padding: 0;
        border: 0;
        border-radius: var(--control-radius);
        background: transparent;
        font-size: 21px;
    }

    .header-profile { gap: 7px; }
    .header-pfp { width: 34px; height: 34px; }
    .header-info { min-width: 0; }
    .header-info h2 { font-size: 14px; line-height: 1.25; }
    .header-info p { font-size: 11px; }
    .header-tools { flex: 0 0 auto; gap: 1px; }
    .chat-header .header-tools > button,
    .chat-header .menu-container > button { flex-basis: 40px; width: 40px; height: 40px; min-width: 40px; min-height: 40px; }

    .sender-filter-dropdown {
        position: fixed;
        top: auto;
        right: max(8px, env(safe-area-inset-right, 0px));
        left: max(8px, env(safe-area-inset-left, 0px));
        bottom: calc(var(--chat-composer-height) + env(safe-area-inset-bottom, 0px) + 8px);
        width: auto;
        min-width: 0;
        max-width: none;
        max-height: min(70dvh, max(0px, calc(var(--participant-sheet-viewport-height, 100dvh) - max(8px, env(safe-area-inset-top, 0px)) - var(--chat-composer-height) - env(safe-area-inset-bottom, 0px) - 16px)));
        transform-origin: bottom center;
    }
    .sender-filter-dropdown-header,
    .sender-filter-search-wrap { flex: 0 0 auto; }
    .sender-filter-list {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        padding-bottom: 12px;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
    }

    .dropdown-menu {
        position: fixed;
        top: calc(env(safe-area-inset-top, 0px) + 58px);
        right: max(8px, env(safe-area-inset-right, 0px));
        width: min(248px, calc(100vw - 16px));
        max-width: none;
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 74px);
        transform-origin: top right;
    }

    .menu-item { min-height: 44px; }
    .search-toolbar { min-height: 56px; height: auto; padding: 6px 8px; gap: 6px; }
    .search-input-group { height: 42px; padding: 0 6px; gap: 4px; }
    .search-input-group input { min-width: 0; font-size: 16px; }
    .search-nav { flex: 0 0 auto; gap: 0; }
    .search-nav button { min-width: 40px; min-height: 40px; }
    .search-nav button:first-of-type { margin-left: 2px; }

    .chat-footer {
        height: calc(var(--chat-composer-height) + env(safe-area-inset-bottom, 0px));
        flex: 0 0 auto;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 2px);
    }
    .scroll-latest { right: 14px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
    .messages-viewport { scroll-padding-bottom: 16px; }
    .date-sheet-backdrop { align-items: flex-end; padding: 12px 12px max(12px, env(safe-area-inset-bottom, 0px)); }
    .date-sheet { border-radius: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .dropdown-menu,
    .sender-filter-dropdown,
    .chat-header .header-tools > button,
    .chat-header .menu-container > button,
    .menu-item,
    .sender-filter-item,
    .sender-filter-btn .sender-filter-caret,
    .search-toolbar,
    .chat-header .header-tools > button,
    .chat-header .menu-container > button { animation: none; transition: none; }
}

@media (max-width: 800px) {
    .scroll-latest { right: 16px; bottom: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .scroll-latest { transition: opacity 0.18s ease; transform: none; }
    .scroll-latest.show { transform: none; }
}

/* ── Sponsorship appeal ──
   The app's only promotional surface. It replaces a pair of asks: a sponsor
   card four seconds after boot plus a full-screen modal listing the developer's
   other projects once a chat opened. Now there is one card, shown only after a
   chat has actually rendered.

   Deliberately a card and never a modal — it must not stand between the user
   and the conversation they just opened. Shares .install-prompt's geometry so
   the two read as the same kind of object, with a pink accent that belongs to
   neither viewer's palette (WhatsApp green / Instagram gradient) so it reads as
   the app speaking rather than part of the chat. */
.sponsor-prompt {
    position: fixed;
    left: 50%;
    bottom: max(20px, env(safe-area-inset-bottom, 0px));
    z-index: 3000;
    display: flex;
    align-items: center;
    gap: 14px;
    width: min(480px, calc(100vw - 32px));
    padding: 14px 16px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
    transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
}
body.light-theme .sponsor-prompt {
    box-shadow: 0 18px 40px rgba(17, 27, 33, 0.12);
}
.sponsor-prompt.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.sponsor-prompt-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(219, 97, 162, 0.14);
    color: #db61a2;
    font-size: 21px;
}
.sponsor-prompt-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sponsor-prompt-text strong {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-primary);
}
.sponsor-prompt-text span {
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--text-secondary);
}
.sponsor-prompt-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.sponsor-prompt-no,
.sponsor-prompt-yes {
    border: 0;
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.sponsor-prompt-no {
    background: transparent;
    color: var(--text-secondary);
    padding: 9px 10px;
}
.sponsor-prompt-no:hover { color: var(--text-primary); }
.sponsor-prompt-yes {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #db61a2;
    color: #fff;
}
.sponsor-prompt-yes i { font-size: 14px; }
.sponsor-prompt-yes:hover { background: #e77ab5; transform: translateY(-1px); }
.sponsor-prompt-no:focus-visible,
.sponsor-prompt-yes:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

@media (max-width: 560px) {
    .sponsor-prompt {
        flex-wrap: wrap;
        gap: 10px 12px;
        bottom: max(12px, env(safe-area-inset-bottom, 0px));
    }
    .sponsor-prompt-actions { width: 100%; justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
    .sponsor-prompt { transition: opacity 0.3s ease; transform: translateX(-50%); }
    .sponsor-prompt.show { transform: translateX(-50%); }
    .sponsor-prompt-yes:hover { transform: none; }
}

.storage-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 12px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
}
.storage-note[hidden],
.upload-back[hidden] { display: none; }
.storage-note i {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--primary);
}
.storage-note-warn i { color: var(--highlight); }

.storage-summary {
    margin: 18px 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.storage-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}

.storage-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-soft);
}
.storage-item.active { border-color: var(--primary); }
.storage-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.storage-item-info strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.storage-item-info span {
    font-size: 12px;
    color: var(--text-secondary);
}

.stored-delete {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 17px;
    transition: background 0.18s ease, color 0.18s ease;
}
.stored-delete:hover,
.stored-delete:focus-visible {
    background: rgba(255, 107, 107, 0.14);
    color: var(--danger);
}

.storage-delete-all,
.upload-back,
.import-another {
    width: 100%;
    justify-content: center;
    gap: 8px;
}
.storage-delete-all { margin-top: 14px; }
.import-another { margin-top: 12px; }

.stored-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.stored-list[hidden] { display: none; }
.stored-list-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 6px 0 4px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
}
.stored-item {
    position: relative;
    display: flex;
    align-items: center;
}
.stored-item .chat-item {
    flex: 1;
    min-width: 0;
    width: 100%;
    padding-right: 44px;
}
.stored-item.active .chat-item { background: var(--bg-header); }
.stored-item .stored-delete {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.btn-danger {
    background: var(--danger);
    color: #2a0d0d;
}
.btn-danger:not(:disabled):hover { background: #ff8484; }

/* Background copy progress card. Sits above the toast slot so "Loaded" /
   "Saved" messages don't cover the progress readout. */
.persist-card {
    position: fixed;
    left: 50%;
    bottom: max(84px, calc(env(safe-area-inset-bottom, 0px) + 84px));
    z-index: 3001;
    display: flex;
    align-items: center;
    gap: 14px;
    width: min(480px, calc(100vw - 32px));
    padding: 14px 16px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
    transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
}
.persist-card[hidden] { display: none; }
body.light-theme .persist-card { box-shadow: 0 18px 40px rgba(17, 27, 33, 0.12); }
.persist-card.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.persist-card-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(0, 168, 132, 0.14);
    color: var(--primary);
    font-size: 21px;
}
.persist-card-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.persist-card-text strong {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}
.persist-card-text span {
    font-size: 12.5px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.persist-bar {
    height: 4px;
    margin-top: 2px;
    border-radius: 999px;
    background: var(--bg-input);
    overflow: hidden;
}
.persist-bar-fill {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--primary);
    transition: width 0.25s ease;
}
.persist-card-cancel {
    flex-shrink: 0;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    transition: color 0.18s ease, border-color 0.18s ease;
}
.persist-card-cancel:hover:not(:disabled) {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}
.persist-card-cancel:disabled { opacity: 0.55; cursor: not-allowed; }

/* Keep the contextual latest-message button clear of the composer. */
.scroll-latest { bottom: 76px; }
.sender-filter-search-clear[hidden] { display: none !important; }

@media (max-width: 800px) {
    .scroll-latest { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
}

/* Header participant control yields space to the chat identity. */
.sender-filter-wrapper {
    gap: 2px;
    width: fit-content;
    max-width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}
.sender-filter-wrapper:focus-within { border-color: transparent; box-shadow: none; }
.sender-filter-btn {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    gap: 7px;
    padding: 0 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-primary);
    background: rgba(134, 150, 160, 0.075);
    transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}
.sender-filter-btn:hover,
.sender-filter-btn[aria-expanded="true"] {
    border-color: transparent;
    background: transparent;
    color: var(--text-primary);
}
.sender-filter-btn:active { background: var(--bg-soft); }
.sender-filter-btn i.ph-funnel { color: var(--text-secondary); font-size: 14px; }
.sender-filter-btn[aria-expanded="true"] i.ph-funnel { color: var(--primary); }
.sender-filter-text {
    flex: 0 1 auto;
    min-width: 0;
    max-width: min(156px, 18vw);
    font-size: 12.5px;
    font-weight: 550;
}
.sender-filter-caret { font-size: 11px; }
.sender-filter-container.has-filter .sender-filter-wrapper { background: transparent; }
.sender-filter-container.has-filter .sender-filter-btn {
    border-color: rgba(0, 168, 132, 0.4);
    color: var(--text-primary);
    background: rgba(0, 168, 132, 0.1);
}
.sender-filter-container.has-filter .sender-filter-btn i.ph-funnel,
.sender-filter-container.has-filter .sender-filter-caret { color: var(--primary); }

/* ── Sitewide touch and control feedback ── */
:root {
    --motion-fast: 140ms;
    --motion-standard: 220ms;
    --ease-standard: cubic-bezier(0.2, 0.75, 0.25, 1);
    --ease-press: cubic-bezier(0.2, 0.85, 0.3, 1);
}

:where(button, a[href], [role="button"], [role="option"], input, select, summary) {
    touch-action: manipulation;
}

:where(button:not(:disabled), [role="button"]:not([aria-disabled="true"]), [role="option"]:not([aria-disabled="true"])) {
    transition-property: transform, background-color, border-color, color, box-shadow, filter, opacity;
    transition-duration: var(--motion-standard);
    transition-timing-function: var(--ease-standard);
}

button:not(:disabled):active,
[role="button"]:not([aria-disabled="true"]):active,
[role="option"]:not([aria-disabled="true"]):active,
a[href]:active,
.setting-row:active,
.chat-item:active,
.sender-filter-item:active,
.emoji-item:active,
.feature-card:active,
.platform-card:active,
.repo-card:active,
.sponsor-card:active,
.stat-box:active,
.media-doc-link:active {
    transform: scale(0.975);
    filter: brightness(1.04);
    transition-duration: 90ms;
    transition-timing-function: var(--ease-press);
}

.btn-primary:not(:disabled):active,
.btn-secondary:not(:disabled):active { transform: scale(0.975); }

.tap-ripple {
    position: fixed;
    z-index: 9999;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(0, 168, 132, 0.2) 0%, rgba(0, 168, 132, 0.12) 52%, transparent 74%);
    animation: tap-ripple-expand 430ms var(--ease-standard) forwards;
    will-change: transform, opacity;
}

@keyframes tap-ripple-expand {
    0% { opacity: 0.78; transform: scale(0.4); }
    100% { opacity: 0; transform: scale(8); }
}

@media (hover: hover) and (pointer: fine) {
    .feature-card,
    .platform-card,
    .repo-card,
    .sponsor-card,
    .stat-box {
        transition-timing-function: var(--ease-standard);
    }
}

@media (hover: none) and (pointer: coarse) {
    :root { --control-height: 44px; }

    .setting-row { min-height: 56px; }
    .menu-item { min-height: 48px; }
    .chat-header .header-tools > button,
    .chat-header .menu-container > button,
    .sidebar-nav button,
    .mobile-menu,
    .drawer-close,
    .to-top { min-width: 44px; min-height: 44px; }

    .landing-nav .nav-links a { padding: 8px 6px; }
    .tap-ripple { animation-duration: 380ms; }
}

@media (prefers-reduced-motion: reduce) {
    .tap-ripple { display: none; animation: none; }
    button:not(:disabled):active,
    [role="button"]:not([aria-disabled="true"]):active,
    [role="option"]:not([aria-disabled="true"]):active,
    a[href]:active,
    .setting-row:active,
    .chat-item:active,
    .sender-filter-item:active,
    .emoji-item:active,
    .feature-card:active,
    .platform-card:active,
    .repo-card:active,
    .sponsor-card:active,
    .stat-box:active,
    .media-doc-link:active { transform: none; filter: none; }
}

.sender-filter-wrapper { border: 0; background: transparent; box-shadow: none; }
.sender-filter-btn { flex: 0 1 auto; }

/* Preserve the full frame: the supplied demo has useful UI near all four edges. */
.hero-demo {
    width: min(960px, 100%);
    margin: 34px auto 0;
    overflow: hidden;
    border: 1px solid rgba(134, 150, 160, 0.24);
    border-radius: 14px;
    background: #07131a;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
    line-height: 0;
}
.hero-demo-video {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    background: #07131a;
}
body.light-theme .hero-demo {
    border-color: rgba(17, 27, 33, 0.12);
    box-shadow: 0 16px 42px rgba(17, 27, 33, 0.12);
}

@media (max-width: 800px) {
    .hero-demo { width: 100%; margin-top: 26px; border-radius: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18); }
}

@media (min-width: 521px) and (max-width: 800px) {
    .sender-filter-wrapper { max-width: 220px; }
    .sender-filter-text { max-width: 116px; font-size: 12px; }
    .hero-demo { margin-top: 22px; border-radius: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .hero-demo.cl-enter { animation: none; }
}

/* On narrow phones, the filter takes one fixed icon slot; the title keeps the remaining flex space. */
@media (max-width: 520px) {
    .chat-header { gap: var(--space-1); }
    .header-profile { flex: 1 1 0; }
    .header-info { flex: 1 1 0; }
    .sender-filter-wrapper { flex: 0 0 var(--control-height); width: var(--control-height); min-width: var(--control-height); max-width: var(--control-height); padding: 0; }
    .sender-filter-btn { position: relative; justify-content: center; flex: 0 0 100%; width: 100%; min-width: 100%; padding: 0; }
    .sender-filter-prefix,
    .sender-filter-text,
    .sender-filter-caret { display: none; }
    .sender-filter-badge { position: absolute; top: -3px; right: -3px; border: 2px solid var(--bg-header); }
}
