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

.pixel-text {
    font-family: 'Press Start 2P', cursive;
    text-transform: uppercase;
}

body {
    background-color: #000;
    font-family: 'Press Start 2P', cursive;
    color: white;
    height: var(--tg-viewport-height, 100svh);
    min-height: var(--tg-viewport-height, 100svh);
    max-height: var(--tg-viewport-height, 100svh);
    width: 100vw;
    min-width: 100vw;
    max-width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.screen {
    width: 100vw;
    height: var(--tg-viewport-height, 100svh);
    text-align: center;
    background-color: #000;
    position: relative;
    overflow: hidden;
    margin: 0 auto;
}

/* Стартовый экран */
.logo {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding: 20px;
    transform: translateY(-20%);
}

.main-logo {
    width: 100%;
    max-width: 300px;
    height: auto;
    object-fit: contain;
}

.start-button {
    padding: 15px 40px;
    font-size: 18px;
    background: #ff0000;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.start-button:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}

/* Экран выбора персонажа */
.vs-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.character-selection {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: calc(100% - 150px);
    padding: 20px;
    position: relative;
    overflow: hidden;
    margin-top: 20px;
    transform: translateY(-10%);
}

/* Эффекты заднего фона */
.background-effects {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.energy-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #ff0000;
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 0 10px #ff0000, 0 0 20px #ff0000;
    animation: particleGlow 0.5s ease-out;
}

.energy-wave {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 0%, rgba(255, 255, 255, 0.1) 50%, transparent 100%);
    animation: waveEffect 4s ease-in-out infinite;
    opacity: 0.3;
}

.field-side.left .energy-wave {
    background: radial-gradient(circle at center, transparent 0%, rgba(204, 0, 0, 0.2) 50%, transparent 100%);
}

.field-side.right .energy-wave {
    background: radial-gradient(circle at center, transparent 0%, rgba(0, 102, 204, 0.2) 50%, transparent 100%);
}

@keyframes particleGlow {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

@keyframes waveEffect {
    0%, 100% {
        transform: scale(0.8);
        opacity: 0.3;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.5;
    }
}

.vs-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -70%);
    z-index: 1;
    width: 120px;
}

.vs-logo img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.7));
}

.character-option {
    cursor: pointer;
    transition: all 0.3s ease;
    height: 100%;
    width: 45%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    padding: 10px;
    border-radius: 10px;
    z-index: 2;
    background: transparent;
    overflow: hidden;
}

.character-option:hover {
    transform: scale(1.05);
    background-color: rgba(255, 255, 255, 0.05);
}

.character-option .character-img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    transition: all 0.5s ease;
    transform-origin: center center;
}

.character-option:not(:hover) .character-img {
    filter: brightness(0.9);
}

.character-option h3 {
    font-size: 16px;
    margin-top: 20px;
}

/* Игровой экран */
.game-stats {
    display: flex;
    justify-content: space-around;
    padding: 10px;
    font-size: 12px;
    font-family: 'Press Start 2P', cursive;
    background: rgba(0, 0, 0, 0.8);
    position: relative;
    width: 100%;
    z-index: 10;
    text-transform: uppercase;
}

.score, .timer {
    font-family: 'Press Start 2P', cursive;
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.lives {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.hearts {
    display: flex;
    gap: 5px;
}

.heart {
    font-size: 16px;
}

.game-field {
    position: relative;
    width: 100%;
    height: calc(100% - 40px);
    background: #111;
    overflow: hidden;
    margin: 0 auto;
    touch-action: none;
}

/* Граница нижней части игрового поля */
.field-boundary.bottom {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.8);
    bottom: 40%;
    z-index: 1000;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.field-side {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    z-index: 1;
}

.field-side.left {
    left: 0;
    background: #cc0000;
    border-bottom: none;
}

.field-side.right {
    right: 0;
    background: #0066cc;
    border-bottom: none;
}

/* Границы игрового поля */
.field-side.left::before,
.field-side.right::before {
    content: '';
    position: absolute;
    bottom: 40%;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.5);
    z-index: 2;
}

.field-divider {
    position: absolute;
    left: 50%;
    top: 0;
    height: 60%; /* Оставляем разделительную линию только в игровой зоне */
    width: 4px;
    background: rgba(255, 255, 255, 0.5);
    transform: translateX(-50%);
    z-index: 2;
}

.energy-effect {
    position: absolute;
    width: 150px;
    height: 150px;
    pointer-events: none;
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.energy-effect.active {
    opacity: 1;
    animation: energyBurst 0.5s ease-out;
}

@keyframes energyBurst {
    0% {
        transform: scale(0.1);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.energy-effect.left {
    left: 0;
    background: radial-gradient(circle, 
        rgba(0, 195, 255, 1) 0%,
        rgba(0, 195, 255, 0.8) 30%,
        rgba(0, 195, 255, 0) 70%
    );
}

.energy-effect.right {
    right: 0;
    background: radial-gradient(circle, 
        rgba(255, 50, 50, 1) 0%,
        rgba(255, 50, 50, 0.8) 30%,
        rgba(255, 50, 50, 0) 70%
    );
}

.paddle {
    position: absolute;
    width: 15px;
    height: 80px;
    background: linear-gradient(90deg, rgba(255,255,255,0.9), rgba(255,255,255,0.3));
    border-radius: 8px;
    box-shadow: 
        0 0 15px rgba(255, 255, 255, 0.8),
        0 0 30px rgba(0, 195, 255, 0.5);
    z-index: 9;
}

#player-paddle, #opponent-paddle {
    width: 15px;
    height: 120px;
    background: #ffffff;
    border-radius: 8px;
    position: absolute;
    z-index: 100;
    opacity: 1;
    box-shadow: 0 0 5px 2px rgba(255, 255, 255, 0.5);
}

#player-paddle {
    left: 30px;
}

#opponent-paddle {
    right: 30px;
}

.ball {
    width: 15px;
    height: 15px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    z-index: 3;
    box-shadow: none;
}

.character-portrait {
    position: absolute;
    width: 180px;
    height: 250px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center bottom;
    opacity: 0.5;
    transition: all 0.8s;
    z-index: 200;
    bottom: 20px;
}

#player-portrait, #opponent-portrait {
    position: absolute;
    width: 180px;
    height: 180px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    top: 40%; /* Поднимаем портреты выше */
    transform: translateY(-50%);
    z-index: 10;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

#player-portrait {
    left: 40px;
}

#opponent-portrait {
    right: 40px;
}

/* Оверлей для отсчета */
.countdown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.countdown-content {
    text-align: center;
    position: absolute;
    left: 50%;
    top: 422px; /* Точно середина игрового поля */
    transform: translate(-50%, -50%);
    width: 100%;
}

.countdown-text {
    font-size: 32px;
    color: #ff0000;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
    margin-bottom: 30px;
}

.countdown-number {
    font-size: 72px;
    color: white;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

/* Анимации */
@keyframes pulse {
    0% { transform: scale(1); opacity: 0.15; }
    50% { transform: scale(1.1); opacity: 0.4; }
    100% { transform: scale(1); opacity: 0.15; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pulse {
    animation: pulse 2s infinite;
}

.fade-in {
    animation: fadeIn 0.5s forwards;
}

.character-portrait.angry {
    animation: angryAura 1s infinite alternate;
    filter: brightness(1.4) contrast(1.4) hue-rotate(220deg);
}

@keyframes angryAura {
    from {
        box-shadow: 
            0 0 20px rgba(0, 195, 255, 0.5),
            0 0 40px rgba(0, 195, 255, 0.3);
    }
    to {
        box-shadow: 
            0 0 40px rgba(0, 195, 255, 0.7),
            0 0 80px rgba(0, 195, 255, 0.5);
    }
}

/* Эффекты при наведении на персонажей */
.screen.hover-musk {
    background: #cc0000;
}

.screen.hover-zuker {
    background: #0066cc;
}

.character-option {
    cursor: pointer;
    transition: all 0.3s ease;
    height: 100%;
    width: 45%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    padding: 10px;
    border-radius: 10px;
    z-index: 2;
    background: transparent;
    overflow: hidden;
}

.character-option:hover {
    transform: scale(1.05);
    background-color: rgba(255, 255, 255, 0.05);
}

.character-option.selected {
    transform: scale(1.1);
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.character-option.selected .character-img {
    filter: brightness(1.1);
}

/* Уведомления */
.game-notification {
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 10px;
    color: white;
    font-family: 'Press Start 2P', cursive;
    text-align: center;
    font-size: 16px;
    z-index: 300;
    animation: notificationFadeIn 0.5s forwards;
    white-space: nowrap;
}

.game-notification.health {
    background-color: rgba(255, 0, 0, 0.8);
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}

.game-notification.score {
    background-color: rgba(0, 255, 0, 0.8);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

.game-notification.fadeOut {
    animation: notificationFadeOut 0.5s forwards;
}

@keyframes notificationFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes notificationFadeOut {
    from { opacity: 1; transform: translateX(-50%) translateY(0); }
    to { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* Экран окончания игры */
.game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease-in-out;
}

.game-over-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 320px;
    padding: 20px;
}

.game-over-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 32px;
    color: #ff0000;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
    text-align: center;
}

.game-over-score {
    font-family: 'Press Start 2P', cursive;
    font-size: 18px;
    color: white;
    margin-bottom: 30px;
    text-align: center;
}

.share-button, .restart-button {
    padding: 12px 0;
    width: 100%;
    background-color: #ff0000;
    border: none;
    border-radius: 5px;
    font-family: 'Press Start 2P', cursive;
    font-size: 16px;
    color: white;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s;
    margin-bottom: 10px;
}

.share-button {
    background-color: #ff0000;
}

.restart-button {
    background-color: #333;
    margin-top: 30px;
}

.share-button:hover, .restart-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.5);
}

/* Кнопки */
button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

/* Игровые элементы */
#ball, #player-paddle, #opponent-paddle {
    position: absolute;
    z-index: 3;
}

#ball {
    width: 15px;
    height: 15px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    z-index: 3;
    box-shadow: none;
}

#player-paddle, #opponent-paddle {
    width: 15px;
    height: 120px;
    background: #ffffff;
    border-radius: 8px;
}

#player-paddle {
    left: 30px;
}

#opponent-paddle {
    right: 30px;
}

/* Эффекты */
.ball-trail {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: absolute;
    z-index: 4;
    opacity: 1;
    box-shadow: 0 0 15px 8px rgba(255, 255, 255, 0.8);
    filter: blur(1px);
    animation: trailFade 0.4s ease-out forwards;
}

@keyframes trailFade {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.5);
        opacity: 0;
    }
}

.hit-notification {
    position: absolute;
    color: white;
    font-size: 9px;
    font-weight: bold;
    font-family: 'Press Start 2P', cursive !important;
    text-shadow: 
        1px 1px 0 #000, 
        -1px 1px 0 #000, 
        1px -1px 0 #000, 
        -1px -1px 0 #000;
    z-index: 1500;
    white-space: nowrap;
    animation: notifyPulse 1s ease-out;
    letter-spacing: 0.5px;
    transform: translate(-50%, -50%); /* Центрируем относительно точки появления */
    pointer-events: none; /* Чтобы не мешало кликам */
}

.hit-notification.score {
    color: #00ff00;
    font-size: 9px;
}

.hit-notification.lose {
    color: #ff0000;
    font-size: 9px;
}

@keyframes notifyPulse {
    0% { 
        transform: translate(-50%, -50%) scale(0.5); 
        opacity: 0; 
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.2); 
        opacity: 1; 
    }
    100% { 
        transform: translate(-50%, -50%) scale(1); 
        opacity: 1; 
    }
}

.hit-effect {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 5;
    filter: blur(2px);
}

/* Эффекты для портретов после 60 секунд */
.fire-effect {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease;
    z-index: 199;
}

.fire-effect.active {
    opacity: 1;
}

.musk-fire {
    background: 
        radial-gradient(ellipse at center, rgba(255, 0, 0, 0.5) 0%, transparent 70%),
        radial-gradient(ellipse at top, rgba(255, 255, 0, 0.5) 0%, transparent 70%);
    animation: fireFlicker 2s infinite alternate;
}

.zuker-fire {
    background: 
        radial-gradient(ellipse at center, rgba(0, 102, 255, 0.5) 0%, transparent 70%),
        radial-gradient(ellipse at top, rgba(0, 255, 255, 0.5) 0%, transparent 70%);
    animation: fireFlicker 2s infinite alternate-reverse;
}

@keyframes fireFlicker {
    0% { opacity: 0.7; transform: scale(0.95); }
    50% { opacity: 0.9; transform: scale(1.05); }
    100% { opacity: 0.7; transform: scale(0.95); }
}

/* Анимация тряски экрана */
@keyframes screenShake {
    0% { transform: translate(0, 0) rotate(0); }
    10% { transform: translate(-5px, -5px) rotate(-1deg); }
    20% { transform: translate(5px, -5px) rotate(1deg); }
    30% { transform: translate(-5px, 5px) rotate(0); }
    40% { transform: translate(5px, 5px) rotate(1deg); }
    50% { transform: translate(-5px, -5px) rotate(-1deg); }
    60% { transform: translate(5px, -5px) rotate(0); }
    70% { transform: translate(-5px, 5px) rotate(-1deg); }
    80% { transform: translate(5px, 5px) rotate(1deg); }
    90% { transform: translate(-5px, -5px) rotate(0); }
    100% { transform: translate(0, 0) rotate(0); }
}

.screen-shake {
    animation: screenShake 0.5s ease-in-out;
}

/* Тряска экрана - легкая (с 30 секунд) */
@keyframes shakeLight {
    0% { transform: translate(0, 0); }
    25% { transform: translate(1.2px, 1.2px); }
    50% { transform: translate(-1.2px, 0px); }
    75% { transform: translate(0px, -1.2px); }
    100% { transform: translate(0, 0); }
}

/* Тряска экрана - средняя (с 60 секунд) */
@keyframes shakeMedium {
    0% { transform: translate(0, 0); }
    25% { transform: translate(2.4px, 2.4px); }
    50% { transform: translate(-2.4px, 0px); }
    75% { transform: translate(0px, -2.4px); }
    100% { transform: translate(0, 0); }
}

.screen-shake-light {
    animation: shakeLight 0.1s linear infinite;
}

.screen-shake-medium {
    animation: shakeMedium 0.1s linear infinite;
}

/* Тряска экрана - экстремальная (финальная) */
@keyframes shakeExtreme {
    0% { transform: translate(0, 0) rotate(0deg); }
    10% { transform: translate(-12px, -12px) rotate(-3.6deg); }
    20% { transform: translate(14.4px, -16.8px) rotate(4.8deg); }
    30% { transform: translate(-18px, 12px) rotate(-2.4deg); }
    40% { transform: translate(14.4px, 18px) rotate(6deg); }
    50% { transform: translate(-14.4px, -12px) rotate(-6deg); }
    60% { transform: translate(18px, -14.4px) rotate(2.4deg); }
    70% { transform: translate(-12px, 18px) rotate(-6deg); }
    80% { transform: translate(18px, 12px) rotate(4.8deg); }
    90% { transform: translate(-18px, -18px) rotate(-3.6deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

.screen-shake-extreme {
    animation: shakeExtreme 0.3s linear;
}

/* Стили для пузырьков на портретах */
.portrait-bubble {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 3px rgba(255, 255, 255, 0.9);
    filter: blur(0.2px);
    z-index: 201;
    opacity: 1;
    animation: bubblePulse 0.3s infinite alternate;
    will-change: transform, opacity;
}

@keyframes bubblePulse {
    from { 
        transform: scale(1); 
        opacity: 0.9;
        background: rgba(255, 255, 255, 0.8);
    }
    to { 
        transform: scale(1.05); 
        opacity: 1;
        background: rgba(255, 255, 255, 1);
    }
}

/* Эффект вспышки экрана */
.screen-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 300;
    mix-blend-mode: overlay;
    will-change: opacity;
}

/* Экран загрузки */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-content {
    text-align: center;
    width: 80%;
    max-width: 400px;
}

.loading-text {
    font-family: 'Press Start 2P', cursive;
    color: white;
    font-size: 20px;
    margin-bottom: 20px;
    text-transform: uppercase;
    animation: blink 1s infinite alternate;
}

.loading-progress {
    width: 100%;
    height: 20px;
    background-color: #333;
    border: 2px solid #666;
    border-radius: 10px;
    overflow: hidden;
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(to right, #cc0000, #0066cc);
    transition: width 0.3s ease-out;
}

@keyframes blink {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

/* Кнопка начала игры после выбора персонажа */
.start-game-button {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background-color: #ff0000;
    color: white;
    font-family: 'Press Start 2P', cursive;
    padding: 20px 30px;
    border-radius: 10px;
    font-size: 20px;
    cursor: pointer;
    z-index: 500;
    text-align: center;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.7);
    animation: pulse-button 1.5s infinite alternate;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

@keyframes pulse-button {
    from { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 20px rgba(255, 0, 0, 0.7); }
    to { transform: translate(-50%, -50%) scale(1.1); box-shadow: 0 0 30px rgba(255, 0, 0, 0.9); }
}

/* Оптимизация для мобильных устройств */
.low-performance-mode .ball-trail {
    animation-duration: 0.2s;
    box-shadow: 0 0 5px 2px rgba(255, 255, 255, 0.4) !important;
    opacity: 0.6;
    filter: none;
}

.low-performance-mode .hit-effect {
    filter: none;
    width: 30px !important;
    height: 30px !important;
}

.low-performance-mode .portrait-bubble {
    animation: none;
    filter: none;
    box-shadow: none !important;
}

.low-performance-mode .fire-effect {
    animation-duration: 3s;
    opacity: 0.5 !important;
}

.low-performance-mode .screen-flash {
    display: none;
}

.low-performance-mode .screen-shake-extreme,
.low-performance-mode .screen-shake-medium {
    animation: shakeLight 0.1s linear 3;
    animation-iteration-count: 3;
}

/* Исправление для логотипа на мобильных устройствах */
@media (max-width: 768px) {
    .logo {
        gap: 20px;
        padding: 15px;
    }
    
    .main-logo {
        max-width: 250px;
    }
    
    .character-selection {
        margin-top: 100px;
        height: calc(100% - 130px);
        padding: 15px;
    }
    
    .character-option .character-img {
        max-height: 350px;
    }
    
    .character-select-bottom {
        top: 15px;
        padding: 10px;
    }
    
    #selected-character-info {
        font-size: 10px;
        padding: 6px;
    }
    
    #start-game-after-select {
        padding: 10px 15px;
        font-size: 12px;
    }
    
    .energy-particle, 
    .energy-wave {
        opacity: 0.4;
    }
    
    .portrait-bubble {
        animation-duration: 0.5s;
    }
    
    .ball-trail {
        animation-duration: 0.2s;
    }
}

/* Адаптация для Telegram */
@media (max-height: 700px) {
    .character-selection {
        margin-top: 80px;
        height: calc(100% - 120px);
    }
    
    .character-option .character-img {
        max-height: 300px;
    }
    
    .character-select-bottom {
        top: 10px;
        padding: 8px;
    }
    
    #selected-character-info {
        font-size: 9px;
        padding: 5px;
    }
    
    #start-game-after-select {
        padding: 8px 12px;
        font-size: 11px;
    }
}

/* Секция с кнопкой внизу экрана выбора персонажа */
.character-select-bottom {
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    gap: 10px;
    z-index: 99;
    background: rgba(0, 0, 0, 0.8);
    border-bottom: 2px solid rgba(255, 0, 0, 0.8);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.8);
}

#selected-character-info {
    font-family: 'Press Start 2P', cursive;
    color: #ffcc00;
    font-size: 12px;
    text-align: center;
    margin-bottom: 5px;
    padding: 8px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 10px;
    width: 100%;
    max-width: 280px;
}

#start-game-after-select {
    padding: 12px 20px;
    font-size: 14px;
    opacity: 0.6;
    transform: scale(0.95);
    transition: opacity 0.3s, transform 0.3s;
    z-index: 100;
    position: relative;
}

#start-game-after-select:not([disabled]) {
    opacity: 1;
    transform: scale(1.05);
    background: linear-gradient(to right, #ff0000, #ff6600);
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.8), 0 0 40px rgba(255, 255, 0, 0.4);
    animation: pulse-button-character 1.5s infinite alternate;
}

@keyframes pulse-button-character {
    from { transform: scale(1); box-shadow: 0 0 20px rgba(255, 0, 0, 0.8); }
    to { transform: scale(1.08); box-shadow: 0 0 30px rgba(255, 0, 0, 0.9), 0 0 50px rgba(255, 255, 0, 0.5); }
}

/* Стили для диалога шеринга */
.share-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.share-dialog-content {
    background-color: #111;
    border: 2px solid #ff0000;
    border-radius: 10px;
    max-width: 90%;
    width: 350px;
    padding: 20px;
    color: white;
    font-family: 'Press Start 2P', cursive;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.share-dialog-content h3 {
    font-size: 18px;
    margin-bottom: 10px;
    text-align: center;
    color: #ff0000;
}

.share-text {
    background-color: rgba(0, 0, 0, 0.7);
    border: 1px solid #333;
    border-radius: 5px;
    padding: 15px;
    font-size: 12px;
    line-height: 1.5;
    max-height: 300px;
    overflow-y: auto;
    width: 100%;
    white-space: pre-wrap;
}

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

.copy-button, .close-button {
    width: 100%;
    padding: 10px;
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
}

.copy-button {
    background-color: #ff0000;
    color: white;
}

.close-button {
    background-color: #333;
    color: white;
}

@media (max-width: 480px) {
    .screen {
        max-width: 100%;
        height: 100vh;
    }

    .logo {
        gap: 15px;
        padding: 10px;
        transform: translateY(-10%);
    }

    .main-logo {
        max-width: 200px;
    }

    .start-button { 
        padding: 10px 20px; 
        font-size: 12px; 
    }

    .game-stats { 
        font-size: 8px;
        padding: 5px;
    }

    .character-selection {
        margin-top: 60px;
        height: calc(100% - 100px);
        padding: 10px;
    }

    .character-option .character-img {
        max-height: 250px;
    }

    .vs-logo {
        width: 80px;
    }

    .character-option h3 {
        font-size: 12px;
        margin-top: 10px;
    }

    #selected-character-info {
        font-size: 8px;
        padding: 5px;
    }

    .countdown-text {
        font-size: 24px;
    }

    .countdown-number {
        font-size: 48px;
    }

    .hit-notification {
        font-size: 8px;
    }

    .game-over-title {
        font-size: 24px;
    }

    .game-over-score {
        font-size: 14px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .screen {
        max-width: 480px;
    }

    .logo {
        gap: 20px;
        padding: 15px;
    }

    .main-logo {
        max-width: 250px;
    }

    .start-button { 
        padding: 12px 25px; 
        font-size: 14px; 
    }

    .game-stats { 
        font-size: 10px;
        padding: 8px;
    }

    .character-selection {
        margin-top: 80px;
        height: calc(100% - 120px);
    }

    .character-option .character-img {
        max-height: 300px;
    }

    .vs-logo {
        width: 100px;
    }

    #selected-character-info {
        font-size: 10px;
        padding: 6px;
    }
}

@media (min-width: 769px) {
    .screen {
        max-width: 100vw;
        height: var(--tg-viewport-height, 100svh);
    }

    .logo {
        gap: 30px;
    }

    .main-logo {
        max-width: 300px;
    }

    .start-button { 
        padding: 15px 40px; 
        font-size: 18px; 
    }

    .game-stats { 
        font-size: 12px;
        padding: 10px;
    }

    .character-selection {
        margin-top: 100px;
        height: calc(100% - 150px);
    }

    .character-option .character-img {
        max-height: 400px;
    }

    .vs-logo {
        width: 120px;
    }

    #selected-character-info {
        font-size: 12px;
        padding: 8px;
    }
}

@media (max-height: 600px) {
    .character-selection {
        margin-top: 50px;
        height: calc(100% - 80px);
    }

    .character-option .character-img {
        max-height: 200px;
    }

    .character-select-bottom {
        top: 5px;
        padding: 5px;
    }

    #selected-character-info {
        font-size: 8px;
        padding: 4px;
        margin-bottom: 2px;
    }

    #start-game-after-select {
        padding: 6px 10px;
        font-size: 10px;
    }

    .game-stats {
        padding: 5px;
    }
}

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .character-option .character-img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }

    .main-logo {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

@media (hover: hover) {
    .start-button:hover {
        transform: scale(1.1);
        box-shadow: 0 0 25px rgba(255, 0, 0, 0.7);
    }

    .character-option:hover {
        transform: scale(1.05);
        background-color: rgba(255, 255, 255, 0.08);
    }

    .share-button:hover, 
    .restart-button:hover {
        transform: scale(1.05);
        box-shadow: 0 0 20px rgba(255, 0, 0, 0.6);
    }
}

@media (hover: none) {
    .character-option:active {
        transform: scale(1.02);
        background-color: rgba(255, 255, 255, 0.05);
    }

    .start-button:active {
        transform: scale(1.05);
    }
}

.low-performance-mode {
    .ball-trail {
        animation-duration: 0.2s;
        box-shadow: 0 0 5px 2px rgba(255, 255, 255, 0.4);
        opacity: 0.6;
        filter: none;
    }

    .hit-effect {
        filter: none;
        width: 20px !important;
        height: 20px !important;
    }

    .portrait-bubble {
        animation: none;
        filter: none;
        box-shadow: none;
    }

    .fire-effect {
        animation-duration: 3s;
        opacity: 0.3 !important;
    }

    .screen-flash {
        display: none;
    }

    .screen-shake-extreme,
    .screen-shake-medium {
        animation: shakeLight 0.1s linear;
        animation-iteration-count: 2;
    }
} 