﻿/* ============================================
   LIMERPG — ПРЕМИУМ СТИЛЬ
   Версия 3.4 | Liquid Glass Edition
   ============================================ */

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

:root, html[data-theme="light"] {
    --lime: #bef575; --lime-dark: #9ed15a; --lime-darker: #7fb848;
    --lime-glow: rgba(190,245,117,0.4); --lime-glow-strong: rgba(190,245,117,0.6);
    --gradient-primary: linear-gradient(135deg, #bef575 0%, #9ed15a 50%, #7fb848 100%);
    --gradient-secondary: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --bg-body: #f0f2f5; --bg-body-gradient: radial-gradient(ellipse at 20% 30%, #f0f2f5 0%, #e2e8f0 100%);
    --bg-card: #ffffff; --bg-card-glass: rgba(255,255,255,0.95);
    --bg-header: #1a1a2e; --bg-header-gradient: linear-gradient(135deg, #1a1a2e 0%, #0f0f1a 100%);
    --bg-sidebar: rgba(255,255,255,0.95); --text-header: #ffffff; --text-main: #1a1a2e; --text-muted: #6b7280;
    --border: #e2e8f0; --border-light: rgba(190,245,117,0.3);
    --btn-bg: rgba(158,209,90,0.85); --btn-hover: rgba(158,209,90,0.95);
    --chat-bg: linear-gradient(135deg, #e8ecf2 0%, #dce3ec 100%);
    --msg-in-bg: rgba(255,255,255,0.6); --msg-out-bg: rgba(158,209,90,0.6);
    --msg-in-text: #1e293b; --msg-out-text: #1a2a1a; --msg-nick: #4f46e5;
    --msg-date-bg: rgba(100,116,139,0.15);
    --msg-radius: 16px; --msg-pad-y: 10px; --msg-pad-x: 14px;
    --room-accent: var(--primary);
    --room-wallpaper: none;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04); --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 20px 40px rgba(0,0,0,0.1); --shadow-xl: 0 30px 60px rgba(0,0,0,0.15);
    --shadow-glow: 0 0 20px rgba(190,245,117,0.3); --overlay: rgba(0,0,0,0.5);
    --primary: #9ed15a; --primary-dark: #7fb848; --primary-alpha: rgba(158,209,90,0.15);
    --transition-fast: 0.15s ease; --transition-base: 0.25s ease; --transition-slow: 0.4s ease;
}

html[data-theme="dark"] {
    --lime: #bef575; --lime-dark: #9ed15a; --lime-glow: rgba(190,245,117,0.3);
    --gradient-primary: linear-gradient(135deg, #2d5a1e 0%, #3a7a28 100%);
    --bg-body: #0a0a12; --bg-body-gradient: radial-gradient(ellipse at 20% 30%, #0a0a12 0%, #0f0f18 100%);
    --bg-card: #13131f; --bg-card-glass: rgba(19,19,31,0.95);
    --bg-header: #0a0a10; --bg-header-gradient: linear-gradient(135deg, #0a0a10 0%, #0f0f18 100%);
    --bg-sidebar: rgba(10,10,18,0.98); --text-header: #e2e8f0; --text-main: #e2e8f0; --text-muted: #94a3b8;
    --border: #2d2d3a; --border-light: rgba(58,122,40,0.3);
    --btn-bg: rgba(58,122,40,0.6); --btn-hover: rgba(58,122,40,0.8);
    --chat-bg: linear-gradient(135deg, #0a0f1a 0%, #0c1220 100%);
    --msg-in-bg: rgba(20,30,45,0.6); --msg-out-bg: rgba(58,122,40,0.45);
    --msg-in-text: #e2e8f0; --msg-out-text: #ffffff; --msg-nick: #60a5fa;
    --msg-date-bg: rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3); --shadow-lg: 0 20px 40px rgba(0,0,0,0.4);
    --overlay: rgba(0,0,0,0.7); --primary: #3a7a28; --primary-dark: #2d5a1e; --primary-alpha: rgba(58,122,40,0.15);
}

html[data-theme="oled"] {
    --lime: #10b981; --lime-dark: #059669; --lime-glow: rgba(16,185,129,0.4);
    --gradient-primary: linear-gradient(135deg, #0e3c26 0%, #1a5c3a 100%);
    --bg-body: #000000; --bg-body-gradient: #000000; --bg-card: #000000; --bg-card-glass: #000000;
    --bg-header: #000000; --bg-header-gradient: #000000; --bg-sidebar: #000000;
    --text-header: #10b981; --text-main: #ffffff; --text-muted: #6b7280;
    --border: #222222; --border-light: rgba(16,185,129,0.3);
    --btn-bg: rgba(16,185,129,0.3); --btn-hover: rgba(16,185,129,0.5);
    --chat-bg: #000000; --msg-in-bg: #0a0a0a; --msg-out-bg: linear-gradient(135deg, #0e3c26, #1a5c3a);
    --msg-in-text: #e0e0e0; --msg-out-text: #ffffff; --msg-nick: #34d399;
    --msg-date-bg: rgba(16,185,129,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.5); --shadow-lg: 0 20px 40px rgba(0,0,0,0.6);
    --overlay: rgba(0,0,0,0.95); --primary: #10b981; --primary-dark: #059669; --primary-alpha: rgba(16,185,129,0.15);
}

html[data-theme="purple"] {
    --lime: #c084fc; --lime-dark: #a855f7; --lime-glow: rgba(192,132,252,0.4);
    --gradient-primary: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
    --bg-body: #1a0b2e; --bg-body-gradient: radial-gradient(ellipse at 20% 30%, #1a0b2e 0%, #2d1b4e 100%);
    --bg-card: #2d1b4e; --bg-card-glass: rgba(45,27,78,0.95);
    --bg-header: #0f0520; --bg-header-gradient: linear-gradient(135deg, #0f0520 0%, #1a0b2e 100%);
    --bg-sidebar: rgba(26,11,46,0.98); --text-header: #e0d4ff; --text-main: #f3e8ff; --text-muted: #c4b5fd;
    --border: #4a2d7c; --border-light: rgba(192,132,252,0.3);
    --btn-bg: rgba(192,132,252,0.4); --btn-hover: rgba(192,132,252,0.6);
    --chat-bg: linear-gradient(135deg, #1a0b2e 0%, #2d1b4e 100%);
    --msg-in-bg: rgba(45,27,78,0.6); --msg-out-bg: rgba(192,132,252,0.45);
    --msg-in-text: #f0e6ff; --msg-out-text: #1a0b2e; --msg-nick: #d8b4fe;
    --msg-date-bg: rgba(192,132,252,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3); --shadow-lg: 0 20px 40px rgba(0,0,0,0.4);
    --overlay: rgba(0,0,0,0.7); --primary: #c084fc; --primary-dark: #a855f7; --primary-alpha: rgba(192,132,252,0.15);
}

/* Анимации */
@keyframes float { 0% { transform: translateY(100vh) rotate(0deg); opacity: 0; } 10% { opacity: 0.4; } 90% { opacity: 0.4; } 100% { transform: translateY(-20vh) rotate(360deg); opacity: 0; } }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.8; transform: scale(1.02); } }
@keyframes pulse-glow { 0%,100% { box-shadow: 0 0 5px var(--lime-glow); } 50% { box-shadow: 0 0 25px var(--lime-glow-strong); } }
@keyframes logo-breathe {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 4px var(--lime-glow));
    }
    50% {
        transform: scale(1.04);
        filter: drop-shadow(0 0 12px var(--lime-glow-strong));
    }
}
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes messageFloat { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmerLight { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes tabGlow { 0%,100% { box-shadow: 0 4px 12px rgba(190,245,117,0.3); } 50% { box-shadow: 0 4px 20px rgba(190,245,117,0.5); } }
@keyframes typing { 0%,100% { opacity: 0.3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }

/* Базовые стили */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; border-radius: 10px; }
::-webkit-scrollbar-thumb { border-radius: 10px; background: var(--primary); }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }
html { scroll-behavior: smooth; height: 100%; overflow-x: hidden; }
body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    background: var(--bg-body-gradient);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100dvh;
    overflow: hidden;
    position: relative;
    transition: background 0.3s ease, color 0.3s ease;
}
.hidden { display: none !important; }

/* Фон с частицами */
.bg-particles { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; overflow: hidden; }
.particle { position: absolute; background: var(--primary); border-radius: 50%; filter: blur(3px); animation: float linear infinite; opacity: 0; }

/* Шапка */
.top-bar {
    background: var(--bg-header-gradient);
    color: var(--text-header);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(12px + env(safe-area-inset-top)) calc(28px + env(safe-area-inset-right)) 12px calc(28px + env(safe-area-inset-left));
    box-shadow: var(--shadow-lg);
    z-index: 90;
    position: relative;
    border-bottom: 1px solid var(--border-light);
    backdrop-filter: blur(10px);
    animation: slideDown 0.5s ease;
}
.logo-header {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 24px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    transition: all var(--transition-base);
    position: relative;
}
.logo-header::after { content: ''; position: absolute; bottom: -4px; left: 0; width: 0; height: 2px; background: var(--gradient-primary); transition: width var(--transition-base); }
.logo-header:hover { transform: scale(1.02); letter-spacing: 0.5px; }
.logo-header:hover::after { width: 100%; }
.logo-icon {
    display: block;
    height: 48px;
    width: auto;
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
    color: var(--primary);
    filter: drop-shadow(0 0 4px var(--lime-glow));
    animation: logo-breathe 2.4s ease-in-out infinite;
    transform-origin: center center;
    will-change: transform, filter;
}
.logo-header:hover .logo-icon {
    animation-play-state: paused;
    transform: scale(1.06);
    filter: drop-shadow(0 0 14px var(--lime-glow-strong));
}
.header-center, .header-right { display: flex; align-items: center; gap: 12px; }

/* Иконки */
.icon-btn {
    background: rgba(255,255,255,0.08);
    border: none;
    color: inherit;
    cursor: pointer;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}
.icon-btn::before { content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0; border-radius: 50%; background: rgba(190,245,117,0.3); transform: translate(-50%,-50%); transition: width 0.4s, height 0.4s; }
.icon-btn:hover::before { width: 100px; height: 100px; }
.icon-btn:hover { background: rgba(190,245,117,0.2); transform: scale(1.08) rotate(5deg); }
.icon-btn:active { transform: scale(0.95); }
.icon-btn svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.8; }

/* Кнопки сайдбаров */
.side-toggle {
    position: fixed !important;
    top: calc(50vh - 50px) !important;
    background: var(--bg-card-glass);
    border: 1px solid var(--border-light);
    cursor: pointer;
    z-index: 99999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-lg);
}
.left-toggle { left: 0 !important; width: 48px; height: 100px; border-left: none; border-radius: 0 28px 28px 0; color: var(--primary); }
.left-toggle svg { width: 28px; height: 28px; stroke-width: 2.2; transition: transform var(--transition-base); }
.left-toggle:hover svg { transform: translateX(4px); }
.right-toggle { right: 0 !important; width: 44px; height: 60px; border-right: none; border-radius: 20px 0 0 20px; background: var(--gradient-primary); color: #1a1a2e; }
.right-toggle .support-icon { width: 24px; height: 24px; transition: transform var(--transition-base); }
.right-toggle:hover .support-icon { transform: translateX(-3px) rotate(-5deg); }
.right-toggle:hover { top: calc(50vh - 35px) !important; width: 54px; height: 70px; }
.side-toggle:hover { top: calc(50vh - 55px) !important; width: 58px; height: 110px; box-shadow: var(--shadow-xl), var(--shadow-glow); }
.left-toggle:hover { background: var(--bg-card-glass); }
.right-toggle:hover { filter: brightness(1.05); }

/* Крестики */
.close-sidebar, .close-support {
    background: rgba(255,255,255,0.08);
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    flex-shrink: 0;
}
.close-sidebar:hover, .close-support:hover { background: rgba(239,68,68,0.2); color: #ef4444; transform: rotate(90deg); }

/* Сайдбары */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 360px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-xl);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
    border: 1px solid var(--border-light);
}
.sidebar.left { left: 0; transform: translateX(-100%); border-right: 1px solid var(--border-light); border-radius: 0 28px 28px 0; }
.sidebar.right { right: 0; transform: translateX(100%); border-left: 1px solid var(--border-light); width: 420px; border-radius: 28px 0 0 28px; }
.sidebar.open { transform: translateX(0); }
.sidebar-header { padding: calc(20px + env(safe-area-inset-top)) 20px 20px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 16px; }
.sidebar-header input { padding: 12px 18px; border-radius: 40px; border: 1px solid var(--border); background: var(--bg-body); color: var(--text-main); outline: none; font-size: 14px; transition: all var(--transition-base); }
.sidebar-header input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--lime-glow); transform: scale(1.01); }

/* Вкладки */
.tab-switcher { display: flex; background: var(--bg-body); border-radius: 60px; padding: 4px; gap: 6px; }
.tab-btn {
    flex: 1; padding: 8px 16px; text-align: center; background: transparent; border: none;
    color: var(--text-muted); cursor: pointer; font-size: 13px; font-weight: 700;
    border-radius: 60px; transition: all 0.3s cubic-bezier(0.4,0,0.2,1); position: relative; overflow: hidden; z-index: 1;
}
.tab-btn::before { content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0; border-radius: 50%; background: var(--primary-alpha); transform: translate(-50%,-50%); transition: width 0.4s, height 0.4s; z-index: -1; }
.tab-btn:active::before { width: 150px; height: 150px; }
.tab-btn.active { background: var(--gradient-primary); color: #1a1a2e; box-shadow: 0 4px 12px var(--lime-glow); animation: tabGlow 2s infinite; }
.tab-btn:not(.active)::after { content: ''; position: absolute; bottom: 4px; left: 50%; width: 0; height: 2px; background: var(--gradient-primary); transform: translateX(-50%); transition: width 0.3s ease; border-radius: 2px; }
.tab-btn:not(.active):hover::after { width: 40%; }
.tab-btn:not(.active):hover { color: var(--primary); transform: translateY(-2px); background: var(--primary-alpha); }

/* Основной контент */
.main-content { flex-grow: 1; display: flex; flex-direction: column; position: relative; overflow: hidden; z-index: 1; }
.screen-view { flex-grow: 1; display: flex; flex-direction: column; overflow: hidden; width: 100%; animation: fadeIn 0.4s ease; position: relative; }

/* Экран приветствия — full-bleed hero */
#welcome-screen {
    align-items: stretch;
    justify-content: center;
    text-align: center;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--bg-body-gradient);
}
.welcome-hero {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100%;
    padding: 48px 24px 56px;
    overflow: hidden;
}
.welcome-hero-glow {
    position: absolute;
    inset: -20% -10% auto;
    height: 70%;
    background:
        radial-gradient(ellipse 55% 50% at 50% 0%, var(--lime-glow) 0%, transparent 70%),
        radial-gradient(ellipse 40% 40% at 20% 40%, var(--primary-alpha) 0%, transparent 65%),
        radial-gradient(ellipse 35% 35% at 80% 30%, var(--primary-alpha) 0%, transparent 60%);
    pointer-events: none;
    animation: welcomeGlowDrift 10s ease-in-out infinite alternate;
}
.welcome-hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    pointer-events: none;
    opacity: 0.55;
}
.welcome-hero-orb--a {
    width: min(42vw, 320px);
    height: min(42vw, 320px);
    left: -6%;
    bottom: 8%;
    background: var(--primary-alpha);
    animation: welcomeOrbFloat 14s ease-in-out infinite;
}
.welcome-hero-orb--b {
    width: min(36vw, 260px);
    height: min(36vw, 260px);
    right: -4%;
    top: 18%;
    background: var(--lime-glow);
    animation: welcomeOrbFloat 11s ease-in-out infinite reverse;
}
.welcome-hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 48px 48px;
    opacity: 0.18;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
    pointer-events: none;
}
.welcome-hero-content {
    position: relative;
    z-index: 1;
    width: min(520px, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: welcomeContentIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.welcome-title {
    font-family: 'Outfit', 'Inter', system-ui, sans-serif;
    font-size: clamp(1.75rem, 5vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin: 0 0 14px;
    color: var(--text-main);
    max-width: 18ch;
    text-shadow: 0 0 40px var(--lime-glow);
}
.welcome-desc {
    color: var(--text-muted);
    line-height: 1.55;
    font-size: 15px;
    max-width: 36ch;
    margin: 0 0 28px;
}
.welcome-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(340px, 100%);
}
.welcome-actions .main-btn {
    width: 100%;
}
.welcome-btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
    box-shadow: none;
}
.welcome-btn-secondary:hover {
    background: var(--primary-alpha);
    border-color: var(--primary);
    color: var(--text-main);
}
.welcome-hint {
    margin-top: 22px;
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0.85;
    letter-spacing: 0.01em;
}
@keyframes welcomeContentIn {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes welcomeGlowDrift {
    from { transform: translateY(0) scale(1); opacity: 0.9; }
    to { transform: translateY(12px) scale(1.04); opacity: 1; }
}
@keyframes welcomeOrbFloat {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(12px, -18px); }
}

.action-buttons { display: flex; flex-direction: column; gap: 16px; width: 100%; }

/* Кнопки */
.main-btn {
    padding: 16px 32px; font-size: 16px; font-weight: 700; border-radius: 60px; cursor: pointer;
    transition: all var(--transition-base); border: none; font-family: inherit;
    position: relative; overflow: hidden; letter-spacing: 0.3px;
}
.main-btn::before { content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0; border-radius: 50%; background: rgba(255,255,255,0.4); transform: translate(-50%,-50%); transition: width 0.5s, height 0.5s; }
.main-btn:hover::before { width: 300px; height: 300px; }
.main-btn:active { transform: scale(0.97); }
.primary-btn { background: var(--gradient-primary); box-shadow: 0 6px 20px var(--lime-glow); text-shadow: 0 1px 2px rgba(255,255,255,0.3); }
.primary-btn:hover { transform: translateY(-4px); box-shadow: 0 12px 30px var(--lime-glow-strong); }
.secondary-btn { background: var(--btn-bg); color: var(--text-header); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.secondary-btn:hover { background: var(--btn-hover); transform: translateY(-4px); border-color: var(--primary); box-shadow: var(--shadow-md); }
.delete-btn { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); color: white; }
.delete-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(239,68,68,0.4); }

/* Активный чат */
#active-chat-screen { background: var(--chat-bg); position: relative; isolation: isolate; }
#active-chat-screen.has-room-wallpaper::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: var(--room-wallpaper);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.45;
    pointer-events: none;
}
.room-top-bar {
    position: relative;
    flex-shrink: 0;
    z-index: 4;
}
.room-header {
    display: flex; align-items: center; justify-content: space-between; padding: 12px 28px; gap: 20px;
    flex-wrap: wrap; position: relative; background: var(--bg-card-glass); backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light); transition: all 0.3s ease;
}
.room-header::before { content: ''; position: absolute; top: 0; left: -50%; width: 200%; height: 100%; background: linear-gradient(90deg, transparent, var(--primary-alpha), transparent); animation: shimmerLight 8s infinite; pointer-events: none; }
.room-title-area { display: flex; align-items: center; flex: 1; cursor: pointer; padding: 8px 16px; border-radius: 60px; transition: all 0.3s cubic-bezier(0.34,1.2,0.64,1); }
.room-title-area:hover { transform: translateX(4px); background: var(--primary-alpha); }
.room-avatar-large { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; margin-right: 14px; border: 2px solid var(--primary); transition: all 0.3s ease; background: var(--bg-card); }
.room-avatar-large:hover { transform: scale(1.05) rotate(5deg); box-shadow: 0 0 20px var(--lime-glow); }
.room-info h2 { font-size: 18px; font-weight: 800; margin-bottom: 4px; color: var(--text-main); }
.room-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted); }
.room-count-box { padding: 2px 12px; border-radius: 30px; font-weight: 700; background: var(--primary-alpha); backdrop-filter: blur(10px); border: 1px solid var(--border-light); color: var(--primary); }
.invite-container { display: flex; align-items: center; border-radius: 50px; padding: 4px 4px 4px 18px; background: var(--msg-in-bg); backdrop-filter: blur(10px); border: 1px solid var(--border-light); }
.invite-container:focus-within { border-color: var(--primary); box-shadow: 0 0 20px var(--lime-glow); background: var(--bg-card-glass); }
.invite-container input { border: none; background: transparent; outline: none; font-size: 13px; width: 140px; color: var(--text-main); }
.invite-container input::placeholder { color: var(--text-muted); font-size: 12px; }
.invite-btn { width: 36px; height: 36px; border: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 16px; background: var(--gradient-primary); color: #1a1a2e; position: relative; overflow: hidden; }
.invite-btn::before { content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0; border-radius: 50%; background: rgba(255,255,255,0.5); transform: translate(-50%,-50%); transition: width 0.4s, height 0.4s; }
.invite-btn:hover::before { width: 100px; height: 100px; }
.invite-btn:hover { transform: rotate(90deg) scale(1.1); }
.room-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.invite-fab {
    display: none;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    background: var(--gradient-primary);
    color: #1a1a2e;
    flex-shrink: 0;
    box-shadow: 0 2px 10px var(--lime-glow);
}
.invite-fab:active { transform: scale(0.94); }
.age-badge { font-size: 10px; padding: 5px 14px; border-radius: 30px; font-weight: 700; letter-spacing: 0.5px; background: var(--primary-alpha); backdrop-filter: blur(10px); border: 1px solid var(--border-light); color: var(--primary); }
.room-chat-history { flex: 1; overflow-x: hidden; overflow-y: auto; padding: 24px 28px; display: flex; flex-direction: column; gap: 12px; position: relative; }
.room-chat-history::-webkit-scrollbar-track { background: var(--primary-alpha); }
.room-chat-history::-webkit-scrollbar-thumb { background: var(--primary); }
.chat-date-separator { align-self: center; padding: 4px 20px; border-radius: 40px; font-size: 10px; font-weight: 700; letter-spacing: 0.5px; margin: 16px 0 8px; background: var(--msg-date-bg); backdrop-filter: blur(10px); color: var(--text-muted); }
.chat-message { display: flex; flex-direction: column; max-width: 78%; }
.chat-message.is-new { animation: messageFloat 0.22s ease-out; }
.chat-message.incoming { align-self: flex-start; }
.chat-message.outgoing { align-self: flex-end; }
.message-username { font-size: 11px; font-weight: 800; margin-bottom: 3px; margin-left: 14px; display: flex; align-items: center; gap: 6px; color: var(--msg-nick); }
.message-bubble { position: relative; padding: var(--msg-pad-y, 10px) var(--msg-pad-x, 18px); border-radius: var(--msg-radius, 24px); font-size: 14px; line-height: 1.5; word-break: break-word; transition: all 0.3s cubic-bezier(0.34,1.2,0.64,1); cursor: pointer; backdrop-filter: blur(12px); -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.message-bubble.is-pressing { transform: scale(0.97); filter: brightness(0.92); }
.incoming .message-bubble { background: var(--msg-in-bg); color: var(--msg-in-text); border: 1px solid var(--border-light); border-radius: 8px var(--msg-radius, 20px) var(--msg-radius, 20px) var(--msg-radius, 20px); }
.outgoing .message-bubble { background: var(--msg-out-bg); color: var(--msg-out-text); border: 1px solid rgba(255,255,255,0.2); border-radius: var(--msg-radius, 20px) 8px var(--msg-radius, 20px) var(--msg-radius, 20px); }
.message-bubble:active { transform: scale(0.97); }
.message-text { padding-right: 50px; display: inline-block; }
.message-bubble.is-edited .message-text { padding-right: 78px; }
/* en-US time is 12h with AM/PM; "edited" is longer than "изм." */
html[lang="en"] .message-text { padding-right: 74px; }
html[lang="en"] .message-bubble.is-edited .message-text { padding-right: 120px; }
.msg-meta { position: absolute; bottom: 8px; right: 14px; display: flex; align-items: center; gap: 4px; font-size: 9px; opacity: 0.7; white-space: nowrap; }
.msg-status.status-read { opacity: 1; color: #3b82f6; }
.msg-delete-btn, .msg-reply-btn, .msg-pin-btn, .msg-forward-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 10px; padding: 2px; transition: all 0.2s; }
.msg-delete-btn:hover { color: #ef4444; transform: scale(1.1); }
.msg-reply-btn:hover, .msg-pin-btn:hover, .msg-forward-btn:hover { color: var(--primary); transform: scale(1.1); }
.sys-msg { text-align: center; font-size: 11px; font-style: italic; padding: 6px 12px; margin: 8px auto; border-radius: 50px; width: fit-content; background: var(--primary-alpha); backdrop-filter: blur(10px); color: var(--text-muted); }
.typing-indicator { display: flex; align-items: center; gap: 4px; padding: 8px 12px; background: var(--msg-in-bg); border-radius: 20px; width: fit-content; margin-bottom: 16px; }
.typing-dot { width: 8px; height: 8px; background: var(--primary); border-radius: 50%; animation: typing 1.4s infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
.room-input-area {
    display: flex;
    align-items: center;
    padding: 16px 28px;
    gap: 12px;
    background: var(--room-composer-bg, var(--bg-card-glass));
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--room-composer-border, var(--border-light));
}
.composer-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.composer-field {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 52px;
    box-sizing: border-box;
    padding: 0 8px 0 18px;
    border-radius: 26px;
    background: var(--room-composer-field-bg, var(--msg-in-bg));
    border: 1px solid var(--room-composer-border, var(--border-light));
    overflow: visible;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.composer-field:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-alpha);
    background: var(--bg-card-glass);
}
.composer-field #room-input,
.room-input-area .composer-field input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 8px 0 0;
    margin: 0;
    border: none !important;
    border-radius: 0 !important;
    outline: none;
    font-size: 15px;
    line-height: 1.35;
    background: transparent !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
    color: var(--text-main);
    -webkit-appearance: none;
    appearance: none;
}
.composer-field #room-input:focus,
.room-input-area .composer-field input:focus {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}
.composer-field #room-input::placeholder {
    color: var(--text-muted);
    font-size: 14px;
}
.emoji-toggle-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
    padding: 0;
}
.emoji-toggle-btn .emoji-toggle-icon {
    display: block;
    width: 22px;
    height: 22px;
}
.emoji-toggle-btn:hover,
.emoji-toggle-btn.is-open {
    background: rgba(127, 127, 127, 0.14);
    color: var(--primary);
    transform: scale(1.05);
}
.emoji-picker-panel {
    position: fixed;
    z-index: 1200;
    width: min(320px, calc(100vw - 16px));
    padding: 10px;
    border-radius: 18px;
    background: var(--bg-card-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xl, 0 12px 40px rgba(0, 0, 0, 0.35));
}
.emoji-picker-panel[hidden] { display: none !important; }
.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 4px;
    max-height: 220px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.emoji-picker-item {
    width: 100%;
    aspect-ratio: 1;
    border: none;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s ease, transform 0.12s ease;
}
.emoji-picker-item:hover {
    background: rgba(127, 127, 127, 0.14);
    transform: scale(1.08);
}
.emoji-picker-item:active { transform: scale(0.95); }
/* Standalone input (DM without composer-field) */
.room-input-area > input {
    flex: 1;
    height: 52px;
    box-sizing: border-box;
    padding: 0 22px;
    border: none;
    border-radius: 26px;
    outline: none;
    font-size: 15px;
    background: var(--msg-in-bg);
    border: 1px solid var(--border-light);
    color: var(--text-main);
}
.room-input-area > input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-alpha);
    background: var(--bg-card-glass);
}
.room-input-area > input::placeholder {
    color: var(--text-muted);
    font-size: 14px;
}

/* Reply compose + quote in bubbles */
.reply-compose-bar {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin: 0;
    padding: 10px 28px 0;
    background: var(--bg-card-glass);
    border-top: 1px solid var(--border-light);
}
.reply-compose-bar.hidden { display: none !important; }
.reply-compose-accent {
    width: 3px;
    border-radius: 3px;
    background: var(--primary);
    flex-shrink: 0;
}
.reply-compose-body { flex: 1; min-width: 0; padding: 4px 0 10px; }
.reply-compose-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 2px;
}
.reply-compose-author {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.reply-compose-text {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.reply-compose-close {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    align-self: center;
}
.reply-compose-close:hover { color: var(--text-main); }

.msg-reply-quote {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    border-left: 3px solid var(--primary);
    background: rgba(0,0,0,0.12);
    border-radius: 8px;
    padding: 6px 10px;
    margin: 0 0 8px;
    cursor: pointer;
    box-sizing: border-box;
}
.outgoing .msg-reply-quote { background: rgba(255,255,255,0.12); }
.msg-reply-quote-author {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 2px;
}
.msg-reply-quote-text {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-forwarded-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    opacity: 0.85;
}

/* Forward picker */
.forward-picker-card { max-width: 420px; width: 100%; }
.forward-preview {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    margin: 0 0 14px;
    max-height: 72px;
    overflow: hidden;
}
.forward-tabs { margin-bottom: 12px; }
.forward-chat-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.forward-chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    border: 1px solid var(--border);
    background: var(--bg-body);
    border-radius: 14px;
    padding: 10px 12px;
    cursor: pointer;
    color: var(--text-main);
}
.forward-chat-item:hover {
    border-color: var(--primary);
    background: var(--primary-alpha);
}
.forward-chat-item img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.forward-chat-item strong {
    display: block;
    font-size: 14px;
}
.forward-chat-item span {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.forward-toast,
.system-notice {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%) translateY(8px);
    background: var(--bg-card-glass);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 10px 16px;
    border-radius: 999px;
    z-index: 10000;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(12px);
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.18s ease;
    max-width: min(90vw, 420px);
    text-align: center;
    pointer-events: none;
}
.system-notice.is-visible,
.forward-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.system-notice--error {
    border-color: rgba(239, 68, 68, 0.45);
}
.system-notice--info {
    border-color: var(--border-light);
}
.sys-msg {
    text-align: center;
    font-size: 11px;
    font-style: italic;
    padding: 6px 12px;
    margin: 8px auto;
    border-radius: 50px;
    width: fit-content;
    max-width: 92%;
    background: var(--primary-alpha);
    backdrop-filter: blur(10px);
    color: var(--text-muted);
    line-height: 1.4;
}
.mute-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    flex-shrink: 0;
}
.composer-muted-notice {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    padding: 8px 14px;
    text-align: center;
    border-radius: 16px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.28);
    color: #b91c1c;
}
.composer-muted-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 2px;
}
.composer-muted-remaining {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.composer-muted-until {
    margin-top: 2px;
    font-size: 11px;
    opacity: 0.85;
    font-weight: 500;
}

.send-btn {
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    color: #1a1a2e;
    box-shadow: 0 4px 15px var(--lime-glow);
    transition: all 0.3s cubic-bezier(0.34,1.2,0.64,1);
    padding: 0;
    flex-shrink: 0;
    align-self: center;
}
.send-btn .send-icon { display: block; width: 22px; height: 22px; margin-left: 2px; /* optical center like Telegram */ }
.send-btn:hover { transform: scale(1.08); box-shadow: 0 0 30px var(--lime-glow-strong); }
.send-btn:active { transform: scale(0.95); }

/* Поддержка */
#right-sidebar { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.support-sidebar-header { flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--bg-card); }
.support-sidebar-messages { flex: 1; overflow-x: hidden; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.support-sidebar-buttons { flex-shrink: 0; padding: 12px 16px; display: flex; gap: 12px; background: var(--bg-card); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.support-btn { flex: 1; padding: 10px; border: none; border-radius: 40px; font-weight: 700; cursor: pointer; font-size: 13px; text-align: center; transition: all 0.2s ease; }
.support-btn.suggestion { background: var(--gradient-primary); color: #1a1a2e; }
.support-btn.complaint { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.support-btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.support-sidebar-input-area { flex-shrink: 0; padding: 12px 16px; background: var(--bg-card); border-top: 1px solid var(--border); }
.support-input-row { display: flex; align-items: center; gap: 12px; width: 100%; }
.support-file-label { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: var(--btn-bg); border-radius: 50%; cursor: pointer; font-size: 20px; flex-shrink: 0; transition: all 0.2s ease; }
.support-file-label:hover { background: var(--btn-hover); transform: scale(1.05); }
.support-input-row input { flex: 1; padding: 12px 18px; border: 1px solid var(--border); border-radius: 60px; background: var(--bg-body); color: var(--text-main); outline: none; font-size: 14px; }
.support-input-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-alpha); }
#support-send { width: 48px; height: 48px; background: var(--gradient-primary); border: none; border-radius: 50%; cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #1a1a2e; }
#support-send:hover { transform: scale(1.08) rotate(15deg); filter: brightness(1.05); }
.support-header-info { display: flex; align-items: center; gap: 12px; }
.support-header-info img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.support-header-info h3 { font-size: 16px; margin: 0; color: var(--text-main); }
.support-header-info span { font-size: 11px; color: #10b981; }
.support-message { display: flex; gap: 12px; margin-bottom: 16px; max-width: 85%; }
.support-message.bot { align-self: flex-start; }
.support-message.user { align-self: flex-end; flex-direction: row-reverse; }
.support-message-avatar img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.support-message-text { padding: 10px 16px; border-radius: 18px; font-size: 13px; line-height: 1.5; word-break: break-word; background: var(--msg-in-bg); border: 1px solid var(--border); color: var(--text-main); }
.support-message.user .support-message-text { background: var(--gradient-primary); color: #1a1a2e; }
.support-message-time { font-size: 10px; color: var(--text-muted); margin-top: 4px; text-align: right; }

/* Левый сайдбар — список чатов как в Telegram */
#left-sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
}
#left-sidebar .sidebar-header {
    flex-shrink: 0;
    padding: 12px 12px 8px;
    border-bottom: 1px solid var(--border-light);
    gap: 10px;
}
#left-sidebar .sidebar-header-top {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-bottom: 0;
}
#left-sidebar .tab-switcher {
    display: flex;
    background: rgba(127, 127, 127, 0.12);
    border-radius: 12px;
    padding: 3px;
    gap: 2px;
    margin-bottom: 0;
}
#left-sidebar .tab-btn {
    flex: 1;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 10px;
    animation: none;
    box-shadow: none;
}
#left-sidebar .tab-btn::before,
#left-sidebar .tab-btn::after {
    display: none;
}
#left-sidebar .tab-btn.active {
    background: var(--bg-card, var(--bg-body));
    color: var(--text-main);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    animation: none;
}
#left-sidebar .tab-btn:not(.active):hover {
    transform: none;
    color: var(--text-main);
    background: transparent;
}
#left-sidebar #chat-search {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border-radius: 22px;
    border: none;
    background: rgba(127, 127, 127, 0.14);
    color: var(--text-main);
    outline: none;
    font-size: 15px;
}
#left-sidebar #chat-search:focus {
    border: none;
    box-shadow: none;
    background: rgba(127, 127, 127, 0.2);
    transform: none;
}
#left-sidebar .chat-list {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 4px 0;
    -webkit-overflow-scrolling: touch;
}
#left-sidebar .chat-list-empty {
    text-align: center;
    padding: 28px 16px;
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
}
#left-sidebar .chat-list-error {
    color: #ef4444;
}
#left-sidebar .chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin: 0 4px;
    border-radius: 12px;
    border-bottom: none;
    cursor: pointer;
    background: transparent;
    backdrop-filter: none;
    transition: background 0.15s ease;
    transform: none;
}
#left-sidebar .chat-item:hover {
    background: rgba(127, 127, 127, 0.1);
    transform: none;
}
#left-sidebar .chat-item:hover .chat-title {
    color: var(--text-main);
}
#left-sidebar .chat-item.is-active {
    background: var(--primary-alpha);
}
#left-sidebar .chat-item img,
#left-sidebar .chat-item .chat-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 0;
    border: none;
    flex-shrink: 0;
    background: var(--bg-body);
    transition: none;
}
#left-sidebar .chat-item:hover img,
#left-sidebar .chat-item:hover .chat-avatar {
    transform: none;
    border: none;
    box-shadow: none;
}
#left-sidebar .chat-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
#left-sidebar .chat-row-top,
#left-sidebar .chat-row-bottom {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}
#left-sidebar .chat-title,
#left-sidebar .chat-item .chat-info h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
#left-sidebar .chat-time {
    flex: 0 0 auto;
    margin-left: auto;
    text-align: right;
    white-space: nowrap;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}
#left-sidebar .chat-preview {
    font-size: 14px;
    line-height: 1.3;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

/* Модальные окна */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--overlay); backdrop-filter: blur(16px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 20px; animation: fadeIn 0.2s ease;
}
.modal-card {
    background: var(--bg-card-glass); backdrop-filter: blur(20px);
    border-radius: 40px; width: 100%; max-width: 500px;
    position: relative; border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xl);
    max-height: 85dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* clip scroll to rounded corners */
    isolation: isolate;
    padding: 0;
    animation: slideUp 0.4s cubic-bezier(0.4,0,0.2,1);
}
.modal-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 20px 24px 28px;
    border-radius: inherit;
}
.modal-card h3 {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 20px;
    padding-right: 48px;
    text-align: left;
    line-height: 1.25;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
/* Cards without a title (e.g. participants) — leave room under absolute close */
.modal-card-clean > .modal-scroll,
.modal-scroll:not(:has(> h3)):not(:has(> .modal-header-bar)) {
    padding-top: 52px;
}
.modal-scroll:has(> .modal-header-bar) {
    padding-top: 16px;
}
.modal-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 16px;
    min-height: 40px;
}
.modal-header-bar h3 {
    margin: 0;
    padding-right: 0;
    flex: 1;
    min-width: 0;
    font-size: 20px;
}
.close-modal {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 6;
    background: var(--bg-body);
    border: 1px solid var(--border);
    font-size: 22px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-base);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}
.modal-header-bar .close-modal {
    position: static;
    top: auto;
    right: auto;
}
.close-modal:hover {
    background: var(--primary-alpha);
    color: var(--primary);
    border-color: var(--primary);
    transform: rotate(90deg);
}

/* Input группы */
.input-group { margin-bottom: 24px; }
.input-group label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 8px; color: var(--text-muted); }
.input-group input, .input-group textarea, .input-group select {
    width: 100%; padding: 14px 18px; border: 1px solid var(--border); border-radius: 20px;
    background: var(--bg-body); color: var(--text-main); outline: none; font-family: inherit;
    font-size: 14px; transition: all var(--transition-base);
}
.input-group input:focus, .input-group textarea:focus, .input-group select:focus {
    border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-alpha); transform: scale(1.01);
}
.select-wrapper { position: relative; width: 100%; }
.select-wrapper select { appearance: none; padding-right: 48px; cursor: pointer; }
.select-wrapper::after { content: "▼"; font-size: 11px; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text-muted); transition: all 0.2s ease; }
.select-wrapper:hover::after { color: var(--primary); transform: translateY(-50%) rotate(180deg); }

/* Профиль */
.profile-modal-card { overflow-x: hidden; }
.profile-banner-block { margin: 0 0 18px; }
.profile-banner {
    width: 100%;
    height: 110px;
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(180, 255, 57, 0.18), rgba(30, 37, 33, 0.9)),
        var(--bg-body);
    background-size: cover;
    background-position: center;
    border: 1px solid var(--border);
    margin-bottom: 10px;
}
.profile-banner.has-image {
    background-color: var(--bg-body);
}
.profile-banner-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.profile-banner-btn {
    flex: 1 1 auto;
    min-width: 0;
    padding: 10px 12px !important;
    font-size: 13px !important;
}
.profile-banner-btn.is-muted {
    opacity: 0.75;
}
.profile-banner-hint {
    margin: 8px 0 0;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.35;
}
.profile-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: -8px 0 18px;
    min-height: 0;
}
.profile-badge-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-body);
    font-size: 12px;
    color: var(--text-main);
}
.profile-badge-chip .badge-icon { font-size: 14px; line-height: 1; }
.profile-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.profile-color-row input[type="color"] {
    width: 52px;
    height: 42px;
    padding: 4px;
    border-radius: 12px;
    cursor: pointer;
    flex-shrink: 0;
}
.profile-color-row .profile-tickets-btn {
    flex: 1;
    padding: 10px 12px !important;
    font-size: 13px !important;
}
.avatar-container { text-align: center; margin-bottom: 28px; cursor: pointer; }
.avatar-container img { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary); box-shadow: 0 0 20px var(--lime-glow); transition: all var(--transition-base); }
.avatar-container img:hover { transform: scale(1.05) rotate(5deg); box-shadow: var(--shadow-xl), var(--shadow-glow); }
.profile-info { background: var(--bg-body); backdrop-filter: blur(10px); padding: 18px 22px; border-radius: 24px; margin-bottom: 28px; border: 1px solid var(--border-light); }
.profile-info p { margin-bottom: 10px; font-size: 14px; }

.dm-profile-name,
.modal-card h3.dm-profile-name {
    margin: 0 0 5px;
    padding: 0;
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    width: 100%;
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
    color: var(--text-main);
    line-height: 1.3;
}

.profile-rating-host {
    margin-top: 8px;
}
.profile-rating {
    text-align: center;
}
.profile-rating-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}
.profile-rating-avg {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    min-width: 2ch;
}
.profile-rating-stars {
    display: inline-flex;
    gap: 2px;
}
.profile-rating-star {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
    padding: 0 1px;
    cursor: default;
    opacity: 0.55;
}
.profile-rating.is-interactive .profile-rating-star {
    cursor: pointer;
}
.profile-rating-star.is-active {
    color: #f5c542;
    opacity: 1;
}
.profile-rating.is-interactive .profile-rating-star:hover,
.profile-rating.is-interactive .profile-rating-star:focus-visible {
    color: #f5c542;
    opacity: 1;
    outline: none;
}
.profile-rating-count {
    font-size: 12px;
    color: var(--text-muted);
}
.profile-rating-mine {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Участники */
.participants-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 0;
}
.participant-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--primary-alpha);
    backdrop-filter: blur(5px);
    transition: all var(--transition-base);
}
.participant-item:hover { background: var(--primary-alpha); transform: translateX(4px); }
.participant-item.is-manageable { cursor: context-menu; }
.participant-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary); }

/* Чат лист в модалках */
.chat-list, .chat-list-modal { overflow-x: hidden; overflow-y: auto; flex-grow: 1; }
.chat-item { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); cursor: pointer; transition: all var(--transition-base); background: transparent; }
.chat-item:hover { background: var(--primary-alpha); transform: translateX(6px); }
.chat-avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; margin-right: 16px; border: 2px solid var(--primary); transition: var(--transition-fast); }
.chat-item:hover .chat-avatar { transform: scale(1.05); }
.chat-info { flex-grow: 1; }
.chat-info h4 { font-size: 16px; font-weight: 800; margin-bottom: 6px; color: var(--text-main); }
.chat-info p { font-size: 12px; color: var(--text-muted); }

/* Настройки */
.setting-item { display: flex; justify-content: space-between; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--border); transition: all 0.2s ease; }
.setting-item:hover { transform: translateX(4px); }
.setting-item:last-child { border-bottom: none; }
.setting-item .select-wrapper { width: auto; min-width: 180px; }
.setting-item select { width: 100%; padding: 10px 35px 10px 16px; border-radius: 30px; border: 1px solid var(--border); background: var(--bg-body); color: var(--text-main); font-size: 14px; font-weight: 500; cursor: pointer; appearance: none; }
.setting-item select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-alpha); }
.setting-item .badge { background: var(--gradient-primary); color: #1a1a2e; padding: 8px 18px; border-radius: 40px; font-size: 13px; font-weight: 700; }

/* Тикеты */
/* Кнопки в профиле — единый стиль */
.profile-tickets-btn,
.admin-panel-btn {
    display: block;                     /* чтобы ссылка занимала всю ширину */
    width: 100%;
    box-sizing: border-box;
    background: var(--primary-alpha);
    border: 1px solid var(--border-light);
    border-radius: 40px;
    padding: 12px 20px;
    margin: 15px 0;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;             /* убираем подчёркивание */
    cursor: pointer;
    transition: all var(--transition-base);
    backdrop-filter: blur(4px);
}

.profile-tickets-btn:hover,
.admin-panel-btn:hover {
    background: var(--primary);
    color: var(--bg-header);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
    border-color: var(--primary);
}
.profile-delete-btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: transparent;
    border: 2px solid #dc3545;
    border-radius: 40px;
    padding: 12px 20px;
    margin: 15px 0;
    color: #dc3545;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s ease;
}

.profile-delete-btn:hover {
    background: #dc3545;
    color: #fff;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 0 20px rgba(220, 53, 69, 0.5);
}
.tickets-modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--overlay);
    backdrop-filter: blur(16px); display: none; align-items: center; justify-content: center; z-index: 1100;
    animation: fadeIn 0.2s ease;
}
.tickets-modal-overlay.active { display: flex; }
.tickets-modal-card {
    background: var(--bg-card-glass); backdrop-filter: blur(20px); border: 1px solid var(--border-light);
    border-radius: 32px; padding: 1.8rem; max-width: 600px; width: 90%; max-height: 80vh;
    display: flex; flex-direction: column; animation: slideUp 0.3s cubic-bezier(0.4,0,0.2,1); box-shadow: var(--shadow-xl);
}
.tickets-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border-light); }
.tickets-modal-header h3 { color: var(--primary); font-size: 1.3rem; font-weight: 700; margin: 0; }
.tickets-modal-close { background: transparent; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: all var(--transition-base); }
.tickets-modal-close:hover { background: var(--primary-alpha); color: var(--primary); transform: rotate(90deg); }
.tickets-list-container { overflow-x: hidden; overflow-y: auto; flex: 1; padding-right: 0.5rem; }
.ticket-item-card {
    background: var(--bg-card); border-radius: 20px; padding: 1rem; margin-bottom: 0.75rem;
    cursor: pointer; transition: all var(--transition-base); border: 1px solid var(--border-light);
    position: relative; overflow: hidden;
}
.ticket-item-card::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, var(--primary-alpha), transparent); transition: left 0.5s ease; }
.ticket-item-card:hover::before { left: 100%; }
.ticket-item-card:hover { border-color: var(--primary); transform: translateX(5px); box-shadow: var(--shadow-md); }
.ticket-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.ticket-status-badge { padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.7rem; font-weight: 600; }
.status-new { background: #ef4444; color: white; }
.status-progress { background: #f59e0b; color: white; }
.status-resolved { background: #10b981; color: white; }
.status-rejected { background: #6b7280; color: white; }
.ticket-date { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.5rem; }
.empty-tickets { text-align: center; padding: 2rem; color: var(--text-muted); }
.ticket-detail-modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.98);
    backdrop-filter: blur(20px); display: none; align-items: center; justify-content: center;
    z-index: 1200; animation: fadeIn 0.2s ease;
}
.ticket-detail-modal-overlay.active { display: flex; }
.response-item { background: var(--msg-in-bg); border-radius: 16px; padding: 12px; margin-bottom: 10px; border-left: 3px solid var(--primary); transition: all var(--transition-base); }
.response-item:hover { transform: translateX(3px); }
.response-header { display: flex; justify-content: space-between; margin-bottom: 8px; }
.response-name { color: var(--primary); font-weight: bold; font-size: 0.85rem; }
.response-time { font-size: 0.7rem; color: var(--text-muted); }
.response-message { margin-top: 8px; line-height: 1.5; font-size: 0.85rem; color: var(--text-main); }
.admin-badge { text-align: center; background: var(--gradient-primary); color: var(--bg-header); padding: 8px 16px; border-radius: 40px; font-size: 0.85rem; font-weight: 600; margin-bottom: 15px; animation: pulse 2s infinite; }

/* Блокировка */
.blocked-by-them-notice { width: 100%; padding: 12px; text-align: center; color: #721c24; background: #f8d7da; border-radius: 5px; font-weight: bold; }

/* Адаптив — базовая сетка (детальный mobile ниже) */
@media (max-width: 768px) {
    .chat-message { max-width: 88%; }
    .room-chat-history { padding: 12px 14px; gap: 10px; }
    .welcome-hero { padding: 32px 18px 40px; }
    .top-bar { padding-left: 10px; padding-right: 10px; gap: 6px; }
    .logo-header .logo-text { display: none; }
    .logo-header img.logo-icon { height: 36px !important; }
}
@media (max-width: 480px) {
    .welcome-hero { padding: 24px 16px 32px; }
    .welcome-title { font-size: 1.55rem; max-width: none; }
    .welcome-desc { font-size: 14px; margin-bottom: 22px; }
    .main-btn { padding: 14px 20px; font-size: 14px; }
    .icon-btn { width: 38px; height: 38px; }
    .room-avatar-large { width: 40px; height: 40px; margin-right: 10px; }
    .room-info h2 { font-size: 15px; }
}
@media (max-height: 600px) and (orientation: landscape) {
    .modal-overlay { align-items: flex-start; overflow-x: hidden; overflow-y: auto; }
    .modal-card { margin: 12px auto; max-height: none; }
    .welcome-hero { padding: 16px 20px; }
    .welcome-title { font-size: 1.35rem; margin-bottom: 6px; max-width: none; }
    .welcome-desc { margin-bottom: 14px; font-size: 13px; }
    .welcome-actions { flex-direction: row; gap: 10px; width: auto; max-width: 100%; }
    .welcome-actions .main-btn { width: auto; padding: 12px 16px; }
    .welcome-hint { margin-top: 12px; }
}
/* Закреплённое сообщение */
#pinned-message-container {
    padding: 8px 16px;
    background: var(--primary-alpha);
    border-bottom: 1px solid var(--border-light);
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-main);
    transition: all 0.3s ease;
}

#pinned-message-container:hover {
    background: var(--primary-alpha);
}

.pinned-message {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.pinned-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.pinned-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pinned-text strong {
    color: var(--primary);
}

.unpin-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 50%;
    transition: all 0.2s;
}

.unpin-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}
/* ===== ЧЕРНЫЙ СПИСОК ===== */
.banned-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-x: hidden; overflow-y: auto;
    padding: 4px 0;
    margin-bottom: 15px;
}

.banned-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-body);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.banned-user-item:hover {
    border-color: var(--primary);
}

.banned-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.banned-user-name {
    flex: 1;
    font-weight: 500;
    color: var(--text-main);
    font-size: 14px;
}

.banned-user-date {
    font-size: 12px;
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 20px 0;
    font-size: 14px;
    line-height: 1.4;
}
.age-badge {
    display: inline-block; /* или inline */
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.age-badge.nsfw {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid #ef4444;
}

.age-badge.sixteen {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid #f59e0b;
}

.age-badge.twelve {
    background: rgba(58, 122, 40, 0.15);
    color: #3a7a28;
    border: 1px solid #3a7a28;
}
/* ===== ПЕРСОНАЖИ ===== */
.characters-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0;
}

.character-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--bg-body);
    border-radius: 12px;
    border: 1px solid var(--border);
    color: var(--text-main);
    transition: all 0.2s;
}

.character-item:hover {
    border-color: var(--primary);
}

.character-item .avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--border-light);
}

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

.character-item .name {
    font-weight: 600;
    color: var(--text-main);
    font-size: 15px;
}

.character-item .meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.character-item .meta span {
    background: var(--bg-body);
    padding: 1px 10px;
    border-radius: 10px;
}

.character-item .actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.character-item .actions button {
    padding: 4px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.char-select-btn {
    background: var(--primary);
    color: var(--text-main);
}

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

.char-select-btn.active {
    background: #22c55e;
    color: #fff;
}

.char-edit-btn {
    background: var(--bg-body);
    color: var(--text-main);
    border: 1px solid var(--border) !important;
}

.char-edit-btn:hover {
    background: var(--border);
}

.char-delete-btn {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.char-delete-btn:hover {
    background: rgba(239, 68, 68, 0.25);
}

.char-other {
    opacity: 0.7;
    cursor: default;
}

/* ===== КРУЖОК ВЫБОРА ПЕРСОНАЖА ===== */
.character-select-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--border-light, #3a3a4a);
    background: var(--bg-body, #0a0a12);
    cursor: pointer;
    padding: 2px;
    flex-shrink: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-select-btn:hover {
    border-color: var(--primary, #3a7a28);
    transform: scale(1.05);
}

.character-select-btn img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-light, #3a3a4a);
}

/* ===== ВЫПАДАЮЩИЙ СПИСОК ПЕРСОНАЖЕЙ ===== */
.room-input-area {
    position: relative;
}

.character-dropdown {
    position: absolute;
    bottom: 52px;
    left: 0;
    right: 0;
    background: var(--bg-card-glass, rgba(26, 26, 46, 0.95));
    backdrop-filter: blur(20px);
    border: 1px solid var(--border, #2d2d3a);
    border-radius: 16px;
    padding: 6px 0;
    max-height: 260px;
    overflow-x: hidden; overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: none;
}

.character-dropdown::-webkit-scrollbar {
    width: 4px;
}

.character-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.character-dropdown::-webkit-scrollbar-thumb {
    background: var(--border, #2d2d3a);
    border-radius: 4px;
}

.character-dropdown .dropdown-item {
    padding: 8px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.15s ease;
    font-size: 13px;
    color: var(--text-main, #e2e8f0);
}

.character-dropdown .dropdown-item:hover {
    background: var(--primary-alpha, rgba(58, 122, 40, 0.15));
}

.character-dropdown .dropdown-item img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-light, #3a3a4a);
}

.character-dropdown .dropdown-item .name {
    flex: 1;
    font-size: 13px;
    color: var(--text-main, #e2e8f0);
}

.character-dropdown .dropdown-item .active-mark {
    color: #22c55e;
    font-size: 14px;
}

.character-dropdown .dropdown-divider {
    height: 1px;
    background: var(--border, #2d2d3a);
    margin: 4px 12px;
}

.character-dropdown .dropdown-item.create {
    color: var(--primary, #3a7a28);
    font-weight: 500;
    justify-content: center;
}

.character-dropdown .dropdown-item.create:hover {
    background: var(--primary-alpha, rgba(58, 122, 40, 0.2));
}

.character-dropdown .empty-dropdown {
    padding: 12px 16px;
    color: var(--text-muted, #94a3b8);
    text-align: center;
    font-size: 13px;
}

/* ===== АДАПТИВ ===== */
@media (max-width: 600px) {
    .character-item {
        flex-wrap: wrap;
    }
    .character-item .actions {
        width: 100%;
        justify-content: flex-end;
    }
}

#dice-modal .dice-modal-card{width:96vw;max-width:1600px;max-height:92vh;overflow:auto;display:block;padding:20px 24px 28px}
#dice-modal .dice-app{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(300px,1fr);gap:18px}
#dice-modal .dice-panel,#dice-modal .dice-history{background:rgba(18,18,28,.92);border:1px solid rgba(255,255,255,.06);border-radius:18px;padding:20px;box-sizing:border-box}
#dice-modal .dice-header{display:flex;align-items:center;justify-content:space-between;gap:15px}
#dice-modal .dice-eyebrow{font-size:10px;letter-spacing:2px;text-transform:uppercase;color:#9188d9;font-weight:800}
#dice-modal .dice-header h2,#dice-modal .history-header h3{margin:5px 0 0;color:#fff}
#dice-modal .dice-status{padding:7px 12px;border-radius:9px;background:rgba(110,91,235,.12);border:1px solid rgba(110,91,235,.2);color:#aaa1ff;font-size:12px;font-weight:700}

#dice-modal .dice-stage{position:relative;height:220px;margin-top:18px;overflow:hidden;border-radius:16px;background:radial-gradient(circle at 50% 50%,rgba(93,73,220,.15),transparent 55%),rgba(0,0,0,.18);border:1px solid rgba(255,255,255,.05)}

#dice-modal .roulette-track-wrap{position:absolute;left:0;right:0;top:50%;height:100px;transform:translateY(-50%);overflow:hidden}

#dice-modal .roulette-track{position:absolute;left:0;top:0;height:100px;display:flex;align-items:stretch;will-change:transform}

#dice-modal .roulette-item{flex:0 0 10%;width:10%;min-width:10%;height:100px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;border-right:1px solid rgba(255,255,255,.07);background:rgba(255,255,255,.025);color:rgba(255,255,255,.45);font-size:22px;font-weight:800;user-select:none}

#dice-modal .roulette-item:nth-child(even){background:rgba(255,255,255,.04)}

#dice-modal .roulette-item.selected{color:#fff;background:linear-gradient(145deg,rgba(110,91,235,.5),rgba(70,52,170,.35));box-shadow:inset 0 0 25px rgba(118,96,255,.25),0 0 20px rgba(100,80,240,.15)}

#dice-modal .roulette-pointer{position:absolute;z-index:10;left:50%;top:50%;width:4px;height:135px;transform:translate(-50%,-50%);background:linear-gradient(to bottom,transparent 0%,#8f83ff 18%,#fff 50%,#8f83ff 82%,transparent 100%);box-shadow:0 0 15px rgba(125,105,255,.8);pointer-events:none}

#dice-modal .roulette-pointer:before{content:"";position:absolute;top:-1px;left:50%;transform:translate(-50%,-100%);border-left:8px solid transparent;border-right:8px solid transparent;border-top:11px solid #fff}

#dice-modal .roulette-pointer:after{content:"";position:absolute;bottom:-1px;left:50%;transform:translate(-50%,100%);border-left:8px solid transparent;border-right:8px solid transparent;border-bottom:11px solid #fff}

#dice-modal .dice-controls{margin-top:18px}
#dice-modal .dice-types{display:flex;flex-wrap:wrap;gap:7px}
#dice-modal .dice-types button{height:38px;min-width:52px;padding:0 12px;border:1px solid rgba(255,255,255,.08);border-radius:9px;background:rgba(255,255,255,.035);color:#aaa;cursor:pointer;font-weight:800;transition:.15s}
#dice-modal .dice-types button:hover{background:rgba(255,255,255,.07);color:#fff}
#dice-modal .dice-types button.active{background:linear-gradient(145deg,#6657d7,#4c3cac);border-color:rgba(150,135,255,.5);color:#fff;box-shadow:0 5px 18px rgba(77,61,190,.2)}
#dice-modal .dice-input-row{display:flex;align-items:flex-end;gap:12px;margin-top:13px}
#dice-modal .dice-input-row label{display:flex;flex-direction:column;gap:6px;flex:1}
#dice-modal .dice-input-row label span{font-size:11px;color:#777}
#dice-modal #dice-modifier{width:100%;height:44px;padding:0 12px;box-sizing:border-box;border-radius:9px;border:1px solid rgba(255,255,255,.08);background:rgba(0,0,0,.2);color:#fff;outline:none}
#dice-modal #dice-modifier:focus{border-color:rgba(125,105,255,.55)}
#dice-modal .roll-btn{height:44px;padding:0 22px;border:0;border-radius:9px;background:linear-gradient(145deg,#7465e7,#5141bb);color:#fff;font-weight:800;cursor:pointer;white-space:nowrap;box-shadow:0 6px 20px rgba(78,62,190,.22);transition:.15s}
#dice-modal .roll-btn:hover{transform:translateY(-1px);filter:brightness(1.08)}
#dice-modal .roll-btn:disabled{opacity:.55;cursor:not-allowed;transform:none}
#dice-modal .roll-btn span{margin-right:6px}
#dice-modal .dice-result{margin-top:18px;padding:15px;border-radius:13px;background:rgba(255,255,255,.035);border:1px solid rgba(255,255,255,.06)}
#dice-modal .dice-result.hidden{display:none}
#dice-modal .result-top{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
#dice-modal .result-player{font-weight:800;color:#fff;font-size:15px}
#dice-modal .result-type{font-size:11px;color:#777;margin-top:3px}
#dice-modal .result-time{font-size:11px;color:#666}
#dice-modal .result-values{display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px;margin-top:14px}
#dice-modal .result-values>div{padding:11px;border-radius:10px;background:rgba(0,0,0,.16);text-align:center}
#dice-modal .result-values span{display:block;color:#777;font-size:10px;text-transform:uppercase;letter-spacing:.5px}
#dice-modal .result-values strong{display:block;margin-top:5px;color:#fff;font-size:22px}
#dice-modal .result-total{background:rgba(100,82,220,.14)!important;border:1px solid rgba(120,100,240,.2)}
#dice-modal .result-total strong{color:#aaa1ff}
#dice-modal .result-badge.hidden{display:none}
#dice-modal .history-header{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:14px}
#dice-modal .history-header h3{font-size:18px}
#dice-modal #clear-dice-history{border:1px solid rgba(255,255,255,.07);border-radius:8px;background:rgba(255,255,255,.03);color:#888;padding:7px 10px;font-size:11px;cursor:pointer}
#dice-modal #clear-dice-history:hover{background:rgba(255,255,255,.07);color:#fff}
#dice-modal #dice-history-list{display:flex;flex-direction:column;gap:7px;max-height:500px;overflow-x: hidden; overflow-y: auto;padding-right:3px}
#dice-modal .history-empty{padding:30px 10px;text-align:center;color:#666;font-size:12px}
#dice-modal .history-item{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 11px;border-radius:10px;background:rgba(255,255,255,.025);border:1px solid rgba(255,255,255,.045)}
#dice-modal .history-main{min-width:0}
#dice-modal .history-player{color:#fff;font-size:12px;font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#dice-modal .history-roll{margin-top:3px;color:#666;font-size:10px}
#dice-modal .history-roll strong{color:#aaa1ff}
#dice-modal .history-right{text-align:right}
#dice-modal .history-total{font-size:17px;font-weight:800;color:#fff}
#dice-modal .history-mod{font-size:10px;color:#666;margin-top:2px}
#dice-modal ::-webkit-scrollbar{width:5px;height:5px}
#dice-modal ::-webkit-scrollbar-track{background:transparent}
#dice-modal ::-webkit-scrollbar-thumb{background:rgba(255,255,255,.1);border-radius:10px}

@media(max-width:800px){
#dice-modal .dice-app{grid-template-columns:1fr}
#dice-modal .dice-history{min-height:250px}
}

@media(max-width:520px){
#dice-modal .dice-panel,#dice-modal .dice-history{padding:14px}
#dice-modal .dice-stage{height:180px}
#dice-modal .roulette-item{flex-basis:10%;width:10%;min-width:10%;height:82px}
#dice-modal .roulette-track{height:82px}
#dice-modal .roulette-track-wrap{height:82px}
#dice-modal .dice-input-row{flex-direction:column;align-items:stretch}
#dice-modal .roll-btn{width:100%}
#dice-modal .result-values{grid-template-columns:1fr 1fr}
#dice-modal .result-total{grid-column:1/-1}
}

/* ===== Presence status (online / away / offline) ===== */
.presence-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    vertical-align: middle;
}
.presence-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.15);
}
.presence-dot--sm {
    width: 8px;
    height: 8px;
}
.presence--online .presence-dot { background: #10b981; }
.presence--away .presence-dot { background: #f59e0b; }
.presence--offline .presence-dot { background: #6b7280; }
.presence-label {
    font-size: 13px;
    color: var(--text-muted, #8f9a94);
}
.presence--online .presence-label { color: #10b981; }
.presence--away .presence-label { color: #f59e0b; }
.presence--offline .presence-label { color: #8f9a94; }
.presence-avatar-wrap {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}
.presence-avatar-wrap .presence-indicator {
    position: absolute;
    right: -2px;
    bottom: -2px;
}
.prof-presence {
    margin: 0 0 8px 0;
    min-height: 1.2em;
}

/* ===== Typing indicator ===== */
.typing-indicator-bar {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translate(-50%, 55%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: fit-content;
    max-width: min(92vw, 520px);
    margin: 0;
    padding: 8px 18px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--text-muted, #8f9a94);
    background: color-mix(in srgb, var(--msg-in-bg) 72%, transparent);
    backdrop-filter: blur(14px) saturate(1.15);
    -webkit-backdrop-filter: blur(14px) saturate(1.15);
    border: 1px solid var(--border-light);
    border-radius: 999px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
    z-index: 5;
    pointer-events: none;
    animation: typingBarIn 0.2s ease-out;
}
.typing-indicator-bar.hidden {
    display: none;
}
.typing-indicator-bar .typing-dots {
    flex-shrink: 0;
    width: 22px;
    height: 8px;
    background:
        radial-gradient(circle, currentColor 1.5px, transparent 1.6px) 0 50%,
        radial-gradient(circle, currentColor 1.5px, transparent 1.6px) 8px 50%,
        radial-gradient(circle, currentColor 1.5px, transparent 1.6px) 16px 50%;
    background-repeat: no-repeat;
    background-size: 6px 6px;
    animation: typingPulse 1.1s ease-in-out infinite;
    opacity: 0.85;
}
@keyframes typingBarIn {
    from { opacity: 0; transform: translate(-50%, calc(55% - 6px)); }
    to { opacity: 1; transform: translate(-50%, 55%); }
}
@keyframes typingPulse {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 1; }
}

/* ===== Room settings (п.5) ===== */
.room-settings-tabs {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: center;
    gap: 6px;
    margin: 8px 0 18px;
    padding: 5px;
    border-radius: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
}
.room-settings-tabs::-webkit-scrollbar {
    display: none;
}
.room-settings-tabs .tab-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 11px 14px;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.2;
    border-radius: 12px;
    text-align: center;
    animation: none;
    box-shadow: none;
}
.room-settings-tabs .tab-btn.active {
    animation: none;
    box-shadow: 0 2px 10px var(--lime-glow);
}
.room-settings-tabs .tab-btn:not(.active):hover {
    transform: none;
}
.room-settings-card {
    max-width: min(680px, 100%);
}
.room-settings-card .room-settings-tabs {
    margin: 8px 0 18px;
}
.room-settings-panel.hidden {
    display: none;
}
.settings-hint {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-muted, #8f9a94);
}
/* ===== Character / GM messages (п.6.3) ===== */
.chat-message.character-msg .message-username {
    font-weight: 600;
    letter-spacing: 0.01em;
}
.chat-message.character-msg .message-bubble {
    border-left: 3px solid var(--character-accent, #a8d08d);
    background: color-mix(in srgb, var(--character-accent, #a8d08d) 18%, var(--msg-in-bg));
}
.chat-message.character-msg.outgoing .message-bubble {
    background: color-mix(in srgb, var(--character-accent, #a8d08d) 22%, var(--msg-out-bg));
}
.chat-message.gm-msg .message-username {
    color: #c9a227 !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.chat-message.gm-msg .message-bubble {
    border-left: 3px solid #c9a227;
    background: rgba(201, 162, 39, 0.08);
}
.char-color-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.char-color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: var(--swatch, #a8d08d);
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.char-color-swatch:hover {
    transform: scale(1.08);
}
.char-color-swatch.is-selected {
    border-color: var(--text-main);
    box-shadow: 0 0 0 2px var(--primary-alpha), 0 0 0 1px var(--swatch);
}
.room-wallpaper-preview-wrap {
    margin-bottom: 10px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-card);
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.room-wallpaper-preview {
    width: 100%;
    max-height: 140px;
    object-fit: cover;
    display: block;
}
.room-wallpaper-empty {
    padding: 16px;
    font-size: 12px;
    color: var(--text-muted);
}
.room-wallpaper-filename {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
    word-break: break-all;
}
.character-item.is-active-speaker {
    outline: 1px solid rgba(34, 197, 94, 0.45);
}
.character-item.speaker-gm .name,
.character-item.speaker-self .name {
    font-weight: 600;
}

/* ===== Edited message mark (п.8) ===== */
.msg-edited {
    font-size: 9px;
    color: var(--text-muted, #8f9a94);
    font-style: italic;
    flex-shrink: 0;
}

.context-menu-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    object-fit: contain;
    display: block;
    filter: var(--icon-filter, none);
}

/* ===== Chat control buttons (dice / tools) ===== */
.chat-control-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 42px;
    padding: 0 14px;
    border: none;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    color: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}
.chat-control-btn:hover {
    background: rgba(190,245,117,0.2);
}
.chat-control-btn:active { transform: scale(0.96); }
.chat-control-emoji { font-size: 16px; line-height: 1; }
.chat-control-label { font-size: 13px; }

/* Overlay behind sidebars */
.content-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    z-index: 95;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
body.left-open .content-overlay,
body.right-open .content-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================
   MOBILE APP LAYOUT (modern chat UX)
   ============================================ */
@media (max-width: 768px) {
    /* Header: toggles become normal toolbar icons */
    .top-bar {
        padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
        gap: 4px;
        min-height: 52px;
    }
    .header-center,
    .header-right {
        gap: 4px;
    }
    .side-toggle,
    .left-toggle,
    .right-toggle {
        position: static !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        width: 40px !important;
        height: 40px !important;
        border-radius: 50% !important;
        border: none !important;
        display: flex !important;
        box-shadow: none !important;
        background: rgba(255, 255, 255, 0.08) !important;
        color: inherit !important;
        backdrop-filter: none;
        flex-shrink: 0;
    }
    /* Keep admin hide working (overrides display:flex !important above) */
    .side-toggle.hidden,
    .right-toggle.hidden {
        display: none !important;
    }
    .left-toggle { color: var(--primary) !important; }
    .right-toggle {
        background: var(--gradient-primary) !important;
        color: #1a1a2e !important;
    }
    .side-toggle:hover,
    .left-toggle:hover,
    .right-toggle:hover {
        top: auto !important;
        width: 40px !important;
        height: 40px !important;
        transform: none;
        filter: none;
    }
    .left-toggle svg,
    .right-toggle .support-icon {
        width: 20px !important;
        height: 20px !important;
    }
    .icon-btn {
        width: 40px;
        height: 40px;
    }
    .icon-btn svg {
        width: 20px;
        height: 20px;
    }
    .icon-btn:hover {
        transform: none;
    }

    /* Full-bleed drawers */
    .sidebar,
    .sidebar.left,
    .sidebar.right {
        width: min(100vw, 420px);
        max-width: 100vw;
        border-radius: 0;
        z-index: 120;
    }
    .sidebar.left {
        width: 100vw;
        max-width: 100vw;
    }
    #left-sidebar .sidebar-header {
        padding: calc(10px + env(safe-area-inset-top)) 10px 8px;
    }
    #left-sidebar .chat-item {
        padding: 9px 10px;
        margin: 0 2px;
        border-radius: 10px;
    }
    #left-sidebar .chat-item img,
    #left-sidebar .chat-item .chat-avatar {
        width: 50px;
        height: 50px;
    }
    #left-sidebar .chat-title,
    #left-sidebar .chat-item .chat-info h4 {
        font-size: 16px;
    }
    #left-sidebar .chat-preview {
        font-size: 14px;
    }
    .sidebar-header {
        padding: calc(12px + env(safe-area-inset-top)) 14px 12px;
        gap: 10px;
    }
    .tab-btn {
        padding: 10px 8px;
        font-size: 12px;
    }
    .room-settings-tabs {
        margin: 0 0 14px;
        padding: 3px;
        gap: 3px;
        border-radius: 12px;
        justify-content: flex-start;
    }
    .room-settings-tabs .tab-btn {
        flex: 0 0 auto;
        padding: 9px 12px;
        font-size: 12px;
        border-radius: 9px;
    }

    /* Chat header — compact, messenger-style */
    .room-header {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
        min-height: 56px;
    }
    .room-header::before {
        display: none;
    }
    .room-title-area {
        min-width: 0;
        flex: 1;
        padding: 4px 6px;
        border-radius: 14px;
    }
    .room-title-area:hover {
        transform: none;
    }
    .room-meta {
        flex-wrap: nowrap;
        overflow: hidden;
    }
    .room-meta #active-room-desc-short,
    .room-meta .meta-dot {
        display: none;
    }
    .room-info h2 {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 55vw;
        margin-bottom: 2px;
    }
    .invite-container {
        display: none !important;
    }
    .invite-fab {
        display: flex !important;
    }
    .room-header-actions {
        display: flex;
        gap: 6px;
        flex-shrink: 0;
    }
    #active-room-age.age-badge:not([hidden]) {
        display: inline-flex;
        align-items: center;
        padding: 4px 8px;
        font-size: 10px;
        max-width: 72px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex-shrink: 0;
    }
    #btn-room-settings {
        flex-shrink: 0;
        width: 36px;
        height: 36px;
        padding: 0 !important;
        border-radius: 50%;
        font-size: 16px;
    }

    /* Messages */
    .message-bubble {
        padding: 9px 12px 18px;
        font-size: 14px;
        border-radius: 18px;
    }
    .incoming .message-bubble {
        border-radius: 4px 16px 16px 16px;
    }
    .outgoing .message-bubble {
        border-radius: 16px 4px 16px 16px;
    }
    .message-text {
        padding-right: 42px;
    }
    .participant-item:hover {
        transform: none;
    }
    .chat-item:hover {
        transform: none;
    }

    /* Composer */
    .reply-compose-bar {
        padding: 8px 12px 0;
    }
    .room-input-area {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 8px;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    }
    .composer-tools {
        gap: 6px;
    }
    .composer-field {
        height: 48px;
        padding: 0 6px 0 14px;
        border-radius: 24px;
    }
    .composer-field #room-input,
    .room-input-area .composer-field input {
        min-width: 0;
        flex: 1;
        height: 100%;
        padding: 0 6px 0 0;
        font-size: 16px; /* prevents iOS zoom */
        border-radius: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }
    .emoji-toggle-btn {
        width: 38px;
        height: 38px;
    }
    .emoji-toggle-btn .emoji-toggle-icon {
        width: 20px;
        height: 20px;
    }
    .emoji-picker-panel {
        width: min(300px, calc(100vw - 16px));
        border-radius: 16px;
    }
    .emoji-picker-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        max-height: min(240px, 38dvh);
    }
    .send-btn {
        width: 48px;
        height: 48px;
        flex-shrink: 0;
    }
    .send-btn:hover {
        transform: none;
    }
    .chat-control-btn {
        width: 42px;
        height: 42px;
        padding: 0;
        border-radius: 50%;
    }
    .chat-control-label {
        display: none;
    }
    #character-select-btn.icon-btn,
    .character-select-btn {
        width: 42px;
        height: 42px;
        flex-shrink: 0;
    }
    .characters-btn-list {
        display: none;
    }
    .typing-indicator-bar {
        max-width: calc(100vw - 24px);
        padding: 7px 14px;
        font-size: 11px;
    }

    /* Modals → bottom sheet */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
        justify-content: center;
    }
    .modal-card {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 22px 22px 0 0;
        max-height: min(92dvh, calc(100dvh - env(safe-area-inset-top)));
        padding: 0;
        overflow: hidden;
        animation: mobileSheetUp 0.28s ease;
    }
    .modal-scroll {
        padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
    }
    .modal-card-clean > .modal-scroll,
    .modal-scroll:not(:has(> h3)):not(:has(> .modal-header-bar)) {
        padding-top: 48px;
    }
    .modal-scroll:has(> .modal-header-bar) {
        padding-top: 12px;
    }
    .modal-card h3 {
        font-size: 18px;
        margin-bottom: 14px;
        padding-right: 44px;
        text-align: left;
    }
    .modal-header-bar {
        margin-bottom: 12px;
    }
    .modal-header-bar h3 {
        padding-right: 0;
        margin-bottom: 0;
        font-size: 18px;
    }
    .close-modal {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        font-size: 22px;
    }
    .input-group {
        margin-bottom: 14px;
    }
    .input-group input,
    .input-group textarea,
    .input-group select {
        font-size: 16px;
        padding: 12px 14px;
        border-radius: 14px;
    }
    .main-btn {
        border-radius: 16px;
    }
    .forward-picker-card {
        max-width: 100%;
    }
    .modal-card.room-settings-card,
    .room-settings-card,
    .characters-modal .modal-card,
    #characters-modal .modal-card {
        max-width: 100% !important;
    }
    .room-chat-history,
    .sidebar .chat-list,
    .modal-card {
        -webkit-overflow-scrolling: touch;
    }
    .forward-chat-list {
        max-height: 50dvh;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Welcome */
    .welcome-hero-glow,
    .welcome-hero-orb {
        animation: none;
    }
    .welcome-desc {
        font-size: 14px;
        margin-bottom: 24px;
    }

    /* Dice modal stays usable */
    #dice-modal .dice-modal-card {
        width: 100%;
        max-width: 100%;
        max-height: 94dvh;
        border-radius: 22px 22px 0 0;
        margin: 0;
    }
    #dice-modal .dice-app {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    #dice-modal .dice-stage {
        height: 160px;
    }

    /* Tickets / support */
    .tickets-modal-card {
        max-width: 100%;
        border-radius: 22px 22px 0 0;
    }

    .notif-toast-host {
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
        max-width: none !important;
    }
    .notif-toast {
        padding: 10px 12px 10px 11px;
        border-radius: 14px;
    }
    .notif-toast-text {
        font-size: 12px;
        -webkit-line-clamp: 3;
    }
    .notif-toolbar {
        gap: 8px;
    }
    .notif-toolbar .main-btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .top-bar {
        padding-left: 8px;
        padding-right: 8px;
    }
    .room-count-box {
        padding: 2px 8px;
        font-size: 10px;
    }
    .message-username {
        margin-left: 8px;
        font-size: 10px;
    }
    .character-item .actions {
        gap: 6px;
    }
    .character-item .actions button {
        padding: 6px 10px;
        font-size: 12px;
    }
}

@keyframes mobileSheetUp {
    from { transform: translateY(24px); opacity: 0.6; }
    to { transform: translateY(0); opacity: 1; }
}

/* Touch: reduce hover transforms that cause layout jump */
@media (hover: none) and (pointer: coarse) {
    .chat-item:hover,
    .participant-item:hover,
    .room-title-area:hover,
    .icon-btn:hover,
    .send-btn:hover,
    .main-btn:hover,
    .welcome-actions .main-btn:hover {
        transform: none;
    }
}

/* ===== Notifications list ===== */
.notif-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.notif-toolbar .main-btn {
    padding: 6px 12px;
    font-size: 12px;
}
.notif-tabs.room-settings-tabs {
    margin: 0 0 12px;
}
.notif-empty {
    text-align: center;
    padding: 28px 16px;
    color: var(--text-muted);
    font-size: 14px;
}
#notifications-btn {
    position: relative;
}
#notifications-btn::before {
    z-index: 0;
}
#notifications-btn:hover::before {
    width: 100%;
    height: 100%;
}
#notifications-btn:hover {
    transform: scale(1.05);
}
#notifications-btn svg {
    position: relative;
    z-index: 1;
}
#notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    box-sizing: border-box;
    z-index: 3;
    pointer-events: none;
    box-shadow: 0 0 0 2px var(--bg-header, #1a1a2e);
}
.notif-toast-host {
    position: fixed;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: min(300px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    box-sizing: border-box;
    pointer-events: none;
}
.notif-toast {
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 11px 14px 11px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: var(--shadow-md);
    text-align: left;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    font: inherit;
    overflow: hidden;
}
.notif-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.notif-toast:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--border-light);
}
.notif-toast-accent {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
}
.notif-toast-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-alpha);
    font-size: 14px;
    line-height: 1;
    margin-top: 1px;
}
.notif-toast-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.notif-toast-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.notif-toast-text {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.notif-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 12px 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-body);
    color: var(--text-main);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.notif-item--unread {
    background: var(--primary-alpha);
    border-color: var(--primary);
    box-shadow: inset 3px 0 0 var(--primary);
}
.notif-item--unread .notif-item-text {
    font-weight: 700;
    color: var(--text-main);
}
.notif-item--read {
    opacity: 0.72;
}
.notif-item--read .notif-item-text {
    font-weight: 400;
    color: var(--text-muted);
}
.notif-item--clickable {
    cursor: pointer;
}
.notif-item--clickable:hover {
    border-color: var(--primary);
}
.notif-item-icon {
    font-size: 22px;
    line-height: 1.2;
    flex-shrink: 0;
}
.notif-item-body {
    flex: 1;
    min-width: 0;
}
.notif-new-badge {
    display: inline-block;
    margin-bottom: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #fff;
    background: var(--primary-dark);
}
.notif-item-text {
    font-size: 14px;
    line-height: 1.35;
    word-break: break-word;
}
.notif-item-time {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}
.notif-item-open {
    margin-top: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-dark);
}
.join-request-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.join-request-actions .main-btn {
    padding: 6px 12px;
    font-size: 12px;
}
.room-accent-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.room-accent-row input[type="color"] {
    width: 48px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

/* Room theme: glass — fully translucent composer bar */
#active-chat-screen.room-theme-glass #chat-controls-wrapper.room-input-area,
#active-chat-screen.room-theme-glass .room-input-area {
    background: transparent !important;
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: none;
}
#active-chat-screen.room-theme-glass .composer-field {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.16);
}
#active-chat-screen.room-theme-glass .composer-field:focus-within {
    background: rgba(255, 255, 255, 0.14);
}
#active-chat-screen.room-theme-glass .room-header {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#active-chat-screen.room-theme-neon .message-bubble {
    box-shadow: 0 0 0 1px rgba(217, 70, 239, 0.18), 0 0 18px rgba(0, 200, 180, 0.12);
}
#active-chat-screen.room-theme-noir .incoming .message-bubble,
#active-chat-screen.room-theme-noir .outgoing .message-bubble {
    border-color: rgba(255, 255, 255, 0.08);
}

.mark-read-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--primary-dark);
    line-height: 1;
    padding: 2px 4px;
    flex-shrink: 0;
}
.mark-read-btn:hover {
    color: var(--primary);
}

