/* ═════════════════════════════════════════════════════════════════════════════════════════════════
   Vibora "galaxy" look: deep indigo, violet glow, soft sparkles. Same language as the Windows installer,
   the landing page and the app icon. Loaded AFTER index.css, so it only has to re-skin the design tokens
   the whole app already uses and polish the key components.

   The light and cyber themes (body.light-theme / body.cyber-theme) keep their own colours: they redefine the
   tokens with a more specific selector, and everything background-ish below is scoped to the default dark theme.
   ═════════════════════════════════════════════════════════════════════════════════════════════════ */

:root {
    --background: #07041b;
    --surface: rgba(17, 10, 46, 0.88);
    --surface-secondary: #140c38;
    --surface-raised: #1c1150;
    --surface-hover: rgba(140, 82, 255, 0.14);
    --text: #f4f0ff;
    --text-muted: #a99bd9;
    --accent: #9a63ff;
    --accent-hover: #b48cff;
    --accent-soft: rgba(154, 99, 255, 0.18);
    --border: rgba(168, 125, 255, 0.22);
    --glass-bg: rgba(14, 8, 40, 0.82);
    --input-bg: #0e0830;
    --card-bg: #140c38;
    --bg-lighter: #1a1048;
    --shadow: 0 22px 60px rgba(3, 1, 16, 0.6);
    --galaxy-glow: 0 0 0 1px rgba(168, 125, 255, 0.28), 0 0 34px rgba(110, 60, 240, 0.22);
    --galaxy-primary: linear-gradient(180deg, #8a4dff 0%, #6a2fe0 100%);
}

::selection { background: rgba(154, 99, 255, 0.45); color: #fff; }
* { scrollbar-color: rgba(154, 99, 255, 0.45) rgba(10, 6, 34, 0.45); }
::-webkit-scrollbar-thumb { background: rgba(154, 99, 255, 0.4); }
::-webkit-scrollbar-thumb:hover { background: rgba(180, 140, 255, 0.7); }
::-webkit-scrollbar-track { background: rgba(10, 6, 34, 0.45); }

/* ── page background: the galaxy + a faint star field ─────────────────────────────────────────── */
body:not(.light-theme):not(.cyber-theme) {
    background:
        radial-gradient(62% 52% at 100% 100%, rgba(112, 56, 240, 0.40) 0%, rgba(112, 56, 240, 0) 62%),
        radial-gradient(56% 46% at 0% 0%, rgba(40, 22, 120, 0.60) 0%, rgba(40, 22, 120, 0) 70%),
        #07041b;
    background-attachment: fixed;
}
body:not(.light-theme):not(.cyber-theme)::before {
    content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.6;
    background-image:
        radial-gradient(1.6px 1.6px at 8% 14%, #cdb2ff 55%, transparent 60%),
        radial-gradient(1.2px 1.2px at 17% 71%, #ffffff 55%, transparent 60%),
        radial-gradient(1.8px 1.8px at 26% 33%, #b48cff 55%, transparent 60%),
        radial-gradient(1.2px 1.2px at 38% 88%, #ffffff 55%, transparent 60%),
        radial-gradient(1.6px 1.6px at 47% 9%, #cdb2ff 55%, transparent 60%),
        radial-gradient(1.2px 1.2px at 58% 52%, #ffffff 55%, transparent 60%),
        radial-gradient(1.8px 1.8px at 66% 24%, #b48cff 55%, transparent 60%),
        radial-gradient(1.2px 1.2px at 74% 79%, #ffffff 55%, transparent 60%),
        radial-gradient(1.6px 1.6px at 83% 41%, #cdb2ff 55%, transparent 60%),
        radial-gradient(1.2px 1.2px at 91% 12%, #ffffff 55%, transparent 60%),
        radial-gradient(1.8px 1.8px at 95% 66%, #b48cff 55%, transparent 60%),
        radial-gradient(1.2px 1.2px at 3% 52%, #ffffff 55%, transparent 60%);
}

/* ── buttons ─────────────────────────────────────────────────────────────────────────────────── */
.btn-primary {
    background: var(--galaxy-primary); color: #fff; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 12px; font-weight: 700;
    box-shadow: 0 8px 24px rgba(122, 64, 245, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.32);
    transition: transform 0.12s, filter 0.12s, box-shadow 0.12s;
}
.btn-primary:hover { background: var(--galaxy-primary); filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 12px 30px rgba(122, 64, 245, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.38); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { transform: none; filter: none; }
.btn-secondary { background: rgba(14, 8, 40, 0.6); border: 1px solid var(--border); border-radius: 12px; color: var(--text); }
.btn-secondary:hover { border-color: rgba(200, 170, 255, 0.6); background: rgba(40, 24, 100, 0.55); }
.btn-icon { border-radius: 12px; }
.btn-icon:hover { background: var(--surface-hover); }
.btn-danger { background: linear-gradient(180deg, #ff6b7e, #d9264a) !important; border-color: rgba(255, 255, 255, 0.2) !important; }

/* ── inputs ──────────────────────────────────────────────────────────────────────────────────── */
input[type="email"], input[type="text"], input[type="password"], input[type="search"], input[type="number"], input[type="url"], textarea, select {
    background: var(--input-bg); border: 1px solid var(--border); color: var(--text); border-radius: 12px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: rgba(190, 150, 255, 0.85); box-shadow: 0 0 0 3px rgba(154, 99, 255, 0.28), 0 0 22px rgba(122, 64, 245, 0.25); }
input::placeholder, textarea::placeholder { color: rgba(169, 155, 217, 0.55); }

/* ── sign in / register ──────────────────────────────────────────────────────────────────────── */
#auth-view { position: relative; }
#auth-view .auth-card, .auth-card.glass-panel {
    background: linear-gradient(180deg, rgba(24, 14, 66, 0.82), rgba(12, 7, 36, 0.88)); border: 1px solid rgba(168, 125, 255, 0.35); border-radius: 24px;
    box-shadow: var(--galaxy-glow), 0 28px 70px rgba(3, 1, 16, 0.7); backdrop-filter: blur(14px);
}
.auth-card h1, .auth-card h2 { letter-spacing: -0.01em; }
.auth-card a { color: #b48cff; }
.auth-card a:hover { color: #d9c7ff; }
#auth-view > .auth-card { position: relative; z-index: 1; }

/* ── panels: rail, sidebar, chat ─────────────────────────────────────────────────────────────── */
body:not(.light-theme):not(.cyber-theme) #main-view { background: none; }
body:not(.light-theme):not(.cyber-theme) .sidebar {
    background: linear-gradient(180deg, rgba(22, 13, 62, 0.9), rgba(12, 7, 36, 0.92));
    border-color: var(--border); box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05); backdrop-filter: blur(14px);
}
body:not(.light-theme):not(.cyber-theme) .chat-area {
    background:
        radial-gradient(70% 50% at 100% 0%, rgba(110, 60, 240, 0.14) 0%, rgba(110, 60, 240, 0) 70%),
        linear-gradient(180deg, rgba(10, 6, 32, 0.94), rgba(6, 3, 24, 0.97));
    border-color: var(--border);
}
body:not(.light-theme):not(.cyber-theme) .chat-header { background: rgba(14, 8, 40, 0.8); border-color: var(--border); }
body:not(.light-theme):not(.cyber-theme) .messages { background: transparent; }
.sidebar-header, .chat-header { border-color: var(--border); }

.rail-btn { border-radius: 14px; }
.rail-btn:hover { background: var(--surface-hover); }
.rail-btn.is-active { background: linear-gradient(180deg, rgba(138, 77, 255, 0.32), rgba(106, 47, 224, 0.22)); box-shadow: inset 0 0 0 1px rgba(190, 150, 255, 0.35), 0 0 18px rgba(122, 64, 245, 0.3); color: #fff; }
.rail-new, .rail-btn.rail-new { background: var(--galaxy-primary); box-shadow: 0 8px 22px rgba(122, 64, 245, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35); color: #fff; }

.dm-item { border-radius: 14px; }
.dm-item:hover { background: var(--surface-hover); border-color: var(--border); }
.dm-item.active { background: linear-gradient(135deg, rgba(138, 77, 255, 0.26), rgba(106, 47, 224, 0.14)); border-color: rgba(190, 150, 255, 0.55); box-shadow: 0 0 20px rgba(122, 64, 245, 0.2); }
.conv-filter { border-radius: 999px; border: 1px solid var(--border); background: rgba(14, 8, 40, 0.5); color: var(--text-muted); }
.conv-filter.active { background: var(--galaxy-primary); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(122, 64, 245, 0.45); }
.sidebar-search { background: var(--input-bg); border: 1px solid var(--border); border-radius: 14px; }
.sidebar-search:hover, .sidebar-search:focus-within { border-color: rgba(190, 150, 255, 0.6); }

/* ── messages and composer ───────────────────────────────────────────────────────────────────── */
.message-bubble { background: var(--surface-secondary); border: 1px solid var(--border); box-shadow: 0 8px 22px rgba(3, 1, 16, 0.35); }
.message.sent .message-bubble {
    background: linear-gradient(135deg, #8a4dff 0%, #6a2fe0 100%); border-color: rgba(255, 255, 255, 0.2); color: #fff;
    box-shadow: 0 8px 24px rgba(122, 64, 245, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.glass-panel-composer { background: rgba(14, 8, 40, 0.85); border-color: var(--border); }
.typing-dots span, .typing-dots i { background: #b48cff; }

/* ── modals, menus, panels ───────────────────────────────────────────────────────────────────── */
.modal, .modal-overlay { background: rgba(4, 2, 18, 0.74); backdrop-filter: blur(8px); }
.modal-content, .glass-panel {
    background: linear-gradient(180deg, rgba(24, 14, 66, 0.9), rgba(12, 7, 36, 0.94)); border: 1px solid rgba(168, 125, 255, 0.32);
    box-shadow: var(--galaxy-glow), 0 28px 70px rgba(3, 1, 16, 0.7); border-radius: 22px;
}
.modal-content h2, .modal-content h3 { letter-spacing: -0.01em; }
.dropdown-item:hover, .menu-item:hover, .menu-row:hover { background: var(--surface-hover); }
.account-menu { background: linear-gradient(180deg, rgba(24, 14, 66, 0.94), rgba(12, 7, 36, 0.96)); border-color: rgba(168, 125, 255, 0.35); box-shadow: var(--galaxy-glow), 0 24px 60px rgba(3, 1, 16, 0.7); }
.toast-container .toast, .toast { background: linear-gradient(180deg, rgba(28, 16, 76, 0.96), rgba(14, 8, 44, 0.96)); border: 1px solid rgba(168, 125, 255, 0.4); box-shadow: var(--galaxy-glow); color: #fff; }

/* ── settings ────────────────────────────────────────────────────────────────────────────────── */
.settings-modal-content { background: linear-gradient(180deg, rgba(20, 12, 58, 0.96), rgba(10, 6, 32, 0.97)); }
.settings-sidebar { background: rgba(10, 6, 32, 0.5); border-color: var(--border); }
.settings-tab:hover { background: var(--surface-hover); }
.settings-tab.active { background: linear-gradient(135deg, rgba(138, 77, 255, 0.28), rgba(106, 47, 224, 0.14)); box-shadow: inset 0 0 0 1px rgba(190, 150, 255, 0.4); }
.settings-group-title { color: #b48cff; }
.switch-toggle input:checked + .switch-slider { background: var(--galaxy-primary); box-shadow: 0 0 14px rgba(122, 64, 245, 0.55); }

/* ── mobile tab bar / you view ───────────────────────────────────────────────────────────────── */
.tab-btn.is-active, .tab-btn.active { color: #d9c7ff; }
.tab-icon-new { background: var(--galaxy-primary); box-shadow: 0 8px 22px rgba(122, 64, 245, 0.55); }
.you-card { background: linear-gradient(180deg, rgba(24, 14, 66, 0.7), rgba(12, 7, 36, 0.7)); border: 1px solid var(--border); }

@media (prefers-reduced-motion: reduce) { .btn-primary, .btn-primary:hover { transition: none; transform: none; } }

/* ── in-app update prompt (Android app; the desktop app shows its own window in the same style) ─────────────── */
.upd-overlay { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 20px; background: rgba(4, 2, 18, 0.74); backdrop-filter: blur(8px); }
.upd-overlay[hidden] { display: none; }
.upd-card { width: min(380px, 100%); padding: 26px 24px 22px; text-align: center; border-radius: 24px; border: 1px solid rgba(168, 125, 255, 0.4);
    background: radial-gradient(130% 70% at 100% 105%, rgba(112, 56, 240, 0.7) 0%, rgba(112, 56, 240, 0) 62%), linear-gradient(180deg, #170d46, #0a0623);
    box-shadow: 0 0 0 1px rgba(168, 125, 255, 0.28), 0 0 40px rgba(110, 60, 240, 0.35), 0 26px 60px rgba(3, 1, 16, 0.7); animation: updRise 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes updRise { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.upd-icon { width: 84px; height: 84px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; }
.upd-icon[data-icon="mark"] img { width: 84px; height: 84px; filter: drop-shadow(0 0 22px rgba(130, 80, 255, 0.85)); animation: updBreathe 2.6s ease-in-out infinite; }
.upd-icon[data-icon="ok"] { border: 3px solid #8b5cf6; background: radial-gradient(circle, #1a0f55, #0f0a38 70%); box-shadow: 0 0 34px rgba(139, 92, 246, 0.7); color: #fff; font-size: 40px; font-weight: 700; }
.upd-icon[data-icon="bad"] { width: 70px; height: 70px; background: radial-gradient(circle at 35% 30%, #ff6b7e, #d9264a 75%); box-shadow: 0 0 30px rgba(255, 70, 100, 0.55); color: #fff; font-size: 38px; font-weight: 800; }
@keyframes updBreathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.upd-title { margin: 0 0 8px; font-size: 1.3rem; letter-spacing: -0.01em; }
.upd-sub { margin: 0; color: #b9a9ee; font-size: 0.92rem; line-height: 1.5; }
.upd-notes { margin: 12px 0 0; padding: 9px 12px; text-align: left; white-space: pre-wrap; max-height: 90px; overflow: auto; border-radius: 12px; border: 1px solid rgba(160, 122, 255, 0.2); background: rgba(10, 4, 34, 0.45); color: #d9ccff; font-size: 0.82rem; line-height: 1.45; }
.upd-bar { height: 10px; margin: 18px 0 10px; border-radius: 999px; background: #1a1148; box-shadow: inset 0 0 0 1px rgba(160, 122, 255, 0.2); overflow: hidden; }
.upd-bar[hidden], .upd-detail[hidden], .upd-notes[hidden] { display: none; }
.upd-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #6a2fe0, #b57bff); transition: width 0.18s linear; box-shadow: 0 0 16px rgba(160, 110, 255, 0.9); }
.upd-bar.indeterminate .upd-fill { width: 36%; animation: updSlide 1.2s ease-in-out infinite; }
@keyframes updSlide { 0% { margin-left: -36%; } 100% { margin-left: 100%; } }
.upd-detail { margin: 0; color: #b9a9ee; font-size: 0.82rem; }
.upd-actions { display: flex; gap: 10px; margin-top: 22px; }
.upd-btn { flex: 1; height: 46px; border-radius: 13px; border: 1px solid rgba(160, 122, 255, 0.32); background: #110a33; color: #f1eaff; font: inherit; font-weight: 600; font-size: 0.95rem; cursor: pointer; }
.upd-btn.primary { border-color: rgba(255, 255, 255, 0.2); color: #fff; font-weight: 700; background: linear-gradient(180deg, #8a4dff, #6a2fe0); box-shadow: 0 8px 24px rgba(122, 64, 245, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.upd-btn:focus-visible { outline: 2px solid #d9c7ff; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .upd-card, .upd-icon img, .upd-bar.indeterminate .upd-fill { animation: none !important; } }

/* ── "< Back" on the sign-in / register screens ──────────────────────────────────────────────────── */
.auth-back { position: absolute; z-index: 3; top: calc(env(safe-area-inset-top, 0px) + 14px); left: 14px; display: inline-flex; align-items: center; gap: 4px; height: 42px; padding: 0 16px 0 10px;
    border-radius: 999px; border: 1px solid rgba(168, 125, 255, 0.38); background: rgba(14, 8, 40, 0.65); backdrop-filter: blur(8px); color: #e9defe; font: 600 0.95rem/1 inherit; cursor: pointer;
    box-shadow: 0 6px 20px rgba(3, 1, 16, 0.45); transition: background 0.12s, border-color 0.12s, transform 0.12s; }
.auth-back svg { width: 20px; height: 20px; }
.auth-back:hover { background: rgba(40, 24, 100, 0.75); border-color: rgba(200, 170, 255, 0.7); }
.auth-back:active { transform: scale(0.97); }
.auth-back:focus-visible { outline: 2px solid #d9c7ff; outline-offset: 2px; }

/* ---- Settings redesign: roomy desktop sidebar + pane, phone-first list that fits the screen ---- */
#settings-modal .settings-sidebar { background: linear-gradient(180deg, rgba(30, 18, 86, 0.55), rgba(16, 9, 52, 0.55)); padding: 1.25rem 0.9rem 1rem; gap: 0; }
#settings-modal .settings-sidebar-header { border-bottom: 0; padding: 0.1rem 0.5rem 0.5rem; margin: 0; }
#settings-modal .settings-title-wrap h3 { font-size: 1.25rem; }
#settings-modal .mobile-settings-user-card { display: flex; margin: 0.4rem 0 0.5rem; padding: 0.8rem 0.9rem; background: linear-gradient(135deg, rgba(124, 77, 255, 0.28), rgba(60, 35, 150, 0.35)); border: 1px solid rgba(180, 140, 255, 0.3); }
#settings-modal .mobile-settings-user-card img { width: 44px; height: 44px; }
#settings-modal .mobile-user-info span { font-size: 0.95rem; }
#settings-modal .settings-group-title { margin: 1.1rem 0 0.35rem 0.75rem; font-size: 0.66rem; opacity: 0.85; }
#settings-modal .settings-tab { padding: 0.62rem 0.75rem; border-radius: 12px; margin-bottom: 0.15rem; font-size: 0.92rem; }
#settings-modal .settings-tab-icon { width: 32px; height: 32px; border-radius: 10px; }
#settings-modal .settings-tab.active { background: linear-gradient(90deg, rgba(139, 92, 255, 0.3), rgba(139, 92, 255, 0.1)); border-color: rgba(180, 140, 255, 0.35); }
#settings-modal .settings-tab.active::before { content: ""; position: absolute; left: -0.9rem; top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0; background: #b794ff; }
#settings-modal .settings-body { scroll-behavior: smooth; }
#settings-modal .settings-pane-intro { margin-bottom: 1.4rem; }
#settings-modal .settings-pane-intro h3 { font-size: 1.6rem; }
#settings-modal .settings-section { padding: 1.25rem 1.4rem !important; border-radius: 16px; margin-bottom: 1rem; background: rgba(28, 17, 84, 0.55); }
#settings-modal .settings-section h4 { font-size: 1rem; }
#settings-modal .settings-section input[type="text"],
#settings-modal .settings-section input[type="password"],
#settings-modal .settings-section input[type="email"],
#settings-modal .settings-section textarea { min-height: 44px; border-radius: 10px; }
#settings-modal .settings-pane .btn-primary,
#settings-modal .settings-pane .btn-secondary { min-height: 44px; border-radius: 12px; }

@media (min-width: 769px) {
    #settings-modal .settings-sidebar { width: 310px; }
    #settings-modal .settings-pane { margin: 0 auto; }
}

@media (max-width: 768px) {
    #settings-modal { padding: 0; }
    #settings-modal .modal-content { height: 100dvh !important; max-height: 100dvh !important; }
    #settings-modal .settings-sidebar { padding: calc(0.6rem + env(safe-area-inset-top, 0px)) 0.85rem calc(1.2rem + env(safe-area-inset-bottom, 0px)); background: transparent; overflow-y: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    #settings-modal .settings-sidebar::-webkit-scrollbar { display: none; }
    #settings-modal .settings-sidebar-header { position: sticky; top: calc(-0.6rem - env(safe-area-inset-top, 0px)); z-index: 3; padding: 0.5rem 0.25rem 0.4rem; background: var(--background); }
    #settings-modal .settings-title-wrap h3 { font-size: 1.5rem; }
    #settings-modal .settings-title-wrap svg { display: none; }
    #settings-modal .mobile-settings-user-card { margin: 0.5rem 0 0.25rem; padding: 0.9rem 1rem; }
    #settings-modal .mobile-settings-user-card img { width: 52px; height: 52px; }
    #settings-modal .settings-group-title { margin: 1.1rem 0 0.4rem 0.4rem; }
    #settings-modal .settings-nav-list .settings-tab,
    #settings-modal .settings-mobile-row { min-height: 54px; padding: 0.55rem 0.85rem; margin-bottom: 0.35rem; background: rgba(28, 17, 84, 0.5); border: 1px solid rgba(120, 90, 220, 0.2); border-radius: 14px; font-size: 0.97rem; color: var(--text); }
    #settings-modal .settings-tab.active::before { display: none; }
    #settings-modal .settings-tab.active { background: rgba(28, 17, 84, 0.5); border-color: rgba(120, 90, 220, 0.2); }
    #settings-modal .settings-tab:active { background: rgba(124, 77, 255, 0.3); }
    #settings-modal .settings-logout-row { margin-top: 0.4rem; }
    #settings-modal .settings-status-badge { font-size: 0.78rem; opacity: 0.85; }
    #settings-modal.mobile-settings-active .settings-body { padding: calc(0.5rem + env(safe-area-inset-top, 0px)) 0.9rem calc(1.5rem + env(safe-area-inset-bottom, 0px)) !important; overflow-y: auto; display: block !important; }
    #settings-modal .settings-body-header { position: sticky; top: calc(-0.5rem - env(safe-area-inset-top, 0px)); z-index: 3; padding: 0.4rem 0 0.6rem; background: var(--background); margin-bottom: 0.4rem; }
    #settings-modal .settings-body-header .body-close-btn { position: static; }
    #settings-modal #mobile-settings-back-btn { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 40px; padding: 0 0.8rem 0 0.5rem; border-radius: 999px; background: rgba(28, 17, 84, 0.6); border: 1px solid rgba(120, 90, 220, 0.3); color: var(--text); font-weight: 600; }
    #settings-modal .settings-pane-intro { padding-right: 0; margin-bottom: 1rem; }
    #settings-modal .settings-pane-intro h3 { font-size: 1.4rem; }
    #settings-modal .settings-section { padding: 1rem !important; border-radius: 14px; margin-bottom: 0.8rem; }
    #settings-modal input, #settings-modal select, #settings-modal textarea { font-size: 16px; } /* no iOS zoom-on-focus */
}
#settings-modal .mobile-settings-user-card::before { display: none; }
#settings-modal .settings-tab-icon.icon-orange { background: rgba(249, 115, 22, 0.14); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.28); }
#settings-modal .settings-tab-icon.icon-red { background: rgba(239, 68, 68, 0.14); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.28); }

/* ---- Edit Profile = the profile card, edited in place ---- */
.profile-edit-card { background: rgba(28, 17, 84, 0.55); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; margin-bottom: 1rem; }
.pe-banner { position: relative; height: 150px; background: linear-gradient(120deg, #3a1fa8 0%, #7c4dff 55%, #b794ff 100%); background-size: cover; background-position: center; cursor: pointer; }
.pe-banner:not(.has-image)::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 20% 30%, rgba(255,255,255,.25) 0 1.5px, transparent 2px), radial-gradient(circle at 70% 60%, rgba(255,255,255,.2) 0 1.5px, transparent 2px), radial-gradient(circle at 85% 20%, rgba(255,255,255,.3) 0 1px, transparent 2px); pointer-events: none; }
.pe-banner-btn, .pe-banner-remove { position: absolute; top: 12px; display: inline-flex; align-items: center; gap: 0.4rem; min-height: 36px; padding: 0 0.8rem; border-radius: 999px; background: rgba(10, 5, 35, 0.6); border: 1px solid rgba(220, 200, 255, 0.35); color: #fff; font-size: 0.82rem; font-weight: 600; cursor: pointer; backdrop-filter: blur(6px); transition: background 0.15s, opacity 0.15s; }
.pe-banner-btn { right: 12px; }
.pe-banner-remove { right: 160px; }
.pe-banner-btn:hover, .pe-banner-remove:hover { background: rgba(10, 5, 35, 0.85); }
.pe-banner-remove[hidden] { display: none; }
.pe-head { padding: 0 1.4rem; display: flex; align-items: flex-end; gap: 1rem; margin-top: -48px; position: relative; }
.pe-avatar { position: relative; width: 96px; height: 96px; border-radius: 50%; border: 4px solid #1a1050; background: #1a1050; cursor: pointer; flex-shrink: 0; display: block; overflow: hidden; box-shadow: 0 6px 22px rgba(5, 2, 30, 0.5); }
.pe-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pe-avatar-cam { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(10, 5, 35, 0.55); color: #fff; opacity: 0; transition: opacity 0.15s; }
.pe-avatar:hover .pe-avatar-cam, .pe-avatar:focus-within .pe-avatar-cam { opacity: 1; }
@media (hover: none) { .pe-avatar-cam { opacity: 1; inset: auto 0 0 0; height: 30%; } .pe-avatar-cam svg { width: 14px; height: 14px; } }
.pe-form { padding: 0.6rem 1.4rem 1.4rem; }
.pe-field { position: relative; display: flex; align-items: center; border: 1px solid transparent; border-radius: 12px; transition: border-color 0.15s, background 0.15s; }
.pe-field:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(180, 140, 255, 0.25); }
.pe-field:focus-within { background: rgba(10, 5, 35, 0.55); border-color: #9a63ff; }
.pe-input { flex: 1; min-width: 0; width: 100%; background: transparent !important; border: 0 !important; outline: none !important; box-shadow: none !important; color: var(--text); font: inherit; padding: 0.35rem 0.6rem; min-height: 0 !important; border-radius: 12px !important; text-overflow: ellipsis; }
.pe-input::placeholder { color: var(--text-muted); opacity: 0.7; }
.pe-name { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; }
.pe-pencil { color: var(--text-muted); margin-right: 0.7rem; opacity: 0; transition: opacity 0.15s; flex-shrink: 0; }
.pe-field:hover .pe-pencil { opacity: 0.9; }
.pe-field:focus-within .pe-pencil { opacity: 0; }
@media (hover: none) { .pe-pencil { opacity: 0.55; } }
.pe-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.1rem; }
.pe-handle-field { flex: 1 1 200px; }
.pe-pronouns-field { flex: 1 1 160px; }
.pe-at { padding-left: 0.6rem; color: var(--text-muted); font-weight: 600; }
.pe-handle-field .pe-input { padding-left: 0.1rem; color: var(--text-muted); }
.pe-handle-field:focus-within .pe-input { color: var(--text); }
.pe-bio-field { display: block; margin-top: 0.9rem; padding: 0.6rem 0.7rem 0.4rem; }
.pe-label { display: block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); padding: 0 0.6rem 0.2rem; }
.pe-bio { resize: none; line-height: 1.5; min-height: 4.6em !important; font-size: 0.97rem; }
.pe-count { display: block; text-align: right; font-size: 0.72rem; color: var(--text-muted); padding: 0 0.6rem; opacity: 0; transition: opacity 0.15s; }
.pe-bio-field:focus-within .pe-count { opacity: 1; }
.pe-msg { min-height: 1.2em; font-size: 0.82rem; padding: 0.4rem 0.6rem 0; color: var(--text-muted); }
.pe-head .pe-msg { padding: 0 0 0.6rem; }
.pe-field:has(.pe-invalid) { border-color: #f87171; }

@media (max-width: 768px) {
    .pe-banner { height: 120px; }
    .pe-banner-btn span { display: none; }
    .pe-banner-btn { width: 38px; padding: 0; justify-content: center; }
    .pe-banner-remove { right: 58px; }
    .pe-head { padding: 0 1rem; margin-top: -40px; }
    .pe-avatar { width: 80px; height: 80px; }
    .pe-form { padding: 0.5rem 0.7rem 1rem; }
    .pe-name { font-size: 1.4rem; }
    .pe-handle-field, .pe-pronouns-field { flex: 1 1 100%; }
}
/* tighten: the global input rules add tall padding/heights */
#settings-modal .pe-input { padding: 0.3rem 0.6rem !important; height: auto !important; line-height: 1.3; margin: 0 !important; }
#settings-modal .pe-handle-field .pe-input { padding-left: 0.1rem !important; }
#settings-modal .pe-bio { min-height: 4.2em !important; field-sizing: content; max-height: 12em; }
.pe-form .pe-field { margin: 0; }
.pe-form .pe-msg:empty { min-height: 0; padding: 0; }
.pe-head { margin-bottom: 0.2rem; }

/* ---- "Get the app" prompt (modules/app-promo.js) + sidebar Download button ---- */
.rail-download { display: grid; place-items: center; text-decoration: none; color: inherit; }
.is-native-shell .rail-download { display: none !important; }
.app-promo { position: fixed; z-index: 1500; left: 50%; transform: translateX(-50%); bottom: calc(88px + env(safe-area-inset-bottom, 0px)); width: min(520px, calc(100vw - 24px)); display: grid; grid-template-columns: auto 1fr; gap: 0.6rem 0.8rem; align-items: center; padding: 0.85rem 1rem; border-radius: 18px; background: linear-gradient(135deg, rgba(48, 28, 130, 0.97), rgba(24, 13, 76, 0.97)); border: 1px solid rgba(180, 140, 255, 0.4); box-shadow: 0 14px 40px rgba(3, 1, 16, 0.6); color: var(--text); animation: promoIn 0.3s ease-out; }
@keyframes promoIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .app-promo { animation: none; } }
.app-promo-icon { width: 44px; height: 44px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); padding: 6px; }
.app-promo-text { display: flex; flex-direction: column; min-width: 0; }
.app-promo-text strong { font-size: 0.98rem; }
.app-promo-text span { font-size: 0.82rem; color: var(--text-muted); }
.app-promo-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.app-promo-go { padding: 0 1.2rem; min-height: 40px; display: inline-flex; align-items: center; border-radius: 12px; background: linear-gradient(135deg, #8c52ff, #6d3df0); color: #fff; font-weight: 700; text-decoration: none; }
.app-promo-later, .app-promo-never { min-height: 40px; padding: 0 0.8rem; border-radius: 12px; color: var(--text-muted); font-size: 0.86rem; background: transparent; border: 0; cursor: pointer; }
.app-promo-later:hover, .app-promo-never:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.app-promo-never { margin-left: auto; }
@media (min-width: 769px) { .app-promo { bottom: 24px; left: auto; right: 24px; transform: none; animation-name: promoInDesk; } @keyframes promoInDesk { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } } }

/* ---- Inline message editing (the bubble becomes the editor) ---- */
.message-bubble.is-editing { min-width: min(420px, 78vw); box-shadow: 0 0 0 2px rgba(200, 170, 255, 0.85), 0 8px 24px rgba(10, 5, 40, 0.4); }
.message-bubble.is-editing .translate-toggle-btn, .message-bubble.is-editing .message-reactions { display: none; }
.inline-edit { display: flex; flex-direction: column; gap: 0.45rem; width: 100%; }
.inline-edit-input { width: 100%; box-sizing: border-box; resize: none; background: rgba(10, 5, 35, 0.35) !important; color: inherit; font: inherit; line-height: 1.45; border: 1px solid rgba(255, 255, 255, 0.3) !important; border-radius: 10px !important; padding: 0.5rem 0.65rem !important; outline: none !important; min-height: 2.6em; }
.inline-edit-input:focus { border-color: #fff !important; }
.inline-edit-bar { display: flex; align-items: center; gap: 0.4rem; justify-content: flex-end; flex-wrap: wrap; }
.inline-edit-hint { margin-right: auto; font-size: 0.72rem; opacity: 0.75; }
.inline-edit-cancel, .inline-edit-save { min-height: 32px; padding: 0 0.8rem; border-radius: 999px; font-size: 0.82rem; font-weight: 700; cursor: pointer; border: 0; }
.inline-edit-cancel { background: rgba(255, 255, 255, 0.16); color: inherit; }
.inline-edit-save { background: #fff; color: #3a1fa8; }
@media (max-width: 768px) { .inline-edit-hint { display: none; } .inline-edit-cancel, .inline-edit-save { min-height: 38px; } }
