/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    color: #fff;
}

/* Lives Counter */
.lives-counter {
    position: fixed;
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 100;
}

.lives-label {
    font-size: 20px;
    font-weight: bold;
    color: #F7568D;
    text-shadow: 0 0 10px rgba(247, 86, 141, 0.5);
}

.lives-icons {
    display: flex;
    gap: 8px;
}

.life-icon {
    font-size: 24px;
    filter: drop-shadow(0 0 5px rgba(247, 86, 141, 0.5));
    transition: all 0.3s ease;
}

.life-icon.lost {
    opacity: 0.3;
    filter: grayscale(100%);
}

/* Game Container */
.game-container {
    text-align: center;
    width: 100%;
    max-width: 600px;
    padding: 20px;
}

.game-title {
    font-size: 32px;
    margin-bottom: 40px;
    color: #F7568D;
    text-shadow: 0 0 20px rgba(247, 86, 141, 0.6);
    letter-spacing: 2px;
}

/* Game Board */
.game-board {
    perspective: 1000px;
    display: flex;
    flex-direction: column-reverse;
    gap: 15px;
    justify-content: flex-start;
    align-items: center;
    padding: 20px 0;
    max-height: 70vh;
    overflow-y: auto;
}

.step-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    transform-style: preserve-3d;
    position: relative;
    transition: all 0.3s ease;
    opacity: 0.5;
}

.step-container.active {
    opacity: 1;
    transform: scale(1.1);
}

.step-container.completed {
    opacity: 0.6;
}

.step-container.completed .glass-panel {
    background: linear-gradient(135deg,
        rgba(52, 209, 191, 0.3) 0%,
        rgba(52, 209, 191, 0.1) 100%);
    border-color: rgba(52, 209, 191, 0.6);
}

.step-number {
    position: absolute;
    left: -40px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    font-weight: bold;
    color: #34D1BF;
    text-shadow: 0 0 10px rgba(52, 209, 191, 0.5);
}

.player-position {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    filter: drop-shadow(0 0 15px rgba(34, 197, 94, 0.9)) drop-shadow(0 0 25px rgba(22, 163, 74, 0.6));
    animation: playerPulse 2s ease-in-out infinite;
    z-index: 10;
    pointer-events: none;
}

@keyframes playerPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        filter: drop-shadow(0 0 15px rgba(34, 197, 94, 0.9)) drop-shadow(0 0 25px rgba(22, 163, 74, 0.6));
    }
    50% {
        transform: translate(-50%, -50%) scale(1.15);
        filter: drop-shadow(0 0 20px rgba(34, 197, 94, 1)) drop-shadow(0 0 35px rgba(22, 163, 74, 0.8));
    }
}

/* Glass Panels */
.glass-panel {
    width: 100px;
    height: 120px;
    background: linear-gradient(135deg,
        rgba(52, 209, 191, 0.15) 0%,
        rgba(52, 209, 191, 0.05) 50%,
        rgba(52, 209, 191, 0.15) 100%);
    border: 3px solid rgba(52, 209, 191, 0.4);
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow:
        0 8px 32px rgba(52, 209, 191, 0.2),
        inset 0 0 20px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.glass-panel.disabled {
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none;
}

.glass-panel:hover {
    transform: translateY(-10px) scale(1.05);
    border-color: rgba(52, 209, 191, 0.7);
    box-shadow:
        0 12px 40px rgba(52, 209, 191, 0.4),
        inset 0 0 30px rgba(255, 255, 255, 0.1);
}

.glass-panel:active {
    transform: translateY(-5px) scale(1.02);
}

/* Glass shine effect */
.glass-shine {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) translateY(-100%);
    }
    100% {
        transform: translateX(100%) translateY(100%);
    }
}

/* Panel states */
.glass-panel.correct {
    background: linear-gradient(135deg,
        rgba(52, 209, 191, 0.4) 0%,
        rgba(52, 209, 191, 0.2) 100%);
    border-color: rgba(52, 209, 191, 0.8);
    animation: glow-correct 0.5s ease;
}

.glass-panel.wrong {
    background: linear-gradient(135deg,
        rgba(247, 86, 141, 0.4) 0%,
        rgba(247, 86, 141, 0.2) 100%);
    border-color: rgba(247, 86, 141, 0.8);
    animation: shatter 0.6s ease forwards;
}

@keyframes glow-correct {
    0%, 100% {
        box-shadow: 0 8px 32px rgba(52, 209, 191, 0.2);
    }
    50% {
        box-shadow: 0 8px 60px rgba(52, 209, 191, 0.8);
    }
}

@keyframes shatter {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
        visibility: hidden;
    }
}

.glass-panel.broken {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Start Button */
.start-button {
    margin-top: 40px;
    padding: 15px 40px;
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #F7568D 0%, #d63a72 100%);
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(247, 86, 141, 0.4);
}

.start-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(247, 86, 141, 0.6);
}

.start-button:active {
    transform: translateY(-1px);
}

.start-button.hidden {
    display: none;
}

/* Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.overlay.active {
    display: flex;
}

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

/* Modal */
.modal {
    background: linear-gradient(135deg, #2a2a4e 0%, #1f1f3a 100%);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    border: 3px solid #F7568D;
    box-shadow: 0 0 50px rgba(247, 86, 141, 0.5);
    animation: slideUp 0.4s ease;
    max-width: 90%;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-title {
    font-size: 36px;
    margin-bottom: 20px;
    color: #F7568D;
    text-shadow: 0 0 20px rgba(247, 86, 141, 0.6);
}

.modal-title.victory {
    color: #34D1BF;
    text-shadow: 0 0 20px rgba(52, 209, 191, 0.6);
}

.modal-message {
    font-size: 20px;
    margin-bottom: 30px;
    color: #fff;
}

.stats {
    margin: 20px 0;
    font-size: 18px;
}

.stats p {
    margin: 10px 0;
    color: #34D1BF;
}

.restart-button {
    margin-top: 20px;
    padding: 12px 35px;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #34D1BF 0%, #2ab3a3 100%);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 209, 191, 0.4);
}

.restart-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(52, 209, 191, 0.6);
}

/* Falling Player Animation */
.falling-player {
    position: fixed;
    font-size: 48px;
    pointer-events: none;
    opacity: 0;
    z-index: 500;
}

.falling-player.falling {
    animation: fall 1.2s ease-in forwards;
}

@keyframes fall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: translateY(200px) rotate(180deg);
    }
    100% {
        opacity: 0;
        transform: translateY(120vh) rotate(360deg);
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .game-title {
        font-size: 24px;
        margin-bottom: 30px;
    }

    .glass-panel {
        width: 90px;
        height: 110px;
    }

    .step-container {
        gap: 15px;
    }

    .lives-label {
        font-size: 18px;
    }

    .life-icon {
        font-size: 20px;
    }

    .step-number {
        left: -35px;
        font-size: 16px;
    }

    .player-position {
        font-size: 40px;
    }

    .modal {
        padding: 30px 20px;
    }

    .modal-title {
        font-size: 28px;
    }

    .modal-message {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .glass-panel {
        width: 80px;
        height: 100px;
    }

    .step-container {
        gap: 12px;
    }

    .game-title {
        font-size: 20px;
    }

    .start-button {
        padding: 12px 30px;
        font-size: 18px;
    }

    .lives-label {
        font-size: 16px;
    }

    .life-icon {
        font-size: 18px;
    }

    .step-number {
        left: -30px;
        font-size: 14px;
    }

    .player-position {
        font-size: 36px;
    }
}
