* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-y: overlay;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
    background: transparent !important;
    transform: translate3d(0, 0, 0);
    will-change: contents;
}

.screen.active {
    display: block;
    animation: screenFadeIn 0.5s ease-out;
}

/* Экран ожидания без анимации */
#multiplayer-random-waiting-screen {
    animation: none !important;
}

/* Отключаем анимации h2 в лидерборде и библиотеке чтобы избежать дёргания фона */
#leaderboard-screen h2,
#library-screen h2 {
    animation: none !important;
}

@keyframes screenFadeIn {
    from { 
        opacity: 0; 
    }
    to { 
        opacity: 1; 
    }
}

.container {
    max-width: 400px;
    margin: 0 auto;
    padding: 0 15px;
    position: relative;
    min-height: 600px;
}

h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 15px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { 
        filter: drop-shadow(0 0 10px var(--primary-color, rgba(139, 92, 246, 0.3)));
    }
    50% { 
        filter: drop-shadow(0 0 20px var(--primary-color, rgba(139, 92, 246, 0.6)));
    }
}

h2 {
    font-size: 26px;
    font-weight: 600;
    margin-bottom: 25px;
    color: var(--text-secondary);
    text-align: center;
    animation: slideInDown 0.6s ease-out;
    will-change: transform;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

p {
    margin-bottom: 20px;
    color: var(--text-secondary);
    text-align: center;
}

.btn {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.4), var(--primary-color));
    color: var(--text-primary);
    border: none;
    padding: 16px 24px;
    margin: 10px 0;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    animation: buttonSlideIn 0.6s ease-out;
}

@keyframes buttonSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.start-btn {
    background: var(--primary-gradient);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: startBtnPulse 2s ease-in-out infinite;
}

/* Danger button styling (consistent with app look) */
.danger-btn {
    background: linear-gradient(135deg, rgba(255,99,99,0.85), rgba(255,59,59,0.95));
    color: #fff;
    box-shadow: 0 6px 18px rgba(255,59,59,0.18);
    border-radius: 10px;
    padding: 10px 16px;
    font-weight: 700;
    animation: startBtnPulse 2s ease-in-out infinite;
}
.danger-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(255,59,59,0.22);
}
.danger-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

@keyframes startBtnPulse {
    0%, 100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    }
    50% {
        transform: translateY(-2px) scale(1.02);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    }
}

.start-btn:hover {
    background: var(--primary-gradient);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.secondary-btn {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--text-secondary);
}

.secondary-btn:hover {
    background: rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.stats {
    background: rgba(139, 92, 246, 0.08);
    padding: 25px;
    border-radius: 16px;
    margin: 25px 0;
    border: 1px solid var(--border-color-light);
    backdrop-filter: blur(10px);
    animation: statsSlideIn 0.6s ease-out;
}

@keyframes statsSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin: 15px 0;
    font-size: 16px;
    color: #e9d5ff;
    animation: statItemFadeIn 0.6s ease-out;
}

@keyframes statItemFadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.game-header {
    display: flex;
    justify-content: space-between;
    background: rgba(55, 48, 163, 0.1);
    padding: 18px;
    border-radius: 16px;
    margin-bottom: 25px;
    border: 1px solid rgba(124, 58, 237, 0.3);
    font-size: 14px;
    backdrop-filter: blur(10px);
    animation: gameHeaderSlideIn 0.6s ease-out;
}

@keyframes gameHeaderSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 14px;
    color: #c4b5fd;
    animation: gameInfoFadeIn 0.6s ease-out;
}

@keyframes gameInfoFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#timer {
    color: #f87171;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
}

#timer.warning {
    color: #ff6b6b;
    animation: timerPulse 1s infinite;
}

@keyframes timerPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

.music-player {
    display: flex;
    gap: 12px;
    margin: 25px 0;
    justify-content: center;
    flex-wrap: wrap;
    animation: musicPlayerSlideIn 0.6s ease-out;
}

@keyframes musicPlayerSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.play-btn {
    background: linear-gradient(135deg, #3730a3, #7c3aed);
    color: #ffffff;
    border: none;
    padding: 14px 22px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 120px;
    animation: playBtnBounce 0.6s ease-out;
}

@keyframes playBtnBounce {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

.play-btn.autoplay-btn {
    animation: autoplayPulse 2s infinite;
    border: 2px solid #34d399;
    background: linear-gradient(135deg, #10b981, #34d399) !important;
    color: white !important;
}

.play-btn.manual-play-btn {
    background: linear-gradient(135deg, #f59e0b, #fbbf24) !important;
    color: #000 !important;
    font-weight: bold;
    animation: manualPlayPulse 2s infinite;
}

@keyframes autoplayPulse {
    0% { 
        transform: scale(1); 
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); 
    }
    70% { 
        transform: scale(1.05); 
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); 
    }
    100% { 
        transform: scale(1); 
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); 
    }
}

@keyframes manualPlayPulse {
    0% { 
        transform: scale(1); 
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); 
    }
    70% { 
        transform: scale(1.05); 
        box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); 
    }
    100% { 
        transform: scale(1); 
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); 
    }
}

.answers-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin: 25px 0;
    position: relative;
}

.answer-btn {
    background: rgba(55, 48, 163, 0.1);
    color: #e9d5ff;
    border: 2px solid rgba(124, 58, 237, 0.3);
    padding: 20px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
    backdrop-filter: blur(10px);
    transform: translateY(0);
    position: relative;
    overflow: hidden;
    animation: answerReveal 0.6s ease-out;
}

@keyframes answerReveal {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.answer-btn.center-reveal {
    animation: centerReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center;
}

@keyframes centerReveal {
    from {
        opacity: 0;
        transform: scale(0.3) rotate(0deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.answer-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s;
}

.answer-btn:hover::before {
    left: 100%;
}

.answer-btn:hover {
    background: rgba(124, 58, 237, 0.2);
    border-color: #8b5cf6;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
}

.answer-btn.correct {
    background: linear-gradient(135deg, #10b981, #34d399);
    border-color: #10b981;
    color: white;
    animation: correctPulse 0.6s ease-out;
}

.answer-btn.incorrect {
    background: linear-gradient(135deg, #ef4444, #f87171);
    border-color: #ef4444;
    color: white;
    animation: incorrectShake 0.6s ease-out;
}

@keyframes correctPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

@keyframes incorrectShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

.correct-answer-reveal {
    animation: correctAnswerReveal 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    position: relative;
    z-index: 10;
}

@keyframes correctAnswerReveal {
    0% {
        opacity: 0;
        transform: scale(0.1) rotate(-15deg);
        background: rgba(16, 185, 129, 0.1);
        border-color: rgba(16, 185, 129, 0.3);
    }
    30% {
        opacity: 0.7;
        transform: scale(1.2) rotate(5deg);
        background: rgba(16, 185, 129, 0.3);
        border-color: rgba(16, 185, 129, 0.6);
    }
    60% {
        transform: scale(0.95) rotate(-2deg);
        background: rgba(16, 185, 129, 0.6);
        border-color: rgba(16, 185, 129, 0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        background: linear-gradient(135deg, #10b981, #34d399);
        border-color: #10b981;
        box-shadow: 0 0 30px rgba(16, 185, 129, 0.5);
    }
}

.incorrect-answer-reveal {
    animation: incorrectAnswerReveal 0.8s ease-out forwards;
}

@keyframes incorrectAnswerReveal {
    0% {
        opacity: 0;
        transform: scale(0.1);
        background: rgba(239, 68, 68, 0.1);
        border-color: rgba(239, 68, 68, 0.3);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
        background: rgba(239, 68, 68, 0.4);
        border-color: rgba(239, 68, 68, 0.7);
    }
    100% {
        opacity: 1;
        transform: scale(1);
        background: linear-gradient(135deg, #ef4444, #f87171);
        border-color: #ef4444;
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
    }
}

.answer-btn.center-hide {
    animation: centerHide 0.5s ease-in forwards;
}

@keyframes centerHide {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.1);
        pointer-events: none;
    }
}

.poster {
    width: 100%;
    max-width: 220px;
    height: auto;
    border-radius: 12px;
    margin: 25px auto;
    display: block;
    border: 2px solid rgba(124, 58, 237, 0.3);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
    animation: posterSlideIn 0.8s ease-out;
}

@keyframes posterSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.poster:hover {
    transform: scale(1.02);
}

.poster-container.center-reveal {
    animation: posterCenterReveal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes posterCenterReveal {
    from {
        opacity: 0;
        transform: scale(0.1) rotate(-10deg);
        filter: blur(10px);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1) rotate(5deg);
        filter: blur(2px);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        filter: blur(0);
    }
}

/* Стили для плашки результата */
/* Стили для плашки результата */
.result-stats {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 11, 46, 0.98);
    padding: 15px;
    border-radius: 16px;
    margin: 0;
    border: 2px solid rgba(124, 58, 237, 0.5);
    backdrop-filter: blur(20px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Убираем прокрутку */
    animation: resultStatsReveal 0.4s ease-out;
}

.result-stats.hidden {
    display: none;
}

.result-stats .result-content {
    max-width: 100%;
    width: 100%;
    text-align: center;
    padding: 5px;
    max-height: 100%; /* Ограничиваем высоту */
    overflow: hidden; /* Убираем прокрутку */
}

.result-stats .poster {
    max-width: 150px; /* Уменьшаем постер */
    margin: 10px auto;
}

.result-stats h2 {
    font-size: 20px;
    margin-bottom: 10px;
}

.result-stats h3 {
    font-size: 16px;
    margin-bottom: 8px;
    line-height: 1.2;
}

.result-stats p {
    font-size: 13px;
    margin-bottom: 8px;
    line-height: 1.3;
}

.result-stats .result-details {
    background: rgba(55, 48, 163, 0.2);
    padding: 12px;
    border-radius: 10px;
    margin: 10px 0;
    border: 1px solid rgba(124, 58, 237, 0.3);
    font-size: 13px;
}

.result-stats .result-details p {
    margin: 6px 0;
    text-align: left;
    color: #e9d5ff;
}

.result-stats .result-buttons {
    margin-top: 15px;
    width: 100%;
}

.result-stats .btn {
    padding: 12px 20px;
    font-size: 14px;
}

@keyframes resultStatsReveal {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Убедимся, что другие элементы не перекрывают результат */
.game-header, .game-info, .music-controls, #answers-container {
    position: relative;
    z-index: 1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 15px 0;
    animation: statsGridSlideIn 0.6s ease-out;
}

@keyframes statsGridSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card {
    background: rgba(55, 48, 163, 0.1);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(124, 58, 237, 0.3);
    text-align: center;
    backdrop-filter: blur(10px);
    animation: statCardBounce 0.6s ease-out;
}

@keyframes statCardBounce {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    70% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.stat-card h3 {
    font-size: 12px;
    color: #c4b5fd;
    margin-bottom: 6px;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: bold;
    color: #e9d5ff;
}

.final-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin: 25px 0;
    animation: finalStatsReveal 0.8s ease-out;
}

@keyframes finalStatsReveal {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mode-info {
    text-align: center;
    margin: 15px 0;
    color: #c4b5fd;
    animation: modeInfoFadeIn 0.6s ease-out;
}

@keyframes modeInfoFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.achievements {
    margin: 25px 0;
    animation: achievementsSlideIn 0.6s ease-out;
}

@keyframes achievementsSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.achievement {
    background: rgba(55, 48, 163, 0.1);
    padding: 12px;
    margin: 8px 0;
    border-radius: 12px;
    border: 1px solid rgba(124, 58, 237, 0.3);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    animation: achievementReveal 0.6s ease-out;
}

@keyframes achievementReveal {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.achievement.unlocked {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    animation: achievementUnlock 0.6s ease-out;
}

@keyframes achievementUnlock {
    0% {
        transform: scale(0.8);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.8);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
    }
}

.achievement.locked {
    opacity: 0.5;
}

.achievement:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.2);
}

.achievement-unlocked {
    background: rgba(16, 185, 129, 0.1);
    padding: 15px;
    border-radius: 12px;
    margin: 15px 0;
    border: 1px solid #10b981;
    backdrop-filter: blur(10px);
    animation: achievementUnlockedReveal 0.8s ease-out;
}

@keyframes achievementUnlockedReveal {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.setting-item {
    background: rgba(55, 48, 163, 0.1);
    padding: 20px;
    margin: 15px 0;
    border-radius: 12px;
    border: 1px solid rgba(124, 58, 237, 0.3);
    backdrop-filter: blur(10px);
    animation: settingItemSlideIn 0.6s ease-out;
}

@keyframes settingItemSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.setting-item label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--text-secondary);
}

.setting-item input, .setting-item select {
    width: 100%;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color-light);
    background: rgba(139, 92, 246, 0.08);
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s ease;
    animation: inputSlideIn 0.6s ease-out;
}

@keyframes inputSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.setting-item input:focus, .setting-item select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
    transform: scale(1.02);
}

.setting-buttons {
    margin-top: 25px;
    animation: settingButtonsFadeIn 0.6s ease-out;
}

@keyframes settingButtonsFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.search-box {
    margin: 25px 0;
    animation: searchBoxSlideIn 0.6s ease-out;
}

@keyframes searchBoxSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-box input {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color-light);
    background: rgba(139, 92, 246, 0.08);
    color: var(--text-primary);
    font-size: 16px;
    text-align: center;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.search-box input::placeholder {
    color: var(--text-tertiary);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
    transform: scale(1.02);
}

.filter-buttons {
    display: flex;
    gap: 8px;
    margin: 20px 0;
    flex-wrap: wrap;
    justify-content: center;
    animation: filterButtonsReveal 0.6s ease-out;
}

@keyframes filterButtonsReveal {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-btn {
    padding: 10px 14px;
    border: 1px solid var(--border-color-light);
    border-radius: 8px;
    background: rgba(139, 92, 246, 0.08);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    min-width: 70px;
    backdrop-filter: blur(10px);
    flex: 0 1 auto;
    animation: filterBtnBounce 0.6s ease-out;
}

@keyframes filterBtnBounce {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.filter-btn.active {
    background: var(--primary-gradient);
    border-color: var(--primary-light);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.filter-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    transform: translateY(-1px);
}

.anime-library {
    margin: 25px 0;
    max-height: 60vh;
    overflow-y: auto;
    animation: libraryReveal 0.8s ease-out;
}

@keyframes libraryReveal {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.library-item {
    background: rgba(55, 48, 163, 0.1);
    padding: 18px;
    margin: 10px 0;
    border-radius: 12px;
    border: 1px solid rgba(124, 58, 237, 0.3);
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    cursor: pointer;
    animation: libraryItemSlideIn 0.6s ease-out;
}

@keyframes libraryItemSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.library-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.3);
    border-color: #8b5cf6;
}

.library-poster {
    width: 50px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 15px;
    border: 1px solid rgba(124, 58, 237, 0.3);
}

.library-info {
    flex: 1;
}

.library-info h4 {
    margin: 0 0 6px 0;
    font-size: 16px;
    color: #e9d5ff;
}

.library-info p {
    margin: 0 0 6px 0;
    font-size: 14px;
    color: #c4b5fd;
    text-align: left;
}

.library-info small {
    color: var(--text-tertiary);
    font-size: 12px;
}

.skip-btn {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    border: none;
    color: #000;
    animation: skipBtnPulse 2s infinite;
}

@keyframes skipBtnPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(245, 158, 11, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

.skip-btn:hover {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

.next-btn {
    background: linear-gradient(135deg, #10b981, #34d399);
    border: none;
    animation: nextBtnGlow 2s infinite;
}

@keyframes nextBtnGlow {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(16, 185, 129, 0.6);
    }
}

.next-btn:hover {
    background: linear-gradient(135deg, #059669, #10b981);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.anime-library::-webkit-scrollbar {
    width: 8px;
}

.anime-library::-webkit-scrollbar-track {
    background: rgba(55, 48, 163, 0.1);
    border-radius: 4px;
}

.anime-library::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    border-radius: 4px;
}

.anime-library::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.game-modes {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin: 25px 0;
    animation: gameModesReveal 0.8s ease-out;
}

@keyframes gameModesReveal {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mode-card {
    background: rgba(139, 92, 246, 0.08);
    padding: 20px;
    border-radius: 16px;
    border: 2px solid var(--border-color-light);
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    text-align: center;
    animation: modeCardBounce 0.6s ease-out;
}

@keyframes modeCardBounce {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    70% {
        transform: scale(1.05) translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.mode-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
}

.mode-icon {
    font-size: 40px;
    margin-bottom: 10px;
    animation: modeIconFloat 3s ease-in-out infinite;
}

@keyframes modeIconFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Стили для выбора сложности */
.difficulty-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin: 25px 0;
    animation: difficultyOptionsReveal 0.8s ease-out;
}

@keyframes difficultyOptionsReveal {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.difficulty-card {
    background: rgba(55, 48, 163, 0.1);
    padding: 20px;
    border-radius: 16px;
    border: 2px solid rgba(124, 58, 237, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    text-align: center;
    animation: difficultyCardBounce 0.6s ease-out;
}

@keyframes difficultyCardBounce {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    70% {
        transform: scale(1.05) translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.difficulty-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.3);
    border-color: #8b5cf6;
}

.difficulty-card h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #e9d5ff;
}

.lives-count {
    font-size: 16px;
    color: #f87171;
    margin-bottom: 8px;
    font-weight: 600;
}

.difficulty-card p {
    margin: 8px 0;
    color: #c4b5fd;
    text-align: center;
}

.difficulty-bonus {
    font-size: 14px;
    color: #34d399;
    margin-top: 10px;
    font-weight: 500;
}

/* Специфичные стили для разных уровней сложности */
.difficulty-card[onclick*="easy"] {
    border-color: #34d399;
}

.difficulty-card[onclick*="medium"] {
    border-color: #fbbf24;
}

.difficulty-card[onclick*="hard"] {
    border-color: #f87171;
}

.difficulty-card[onclick*="easy"]:hover {
    border-color: #10b981;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

.difficulty-card[onclick*="medium"]:hover {
    border-color: #f59e0b;
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
}

.difficulty-card[onclick*="hard"]:hover {
    border-color: #ef4444;
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

/* Стили для вертикального регулятора громкости */
.volume-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 15px;
    height: 36px; /* На 40% меньше от 60px */
}

.volume-icon {
    font-size: 20px; /* На 40% меньше от ~33px */
    cursor: pointer;
    color: #c4b5fd;
    transition: all 0.3s ease;
    padding: 6px; /* На 40% меньше */
    border-radius: 50%;
    background: rgba(55, 48, 163, 0.3);
    width: 32px; /* На 40% меньше от ~53px */
    height: 32px; /* На 40% меньше от ~53px */
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid rgba(124, 58, 237, 0.4);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.volume-icon:hover {
    background: rgba(124, 58, 237, 0.4);
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.5);
    border-color: #8b5cf6;
}

.volume-slider-container {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 10px;
    padding: 15px 20px;
    background: rgba(26, 11, 46, 0.98);
    border: 2px solid rgba(124, 58, 237, 0.6);
    border-radius: 15px;
    backdrop-filter: blur(15px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    min-width: 200px; /* Горизонтальный контейнер */
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: space-between;
}

.volume-container:hover .volume-slider-container {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Контейнер для горизонтального ползунка */
.volume-slider-wrapper {
    position: relative;
    width: 120px; /* На 40% меньше от 200px */
    height: 24px; /* На 40% меньше от 40px */
    display: flex;
    align-items: center;
    flex: 1;
}

/* Горизонтальная дорожка */
.volume-track {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 6px;
    background: linear-gradient(to right, 
        rgba(139, 92, 246, 0.2) 0%,
        rgba(139, 92, 246, 0.4) 50%,
        rgba(139, 92, 246, 0.6) 100%);
    border-radius: 3px;
    z-index: 1;
}

/* Заполнение дорожки (уровень громкости) */
.volume-track-fill {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0%;
    height: 6px;
    background: var(--primary-gradient);
    border-radius: 3px;
    z-index: 2;
    transition: width 0.1s ease;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

/* Горизонтальный ползунок */
.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 24px;
    background: transparent;
    border-radius: 12px;
    outline: none;
    margin: 0;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 3;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff, var(--text-secondary));
    cursor: pointer;
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.4),
                0 3px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    z-index: 4;
}

.volume-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff, var(--text-secondary));
    cursor: pointer;
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.4),
                0 3px 8px rgba(0, 0, 0, 0.3);
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 20px var(--primary-color),
                0 4px 10px rgba(0, 0, 0, 0.4);
}

.volume-value-display {
    font-size: 14px; /* На 40% меньше от ~23px */
    color: #e9d5ff;
    font-weight: 600;
    min-width: 40px; /* На 40% меньше от ~67px */
    text-align: center;
    padding: 4px 8px; /* На 40% меньше */
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(139, 92, 246, 0.2));
    border-radius: 8px; /* На 40% меньше от ~13px */
    border: 1px solid rgba(124, 58, 237, 0.5);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* Анимация появления */
@keyframes slideAppear {
    from {
        opacity: 0;
        transform: translateY(-15px) scale(0.9);
        filter: blur(3px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.volume-slider-container {
    animation: slideAppear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Для мобильных устройств */
@media (max-width: 480px) {
    .volume-container {
        margin-left: 10px;
        height: 30px;
    }
    
    .volume-icon {
        width: 28px;
        height: 28px;
        font-size: 18px;
    }
    
    .volume-slider-container {
        min-width: 160px;
        padding: 12px 15px;
        left: -20px;
    }
    
    .volume-slider-wrapper {
        width: 90px;
    }
    
    .volume-value-display {
        font-size: 12px;
        min-width: 35px;
    }
}

/* Анимация пульсации при изменении громкости */
@keyframes volumePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(139, 92, 246, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0);
    }
}

.volume-pulse {
    animation: volumePulse 0.5s ease-out;
}

/* Стили для значка в зависимости от громкости */
.volume-icon.muted {
    color: #f87171;
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

.volume-icon.low {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.4);
}

.volume-icon.medium {
    color: #c4b5fd;
}

.volume-icon.high {
    color: #00ff7f;
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.4);
}

/* Хедер с авторизацией */
.auth-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    margin-bottom: 25px;
    background: rgba(55, 48, 163, 0.1);
    border-radius: 16px;
    padding: 15px 20px;
    border: 1px solid rgba(124, 58, 237, 0.3);
    backdrop-filter: blur(10px);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-info:hover {
    transform: translateY(-2px);
}

.user-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
    transition: all 0.3s ease;
}

.user-circle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5);
}

.user-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 32px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
    margin: 0 auto 20px auto;
}

.user-avatar-container {
    position: relative;
    width: fit-content;
    margin: 0 auto 12px auto;
}

.user-avatar-image {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
    object-fit: cover;
}

.avatar-upload-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    border: 2px solid white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

.avatar-upload-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.6);
}

.username {
    color: #e9d5ff;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.username:hover {
    color: #c4b5fd;
}

.auth-buttons, .user-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.auth-btn {
    padding: 10px 16px !important;
    font-size: 14px !important;
    min-width: 100px;
}

/* Формы авторизации */
.auth-form {
    background: rgba(55, 48, 163, 0.1);
    padding: 25px;
    border-radius: 16px;
    border: 1px solid rgba(124, 58, 237, 0.3);
    backdrop-filter: blur(10px);
    margin: 25px 0;
}

.form-group {
    margin-bottom: 20px;
    animation: formGroupSlideIn 0.5s ease-out;
}

@keyframes formGroupSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #e9d5ff;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: 2px solid rgba(124, 58, 237, 0.3);
    background: rgba(15, 15, 15, 0.8);
    color: #ffffff;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
    background: rgba(15, 15, 15, 0.9);
}

.form-group input::placeholder {
    color: var(--text-tertiary);
    opacity: 0.6;
}

.field-error {
    color: #f87171;
    font-size: 12px;
    margin-top: 5px;
    min-height: 18px;
    display: none;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    border-radius: 8px;
    padding: 12px;
    margin: 15px 0;
    color: #fecaca;
    font-size: 14px;
    text-align: center;
    display: none;
    animation: errorShake 0.5s ease-out;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.success-message {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid #10b981;
    border-radius: 8px;
    padding: 12px;
    margin: 15px 0;
    color: #a7f3d0;
    font-size: 14px;
    text-align: center;
    display: none;
    animation: successPulse 0.5s ease-out;
}

@keyframes successPulse {
    0% { transform: scale(0.95); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.loading {
    text-align: center;
    margin: 20px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(124, 58, 237, 0.3);
    border-top: 3px solid #8b5cf6;
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.auth-links {
    text-align: center;
    margin: 20px 0;
    color: #c4b5fd;
}

.auth-links a {
    color: #8b5cf6;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.auth-links a:hover {
    color: #c4b5fd;
    text-decoration: underline;
}

/* Экран профиля */
.profile-header {
    text-align: center;
    margin-bottom: 15px;
    animation: profileHeaderReveal 0.6s ease-out;
}

@keyframes profileHeaderReveal {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.user-info h3 {
    font-size: 20px;
    color: #e9d5ff;
    margin: 0;
}

.user-info p {
    color: #c4b5fd;
    margin: 2px 0;
    font-size: 12px;
}

.join-date {
    color: var(--text-tertiary) !important;
    font-size: 11px !important;
    opacity: 0.8;
}

.profile-section {
    margin: 15px 0;
    animation: profileSectionReveal 0.6s ease-out;
}

@keyframes profileSectionReveal {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.profile-section h3 {
    font-size: 16px;
    color: #e9d5ff;
    margin-bottom: 12px;
    text-align: center;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.not-logged-in {
    text-align: center;
    padding: 20px 15px;
    background: rgba(55, 48, 163, 0.1);
    border-radius: 16px;
    border: 1px solid rgba(124, 58, 237, 0.3);
    margin: 15px 0;
}

.not-logged-in h3 {
    color: #e9d5ff;
    margin-bottom: 15px;
}

.not-logged-in p {
    color: #c4b5fd;
    margin-bottom: 25px;
}

.not-logged-in .btn {
    margin: 5px 10px;
}

/* Анимации для экранов авторизации */
#login-screen .container,
#register-screen .container,
#profile-screen .container {
    animation: authScreenSlideIn 0.5s ease-out;
}

@keyframes authScreenSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Медиа-запросы для адаптивности */
@media (max-width: 768px) {
    .auth-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .auth-buttons, .user-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .auth-btn {
        width: 100%;
        margin: 5px 0;
    }
    
    .achievements-grid {
        grid-template-columns: 1fr;
    }
    
    .user-circle {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .username {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .auth-form {
        padding: 15px;
    }
    
    .form-group input {
        padding: 12px;
        font-size: 14px;
    }
    
    .user-avatar-large {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
}

#auth-modal {
    z-index: 10000 !important;
}

.auth-modal-content {
    position: relative;
    animation: modalAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(30px);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}

/* Стили для главного экрана без авторизации */
#guest-message {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 12px;
    padding: 15px;
    margin: 20px 0;
    text-align: center;
    animation: guestMessagePulse 2s infinite;
}

@keyframes guestMessagePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.2);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(245, 158, 11, 0);
    }
}

#auth-buttons-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: buttonsSlideIn 0.6s ease-out;
}

#game-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: buttonsSlideIn 0.6s ease-out;
}

/* Профильная карточка */
.profile-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.profile-card:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    border-color: rgba(167, 139, 250, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.2);
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.profile-avatar {
    position: relative;
    flex-shrink: 0;
}

.profile-avatar img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-avatar-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 24px;
}

.profile-info h3 {
    color: #e9d5ff;
    margin: 0;
    font-size: 16px;
}

.profile-info p {
    color: #a78bfa;
    font-size: 12px;
    margin: 4px 0 0 0;
}

.profile-stats-mini {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.mini-stat {
    background: rgba(167, 139, 250, 0.05);
    border: 1px solid rgba(167, 139, 250, 0.15);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
}

.mini-stat .label {
    display: block;
    color: #a78bfa;
    font-size: 11px;
    margin-bottom: 4px;
}

.mini-stat .value {
    display: block;
    color: #e9d5ff;
    font-size: 16px;
    font-weight: bold;
}

@keyframes buttonsSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Стили для недоступных кнопок в гостевом режиме */
.btn:disabled, .btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Стили для заглушек в гостевом режиме */
.guest-blocked {
    position: relative;
    opacity: 0.7;
}

.guest-blocked::after {
    content: "🔒";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    color: rgba(255, 255, 255, 0.5);
    z-index: 2;
}

/* Анимация для кнопок авторизации */
.auth-primary-btn {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6) !important;
    animation: authBtnPulse 2s infinite !important;
}

@keyframes authBtnPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 8px 25px rgba(124, 58, 237, 0.6);
    }
}

.auth-secondary-btn {
    background: transparent !important;
    border: 2px solid #7c3aed !important;
    color: #c4b5fd !important;
    transition: all 0.3s ease !important;
}

.auth-secondary-btn:hover {
    background: rgba(124, 58, 237, 0.1) !important;
    transform: translateY(-2px) !important;
}

/* Стили для информационного блока о регистрации */
.registration-benefits {
    background: rgba(55, 48, 163, 0.1);
    border-radius: 16px;
    padding: 20px;
    margin: 25px 0;
    border: 1px solid rgba(124, 58, 237, 0.3);
    backdrop-filter: blur(10px);
    animation: benefitsReveal 0.8s ease-out;
}

@keyframes benefitsReveal {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 15px 0;
    color: #e9d5ff;
}

.benefit-item .icon {
    font-size: 24px;
    min-width: 30px;
    text-align: center;
}

.benefit-item .text {
    flex: 1;
}

.benefit-item .text h4 {
    margin: 0 0 5px 0;
    color: #e9d5ff;
    font-size: 16px;
}

.benefit-item .text p {
    margin: 0;
    color: #c4b5fd;
    font-size: 14px;
    opacity: 0.8;
}

/* Лидер борд */
.leaderboard-filters {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.leaderboard-filters .filter-btn {
    padding: 10px 16px;
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.3);
    color: #a78bfa;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
}

.leaderboard-filters .filter-btn:hover {
    background: rgba(124, 58, 237, 0.2);
    border-color: rgba(124, 58, 237, 0.5);
}

.leaderboard-filters .filter-btn.active {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    border-color: rgba(124, 58, 237, 0.8);
    color: white;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: rgba(55, 48, 163, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    cursor: pointer;
}

.leaderboard-item:hover {
    background: rgba(55, 48, 163, 0.2);
    border-color: rgba(124, 58, 237, 0.6);
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(124, 58, 237, 0.3);
}

.leaderboard-rank {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    border-radius: 50%;
    color: white;
    font-weight: bold;
    font-size: 18px;
    margin-right: 15px;
    flex-shrink: 0;
}

.leaderboard-rank.top1 {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    font-size: 20px;
}

.leaderboard-rank.top2 {
    background: linear-gradient(135deg, #d1d5db, #9ca3af);
    font-size: 19px;
}

.leaderboard-rank.top3 {
    background: linear-gradient(135deg, #ea580c, #d97706);
    font-size: 19px;
}

.leaderboard-user {
    flex: 1;
}

.leaderboard-username {
    font-weight: 600;
    color: #e9d5ff;
    margin-bottom: 5px;
}

.leaderboard-info {
    font-size: 13px;
    color: #a78bfa;
}

.leaderboard-value {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    flex-shrink: 0;
}

.leaderboard-stat {
    font-weight: 600;
    color: #c4b5fd;
    font-size: 16px;
}

.leaderboard-label {
    font-size: 12px;
    color: #a78bfa;
}

@media (max-width: 600px) {
    .leaderboard-filters {
        gap: 8px;
    }
    
    .leaderboard-filters .filter-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .leaderboard-item {
        padding: 12px;
    }
    
    .leaderboard-rank {
        width: 35px;
        height: 35px;
        font-size: 16px;
        margin-right: 12px;
    }
}

/* Tab Styles */
.tab-btn {
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: #e9d5ff;
}

.tab-btn.active {
    color: #e9d5ff;
    border-bottom-color: #a78bfa !important;
}

/* Request Cards */
.request-card {
    animation: slideIn 0.3s ease-out;
}

.incoming-request-card {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Theme Switcher Styles */
.theme-switcher-container {
    position: relative;
    display: inline-block;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1 1 calc(50% - 8px);
    min-width: 90px;
    border: 1px solid transparent;
}

.theme-option:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.5);
    transform: translateY(-2px);
}

.theme-option span {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Theme Screen Grid Styles */
.themes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 30px 0;
}

.theme-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border: 2px solid var(--border-color-light);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(139, 92, 246, 0.08);
    backdrop-filter: blur(10px);
}

.theme-card:hover {
    border-color: var(--primary-color);
    background: rgba(139, 92, 246, 0.15);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.theme-card span {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

.theme-preview {
    width: 80px;
    height: 60px;
    border-radius: 8px;
    border: 2px solid rgba(139, 92, 246, 0.5);
}

.theme-preview.dark-theme {
    background: linear-gradient(135deg, #0f0f0f 0%, #1a0b2e 100%);
}

.theme-preview.purple-theme {
    background: linear-gradient(135deg, #2d1b4e 0%, #3d2466 100%);
}

.theme-preview.blue-theme {
    background: linear-gradient(135deg, #001f3f 0%, #003366 100%);
}

.theme-preview.ocean-theme {
    background: linear-gradient(135deg, #0a2342 0%, #1a4d5c 100%);
}

.theme-preview.forest-theme {
    background: linear-gradient(135deg, #1a3a2a 0%, #2d5c3f 100%);
}

.theme-preview.sunset-theme {
    background: linear-gradient(135deg, #3d2426 0%, #5a3f4f 100%);
}

/* Responsive themes grid */
@media (max-width: 768px) {
    .themes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .themes-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .theme-card {
        padding: 15px;
        gap: 10px;
    }
    
    #themes-pagination {
        gap: 5px;
        margin-top: 20px !important;
    }
    
    #themes-pagination button {
        font-size: 12px;
        padding: 6px 10px !important;
    }
    
    #pagination-info {
        font-size: 12px;
        min-width: 60px;
    }
}

/* Theme Color Variables - Default Dark Theme */
:root {
    --primary-gradient: linear-gradient(135deg, #8b5cf6, #c4b5fd);
    --primary-color: #8b5cf6;
    --primary-light: #c4b5fd;
    --primary-dark: #7c3aed;
    --bg-gradient: linear-gradient(135deg, #0f0f0f 0%, #1a0b2e 50%, #0f0f0f 100%);
    --bg-light: #1a0b2e;
    --text-primary: #ffffff;
    --text-secondary: #c4b5fd;
    --text-tertiary: #a78bfa;
    --border-color: #7c3aed;
    --border-color-light: rgba(124, 58, 237, 0.3);
}

body {
    background: var(--bg-gradient);
}

/* Favorite Anime Empty Square Styles */
#fav-empty-square {
    width: 320px;
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    margin: 18px auto;
    border-radius: 14px;
    border: 2px solid var(--border-color-light);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.04), rgba(124, 58, 237, 0.02));
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    padding: 18px;
}

#fav-empty-square h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
}

#fav-empty-square p {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
    text-align: center;
    max-width: 260px;
}

/* Favorite Anime Screen Responsive Styles */
@media (max-width: 768px) {
    #favorite-anime-screen .container {
        padding: 0 10px;
    }
    
    #favorite-anime-card {
        max-width: 100% !important;
    }
    
    #fav-preview {
        width: 100% !important;
        height: 150px !important;
    }
    
    #fav-title {
        font-size: 14px !important;
    }
    
    #fav-desc {
        font-size: 13px !important;
        margin-top: 6px !important;
    }
    
    .anime-library {
        max-height: 50vh !important;
    }
    
    .library-item {
        padding: 12px !important;
        margin: 8px 0 !important;
    }
    
    .library-poster {
        width: 40px !important;
        height: 56px !important;
        margin-right: 10px !important;
    }
    
    .library-info h4 {
        font-size: 14px !important;
    }
    
    .library-info p {
        font-size: 12px !important;
    }
    
    .library-info small {
        font-size: 11px !important;
    }
}

@media (max-width: 480px) {
    #favorite-anime-screen h2 {
        font-size: 22px !important;
        margin-bottom: 20px !important;
    }
    
    #favorite-anime-card {
        padding: 15px !important;
    }
    
    #fav-preview {
        width: 100% !important;
        height: 120px !important;
    }
    
    #fav-prev-btn, #fav-next-btn {
        padding: 6px 10px !important;
        font-size: 14px !important;
    }
    
    #fav-add-btn {
        min-width: 140px !important;
        padding: 10px 14px !important;
        font-size: 14px !important;
    }
    
    #fav-note {
        font-size: 12px !important;
        margin-top: 8px !important;
    }
    
    .anime-library {
        max-height: 45vh !important;
    }
    
    .library-item {
        padding: 10px !important;
        margin: 6px 0 !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }
    
    .library-item > div:first-child {
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
    }
    
    .library-poster {
        width: 35px !important;
        height: 50px !important;
        margin-right: 10px !important;
        margin-bottom: 0 !important;
    }
    
    .library-info {
        flex: 1 !important;
    }
    
    .library-info h4 {
        font-size: 13px !important;
        margin-bottom: 4px !important;
    }
    
    .library-info p {
        font-size: 11px !important;
        margin-bottom: 4px !important;
    }
    
    .library-info small {
        font-size: 10px !important;
    }
    
    .library-item > div:last-child {
        align-self: flex-end !important;
    }
}

/* Favorite Picker Modal Responsive Styles */
@media (max-width: 768px) {
    #favorite-picker-modal .container {
        padding: 12px !important;
        max-height: 90vh !important;
    }
    
    #favorite-picker-modal h3 {
        font-size: 16px !important;
    }
    
    #favorite-picker-modal .btn {
        padding: 8px 12px !important;
        font-size: 14px !important;
    }
    
    #favorite-picker-modal input {
        padding: 8px !important;
        font-size: 14px !important;
    }
}

@media (max-width: 480px) {
    #favorite-picker-modal .container {
        padding: 10px !important;
        max-height: 85vh !important;
    }
    
    #favorite-picker-modal h3 {
        font-size: 14px !important;
    }
    
    #favorite-picker-modal .btn {
        padding: 6px 10px !important;
        font-size: 13px !important;
        min-width: auto !important;
    }
    
    #favorite-picker-modal input {
        padding: 6px !important;
        font-size: 13px !important;
    }
    
    #favorite-picker-modal button {
        font-size: 20px !important;
        padding: 4px !important;
    }
}

/* Confirm modal */
.confirm-modal { position: fixed; inset: 0; display:flex; align-items:center; justify-content:center; z-index: 3000; }
.confirm-modal-overlay { position:absolute; inset:0; background: rgba(0,0,0,0.6); backdrop-filter: blur(2px); }
.confirm-modal-content { position:relative; z-index:1; width:90%; max-width:420px; padding:20px; border-radius:12px; background:var(--bg-light); border:2px solid var(--primary-color); box-shadow: 0 20px 60px rgba(0,0,0,0.6); text-align:center; }
.confirm-modal-title { margin:0 0 8px; color: var(--text-secondary); }
.confirm-modal-message { color: var(--text-secondary); margin-bottom: 16px; }
.confirm-modal-actions { display:flex; gap:10px; justify-content:center; }
.confirm-modal .btn { min-width: 110px; }
@media (max-width:480px) { .confirm-modal-content { padding: 14px; } .confirm-modal .btn { min-width: 90px; } }

/* Toast notifications (mobile-friendly banners) */
#toast-container {
    position: fixed;
    top: env(safe-area-inset-top, 12px);
    left: 50%;
    transform: translateX(-50%);
    width: min(95%, 420px);
    /* reduced z-index so it won't be detected as blocking primary UI elements */
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.app-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(2,6,23,0.6);
    color: #fff;
    font-weight: 700;
    backdrop-filter: blur(6px);
    transition: transform 0.2s ease, opacity 0.2s ease;
    border: 1px solid rgba(255,255,255,0.06);
}

.app-toast.success { background: linear-gradient(135deg, rgba(16,185,129,0.9), rgba(34,197,94,0.9)); }
.app-toast.error { background: linear-gradient(135deg, rgba(239,68,68,0.95), rgba(220,38,38,0.95)); }
.app-toast.info { background: linear-gradient(135deg, rgba(124,58,237,0.9), rgba(99,102,241,0.9)); }
.app-toast.warning { background: linear-gradient(135deg, rgba(245,158,11,0.95), rgba(245,130,32,0.95)); color: #111; }

@media (max-width: 520px) {
    #toast-container { left: 12px; transform: none; width: calc(100% - 24px); }
    .app-toast { font-size: 15px; padding: 14px; border-radius: 14px; }
}

/* Friend card entrance/exit helpers to avoid replaying animations on updates */
.friend-card.enter {
    /* temporary state while entering */
    opacity: 1;
}
.friend-card.removing { opacity: 0 !important; transform: translateY(-6px) !important; transition: opacity 0.22s ease, transform 0.22s ease !important; }

/* Make sure friend-card has smooth, non-janky transitions but no forced keyframe replays */
.friend-card {
    transition: opacity 0.22s ease, transform 0.22s ease, background 0.2s ease;
}

.request-card { transition: opacity 0.22s ease, transform 0.22s ease; }

/* Friends screen styling */

/* Debug controls and activity pill removed — online/offline feature disabled */
.friends-header { display:flex; flex-direction:column; align-items:center; gap:8px; margin-bottom: 12px; }
.friends-header .friends-title { margin:0; font-size:22px; text-align:center; color:var(--text-primary); }
.friends-actions { display:flex; gap:12px; align-items:center; justify-content:center; width:100%; }
.friend-input-group { display:flex; gap:8px; align-items:center; }
.friend-input { padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.04); background: rgba(255,255,255,0.02); color: var(--text-primary); min-width: 200px; }
.friend-input::placeholder { color: var(--text-secondary); }
.tabs { display:flex; gap:10px; border-bottom: 2px solid rgba(124, 58, 237, 0.08); margin-bottom: 16px; }
.tab-btn { flex: 1; padding: 12px; background: none; border: none; color: var(--text-secondary); cursor:pointer; font-size:14px; font-weight:700; border-bottom: 3px solid transparent; transition: all 0.25s ease; }
.tab-btn.active { color: var(--text-primary); border-bottom-color: var(--primary-color); }
.section-sub { color: var(--text-secondary); font-size:12px; margin-bottom:8px; }
.friends-list { display:flex; flex-direction:column; gap:10px; }
.requests-list { display:flex; flex-direction:column; gap:10px; }
.empty-state { text-align:center; color: var(--text-secondary); padding: 28px 12px; border-radius: 10px; border: 1px dashed rgba(255,255,255,0.04); background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)); }
.empty-state .emoji { font-size: 36px; margin-bottom: 8px; }
.empty-state .title { font-weight: 700; color: var(--text-primary); margin-bottom:6px; }
.empty-state .desc { font-size: 13px; color: var(--text-secondary); }

/* Compact buttons for friends screen */
.compact-btn { padding: 8px 12px; font-size: 13px; border-radius: 10px; min-width: 88px; }
.friend-card .actions .btn { padding: 8px 12px; font-size: 14px; border-radius: 8px; }

/* Friend card refined */
.friend-card { display:flex; align-items:center; gap:12px; padding: 12px; border-radius: 12px; background: linear-gradient(135deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)); border: 1px solid rgba(255,255,255,0.03); transition: transform 0.18s ease, opacity 0.18s ease; will-change: transform, opacity; }
.friend-card .avatar { width:36px; height:36px; flex: 0 0 36px; border-radius:50%; background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(139,92,246,0.2)); display:inline-flex; align-items:center; justify-content:center; color:#fff; font-weight:800; overflow:hidden; }
.friend-card .avatar img { width:36px; height:36px; border-radius:50%; object-fit:cover; display:block; border: 2px solid rgba(124,58,237,0.35); }
.friend-card .meta { flex:1; min-width:0; }
.friend-card .meta .name { color: var(--text-primary); font-weight:700; font-size: 14px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.friend-card .meta .sub { color: var(--text-secondary); font-size:12px; margin-top:4px; }
.friend-card .actions { display:flex; gap:8px; }

/* Theme aware tweaks */
.friend-card { box-shadow: 0 8px 24px rgba(2,6,23,0.25); }

@media (max-width: 520px) {
    .friend-input { min-width: 120px; }
    .friends-header { flex-direction:column; align-items:stretch; }
    .friends-actions { justify-content:space-between; }
    .friend-card { padding:10px; }
}

/* Avatar fallback styling */
.friend-card .avatar.no-img { font-size: 13px; display:inline-flex; align-items:center; justify-content:center; color: #fff; }

/* Unread messages badge */
.unread-badge {
    display: inline-block;
    font-size: 11px;
    background: #ef4444;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
    font-weight: bold;
    min-width: 16px;
    text-align: center;
}

/* Chat Screen Styles */
#chat-screen {
    display: none;
    min-height: 100vh;
    padding: 0;
}

#chat-screen.active {
    display: flex;
    flex-direction: column;
}

#chat-screen .container {
    min-height: auto;
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 12px 15px;
    gap: 0;
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 12px;
    gap: 12px;
    flex-shrink: 0;
}

.chat-back-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    flex-shrink: 0;
}

.chat-back-btn:hover {
    background: rgba(255,255,255,0.15);
    transform: translateX(-2px);
}

.chat-back-btn svg {
    width: 20px;
    height: 20px;
}

.chat-user-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(139, 92, 246, 0.5);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.chat-user-info {
    flex: 1;
}

.chat-user-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.chat-user-status {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Кастомный скролл для сообщений */
.chat-messages {
    flex: 0 1 auto;
    max-height: 750px;
    padding: 12px;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.03);
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
    min-height: 200px;
}

/* Кастомный скролбар */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.35);
}

.chat-message {
    display: flex;
    margin-bottom: 8px;
}

.chat-message.own {
    justify-content: flex-end;
}

.chat-message.other {
    justify-content: flex-start;
}

.chat-message-bubble {
    max-width: 70%;
    padding: 10px 12px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-message.own .chat-message-bubble {
    background: linear-gradient(90deg, #22c55e, #16a34a);
    color: white;
}

.chat-message.other .chat-message-bubble {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
}

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    align-items: flex-end;
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
    outline: none;
    font-size: 16px;
    transition: all 0.3s ease;
}

.chat-input::placeholder {
    color: var(--text-secondary);
}

.chat-input:focus {
    border-color: var(--primary-color);
    background: rgba(255,255,255,0.08);
}

#chat-send {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
}

#chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

#chat-send:active {
    transform: scale(0.95);
}

/* Стили сообщений в чате */
.chat-message {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    align-items: flex-end;
}

.chat-message.own {
    justify-content: flex-end;
}

.chat-message.own .message-avatar {
    order: 2;
}

.chat-message.own .message-content {
    order: 1;
    align-items: flex-end;
}

.chat-message.other {
    justify-content: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 70%;
}

.message-text {
    margin: 0;
    padding: 10px 14px;
    border-radius: 16px;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 14px;
}

.chat-message.own .message-text {
    background: linear-gradient(90deg, #22c55e, #16a34a);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.other .message-text {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    padding: 0 4px;
}

/* Mobile adjustments for chat */
@media (max-width: 520px) {
    .chat-messages {
        max-height: calc(100vh - 180px);
    }
    
    .chat-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Collection Styles - Theme Adaptive */
.collection-card-element {
    border: 2px solid var(--primary-color) !important;
    background: var(--bg-light) !important;
}

.collection-card-title {
    color: var(--text-secondary) !important;
    background: rgba(15, 15, 15, 0.9) !important;
    border-top: 1px solid var(--primary-color) !important;
}

.collection-card-element:hover {
    box-shadow: 0 0 20px var(--primary-color),
                0 0 40px rgba(139, 92, 246, 0.2) !important;
}

/* Анимация открытия сундука */
@keyframes chestOpen {
    0% {
        transform: rotateZ(0deg) scale(1);
        opacity: 1;
    }
    50% {
        transform: rotateZ(15deg) scale(1.1);
    }
    100% {
        transform: rotateZ(0deg) scale(1);
        opacity: 1;
    }
}

/* Анимация прокручивания карточек */
@keyframes cardSpin {
    0% {
        opacity: 0;
        transform: rotateY(90deg) scale(0.5);
    }
    100% {
        opacity: 1;
        transform: rotateY(0deg) scale(1);
    }
}

/* Анимация выделения выигрышной карточки */
@keyframes winnerPulse {
    0%, 100% {
        box-shadow: 0 0 20px var(--primary-color);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 40px var(--primary-color), 0 0 60px var(--primary-color);
        transform: scale(1.05);
    }
}

/* Анимация пульса индикатора */
@keyframes indicatorPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

