:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2d2d2d;
    --bg-quaternary: #404040;
    --bg-hover: #3a3a3a;
    --bg-active: #4a4a4a;
    --bg-modal: #1a1a1a;
    --bg-card: #1a1a1a;
    --bg-surface: #1a1a1a;
    --bg-message-in: #252525;
    --bg-message-out: #527c9e;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --text-placeholder: #666666;
    --accent: #527c9e;
    --accent-hover: #6a9ab5;
    --accent-light: rgba(82, 124, 158, 0.2);
    --danger: #e17055;
    --danger-hover: #d55a40;
    --danger-light: rgba(225, 112, 85, 0.2);
    --success: #00b894;
    --success-hover: #00a884;
    --success-light: rgba(0, 184, 148, 0.2);
    --warning: #fdcb6e;
    --warning-light: rgba(253, 203, 110, 0.2);
    --gold: #fbbf24;
    --gold-hover: #f59e0b;
    --gold-light: rgba(251, 191, 36, 0.2);
    --info: #74b9ff;
    --info-light: rgba(116, 185, 255, 0.2);
    --border-color: #3a3a3a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.5);
    --shadow-xl: 0 8px 32px rgba(0,0,0,0.6);
    --transition-fast: 0.1s ease;
    --transition: 0.15s ease;
    --transition-slow: 0.3s ease;
    --sidebar-width: 315px;
    --info-width: 288px;
    --header-height: 54px;
    --message-max-width: 65%;
    --border-radius-sm: 7px;
    --border-radius: 11px;
    --border-radius-lg: 18px;
    --border-radius-xl: 25px;
    --border-radius-full: 50%;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Courier New', monospace;
    --z-fab: 25;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-sidebar: 500;
    --z-modal: 1000;
    --z-popover: 1100;
    --z-toast: 1200;
    --z-context-menu: 10000;
    --z-media-viewer: 20000;
    --wallpaper-opacity: 0.15;
    --profile-header-bg: #1a1a2e;
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e8e8e8;
    --bg-quaternary: #d4d4d4;
    --bg-hover: #e0e0e0;
    --bg-active: #cccccc;
    --bg-modal: #ffffff;
    --bg-card: #f8f8f8;
    --bg-surface: #ffffff;
    --bg-message-in: #e8e8e8;
    --bg-message-out: #4a90d9;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-muted: #888888;
    --text-placeholder: #aaaaaa;
    --accent: #4a90d9;
    --accent-hover: #3570b0;
    --accent-light: rgba(74, 144, 217, 0.1);
    --danger: #e15554;
    --danger-hover: #c94040;
    --success: #00a884;
    --warning: #e6a020;
    --gold: #d4a017;
    --border-color: #dddddd;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
    --shadow-xl: 0 8px 32px rgba(0,0,0,0.2);
    --wallpaper-opacity: 0.5;
    --profile-header-bg: #f0f0f5;
}

[data-theme="amoled"] {
    --bg-primary: #000000;
    --bg-secondary: #050505;
    --bg-tertiary: #0a0a0a;
    --bg-quaternary: #151515;
    --bg-hover: #151515;
    --bg-active: #1a1a1a;
    --bg-modal: #050505;
    --bg-card: #050505;
    --bg-surface: #050505;
    --bg-message-in: #111111;
    --bg-message-out: #527c9e;
    --text-primary: #ffffff;
    --text-secondary: #999999;
    --text-muted: #666666;
    --text-placeholder: #555555;
    --accent: #527c9e;
    --accent-hover: #6a9ab5;
    --accent-light: rgba(82, 124, 158, 0.15);
    --danger: #e17055;
    --danger-hover: #d55a40;
    --danger-light: rgba(225, 112, 85, 0.15);
    --success: #00b894;
    --success-hover: #00a884;
    --success-light: rgba(0, 184, 148, 0.15);
    --warning: #fdcb6e;
    --warning-light: rgba(253, 203, 110, 0.15);
    --gold: #fbbf24;
    --gold-hover: #f59e0b;
    --gold-light: rgba(251, 191, 36, 0.15);
    --info: #74b9ff;
    --info-light: rgba(116, 185, 255, 0.15);
    --border-color: #111111;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.5);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.6);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.7);
    --shadow-xl: 0 8px 32px rgba(0,0,0,0.8);
    --wallpaper-opacity: 0.1;
    --profile-header-bg: #000000;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; height: 100%; overflow: hidden; }
body { font-family: var(--font-family); background: var(--bg-primary); color: var(--text-primary); height: 100vh; height: 100dvh; overflow: hidden; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; line-height: 1.45; user-select: none; -webkit-user-select: none; max-width: 100vw; overflow-x: hidden; }
h1,h2,h3,h4,h5,h6 { font-weight: 600; line-height: 1.2; color: var(--text-primary); }
h1 { font-size: 29px; } h2 { font-size: 25px; } h3 { font-size: 18px; } h4 { font-size: 14px; }
p { margin-bottom: 7px; color: var(--text-secondary); }
small { font-size: 11px; color: var(--text-muted); }
a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { text-decoration: underline; color: var(--accent-hover); }
kbd { background: var(--bg-tertiary); padding: 2px 7px; border-radius: 4px; font-size: 12px; font-family: var(--font-mono); border: 1px solid var(--border-color); }
code { background: var(--bg-tertiary); padding: 2px 5px; border-radius: 4px; font-family: var(--font-mono); font-size: 0.9em; }
button { cursor: pointer; border: none; background: none; font-family: inherit; transition: var(--transition); touch-action: manipulation; -webkit-tap-highlight-color: transparent; color: var(--text-primary); position: relative; z-index: 1; }
button:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 18px; background: var(--bg-tertiary); border-radius: var(--border-radius); color: var(--text-primary); font-size: 14px; font-weight: 500; border: 1px solid transparent; transition: all 0.2s ease; white-space: nowrap; cursor: pointer; pointer-events: auto; }
.btn:hover { background: var(--bg-quaternary); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: white; padding: 11px 22px; border-radius: 27px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-md); border: 1px solid var(--accent); cursor: pointer; pointer-events: auto; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--accent-hover); }
.btn-primary:active { transform: scale(0.97); }
.btn-danger { background: var(--danger-light); color: var(--danger); border: 1px solid transparent; cursor: pointer; }
.btn-danger:hover { background: var(--danger); color: white; border-color: var(--danger); }
.btn-block { width: 100%; display: flex; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 7px; color: var(--text-secondary); font-size: 13px; font-weight: 500; }
.form-control { width: 100%; padding: 11px 14px; background: var(--bg-tertiary); border: 1.5px solid var(--border-color); border-radius: var(--border-radius); color: var(--text-primary); font-size: 14px; outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; font-family: var(--font-family); -webkit-appearance: none; -moz-appearance: none; appearance: none; pointer-events: auto; }
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); outline: none; }
.form-control::placeholder { color: var(--text-placeholder); }
textarea.form-control { resize: vertical; min-height: 72px; line-height: 1.5; }
select.form-control { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999999' d='M6 9L1 4h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
input:focus, textarea:focus, select:focus { outline: none !important; border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-light) !important; }
.input-icon { display: flex; align-items: center; background: var(--bg-tertiary); border: 1.5px solid var(--border-color); border-radius: var(--border-radius); padding: 0 14px; transition: border-color 0.2s ease, box-shadow 0.2s ease; position: relative; pointer-events: auto; }
.input-icon:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.input-icon i { color: var(--text-muted); margin-right: 11px; font-size: 14px; flex-shrink: 0; }
.input-icon input { flex: 1; padding: 13px 0; background: transparent; border: none; color: var(--text-primary); font-size: 14px; outline: none; font-family: var(--font-family); pointer-events: auto; }
.input-icon input:focus { outline: none; box-shadow: none; }
.input-icon .toggle-password { background: none; border: none; color: var(--text-muted); padding: 13px 11px; cursor: pointer; flex-shrink: 0; font-size: 16px; pointer-events: auto; }
.input-icon .toggle-password:hover { color: var(--text-primary); }
.checkbox-group { display: flex; align-items: center; gap: 9px; cursor: pointer; color: var(--text-secondary); pointer-events: auto; }
.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--accent); pointer-events: auto; }
.switch { position: relative; display: inline-block; width: 45px; height: 23px; flex-shrink: 0; pointer-events: auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--bg-quaternary); transition: .3s; border-radius: 23px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before { transform: translateX(22px); }
input[type="range"] { -webkit-appearance: none; appearance: none; height: 3px; background: var(--bg-tertiary); border-radius: 2px; outline: none; cursor: pointer; pointer-events: auto; opacity: 0.6; transition: opacity 0.2s ease; }
input[type="range"]:hover { opacity: 1; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--text-muted); cursor: pointer; border: 2px solid var(--bg-secondary); box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: all 0.2s ease; }
input[type="range"]::-webkit-slider-thumb:hover { background: var(--text-primary); transform: scale(1.1); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--text-muted); cursor: pointer; border: 2px solid var(--bg-secondary); }
input[type="range"]::-moz-range-thumb:hover { background: var(--text-primary); }
input[type="range"]::-webkit-slider-runnable-track { background: var(--bg-tertiary); border: none; border-radius: 2px; }
input[type="range"]::-moz-range-track { background: var(--bg-tertiary); border: none; border-radius: 2px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes slideInUp { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideOutDown { from { transform: translateY(0); opacity: 1; } to { transform: translateY(100%); opacity: 0; } }
@keyframes slideInDown { from { transform: translateY(-100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideOutUp { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-100%); opacity: 0; } }
@keyframes slideInLeft { from { transform: translateX(-100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOutLeft { from { transform: translateX(0); opacity: 1; } to { transform: translateX(-100%); opacity: 0; } }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOutRight { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }
@keyframes scaleIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes scaleOut { from { transform: scale(1); opacity: 1; } to { transform: scale(0.8); opacity: 0; } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes wave { 0%,100% { transform: scaleY(1); } 50% { transform: scaleY(2); } }
@keyframes messageAppear { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes crownGlow { 0%,100% { filter: drop-shadow(0 0 2px var(--gold)); transform: scale(1); } 25% { filter: drop-shadow(0 0 6px var(--gold)); transform: scale(1.15); } 50% { filter: drop-shadow(0 0 3px var(--gold)); transform: scale(1); } 75% { filter: drop-shadow(0 0 8px var(--gold)); transform: scale(1.1); } }
@keyframes highlightPulse { 0% { background: var(--warning); } 100% { background: transparent; } }
@keyframes telegramMessageIn { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes telegramModalIn { from { opacity: 0; transform: scale(0.95) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes telegramModalOut { from { opacity: 1; transform: scale(1) translateY(0); } to { opacity: 0; transform: scale(0.95) translateY(20px); } }
@keyframes story-progress { from { width: 0%; } to { width: 100%; } }
@keyframes story-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(160, 85, 247, 0.4); } 50% { box-shadow: 0 0 0 5px rgba(160, 85, 247, 0); } }
.animated-emoji { width: 42px !important; height: 42px !important; display: inline-flex !important; align-items: center !important; justify-content: center !important; cursor: pointer; border-radius: 8px; overflow: visible !important; }
.animated-emoji svg { width: 100% !important; height: 100% !important; }
.crown-animated { display: inline-block; animation: crownGlow 2s ease-in-out infinite; }
.highlight-animation { animation: highlightPulse 2s ease; }

.loading-screen { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg-primary); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 9999; transition: opacity 0.5s ease; }
.loading-logo { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 22px; }
.loading-logo span { font-size: 43px; font-weight: bold; color: var(--accent); letter-spacing: 5px; animation: pulse 1.5s infinite; }
.loading-spinner { width: 36px; height: 36px; border: 3px solid var(--border-color); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
.loading-text { margin-top: 14px; color: var(--text-muted); font-size: 13px; }

.auth-screen { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg-primary); display: flex; align-items: flex-start; justify-content: center; z-index: 1000; overflow-y: auto; padding: 18px; padding-bottom: 36px; }
.auth-container { width: 100%; max-width: 720px; background: var(--bg-secondary); border-radius: var(--border-radius-xl); padding: 0; box-shadow: var(--shadow-xl); border: 1px solid var(--border-color); animation: scaleIn 0.3s ease; position: relative; margin: 0 auto; overflow: hidden; }
.auth-logo { text-align: center; margin-bottom: 18px; }
.auth-logo-icon { font-size: 36px; color: var(--accent); margin-bottom: 8px; }
.auth-logo h1 { font-size: 29px; margin-bottom: 5px; color: var(--text-primary); }
.auth-logo h2 { font-size: 22px; margin-bottom: 5px; color: var(--text-primary); }
.auth-logo p { color: var(--text-muted); font-size: 14px; }
.auth-tabs { display: flex; gap: 7px; margin-bottom: 25px; background: var(--bg-tertiary); padding: 4px; border-radius: var(--border-radius-lg); }
.auth-tab { flex: 1; padding: 11px; border: none; background: transparent; color: var(--text-secondary); font-size: 14px; font-weight: 500; cursor: pointer; border-radius: var(--border-radius); transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; gap: 7px; pointer-events: auto; }
.auth-tab.active { background: var(--accent); color: white; }
.auth-tab:hover:not(.active) { color: var(--text-primary); background: var(--bg-hover); }
.auth-form { display: none; }
.auth-form.active { display: block; animation: fadeIn 0.3s ease; max-height: 65vh; overflow-y: auto; }
.auth-btn { width: 100%; padding: 13px; background: var(--accent); border: none; border-radius: var(--border-radius); color: white; font-size: 14px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 14px; transition: all 0.2s ease; border: 1px solid var(--accent); pointer-events: auto; }
.auth-btn:hover { background: var(--accent-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--accent-hover); }
.auth-btn:active { transform: scale(0.98); }
.auth-footer { text-align: center; margin-top: 22px; color: var(--text-muted); font-size: 13px; }
.auth-footer a { color: var(--accent); font-weight: 500; cursor: pointer; pointer-events: auto; }
.auth-footer a:hover { text-decoration: underline; }
.register-progress { display: flex; align-items: center; justify-content: center; gap: 0; margin-bottom: 16px; }
.progress-step { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-tertiary); border: 2px solid var(--border-color); color: var(--text-muted); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; transition: all 0.3s ease; }
.progress-step.active { background: var(--accent); border-color: var(--accent); color: white; }
.progress-step.completed { background: var(--success); border-color: var(--success); color: white; }
.progress-line { width: 54px; height: 2px; background: var(--border-color); transition: background 0.3s ease; }
.progress-line.completed { background: var(--success); }
.lang-pill { display: flex; justify-content: center; gap: 2px; margin-bottom: 16px; flex-wrap: wrap; }
.lang-pill-btn { padding: 6px 10px; border: 1px solid var(--border-color); background: var(--bg-tertiary); color: var(--text-secondary); font-size: 11px; cursor: pointer; font-weight: 500; transition: all 0.2s ease; }
.lang-pill-btn:first-child { border-radius: 16px 0 0 16px; }
.lang-pill-btn:last-child { border-radius: 0 16px 16px 0; }
.lang-pill-btn:not(:first-child):not(:last-child) { border-radius: 0; }
.lang-pill-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

.auth-desktop-layout { display: flex; gap: 0; min-height: 480px; border-radius: var(--border-radius-xl); overflow: hidden; }
.auth-left-column { flex: 1; padding: 40px 32px; display: flex; flex-direction: column; justify-content: center; background: var(--bg-secondary); min-width: 320px; }
.auth-left-column .auth-logo { text-align: center; margin-bottom: 32px; }
.auth-left-column .auth-logo-icon { font-size: 36px; color: var(--accent); margin-bottom: 12px; }
.auth-left-column h1 { font-size: 28px; margin-bottom: 8px; }
.auth-left-column p { color: var(--text-muted); font-size: 14px; }
.auth-form-desktop { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.auth-divider { display: flex; align-items: center; justify-content: center; padding: 0 8px; background: var(--bg-secondary); position: relative; }
.auth-divider::after { content: ''; position: absolute; left: 50%; top: 15%; bottom: 15%; width: 1px; background: var(--border-color); }
.auth-right-column { flex: 1; padding: 40px 32px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--bg-secondary); min-width: 280px; }
.auth-mobile-layout { padding: 22px 18px; display: flex; flex-direction: column; }

@media (max-width: 768px) { .auth-desktop-layout { display: none !important; } .auth-mobile-layout { display: flex !important; } .auth-container { max-width: 380px; padding: 0; } }
@media (min-width: 769px) { .auth-desktop-layout { display: flex !important; } .auth-mobile-layout { display: none !important; } .auth-container { max-width: 720px; } }

.main-screen { display: flex; height: 100vh; height: 100dvh; width: 100%; position: relative; }
.sidebar { width: var(--sidebar-width); background: var(--bg-secondary); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; position: relative; flex-shrink: 0; z-index: 10; }
.sidebar-header { height: var(--header-height); padding: 0 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border-color); gap: 11px; }
.sidebar-title { font-size: 18px; font-weight: 700; color: var(--text-primary); flex: 1; cursor: pointer; user-select: none; }
.menu-btn, .search-btn { width: 40px; height: 40px; border-radius: var(--border-radius-full); display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--text-primary); background: var(--bg-tertiary); cursor: pointer; border: 1px solid transparent; transition: all 0.2s ease; flex-shrink: 0; pointer-events: auto; }
.menu-btn:hover, .search-btn:hover { background: var(--bg-quaternary); color: var(--accent); }
.sidebar-menu { position: fixed; top: 0; left: 0; width: 270px; height: 100vh; height: 100dvh; background: var(--bg-secondary); z-index: var(--z-sidebar); display: none; flex-direction: column; box-shadow: var(--shadow-xl); border-right: 1px solid var(--border-color); animation: slideInLeft 0.3s ease; padding-top: 18px; pointer-events: auto; }
.close-menu-btn { width: 28px; height: 28px; border-radius: var(--border-radius-full); display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--text-muted); background: var(--bg-tertiary); cursor: pointer; transition: all 0.2s ease; position: absolute; top: 12px; right: 12px; pointer-events: auto; }
.close-menu-btn:hover { background: var(--bg-quaternary); color: var(--text-primary); }
.menu-profile { padding: 14px 18px; display: flex; align-items: center; gap: 14px; cursor: pointer; background: transparent; transition: background 0.2s ease; border-radius: var(--border-radius); margin: 0 11px 11px; position: relative; }
.menu-profile:hover { background: var(--bg-tertiary); }
.menu-avatar { width: 45px; height: 45px; border-radius: var(--border-radius-full); display: flex; align-items: center; justify-content: center; font-size: 18px; color: white; background: var(--accent); overflow: hidden; flex-shrink: 0; }
.menu-avatar img { width: 100%; height: 100%; object-fit: cover; }
.menu-profile-info { flex: 1; min-width: 0; }
.menu-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
.menu-username { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-items { flex: 1; overflow-y: auto; padding: 4px 0; }
.menu-item { display: flex; align-items: center; gap: 14px; padding: 11px 18px; color: var(--text-primary); cursor: pointer; background: transparent; width: 100%; transition: background 0.2s ease; font-size: 14px; border: none; text-align: left; pointer-events: auto; }
.menu-item:hover { background: var(--bg-tertiary); }
.menu-item i { width: 22px; color: var(--accent); font-size: 16px; text-align: center; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger i { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-light); }
.menu-divider { height: 1px; background: var(--border-color); margin: 4px 0; }
.sidebar-search { height: var(--header-height); padding: 0 14px; display: none; align-items: center; gap: 9px; border-bottom: 1px solid var(--border-color); animation: slideInDown 0.3s ease; }
.sidebar-search i { color: var(--text-muted); }
.sidebar-search input { flex: 1; background: none; border: none; color: var(--text-primary); font-size: 14px; outline: none; font-family: var(--font-family); pointer-events: auto; }
.sidebar-search input::placeholder { color: var(--text-muted); }
.close-search-btn { padding: 7px; color: var(--text-muted); cursor: pointer; background: transparent; border: none; font-size: 14px; transition: color 0.2s ease; pointer-events: auto; }
.close-search-btn:hover { color: var(--text-primary); }
.chat-list { flex: 1; overflow-y: auto; padding: 7px; position: relative; }

.chat-folder-list { display: flex; gap: 5px; padding: 5px 6px; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: none; -ms-overflow-style: none; border-bottom: 1px solid var(--border-color); flex-shrink: 0; background: var(--bg-secondary); border-radius: 20px; margin: 3px 7px 0; }
.chat-folder-list::-webkit-scrollbar { height: 0; }
.folder-tab { padding: 6px 13px; border-radius: 20px; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; color: #ffffff; background: transparent; transition: all 0.2s ease; pointer-events: auto; }
.folder-tab:hover { background: rgba(255,255,255,0.08); }
.folder-tab.active { border: 1px solid var(--accent); color: #ffffff; background: transparent; }
.folder-add { background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary); padding: 6px 9px; font-size: 16px; }
.folder-add:hover { background: rgba(255,255,255,0.08); }

.chat-item { display: flex; align-items: center; padding: 10px; border-radius: var(--border-radius); cursor: pointer; margin-bottom: 3px; animation: fadeIn 0.3s ease; background: transparent; transition: background 0.2s ease; position: relative; overflow: hidden; pointer-events: auto; }
.chat-item:hover { background: var(--bg-tertiary); }
.chat-item.active { background: var(--accent); }
.chat-item.active .chat-item-name, .chat-item.active .chat-item-message, .chat-item.active .chat-item-meta { color: white; }
.chat-avatar-wrapper { position: relative; margin-right: 11px; flex-shrink: 0; }
.chat-avatar-sm { width: 45px; height: 45px; border-radius: var(--border-radius-full); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 500; color: white; background: var(--accent); overflow: hidden; }
.chat-avatar-sm img { width: 100%; height: 100%; object-fit: cover; }
.online-indicator { position: absolute; bottom: 2px; right: 2px; width: 11px; height: 11px; background: var(--success); border: 2px solid var(--bg-secondary); border-radius: var(--border-radius-full); }
.chat-item-info { flex: 1; min-width: 0; }
.chat-item-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3px; gap: 7px; }
.chat-item-name { font-weight: 600; font-size: 14px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 162px; }
.chat-item-meta { font-size: 11px; color: var(--text-muted); flex-shrink: 0; margin-left: 7px; }
.chat-item-last { display: flex; justify-content: space-between; align-items: center; }
.chat-item-message { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.pinned-icon { color: var(--accent); font-size: 11px; margin-right: 4px; }
.unread-badge { background: var(--accent); color: white; font-size: 11px; font-weight: 600; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 5px; flex-shrink: 0; margin-left: 7px; }

.chat-area { flex: 1; display: flex; flex-direction: column; background: var(--bg-primary); position: relative; overflow: hidden; }
.empty-chat { flex: 1; display: flex; align-items: center; justify-content: center; }
.empty-state { text-align: center; animation: fadeIn 0.5s ease; padding: 36px; }
.empty-state h3 { font-size: 22px; margin-bottom: 7px; color: var(--text-primary); }
.empty-state p { font-size: 14px; margin-bottom: 22px; color: var(--text-secondary); }
.active-chat { display: flex; flex-direction: column; height: 100%; position: relative; background-image: url('/images/fon.png'); background-size: cover; background-position: center; }
.chat-header { height: var(--header-height); padding: 0 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border-color); background: var(--bg-secondary); position: relative; z-index: 2; backdrop-filter: blur(10px); pointer-events: auto; }
.chat-header-left { display: flex; align-items: center; gap: 11px; cursor: pointer; padding: 7px 11px; border-radius: var(--border-radius); background: transparent; transition: background 0.2s ease; flex: 1; min-width: 0; pointer-events: auto; }
.chat-header-left:hover { background: var(--bg-tertiary); }
.back-btn-mobile { display: none; width: 36px; height: 36px; border-radius: var(--border-radius-full); align-items: center; justify-content: center; font-size: 16px; color: var(--text-primary); background: var(--bg-tertiary); margin-right: 7px; cursor: pointer; flex-shrink: 0; border: 1px solid var(--border-color); transition: all 0.2s ease; pointer-events: auto; }
.chat-avatar { width: 36px; height: 36px; border-radius: var(--border-radius-full); display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 500; color: white; background: var(--accent); overflow: hidden; flex-shrink: 0; }
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-header-info { display: flex; flex-direction: column; min-width: 0; }
.chat-title { font-size: 14px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-subtitle { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.chat-header-right { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.header-btn { width: 36px; height: 36px; border-radius: var(--border-radius-full); display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--text-primary); background: var(--bg-tertiary); cursor: pointer; border: 1px solid transparent; transition: all 0.2s ease; pointer-events: auto; }
.header-btn:hover { background: var(--bg-quaternary); color: var(--accent); }
.header-btn i { pointer-events: none; }
.messages-container { flex: 1; overflow-y: auto; padding: 18px; position: relative; z-index: 1; -webkit-overflow-scrolling: touch; }
.messages-list { display: flex; flex-direction: column; gap: 7px; max-width: 720px; margin: 0 auto; }
.pinned-messages-bar { background: var(--bg-secondary); border: 1px solid var(--accent); border-radius: var(--border-radius); padding: 9px 14px; margin-bottom: 11px; display: flex; align-items: center; gap: 11px; cursor: pointer; transition: background 0.2s ease; z-index: 5; }
.pinned-messages-bar:hover { background: var(--bg-tertiary); }
.pinned-messages-bar i { color: var(--accent); font-size: 14px; flex-shrink: 0; }
.pinned-message-item { flex: 1; font-size: 13px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pinned-count { color: var(--accent); font-size: 12px; cursor: pointer; flex-shrink: 0; }
.pinned-close-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 0 4px; flex-shrink: 0; pointer-events: auto; }
.pinned-close-btn:hover { color: var(--danger); }
.message-date-separator { text-align: center; margin: 18px 0; }
.message-date-separator span { background: rgba(0,0,0,0.4); backdrop-filter: blur(8px); padding: 2px 8px; border-radius: 18px; font-size: 10px; color: white; display: inline-block; }
.message { display: flex; margin-bottom: 7px; animation: messageAppear 0.3s ease; position: relative; max-width: var(--message-max-width); cursor: default; pointer-events: auto; }
.message.incoming { align-self: flex-start; }
.message.outgoing { align-self: flex-end; }
.message.selected .message-bubble { box-shadow: 0 0 0 2px var(--accent); }
.message-avatar { width: 32px; height: 32px; border-radius: var(--border-radius-full); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 500; color: white; margin-right: 7px; flex-shrink: 0; overflow: hidden; cursor: pointer; pointer-events: auto; }
.message-avatar img { width: 100%; height: 100%; object-fit: cover; }
.message-content { max-width: 100%; position: relative; pointer-events: auto; }
.message-bubble { background: var(--bg-message-in); padding: 2px 6px 3px 6px; border-radius: 12px; word-wrap: break-word; position: relative; box-shadow: var(--shadow-sm); cursor: pointer; pointer-events: auto; }
.outgoing .message-bubble { background: var(--bg-message-out); color: white; border-bottom-right-radius: 4px; }
.incoming .message-bubble { border-bottom-left-radius: 4px; }
.message-text { line-height: 1.2; word-break: break-word; color: #fff; font-size: 15px; font-weight: 400; }
.message-text strong { font-weight: 700; }
.message-text em { font-style: italic; }
.message-text del { text-decoration: line-through; opacity: 0.7; }
.message-text code { background: rgba(0,0,0,0.2); padding: 2px 5px; border-radius: 4px; font-family: var(--font-mono); font-size: 0.9em; }
.message-text a { color: var(--accent); text-decoration: underline; }
.outgoing .message-text a { color: #fff; }
.message-emoji-only { background: transparent !important; box-shadow: none !important; padding: 0 !important; }
.message-emoji-only .message-text { font-size: 43px; line-height: 1.2; }
.message-meta { display: inline; float: right; margin-left: 8px; position: relative; top: 8px; font-size: 11px; color: var(--text-muted); padding: 0; }
.outgoing .message-meta { justify-content: flex-end; }
.message-time { font-size: 10px; color: #fff; display: inline; position: relative; top: 4px; }
.message-status { display: flex; align-items: center; font-size: 9px; display: inline; position: relative; top: 3px; margin-left: 3px; }
.status-pending, .status-sent { color: rgba(255,255,255,0.7) !important; }
.status-read { color: #fff !important; }
.pinned-msg-icon { color: var(--accent); font-size: 11px; margin-left: 4px; }
.message-reply { display: flex; align-items: flex-start; gap: 7px; padding: 7px 11px; background: rgba(0,0,0,0.1); border-radius: 11px; margin-bottom: 7px; border-left: 3px solid var(--accent); cursor: pointer; pointer-events: auto; }
.message-reply i { color: var(--accent); font-size: 13px; }
.reply-name { font-weight: 500; font-size: 12px; display: block; }
.reply-text { font-size: 11px; color: var(--text-secondary); }
.message-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction { background: var(--bg-tertiary); padding: 4px 7px; border-radius: 18px; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; transition: all 0.2s ease; pointer-events: auto; }
.reaction:hover { background: var(--accent-light); }
.message-image-wrapper { max-width: 270px; border-radius: 11px; overflow: hidden; cursor: pointer; }
.message-image { width: 100%; height: auto; display: block; transition: transform 0.3s ease; }
.message-image:hover { transform: scale(1.02); }
.message-video { max-width: 270px; border-radius: 11px; overflow: hidden; }
.message-video video { width: 100%; height: auto; display: block; border-radius: 11px; }
.image-grid-1 { max-width: 270px; }
.image-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; max-width: 270px; }
.grid-item { aspect-ratio: 1; border-radius: 7px; overflow: hidden; position: relative; cursor: pointer; pointer-events: auto; }
.grid-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.grid-item:hover img { transform: scale(1.05); }
.grid-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; font-size: 25px; font-weight: bold; color: white; backdrop-filter: blur(4px); }

.voice-message { display: flex; align-items: center; gap: 7px; padding: 5px 9px; min-width: 180px; max-width: 270px; }
.voice-play-btn { width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--accent); color: white; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.voice-progress-container { flex: 1; height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; overflow: hidden; }
.voice-progress-bar { height: 100%; background: var(--accent); width: 0%; transition: width 0.1s linear; }
.voice-duration { font-size: 11px; color: #fff; flex-shrink: 0; min-width: 36px; }
.voice-transcribe-btn:hover { background: var(--accent) !important; color: #fff !important; }
.voice-transcript-text { word-break: break-word; }
.voice-transcript-expand:hover { color: var(--accent-hover) !important; }

.audio-message-inline { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; min-width: 200px; }
.audio-message-inline .audio-cover { width: 40px; height: 40px; border-radius: 8px; background: var(--bg-tertiary); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.audio-message-inline .audio-info { flex: 1; min-width: 0; }
.audio-message-inline .audio-title { font-size: 14px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-message-inline .audio-artist { font-size: 12px; color: var(--text-muted); }
.audio-message-inline .audio-duration { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.audio-message-inline .audio-play-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: white; font-size: 12px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; border: none; }
.audio-message-inline .audio-play-btn:hover { background: var(--accent-hover); }

.message-file { display: flex; align-items: center; gap: 11px; padding: 7px 11px; cursor: pointer; pointer-events: auto; }
.file-icon { width: 36px; height: 36px; border-radius: 9px; background: var(--bg-tertiary); display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--text-secondary); }
.file-info { flex: 1; }
.file-name { font-weight: 500; margin-bottom: 2px; color: #fff; }
.file-size { font-size: 11px; color: #fff; }
.file-download-btn { width: 32px; height: 32px; border-radius: var(--border-radius-full); background: var(--bg-tertiary); display: flex; align-items: center; justify-content: center; color: var(--text-primary); cursor: pointer; border: none; transition: all 0.2s ease; pointer-events: auto; }
.file-download-btn:hover { background: var(--accent); color: white; }
.message-file-uploading { padding: 11px; }
.upload-progress-bar { height: 4px; background: var(--bg-tertiary); border-radius: 2px; overflow: hidden; margin-bottom: 4px; opacity: 0.6; }
.upload-progress-fill { height: 100%; background: var(--text-muted); transition: width 0.3s ease; }
.upload-progress-text { font-size: 11px; color: #fff; opacity: 0.8; }
.message-error { color: var(--danger); }
.message-deleted { color: var(--text-muted); font-style: italic; }

.code-block { position: relative; margin: 8px 0; border-radius: 12px; overflow: hidden; background: #1e1e1e; border: 1px solid #333; }
.code-header { padding: 6px 14px; font-size: 11px; color: #888; background: #2d2d2d; text-transform: lowercase; font-family: var(--font-mono); }
.code-content { padding: 14px; margin: 0; overflow-x: auto; font-family: var(--font-mono); font-size: 13px; line-height: 1.6; color: #d4d4d4; white-space: pre-wrap; word-break: break-word; }
.code-copy-btn { position: absolute; bottom: 6px; right: 8px; background: rgba(255,255,255,0.08); border: none; color: #888; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; transition: all 0.2s; z-index: 2; }
.code-copy-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
.spoiler-text { background: #333; color: #333; border-radius: 4px; padding: 0 4px; cursor: pointer; transition: all 0.2s; }
.spoiler-text.revealed { background: transparent; color: inherit; }

.poll-container { background: var(--bg-tertiary); padding: 14px; border-radius: 14px; min-width: 225px; }
.poll-question { font-weight: 600; margin-bottom: 14px; font-size: 14px; }
.poll-options { display: flex; flex-direction: column; gap: 8px; }
.poll-option { cursor: pointer; }
.poll-option-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.poll-radio { width: 16px; height: 16px; border: 2px solid #555; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.poll-radio.selected { border-color: var(--accent); }
.poll-radio.selected::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.poll-option-text { flex: 1; }
.poll-option-votes { font-size: 12px; color: var(--text-muted); }
.poll-bar-container { height: 5px; background: var(--bg-quaternary); border-radius: 2px; overflow: hidden; margin-bottom: 4px; }
.poll-bar { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.3s ease; }
.poll-footer { margin-top: 10px; font-size: 12px; color: var(--text-muted); }

.context-menu { position: fixed; background: var(--bg-secondary); border-radius: 13px; box-shadow: 0 7px 27px rgba(0,0,0,0.5); padding: 5px; min-width: 180px; z-index: var(--z-context-menu); display: none; animation: scaleIn 0.15s ease; border: 1px solid var(--border-color); backdrop-filter: blur(10px); pointer-events: auto; }
.context-menu-item { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-radius: 7px; cursor: pointer; color: #fff; background: transparent; border: none; width: 100%; text-align: left; font-size: 14px; transition: background 0.2s ease; pointer-events: auto; }
.context-menu-item:hover { background: var(--bg-tertiary); }
.context-menu-item i { width: 18px; color: var(--accent); }
.context-menu-item.danger { color: var(--danger); }
.context-menu-item.danger i { color: var(--danger); }
.context-menu-separator { height: 1px; background: var(--border-color); margin: 7px 0; }

.msg-ctx-reactions { display: flex; gap: 6px; padding: 8px 10px; justify-content: center; border-bottom: 1px solid var(--border-color); margin-bottom: 4px; flex-wrap: wrap; }
.msg-ctx-reaction { font-size: 24px; cursor: pointer; padding: 4px; border-radius: 8px; transition: background 0.15s; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; }
.msg-ctx-reaction:hover { background: var(--bg-tertiary); }
.msg-ctx-expand { font-size: 18px; color: var(--text-muted); }
.msg-ctx-actions { padding: 0; }
.msg-ctx-details { font-size: 12px; padding: 8px 14px; color: var(--text-muted); }

.menu-item-new { display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; border-radius: 8px; font-size: 14px; color: #fff; transition: background 0.15s; }
.menu-item-new:hover { background: var(--bg-tertiary); }
.menu-item-new i { width: 18px; text-align: center; color: var(--accent); }
.menu-item-new.delete { color: var(--danger); }
.menu-item-new.delete i { color: var(--danger); }
.reactions-panel-new { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-bottom: 1px solid #2f2f2f; margin-bottom: 4px; }
.reaction-new { font-size: 22px; cursor: pointer; padding: 4px; border-radius: 8px; transition: background 0.15s; }
.reaction-new:hover { background: rgba(255,255,255,0.1); }

.stories-bar { padding: 4px 0; border-bottom: 1px solid var(--border-color); background: var(--bg-primary); overflow: hidden; transition: padding 0.3s ease; }
.stories-bar.expanded { padding: 10px 0; }
.stories-scroll { display: flex; gap: 8px; padding: 0 8px; overflow-x: auto; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.stories-scroll::-webkit-scrollbar { display: none; }
.story-bubble { display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; flex-shrink: 0; position: relative; transition: transform 0.3s ease; }
.story-avatar-ring { width: 34px; height: 34px; border-radius: 50%; padding: 2px; position: relative; transition: width 0.3s ease, height 0.3s ease; }
.stories-bar.expanded .story-avatar-ring { width: 44px; height: 44px; }
.story-avatar-ring.has-story { background: linear-gradient(135deg, #4a0e4e, #7b2d8e, #a855f7, #c084fc); }
.story-avatar-ring.has-unviewed { animation: story-pulse 2s infinite; }
.story-avatar-ring.viewed { background: var(--border-color); }
.story-avatar-ring.empty { background: var(--border-color); border: 2px dashed var(--text-muted); }
.story-avatar { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--bg-tertiary); border: 2px solid var(--bg-primary); }
.story-avatar img { width: 100%; height: 100%; object-fit: cover; }
.story-name { font-size: 10px; color: var(--text-secondary); text-align: center; max-width: 50px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: opacity 0.3s ease, max-height 0.3s ease; }
.story-plus { position: absolute; bottom: 16px; right: 1px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: white; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: bold; border: 2px solid var(--bg-primary); transition: opacity 0.3s ease; }
.story-viewer { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #000; z-index: 20000; display: none; flex-direction: column; animation: fadeIn 0.3s ease; }

.series-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; margin-left: 4px; }
.series-badge.active { color: #fbbf24; }
.series-badge.inactive { color: #888; }
.e2ee-chat .message-bubble { border: 1px solid #00b894; }
.voice-btn, .attach-btn, .send-btn { transition: opacity 0.25s ease, transform 0.25s ease, display 0.25s ease; }

.voice-recorder-inline { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--bg-secondary); border-radius: 24px; min-height: 48px; animation: fadeIn 0.2s ease; }
.voice-wave-container { flex: 1; display: flex; align-items: center; gap: 3px; height: 40px; }
.voice-wave-container span { width: 3px; background: var(--accent); border-radius: 2px; transition: height 0.1s; }
.voice-timer { font-size: 16px; font-weight: 600; color: var(--text-primary); min-width: 45px; text-align: center; }
.voice-cancel-btn, .voice-send-btn { width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.voice-cancel-btn { background: var(--danger); color: #fff; }
.voice-send-btn { background: var(--accent); color: #fff; }
.gift-shop-tabs { display: flex; margin: 12px 14px; background: var(--bg-tertiary); border-radius: 12px; overflow: hidden; }
.gift-shop-tab { flex: 1; text-align: center; padding: 10px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-secondary); transition: all 0.2s; }
.gift-shop-tab.active { background: var(--accent); color: #fff; }
.gift-card { transition: transform 0.2s; }
.gift-card:hover { transform: translateY(-2px); }
.video-circle-message { position: relative; display: inline-block; border-radius: 12px; overflow: hidden; cursor: pointer; }
.video-circle-message video { display: block; border-radius: 12px; object-fit: cover; }

.mini-player { height: 40px; background: var(--bg-secondary); border-bottom: 1px solid var(--border-color); display: none; align-items: center; gap: 10px; padding: 0 12px; cursor: pointer; flex-shrink: 0; transition: background 0.2s; }
.mini-player:hover { background: #222; }
.mini-player.active { display: flex; }
.mini-player .mp-play { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); border: none; color: #fff; font-size: 12px; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.mini-player .mp-name { flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; color: var(--text-primary); }
.mini-player .mp-time { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.mini-player .mp-close { width: 22px; height: 22px; border: none; background: none; color: var(--text-muted); font-size: 16px; cursor: pointer; flex-shrink: 0; }
.mini-player .mp-close:hover { color: var(--danger); }
.mini-player .mini-progress-bar { position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: #333; }
.mini-player .mini-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #6a9ab5); width: 0%; transition: width 0.1s linear; }

.player-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: transparent; z-index: 1000; flex-direction: column; justify-content: flex-end; }
.player-overlay.active { display: flex; }
.player-panel { width: 100%; background: #1c1c1e; border-radius: 16px 16px 0 0; padding: 12px 16px 20px; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.player-panel .handle { width: 36px; height: 4px; background: #3a3a3c; border-radius: 2px; margin: 0 auto 14px; }
.player-panel .track-info { text-align: center; margin-bottom: 14px; }
.player-panel .track-title { font-size: 15px; font-weight: 500; color: #fff; }
.player-panel .track-sub { font-size: 13px; color: #888; margin-top: 2px; }
.player-panel .progress-bar { margin-bottom: 14px; }
.player-panel .progress-bar .times { display: flex; justify-content: space-between; font-size: 11px; color: #666; margin-bottom: 6px; }
.player-panel .progress-bar .track { height: 4px; background: #333; border-radius: 2px; position: relative; cursor: pointer; }
.player-panel .progress-bar .fill { height: 100%; background: linear-gradient(90deg, var(--accent), #6a9ab5); border-radius: 2px; width: 0%; }
.player-panel .controls { display: flex; align-items: center; justify-content: center; gap: 24px; }
.player-panel .controls button { background: none; border: none; color: #fff; cursor: pointer; font-size: 18px; opacity: 0.8; transition: opacity 0.2s; padding: 4px; }
.player-panel .controls button:hover { opacity: 1; }
.player-panel .controls .btn-play-big { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); font-size: 20px; display: flex; align-items: center; justify-content: center; }
.volume-wrapper { position: relative; display: inline-block; }
.volume-wrapper .volume-slider { display: none; position: absolute; bottom: 44px; left: 50%; transform: translateX(-50%); width: 6px; height: 80px; background: #333; border-radius: 3px; cursor: pointer; }
.volume-wrapper:hover .volume-slider, .volume-slider:hover { display: block; }
.volume-slider .vol-fill { width: 100%; background: var(--accent); border-radius: 3px; position: absolute; bottom: 0; transition: height 0.1s; }

.avatar-history-viewer { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: #000; z-index: 20000; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.avatar-history-viewer .counter { position: absolute; top: 16px; right: 16px; color: #fff; font-size: 14px; background: rgba(0,0,0,0.5); padding: 4px 10px; border-radius: 12px; }
.avatar-history-viewer img { max-width: 90%; max-height: 80vh; object-fit: contain; border-radius: 12px; }

.typing-indicator { display: flex; align-items: center; padding: 7px 18px; background: var(--bg-secondary); border-top: 1px solid var(--border-color); animation: slideInUp 0.3s ease; }
.typing-text { font-size: 13px; color: var(--text-muted); }
.typing-dots { display: flex; gap: 4px; margin-left: 7px; }
.typing-dots span { width: 5px; height: 5px; background: var(--text-muted); border-radius: 50%; animation: pulse 1s infinite; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

.chat-input-area { padding: 11px 14px; background: var(--bg-secondary); border-top: 1px solid var(--border-color); position: relative; z-index: 2; pointer-events: auto; }
.reply-panel { display: flex; align-items: center; justify-content: space-between; padding: 7px 11px; background: var(--bg-tertiary); border-radius: var(--border-radius); margin-bottom: 11px; animation: slideInDown 0.3s ease; pointer-events: auto; }
.reply-info { display: flex; align-items: center; gap: 11px; }
.reply-content { display: flex; flex-direction: column; }
.reply-content .reply-name { font-weight: 500; font-size: 13px; color: var(--accent); }
.reply-content .reply-text { font-size: 12px; color: var(--text-secondary); }
.cancel-reply-btn { padding: 7px; color: var(--text-muted); cursor: pointer; font-size: 14px; transition: color 0.2s ease; pointer-events: auto; }
.cancel-reply-btn:hover { color: var(--danger); }

.input-container { display: flex; align-items: center; position: relative; pointer-events: auto; }
.message-input-wrapper { flex: 1; display: flex; align-items: center; background: var(--bg-tertiary); border-radius: 22px; padding: 0 4px; min-height: 40px; border: 1.5px solid var(--border-color); transition: border-color 0.2s ease; position: relative; pointer-events: auto; }
.message-input-wrapper:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.emoji-btn, .attach-btn, .voice-btn { width: 36px; height: 36px; border-radius: var(--border-radius-full); display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--text-primary); cursor: pointer; flex-shrink: 0; border: none; transition: all 0.2s ease; pointer-events: auto; background: transparent; }
.emoji-btn:hover, .attach-btn:hover, .voice-btn:hover { color: var(--accent); }
.voice-btn.recording { background: var(--danger); color: white; animation: pulse 1s infinite; }
.message-input { flex: 1; padding: 8px 4px; border: none; background: transparent; color: var(--text-primary); font-size: 14px; outline: none; resize: none; overflow-y: auto; line-height: 1.45; max-height: 120px !important; min-height: 24px; word-break: break-word; font-family: var(--font-family); pointer-events: auto; cursor: text; }
.message-input:empty:before { content: attr(placeholder); color: var(--text-placeholder); pointer-events: none; }
.message-input:focus { outline: none; box-shadow: none; }
.send-btn { width: 34px; height: 34px; border-radius: var(--border-radius-full); background: var(--accent); display: none; align-items: center; justify-content: center; font-size: 14px; color: white; cursor: pointer; flex-shrink: 0; border: none; transition: all 0.2s ease; pointer-events: auto; }
.send-btn:hover { background: var(--accent-hover); transform: scale(1.05); }
.attach-menu { position: absolute; bottom: 72px; left: 14px; background: var(--bg-secondary); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 7px; display: none; z-index: var(--z-dropdown); animation: scaleIn 0.2s ease; border: 1px solid var(--border-color); min-width: 180px; pointer-events: auto; }
.attach-option { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-radius: var(--border-radius); cursor: pointer; color: var(--text-primary); background: transparent; border: none; width: 100%; text-align: left; font-size: 14px; transition: background 0.2s ease; pointer-events: auto; }
.attach-option:hover { background: var(--bg-tertiary); }
.attach-option i { width: 22px; text-align: center; }

.emoji-picker { position: absolute; bottom: 72px; left: 72px; width: 315px; max-height: 315px; background: var(--bg-secondary); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 11px; z-index: var(--z-dropdown); animation: scaleIn 0.2s ease; border: 1px solid var(--border-color); pointer-events: auto; overflow: hidden; display: flex; flex-direction: column; }
.emoji-tabs { display: flex; gap: 0; margin-bottom: 7px; border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.emoji-tab { padding: 7px 14px; background: transparent; border: none; color: var(--text-secondary); cursor: pointer; font-size: 12px; border-bottom: 2px solid transparent; }
.emoji-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.emoji-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0px; max-height: 252px; overflow-y: auto; }
.emoji-item { display: flex; align-items: center; justify-content: center; padding: 5px; font-size: 22px; cursor: pointer; border-radius: 7px; width: 100%; aspect-ratio: 1; }
.emoji-item:hover { background: var(--bg-tertiary); }

.mention-suggestions, .command-suggestions { position: absolute; bottom: 72px; left: 72px; background: var(--bg-secondary); border-radius: 11px; box-shadow: var(--shadow-lg); max-width: 270px; max-height: 180px; overflow-y: auto; z-index: var(--z-dropdown); animation: fadeIn 0.2s ease; border: 1px solid var(--border-color); pointer-events: auto; }
.mention-suggestion { display: flex; align-items: center; gap: 9px; padding: 9px 13px; cursor: pointer; transition: background 0.2s ease; pointer-events: auto; }
.mention-suggestion:hover { background: var(--bg-tertiary); }
.mention-suggestion-avatar { width: 29px; height: 29px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; color: white; flex-shrink: 0; overflow: hidden; }
.mention-suggestion-avatar img { width: 100%; height: 100%; object-fit: cover; }

.info-panel { position: absolute; right: 0; top: 0; bottom: 0; width: var(--info-width); background: var(--bg-secondary); border-left: 1px solid var(--border-color); display: none; flex-direction: column; z-index: var(--z-sidebar); animation: slideInRight 0.3s ease; pointer-events: auto; }
.info-header { height: var(--header-height); padding: 0 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border-color); }
.info-header h3 { font-size: 16px; font-weight: 600; }
.close-info-btn { font-size: 18px; color: var(--text-muted); cursor: pointer; transition: color 0.2s ease; pointer-events: auto; }
.close-info-btn:hover { color: var(--text-primary); }
.info-content { flex: 1; overflow-y: auto; padding: 18px; }
.info-avatar { width: 90px; height: 90px; border-radius: var(--border-radius-full); margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; font-size: 36px; color: white; background: var(--accent); overflow: hidden; cursor: pointer; }
.info-avatar img { width: 100%; height: 100%; object-fit: cover; }
.info-name { font-size: 20px; font-weight: 600; text-align: center; margin-bottom: 4px; }
.info-section { margin-bottom: 22px; }
.info-section h4 { font-size: 14px; font-weight: 600; margin-bottom: 11px; color: var(--text-secondary); }
.member-item { display: flex; align-items: center; gap: 11px; padding: 7px; border-radius: var(--border-radius); cursor: pointer; transition: background 0.2s ease; pointer-events: auto; }
.member-item:hover { background: var(--bg-tertiary); }
.member-avatar { width: 36px; height: 36px; border-radius: var(--border-radius-full); display: flex; align-items: center; justify-content: center; font-size: 14px; color: white; background: var(--accent); overflow: hidden; flex-shrink: 0; }
.member-avatar img { width: 100%; height: 100%; object-fit: cover; }
.member-name { font-weight: 500; margin-bottom: 2px; }
.member-role { font-size: 11px; color: var(--text-muted); }
.member-role.owner { color: var(--gold); }
.member-role.admin { color: var(--accent); }
.profile-screen { position: fixed; top: 0; right: 0; width: 100%; max-width: 378px; height: 100vh; height: 100dvh; background: var(--bg-secondary); z-index: var(--z-sidebar); display: none; flex-direction: column; box-shadow: var(--shadow-xl); border-left: 1px solid var(--border-color); overflow-y: auto; }
.profile-screen-header { display: flex; align-items: center; gap: 11px; padding: 14px; border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.profile-screen-header h3 { font-size: 16px; flex: 1; }
.profile-screen-content { flex: 1; overflow-y: auto; }
.avatar-upload { text-align: center; cursor: pointer; margin-bottom: 18px; pointer-events: auto; }
.avatar-preview { width: 72px; height: 72px; border-radius: var(--border-radius-full); background: var(--accent); margin: 0 auto 11px; display: flex; align-items: center; justify-content: center; font-size: 29px; color: white; overflow: hidden; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

.settings-tabs { display: flex; gap: 0; margin-bottom: 0; border-bottom: 1px solid var(--border-color); flex-wrap: wrap; }
.settings-tab { padding: 11px 13px; background: transparent; border: none; color: var(--text-secondary); cursor: pointer; font-size: 12px; font-weight: 500; border-bottom: 2px solid transparent; transition: all 0.2s ease; font-family: var(--font-family); pointer-events: auto; white-space: nowrap; display: flex; align-items: center; gap: 5px; }
.settings-tab:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.settings-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.settings-tab i { font-size: 11px; }
.settings-section { padding: 0; }
.settings-section h4 { font-size: 13px; font-weight: 600; margin: 16px 14px 8px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.settings-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border-color); cursor: pointer; font-size: 13px; text-align: left; gap: 11px; }
.settings-item:last-child { border-bottom: none; }
.settings-item:hover { background: var(--bg-tertiary); }
.settings-item i { width: 20px; text-align: center; flex-shrink: 0; }
.settings-item.danger { color: var(--danger); }
.settings-item .settings-value { color: var(--text-muted); font-size: 12px; }

.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); display: none; align-items: center; justify-content: center; z-index: var(--z-modal); backdrop-filter: blur(4px); }
.modal-container { width: 90%; max-width: 450px; max-height: 85vh; background: var(--bg-secondary); border-radius: 22px; box-shadow: var(--shadow-xl); display: flex; flex-direction: column; animation: scaleIn 0.3s ease; border: 1px solid var(--border-color); pointer-events: auto; overflow: hidden; }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-close { width: 29px; height: 29px; border-radius: var(--border-radius-full); display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--text-muted); background: var(--bg-tertiary); cursor: pointer; border: none; transition: all 0.2s ease; pointer-events: auto; }
.modal-close:hover { background: var(--bg-quaternary); color: var(--text-primary); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 11px; pointer-events: auto; flex-shrink: 0; }

.chat-search-bar { height: var(--header-height); padding: 7px 14px; background: var(--bg-secondary); border-bottom: 1px solid var(--border-color); display: none; align-items: center; gap: 11px; position: absolute; top: 0; left: 0; right: 0; z-index: 40; animation: slideInDown 0.3s ease; pointer-events: auto; }
.chat-search-input { flex: 1; padding: 7px 14px; background: var(--bg-tertiary); border: 1.5px solid var(--border-color); border-radius: 18px; color: var(--text-primary); font-size: 14px; outline: none; font-family: var(--font-family); pointer-events: auto; cursor: text; }
.chat-search-input:focus { border-color: var(--accent); }
.search-navigation { display: flex; align-items: center; gap: 7px; }
.search-nav-btn { width: 29px; height: 29px; border-radius: var(--border-radius-full); display: flex; align-items: center; justify-content: center; color: var(--text-secondary); background: var(--bg-tertiary); cursor: pointer; border: none; transition: all 0.2s ease; pointer-events: auto; }
.search-nav-btn:hover { background: var(--bg-quaternary); color: var(--text-primary); }
.search-nav-count { font-size: 13px; color: var(--text-muted); }
.highlight { background: var(--warning); color: black; padding: 0 2px; border-radius: 2px; }
.search-highlight { box-shadow: 0 0 9px var(--warning); }

.scroll-bottom-btn { position: absolute; bottom: 90px; right: 18px; width: 40px; height: 40px; border-radius: var(--border-radius-full); background: var(--bg-secondary); border: 1px solid var(--border-color); color: var(--text-primary); font-size: 16px; cursor: pointer; box-shadow: var(--shadow-md); display: none; align-items: center; justify-content: center; z-index: 20; transition: all 0.2s ease; pointer-events: auto; }
.scroll-bottom-btn:hover { background: var(--accent); color: white; transform: scale(1.05); }

.media-viewer { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.95); z-index: var(--z-media-viewer); display: none; align-items: center; justify-content: center; animation: fadeIn 0.3s ease; }
.close-media { position: absolute; top: 18px; right: 18px; width: 40px; height: 40px; border-radius: var(--border-radius-full); background: rgba(255,255,255,0.1); color: white; font-size: 22px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10; border: none; transition: background 0.2s ease; pointer-events: auto; }
.close-media:hover { background: rgba(255,255,255,0.2); }
.media-container { max-width: 90vw; max-height: 90vh; display: flex; align-items: center; justify-content: center; }
.media-container img, .media-container video { max-width: 100%; max-height: 90vh; border-radius: 11px; box-shadow: var(--shadow-xl); object-fit: contain; }
.media-controls { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; gap: 14px; background: rgba(0,0,0,0.5); padding: 11px 18px; border-radius: 36px; backdrop-filter: blur(10px); }
.media-btn { width: 40px; height: 40px; border-radius: var(--border-radius-full); background: rgba(255,255,255,0.1); color: white; font-size: 18px; display: flex; align-items: center; justify-content: center; cursor: pointer; border: none; transition: background 0.2s ease; pointer-events: auto; }
.media-btn:hover { background: rgba(255,255,255,0.2); }

.select-mode-bar { position: absolute; top: 0; left: 0; right: 0; background: var(--accent); padding: 9px 14px; display: none; align-items: center; justify-content: space-between; z-index: 30; animation: slideInDown 0.3s ease; pointer-events: auto; }
.select-mode-count { color: white; font-weight: 500; }
.select-mode-actions { display: flex; gap: 7px; }
.select-mode-actions button { padding: 5px 13px; background: rgba(255,255,255,0.2); border: none; color: white; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 500; transition: background 0.2s ease; pointer-events: auto; }
.select-mode-actions button:hover { background: rgba(255,255,255,0.3); }

.toast-container { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: 7px; pointer-events: none; }
.toast { padding: 11px 18px; border-radius: var(--border-radius); color: white; font-size: 13px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 9px; pointer-events: auto; min-width: 180px; max-width: 360px; animation: slideInUp 0.3s ease; cursor: pointer; }
.toast.info { background: var(--info); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); color: black; }

.formatting-toolbar { position: fixed; background: var(--bg-secondary); border-radius: var(--border-radius); box-shadow: var(--shadow-lg); padding: 7px; display: none; gap: 4px; z-index: var(--z-dropdown); border: 1px solid var(--border-color); pointer-events: auto; }
.formatting-toolbar button { width: 32px; height: 32px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--text-primary); background: transparent; cursor: pointer; border: none; transition: background 0.2s ease; pointer-events: auto; }
.formatting-toolbar button:hover { background: var(--bg-tertiary); }

.inline-keyboard { margin-top: 4px; }
.inline-keyboard-btn { pointer-events: auto; cursor: pointer; }

.maintenance-screen { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg-primary); display: none; align-items: center; justify-content: center; z-index: 9999; flex-direction: column; text-align: center; padding: 36px; }
.maintenance-screen h2 { margin-bottom: 14px; color: var(--accent); }
.maintenance-screen .maintenance-icon { font-size: 58px; margin-bottom: 22px; color: var(--warning); }
.maintenance-spinner { width: 36px; height: 36px; border: 3px solid var(--border-color); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin-top: 29px; }

.fab-new-chat { position: absolute; bottom: 18px; right: 18px; width: 40px; height: 40px; border-radius: 20px; background: var(--accent); color: white; font-size: 18px; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--shadow-lg); z-index: 25; border: none; transition: transform 0.2s; }
.fab-new-chat:hover { transform: scale(1.1); }
.fab-new-story { position: absolute; bottom: 66px; right: 25px; width: 26px; height: 26px; border-radius: 50%; background: var(--bg-tertiary); color: var(--text-muted); font-size: 11px; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--shadow-md); z-index: 24; border: none; transition: transform 0.2s; }
.fab-new-story:hover { transform: scale(1.1); }

.xailo-modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(8px); z-index: 10000; display: none; align-items: center; justify-content: center; }
.xailo-modal-dialog { background: var(--bg-secondary); border-radius: 20px; padding: 24px; max-width: 400px; width: 90%; box-shadow: var(--shadow-xl); border: 1px solid var(--border-color); }

.voters-panel { position: fixed; background: var(--bg-secondary); border-radius: 14px; box-shadow: 0 8px 30px rgba(0,0,0,0.5); padding: 6px; min-width: 280px; max-width: 360px; max-height: 60vh; overflow-y: auto; z-index: 10001; display: none; border: 1px solid var(--border-color); }
.voter-group-header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; border-radius: 8px; }
.voter-group-header:hover { background: var(--bg-tertiary); }
.voter-sublist { display: none; padding: 0 14px 10px 48px; }
.voter-group.expanded .voter-sublist { display: block; }

.badge { display: inline-block; padding: 4px 9px; border-radius: 11px; font-size: 11px; font-weight: 500; }
.badge-success { background: var(--success); color: white; }
.badge-danger { background: var(--danger); color: white; }
.badge-warning { background: var(--warning); color: black; }
.badge-info { background: var(--accent); color: white; }

.color-presets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; padding: 8px 0; }
.color-preset { width: 44px; height: 44px; border-radius: 12px; cursor: pointer; border: 2px solid transparent; transition: all 0.2s ease; position: relative; box-shadow: var(--shadow-sm); }
.color-preset:hover { transform: scale(1.1); border-color: var(--text-primary); }
.color-preset.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.color-preset.active::after { content: '✓'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #fff; font-weight: 700; font-size: 18px; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }

.color-picker-custom { background: var(--bg-secondary); border-radius: 16px; padding: 16px; border: 1px solid var(--border-color); box-shadow: var(--shadow-lg); position: fixed; z-index: 10001; width: 300px; }
.color-picker-custom .cp-hex-input { width: 100%; padding: 10px 14px; background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: 10px; color: var(--text-primary); font-size: 14px; font-family: var(--font-mono); text-align: center; letter-spacing: 1px; margin-bottom: 12px; }
.color-picker-custom .cp-sliders { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.color-picker-custom .cp-slider-row { display: flex; align-items: center; gap: 10px; }
.color-picker-custom .cp-slider-row label { width: 20px; font-weight: 700; font-size: 12px; color: var(--text-secondary); text-align: center; }
.color-picker-custom .cp-slider-row input[type="range"] { flex: 1; height: 6px; -webkit-appearance: none; appearance: none; border-radius: 3px; outline: none; }
.color-picker-custom .cp-slider-row input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--border-color); cursor: pointer; }
.color-picker-custom .cp-slider-row input[type="range"].r::-webkit-slider-thumb { background: #e17055; }
.color-picker-custom .cp-slider-row input[type="range"].g::-webkit-slider-thumb { background: #00b894; }
.color-picker-custom .cp-slider-row input[type="range"].b::-webkit-slider-thumb { background: #4a90d9; }
.color-picker-custom .cp-slider-row input[type="number"] { width: 50px; padding: 6px; background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: 6px; color: var(--text-primary); text-align: center; font-size: 13px; }
.color-picker-custom .cp-preview { width: 100%; height: 50px; border-radius: 12px; margin-bottom: 12px; border: 1px solid var(--border-color); }
.color-picker-custom .cp-actions { display: flex; gap: 8px; }
.color-picker-custom .cp-actions button { flex: 1; padding: 8px; border-radius: 8px; border: none; cursor: pointer; font-weight: 500; font-size: 13px; }

.customization-preview { background: var(--bg-secondary); border-radius: 16px; padding: 16px; margin-bottom: 16px; border: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 8px; }
.customization-preview .preview-chat { display: flex; gap: 8px; align-items: flex-end; }
.customization-preview .preview-bubble-in { padding: 8px 12px; border-radius: 12px 12px 12px 4px; max-width: 70%; font-size: 13px; }
.customization-preview .preview-bubble-out { padding: 8px 12px; border-radius: 12px 12px 4px 12px; max-width: 70%; margin-left: auto; font-size: 13px; }

.wallpaper-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; }
.wallpaper-item { aspect-ratio: 9/16; border-radius: 12px; background-size: cover; background-position: center; cursor: pointer; border: 2px solid transparent; transition: all 0.2s ease; position: relative; overflow: hidden; }
.wallpaper-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.wallpaper-item.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.wallpaper-item.active::after { content: '✓'; position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; background: var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 700; }
.wallpaper-upload { aspect-ratio: 9/16; border-radius: 12px; border: 2px dashed var(--border-color); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; color: var(--text-muted); transition: all 0.2s ease; font-size: 13px; }
.wallpaper-upload:hover { border-color: var(--accent); color: var(--accent); }

.slider-with-value { display: flex; align-items: center; gap: 12px; }
.slider-with-value input[type="range"] { flex: 1; }
.slider-with-value .slider-value { min-width: 40px; text-align: center; font-size: 13px; color: var(--text-secondary); font-weight: 500; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
::selection { background: var(--accent); color: white; }

body.modal-open { overflow: hidden; }
body.message-select-mode .message { cursor: pointer; }
.energy-saving .message-animated-emoji { display: none; }

@media (max-width: 768px) {
    :root { --sidebar-width: 100%; --info-width: 100%; --message-max-width: 85%; }
    .main-screen { position: relative; overflow: hidden; }
    .sidebar { position: absolute; top: 0; left: 0; bottom: 0; width: 100%; z-index: 10; transition: transform 0.3s ease; transform: translateX(0); }
    .main-screen.chat-open .sidebar { transform: translateX(-100%); }
    .chat-area { position: absolute; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; transform: translateX(100%); transition: transform 0.3s ease; z-index: 20; }
    .main-screen.chat-open .chat-area { transform: translateX(0); }
    .main-screen.chat-open .back-btn-mobile { display: flex !important; }
    .chat-open .back-btn-mobile { display: flex !important; }
    .main-screen.chat-open .fab-new-chat, .main-screen.chat-open .fab-new-story { display: none !important; }
    .info-panel { width: 100%; z-index: 30; }
    .profile-screen { max-width: 100%; }
    .modal-container { width: 95%; max-height: 85vh; margin: 9px; }
    .modal-body { max-height: calc(85vh - 126px); }
    .emoji-picker { position: fixed; bottom: 0; left: 0; right: 0; width: 100% !important; max-height: 315px; border-radius: 18px 18px 0 0 !important; z-index: var(--z-sticky); }
    body { max-width: 100vw; overflow-x: hidden; }
    .chat-folder-list { overflow-x: auto; }
    .chat-item-name { max-width: 108px; }
    .chat-item-message { max-width: 135px; }
}

@media (max-width: 380px) {
    .chat-item-name { max-width: 72px; }
    .chat-item-message { max-width: 90px; }
    .chat-item-meta { font-size: 9px; }
    .message { max-width: 90%; }
    .emoji-grid { grid-template-columns: repeat(5, 1fr); }
    .auth-container { padding: 18px 14px; }
    .modal-container { width: 98%; margin: 4px; padding: 14px; }
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .chat-input-area { padding-bottom: max(11px, env(safe-area-inset-bottom)); }
    .sidebar { padding-bottom: env(safe-area-inset-bottom); }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; } }
*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }