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

body {
    background-color: black;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.video-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gif-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.gif-image.paused {
    animation-play-state: paused;
}

.video-container.hidden {
    display: none;
}

.video-container.centered {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 100 !important;
    grid-column: unset !important;
    grid-row: unset !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
}

.controls {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 15px;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 15px 25px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    z-index: 1000;
}

.controls button {
    background-color: #fff;
    color: #000;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.controls button:hover {
    background-color: #ddd;
}

.controls button:active {
    background-color: #bbb;
}

.duration-display {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    min-width: 120px;
    text-align: center;
}

.play-button {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #000;
    border: none;
    padding: 12px 40px;
    font-size: 24px;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
}

.play-button:hover {
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 12px 30px rgba(255, 215, 0, 0.6);
}

.play-button:active {
    transform: translateX(-50%) scale(0.95);
}

.play-button.playing {
    background: transparent;
    box-shadow: none;
    padding: 0;
    width: 100px;
    height: 100px;
    animation: shake 0.3s infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-button.playing img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    display: none;
}

@keyframes shake {
    0%, 100% { 
        transform: translateX(-50%) rotate(0deg) scale(1, 1); 
    }
    10% { 
        transform: translateX(-50%) rotate(-5deg) scale(1.15, 0.9); 
    }
    20% { 
        transform: translateX(-50%) rotate(5deg) scale(0.9, 1.15); 
    }
    30% { 
        transform: translateX(-50%) rotate(-5deg) scale(1.1, 0.95); 
    }
    40% { 
        transform: translateX(-50%) rotate(5deg) scale(0.95, 1.1); 
    }
    50% { 
        transform: translateX(-50%) rotate(-3deg) scale(1.08, 0.92); 
    }
    60% { 
        transform: translateX(-50%) rotate(3deg) scale(0.92, 1.08); 
    }
    70% { 
        transform: translateX(-50%) rotate(-2deg) scale(1.05, 0.95); 
    }
    80% { 
        transform: translateX(-50%) rotate(2deg) scale(0.95, 1.05); 
    }
    90% { 
        transform: translateX(-50%) rotate(-1deg) scale(1.02, 0.98); 
    }
}

.instruction-text {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    z-index: 1000;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.instruction-text .desktop {
    display: block;
}

.instruction-text .mobile {
    display: none;
}

.spinner-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: black;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner-container.hidden {
    display: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 215, 0, 0.3);
    border-top: 6px solid #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.nav-icon {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #ff8c00;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1001;
}

.nav-icon:hover {
    transform: scale(1.1);
    border-color: #ffa500;
}

.nav-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shakes-counter {
    position: fixed;
    top: 20px;
    right: 20px;
    font-family: 'Press Start 2P', cursive;
    font-size: 20px;
    font-weight: bold;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 15px;
}

.shakes-counter .label {
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(255, 215, 0, 0.8), 0 0 10px rgba(255, 215, 0, 0.5);
}

.shakes-counter .value {
    color: #ff8c00;
    text-shadow: 2px 2px 4px rgba(255, 140, 0, 0.8), 0 0 10px rgba(255, 140, 0, 0.5);
}

.shakes-animation {
    position: fixed;
    font-family: 'Press Start 2P', cursive;
    font-size: 24px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 1002;
    animation: floatUp 1s ease-out forwards;
    will-change: transform, opacity;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate3d(0, -150px, 0) scale(1.5);
    }
}

@media (max-width: 768px) {
    .instruction-text .desktop {
        display: none;
    }
    .instruction-text .mobile {
        display: block;
    }

    body {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
    }

    .video-container:nth-child(5) {
        grid-column: auto;
        grid-row: auto;
    }

    .video-container {
        display: flex;
        justify-content: center;
    }

    .video-container.row-1 {
        align-items: flex-end;
        padding-top: 20%;
    }

    .video-container.row-2 {
        align-items: flex-start;
        padding-bottom: 20%;
        margin-top: -20%;
    }

    .spinner-container {
        align-items: center;
        z-index: 9999;
    }

    .spinner-container.hidden {
        display: none;
    }

    .spinner {
        width: 60px;
        height: 60px;
        border: 6px solid rgba(255, 215, 0, 0.3);
        border-top: 6px solid #ffd700;
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

    .play-button {
        padding: 12px 50px;
        font-size: 28px;
        bottom: 30px;
        touch-action: manipulation;
    }
}
