/* Tram Energy Collector Game Styles */

#tram-game-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

#tram-game-overlay.active {
    display: flex;
}

#tram-game-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
}

#tram-game-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s;
}

#tram-game-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

#tram-game-header {
    text-align: center;
    color: white;
    margin-bottom: 20px;
}

#tram-game-header h2 {
    margin: 0 0 10px 0;
    font-size: 28px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

#tram-game-score {
    display: flex;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px;
    border-radius: 10px;
    color: white;
    font-weight: bold;
}

#tram-game-canvas {
    width: 800px;
    height: 500px;
    background: linear-gradient(to bottom, #87CEEB 0%, #98D8E8 50%, #5FA777 100%);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
}

/* Railway track */
.railway-track {
    position: absolute;
    bottom: 150px;
    left: 0;
    width: 100%;
    height: 4px;
    background: #333;
    box-shadow: 0 2px 0 #333, 0 -2px 0 #333;
}

.railway-sleeper {
    position: absolute;
    bottom: 145px;
    width: 60px;
    height: 14px;
    background: #654321;
    border-radius: 2px;
}

/* Tram */
#tram {
    position: absolute;
    left: 50px;
    bottom: 160px;
    width: 80px;
    height: 50px;
    transition: left 0.5s ease;
}

.tram-body {
    width: 80px;
    height: 40px;
    background: linear-gradient(to bottom, #E74C3C 0%, #C0392B 100%);
    border-radius: 10px 10px 5px 5px;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.tram-window {
    width: 20px;
    height: 15px;
    background: rgba(135, 206, 235, 0.7);
    border-radius: 3px;
    position: absolute;
    top: 8px;
    border: 2px solid #555;
}

.tram-window:nth-child(1) { left: 10px; }
.tram-window:nth-child(2) { left: 35px; }
.tram-window:nth-child(3) { right: 10px; }

.tram-wheels {
    display: flex;
    justify-content: space-around;
    position: absolute;
    bottom: -8px;
    width: 100%;
}

.wheel {
    width: 12px;
    height: 12px;
    background: #333;
    border-radius: 50%;
    border: 2px solid #666;
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Station */
.station {
    position: absolute;
    bottom: 220px;
    width: 100px;
    text-align: center;
}

.station-sign {
    background: #3498DB;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    margin-bottom: 5px;
}

.station-pole {
    width: 4px;
    height: 60px;
    background: #555;
    margin: 0 auto;
}

/* Energy bubble */
.energy-bubble {
    position: absolute;
    width: 40px;
    height: 40px;
    background: radial-gradient(circle at 30% 30%, #FFD700, #FFA500);
    border-radius: 50%;
    cursor: pointer;
    animation: float 2s ease-in-out infinite, pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    transition: all 0.3s;
}

.energy-bubble::before {
    content: '⚡';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
}

.energy-bubble:hover {
    transform: scale(1.2);
}

.energy-bubble.collected {
    animation: collect 0.5s ease-out forwards;
}

/* Malus bubble style */
.energy-bubble.malus {
    background: radial-gradient(circle at 30% 30%, #FF4444, #CC0000);
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
    animation: float 2s ease-in-out infinite, pulse 1.5s ease-in-out infinite, shake 0.5s ease-in-out infinite;
}

.energy-bubble.malus::before {
    content: '☠️';
    font-size: 20px;
}

@keyframes shake {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes collect {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2) translateY(-100px);
        opacity: 0;
    }
}

/* Final shot screen */
#final-shot-screen {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    z-index: 5;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
}

#final-shot-screen.active {
    display: flex;
}

.goal-animation {
    width: 300px;
    height: 200px;
    position: relative;
    margin: 30px auto;
}

.goal-net {
    width: 100%;
    height: 100%;
    border: 4px solid white;
    position: relative;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 20px,
        rgba(255, 255, 255, 0.1) 20px,
        rgba(255, 255, 255, 0.1) 21px
    ),
    repeating-linear-gradient(
        90deg,
        transparent,
        transparent 20px,
        rgba(255, 255, 255, 0.1) 20px,
        rgba(255, 255, 255, 0.1) 21px
    );
}

.ball {
    width: 30px;
    height: 30px;
    background: radial-gradient(circle at 30% 30%, white, #ddd);
    border-radius: 50%;
    position: absolute;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.ball.shot-simple {
    animation: shotSimple 1.5s ease-out forwards;
}

.ball.shot-lucarne {
    animation: shotLucarne 1.5s ease-out forwards;
}

.ball.shot-spectacular {
    animation: shotSpectacular 2s ease-out forwards;
}

@keyframes shotSimple {
    0% {
        bottom: -50px;
        left: 50%;
        transform: translateX(-50%);
    }
    100% {
        bottom: 50%;
        left: 50%;
        transform: translateX(-50%);
    }
}

@keyframes shotLucarne {
    0% {
        bottom: -50px;
        left: 50%;
        transform: translateX(-50%) rotate(0deg);
    }
    100% {
        bottom: 90%;
        left: 80%;
        transform: translateX(-50%) rotate(720deg);
    }
}

@keyframes shotSpectacular {
    0% {
        bottom: -50px;
        left: 50%;
        transform: translateX(-50%) rotate(0deg) scale(1);
    }
    50% {
        bottom: 120%;
        left: 30%;
        transform: translateX(-50%) rotate(1080deg) scale(1.5);
    }
    100% {
        bottom: 85%;
        left: 85%;
        transform: translateX(-50%) rotate(1440deg) scale(1);
    }
}

.final-message {
    font-size: 32px;
    font-weight: bold;
    text-align: center;
    margin: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.final-score {
    font-size: 24px;
    margin: 10px;
}

.replay-button {
    background: linear-gradient(to bottom, #27AE60, #229954);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 30px;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
}

.replay-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

/* Start screen */
#start-screen {
    display: flex;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 10;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
}

#start-screen.hidden {
    display: none;
}

#start-screen h3 {
    font-size: 32px;
    margin-bottom: 20px;
}

#start-screen p {
    font-size: 18px;
    margin: 10px 0;
    max-width: 600px;
}

.start-button {
    background: linear-gradient(to bottom, #E74C3C, #C0392B);
    color: white;
    border: none;
    padding: 20px 50px;
    font-size: 24px;
    border-radius: 40px;
    cursor: pointer;
    margin-top: 30px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
    font-weight: bold;
}

.start-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.4);
}

/* Responsive */
@media (max-width: 850px) {
    #tram-game-canvas {
        width: 90vw;
        height: 60vh;
    }

    #tram-game-header h2 {
        font-size: 20px;
    }

    #tram {
        width: 60px;
        height: 40px;
    }

    .tram-body {
        width: 60px;
        height: 30px;
    }

    .energy-bubble {
        width: 30px;
        height: 30px;
    }

    .energy-bubble::before {
        font-size: 18px;
    }
}
