/* Professional Game Studio Look & Feel */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&family=Poppins:wght@500;700&display=swap');

:root {
    --primary: #4A55E5;
    --primary-light: #6A73FF;
    --primary-dark: #2A34B5;
    --accent: #FF8A00;
    --success: #2ecc71;
    --dark: #0A1128;
    --darker: #08091D;
    --light: #F2F3FF;
    --gray: #8790AB;
    --pole-color: #5D6987;
    --pole-base: #4A55E5;
    --pole-shadow: rgba(0, 0, 0, 0.2);
    --red: #FF5757;
    --blue: #4A9CFF;
    --green: #4CE0B3;
    --yellow: #FFDE59;
    --orange: #FF8A00;
    --purple: #9C6AFF;
}

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

body {
    font-family: 'Montserrat', sans-serif;
    background: linear-gradient(135deg, var(--darker) 0%, var(--dark) 100%);
    color: var(--light);
    height: 100vh;
    overflow: hidden;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23293462' fill-opacity='0.07' fill-rule='evenodd'/%3E%3C/svg%3E");
    opacity: 0.5;
    z-index: 0;
}

.game-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 1.5rem 1.5rem 2.5rem 1.5rem;
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    overflow: hidden;
    justify-content: space-between;
}

.game-header {
    text-align: center;
    margin-bottom: 1rem;
    position: relative;
}

.game-header h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(to right, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 2px 10px rgba(74, 85, 229, 0.2);
    letter-spacing: 1px;
    position: relative;
}

.game-header h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(to right, var(--primary), var(--accent));
    border-radius: 2px;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: nowrap;
}

/* Button base styling */
button {
    background: linear-gradient(135deg, #2B3253, #424869);
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 4px;
    font-family: 'Arial', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    outline: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
    z-index: 1;
}

button::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 1;
}

#start-button {
    background: linear-gradient(135deg, var(--accent), #FF6B2B);
    color: white;
}

#restart-button {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}

#hint-button {
    background: linear-gradient(135deg, #2B3253, #424869);
    color: white;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

button:disabled {
    background: linear-gradient(135deg, #565B73, #646B87);
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    opacity: 0.7;
}

/* Game board layout */
#game-board {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    height: auto;
    min-height: 319px;
    margin-top: 0;
    margin-bottom: 30px;
    padding: 20px 0 0 0;
    position: relative;
    perspective: 1000px;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    align-self: flex-end;
}

#game-board::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, 
        rgba(74, 85, 229, 0), 
        rgba(74, 85, 229, 0.5), 
        rgba(74, 85, 229, 0)
    );
    z-index: 1;
}

/* Hide scrollbar for Chrome, Safari and Opera */
#game-board::-webkit-scrollbar {
    display: none;
}

/* Pole container - each holds a pole and cubes */
.pole-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 15px;
    position: relative;
    width: 80px;
    height: 319px; /* Reduced from 350px by 31px (28px cube height + 3px margin) */
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.pole-container:hover {
    transform: translateY(-5px);
}

/* The pole itself */
.pole {
    width: 14px;
    height: 100%;
    background: linear-gradient(90deg, 
        rgba(0, 0, 0, 0.2), 
        var(--pole-color), 
        var(--pole-color),
        rgba(255, 255, 255, 0.1)
    );
    border-radius: 7px;
    position: absolute;
    bottom: 0;
    z-index: 1;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2),
                inset 0 1px 2px rgba(255, 255, 255, 0.1);
}

.pole::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 15px;
    background: linear-gradient(to bottom, var(--primary), transparent);
    border-radius: 2px;
}

/* Bottom base with glowing effect */
.pole-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 80px;
    height: 16px;
    background: linear-gradient(to bottom, var(--pole-base), var(--primary-dark));
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(74, 85, 229, 0.5),
                0 -2px 4px rgba(0, 0, 0, 0.3) inset;
    z-index: 1;
    animation: baseGlow 3s infinite alternate;
}

@keyframes baseGlow {
    0% {
        box-shadow: 0 2px 10px rgba(74, 85, 229, 0.5),
                    0 -2px 4px rgba(0, 0, 0, 0.3) inset;
    }
    100% {
        box-shadow: 0 2px 15px rgba(74, 85, 229, 0.8),
                    0 -2px 4px rgba(0, 0, 0, 0.3) inset;
    }
}

/* Container for the cubes on a pole */
.pole-cubes {
    position: absolute;
    bottom: 16px; /* Position above the base */
    width: 100%;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    z-index: 2;
}

/* Individual cube styling */
.cube {
    width: 60px;
    height: 28px;
    border-radius: 6px;
    margin-bottom: 3px;
    cursor: grab;
    transition: transform 0.2s ease-out, box-shadow 0.2s ease;
    z-index: 2;
    position: relative;
    transform-style: preserve-3d;
}

/* 3D cube effect with top and side faces */
.cube::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 0;
    width: 100%;
    height: 5px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 6px 6px 0 0;
    transform: rotateX(90deg);
    transform-origin: bottom;
}

.cube::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2),
                inset 0 1px 3px rgba(255, 255, 255, 0.3);
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 0.2),
        rgba(0, 0, 0, 0.1)
    );
}

.cube:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.cube.dragging {
    opacity: 0.8;
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    filter: brightness(1.1);
}

/* Modern color palette with gradients for cubes */
.cube--red { 
    background: linear-gradient(135deg, #FF5757, #FF3030);
    box-shadow: 0 4px 8px rgba(255, 87, 87, 0.5);
}

.cube--blue { 
    background: linear-gradient(135deg, #4A9CFF, #2F80ED);
    box-shadow: 0 4px 8px rgba(74, 156, 255, 0.5);
}

.cube--green { 
    background: linear-gradient(135deg, #4CE0B3, #2DCB98);
    box-shadow: 0 4px 8px rgba(76, 224, 179, 0.5);
}

.cube--yellow { 
    background: linear-gradient(135deg, #FFDE59, #FFC926);
    box-shadow: 0 4px 8px rgba(255, 222, 89, 0.5);
}

.cube--orange { 
    background: linear-gradient(135deg, #FF8A00, #FF6B00);
    box-shadow: 0 4px 8px rgba(255, 138, 0, 0.5);
}

.cube--purple { 
    background: linear-gradient(135deg, #9C6AFF, #7C3AFF);
    box-shadow: 0 4px 8px rgba(156, 106, 255, 0.5);
}

/* Enhanced animations */
@keyframes dropCube {
    0% { transform: translateY(-20px) scale(1.1); }
    40% { transform: translateY(5px) scale(1); }
    60% { transform: translateY(-8px) scale(1.05); }
    80% { transform: translateY(2px) scale(1); }
    100% { transform: translateY(0) scale(1); }
}

.cube-dropped {
    animation: dropCube 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

/* Pole highlighting with modern glow effects */
.pole-container.can-drop .pole {
    box-shadow: 0 0 15px var(--success);
}

.pole-container.can-drop::after {
    box-shadow: 0 2px 15px var(--success),
                0 -2px 4px rgba(0, 0, 0, 0.3) inset;
    animation: none;
}

.pole-container.active-target .pole {
    box-shadow: 0 0 20px var(--success);
}

.pole-container.active-target::after {
    background: linear-gradient(to bottom, var(--success), #27ae60);
    box-shadow: 0 2px 20px var(--success),
                0 -2px 4px rgba(0, 0, 0, 0.3) inset;
    animation: targetPulse 0.6s infinite alternate;
}

@keyframes targetPulse {
    0% {
        box-shadow: 0 2px 15px var(--success),
                    0 -2px 4px rgba(0, 0, 0, 0.3) inset;
    }
    100% {
        box-shadow: 0 2px 25px var(--success),
                    0 -2px 4px rgba(0, 0, 0, 0.3) inset;
    }
}

/* Win Screen - Professional celebration effect */
#win-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.9) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    animation: fadeIn 0.5s forwards;
}

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

/* Win screen content with particles */
.win-content {
    background: linear-gradient(135deg, var(--dark), #141C3A);
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    animation: celebrate 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 90%;
}

/* Celebration confetti effect */
.win-content::before {
    content: '';
    position: absolute;
    width: 150%;
    height: 150%;
    background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 80c4 0 8-2 12-2s8 2 12 2 8-2 12-2 8 2 12 2c4 0 8-2 12-20 0-1.1-2-5-2-5l-2-3c-1-1.1-2-4-2-5 0-1.1 1-2 1-3 0-1.1-1-2-1-3c0-1.1-1-2-1-3s1-2 1-3c0-1.9-1.2-3-2.2-4-1.1-1-2-2-3-4.2-1-2.1-2-4-2-6C89 5.9 70 3 50 3S11 5.9 11 15c0 2 0 2.3-1 4.3-1 2.1-2 3.1-3 4.2-1 1-1.2 2.1-2.2 4-1 1.9-1 2.9-1 4 0 1.1 1 2 1 3s-1 2-1 3c0 1.1 1 2 1 3s-1 2-1 3c0 1.1 1 2 1 3 0 1.1-1 2-1 3 0 1.1 1 3 1 4 0 0.5-11 25.2-11 25.2L-8 78c0 0.2 15 2 19 2z' fill='%23FF6B00' fill-opacity='0.18'/%3E%3C/svg%3E") repeat;
    top: -25%;
    left: -25%;
    animation: confetti 12s linear infinite;
    opacity: 0.8;
    mix-blend-mode: screen;
}

@keyframes confetti {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(500px) rotate(45deg); }
}

.win-content h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(to right, var(--success), #4CAF50);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 2px 10px rgba(46, 204, 113, 0.2);
}

.win-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: var(--light);
    opacity: 0.9;
}

#play-again-button {
    background: linear-gradient(135deg, var(--success), #4CAF50);
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 1rem 2rem;
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.5);
}

#play-again-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(46, 204, 113, 0.7);
}

.hidden {
    display: none !important;
}

/* Enhanced win animation */
@keyframes celebrate {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.1); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); opacity: 1; }
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .game-header h1 {
        font-size: 1.8rem;
    }
    
    .game-controls {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    
    button {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }
    
    button i {
        font-size: 0.9rem;
    }
    
    #game-board {
        min-height: 293px; /* Reduced from 320px by 27px (24px cube height + 3px margin) */
        margin-bottom: 30px; /* Maintain 30px space below on tablets */
    }
    
    .pole-container {
        margin: 0 10px;
        width: 65px;
        height: 293px; /* Reduced from 320px by 27px (24px cube height + 3px margin) */
    }
    
    .pole-container::after {
        width: 65px;
    }
    
    .cube {
        width: 50px;
        height: 24px;
    }
    
    .win-stars i {
        font-size: 2rem;
    }
    
    .win-stars i:nth-child(2) {
        font-size: 2.5rem;
    }
    
    .move-counter {
        font-size: 1rem;
        padding: 0.4rem 0.8rem;
        margin: 0.3rem auto;
    }
    
    .new-high-score {
        font-size: 1.1rem;
    }
    
    .stat-item {
        padding: 0.8rem 1.2rem;
        min-width: 100px;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .stat-value {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .game-header h1 {
        font-size: 1.5rem;
    }
    
    .game-header {
        margin-bottom: 0.5rem;
    }
    
    .game-controls {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.4rem;
    }
    
    button {
        padding: 0.45rem 0.7rem;
        font-size: 0.8rem;
    }
    
    button i {
        margin-right: 0.1rem;
    }
    
    #game-board {
        min-height: 257px; /* Reduced from 280px by 23px (20px cube height + 3px margin) */
        margin-bottom: 30px; /* Maintain 30px space below on mobile */
    }
    
    .pole-container {
        margin: 0 7px;
        width: 50px;
        height: 257px; /* Reduced from 280px by 23px (20px cube height + 3px margin) */
    }
    
    .pole-container::after {
        width: 50px;
    }
    
    .cube {
        width: 40px;
        height: 20px;
    }
    
    .win-content {
        padding: 2rem;
    }
    
    .win-content h2 {
        font-size: 2rem;
    }
    
    .win-stats {
        gap: 1rem;
    }
    
    .stat-item {
        padding: 0.6rem 1rem;
        min-width: 90px;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
}

/* Desktop-specific styles */
@media (min-width: 1000px) {
    #game-board {
        justify-content: space-around;
        padding: 0 2rem;
        min-height: 319px; /* Reduced from 350px by 31px (28px cube height + 3px margin) */
        margin-bottom: 30px; /* Maintain 30px space below on desktop */
    }
    
    .pole-container {
        margin: 0 15px;
    }
    
    .game-header h1 {
        font-size: 2.5rem;
    }
}

.game-header h1 span {
    color: var(--accent);
    position: relative;
}

.game-header h1 span::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
}

/* Win screen stars animation */
.win-stars {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.win-stars i {
    font-size: 2.5rem;
    color: var(--accent);
    animation: starPulse 2s infinite alternate;
}

.win-stars i:nth-child(1) {
    animation-delay: 0s;
}

.win-stars i:nth-child(2) {
    animation-delay: 0.3s;
    font-size: 3rem;
}

.win-stars i:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes starPulse {
    0% {
        transform: scale(1) rotate(0deg);
        filter: drop-shadow(0 0 5px var(--accent));
    }
    100% {
        transform: scale(1.2) rotate(5deg);
        filter: drop-shadow(0 0 15px var(--accent));
    }
}

/* Add button icon styling */
button i {
    margin-right: 0.1rem; /* Reduce margin to avoid squishing */
    font-size: 1rem;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
}

/* Confetti particles for win animation */
.confetti-particle {
    position: fixed;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    z-index: 100;
    animation: fall 4s ease-out forwards;
    pointer-events: none;
}

@keyframes fall {
    0% {
        transform: translateY(0vh) rotate(0deg) scale(1);
        opacity: 1;
    }
    70% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg) scale(0.5);
        opacity: 0;
    }
}

/* For mobile devices, make sure the game board is at the bottom */
@media (max-height: 700px) {
    .game-header {
        margin-bottom: 0.5rem;
    }
    
    .game-controls {
        margin-bottom: 0.5rem;
    }
    
    #game-board {
        padding-top: 10px; /* Less padding on top for smaller height screens */
    }
}

/* Move counter styling */
.move-counter {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 17, 40, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 1rem;
    padding: 0.6rem 1.2rem;
    margin: 0.5rem auto;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--light);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(74, 85, 229, 0.2);
    transition: all 0.3s ease;
    white-space: pre-line;
    text-align: center;
}

/* Best score styling */
.move-counter .best-score {
    color: var(--accent);
    font-weight: 700;
    margin-top: 0.3rem;
}

/* Win stats styling */
.win-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(10, 17, 40, 0.5);
    padding: 1rem 1.5rem;
    border-radius: 10px;
    border: 1px solid rgba(74, 85, 229, 0.3);
    min-width: 120px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--gray);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--light);
    font-family: 'Poppins', sans-serif;
}

/* High score styling in win screen */
.new-high-score {
    display: block;
    color: var(--accent);
    font-weight: 700;
    font-size: 1.2rem;
    margin-top: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: pulseHighScore 1.5s infinite alternate;
}

@keyframes pulseHighScore {
    0% {
        transform: scale(1);
        text-shadow: 0 0 5px rgba(255, 138, 0, 0.5);
    }
    100% {
        transform: scale(1.05);
        text-shadow: 0 0 15px rgba(255, 138, 0, 0.8);
    }
}

/* Responsive styles for min moves display */
@media (max-width: 768px) {
    .min-moves-display {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .min-moves-display {
        font-size: 0.7rem;
    }
    
    .perfect-score,
    .great-score,
    .good-score {
        font-size: 1rem;
    }
}

/* Min moves value highlight effect */
.min-moves-value.highlight {
    animation: highlight-pulse 1.5s ease-in-out;
}

@keyframes highlight-pulse {
    0% { 
        color: var(--accent);
        text-shadow: 0 0 0 rgba(255, 138, 0, 0); 
    }
    30% { 
        color: var(--accent); 
        text-shadow: 0 0 10px rgba(255, 138, 0, 0.8);
        transform: scale(1.2);
    }
    100% { 
        color: var(--accent);
        text-shadow: 0 0 0 rgba(255, 138, 0, 0);
        transform: scale(1);
    }
}

/* Win screen min moves styling */
.min-stat {
    background: rgba(10, 17, 40, 0.8) !important;
    border: 1px solid rgba(255, 138, 0, 0.4) !important;
    box-shadow: 0 4px 15px rgba(255, 138, 0, 0.2);
}

.min-value {
    color: var(--accent) !important;
}

.comparison-text {
    text-align: center;
    margin-top: 1rem;
    font-size: 1rem;
    color: var(--light);
    opacity: 0.9;
    padding: 0.5rem;
    background: rgba(10, 17, 40, 0.3);
    border-radius: 8px;
    display: inline-block;
}

/* Mobile adjustments for comparison text */
@media (max-width: 768px) {
    .comparison-text {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .comparison-text {
        font-size: 0.8rem;
    }
}

/* Min moves notification */
.min-moves-notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, var(--accent), #FF6B2B);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(255, 138, 0, 0.4);
    z-index: 100;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.min-moves-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.min-moves-notification strong {
    font-size: 1.4rem;
    font-weight: 700;
    margin-left: 5px;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Mobile styles for notification */
@media (max-width: 768px) {
    .min-moves-notification {
        width: 90%;
        font-size: 1rem;
        padding: 12px 20px;
    }
    
    .min-moves-notification strong {
        font-size: 1.2rem;
    }
}

/* Enhance the min moves display to make it more prominent */
.min-moves-display {
    font-size: 1rem;
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

.min-moves-value {
    color: var(--accent);
    font-weight: 700;
    font-size: 1.1rem;
    text-shadow: 0 0 5px rgba(255, 138, 0, 0.3);
}

/* Cheating notification */
.cheat-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, 100vh);
    background: linear-gradient(45deg, #ff0000, #ff6b6b);
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 2rem;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.3);
    opacity: 0;
    z-index: 1000;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.cheat-notification.show {
    transform: translate(-50%, -50%);
    opacity: 1;
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% {
        transform: translate(-52%, -50%);
    }
    20%, 80% {
        transform: translate(-48%, -50%);
    }
    30%, 50%, 70% {
        transform: translate(-54%, -50%);
    }
    40%, 60% {
        transform: translate(-46%, -50%);
    }
}

/* Game statistics display */
.game-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1rem auto;
    padding: 1rem;
    background: rgba(10, 17, 40, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 1rem;
    max-width: 600px;
    border: 1px solid rgba(74, 85, 229, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.game-stats .stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1rem;
    min-width: 120px;
    background: rgba(10, 17, 40, 0.5);
    border-radius: 8px;
    border: 1px solid rgba(74, 85, 229, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.game-stats .stat-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 85, 229, 0.2);
}

.game-stats .stat-label {
    font-size: 0.8rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.3rem;
}

.game-stats .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--light);
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(to right, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Responsive styles for game stats */
@media (max-width: 768px) {
    .game-stats {
        gap: 1rem;
        padding: 0.8rem;
        margin: 0.8rem auto;
    }

    .game-stats .stat-box {
        padding: 0.4rem 0.8rem;
        min-width: 100px;
    }

    .game-stats .stat-label {
        font-size: 0.7rem;
    }

    .game-stats .stat-value {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .game-stats {
        gap: 0.5rem;
        padding: 0.6rem;
        margin: 0.6rem auto;
    }

    .game-stats .stat-box {
        padding: 0.3rem 0.6rem;
        min-width: 90px;
    }

    .game-stats .stat-label {
        font-size: 0.65rem;
    }

    .game-stats .stat-value {
        font-size: 1.1rem;
    }
}

/* Party Mode Button */
.party-button {
    background: linear-gradient(45deg, #ff00ff, #00ffff);
    border: none;
    position: relative;
    overflow: hidden;
}

.party-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        rgba(255,0,255,0.5), 
        rgba(255,255,0,0.5), 
        rgba(0,255,255,0.5), 
        rgba(255,0,255,0.5));
    animation: rotate-rainbow 3s linear infinite;
    opacity: 0.3;
    z-index: 0;
}

.party-button i,
.party-button span {
    position: relative;
    z-index: 1;
}

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

/* Party Mode Overlay */
.party-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}

.party-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Disco Lights */
.disco-lights {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.light {
    position: absolute;
    width: 0;
    height: 0;
    border-radius: 50%;
    filter: blur(50px);
    opacity: 0;
    animation: pulse 1s ease-in-out infinite;
}

.light-1 {
    top: 20%;
    left: 20%;
    background: rgba(255, 0, 255, 0.5);
    animation-delay: 0s;
}

.light-2 {
    top: 20%;
    right: 20%;
    background: rgba(0, 255, 255, 0.5);
    animation-delay: 0.2s;
}

.light-3 {
    bottom: 20%;
    left: 20%;
    background: rgba(255, 255, 0, 0.5);
    animation-delay: 0.4s;
}

.light-4 {
    bottom: 20%;
    right: 20%;
    background: rgba(0, 255, 0, 0.5);
    animation-delay: 0.6s;
}

@keyframes pulse {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(15);
        opacity: 0.5;
    }
    100% {
        transform: scale(30);
        opacity: 0;
    }
}

/* Party Emojis */
.emoji {
    position: absolute;
    font-size: 2rem;
    animation: fly-emoji 3s linear;
    z-index: 10000;
}

@keyframes fly-emoji {
    0% {
        transform: translate(0, -100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), 100vh) rotate(var(--rot));
        opacity: 0;
    }
}

/* Party Confetti */
.party-confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: fall-confetti 4s linear;
}

@keyframes fall-confetti {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Screen Flash Effect */
@keyframes screen-flash {
    0%, 100% {
        background: transparent;
    }
    25% {
        background: rgba(255, 0, 255, 0.2);
    }
    50% {
        background: rgba(0, 255, 255, 0.2);
    }
    75% {
        background: rgba(255, 255, 0, 0.2);
    }
}

.party-overlay.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    animation: screen-flash 0.5s linear infinite;
    pointer-events: none;
}

/* Win Message Styling */
.message.win {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: linear-gradient(
        45deg,
        #ffd700 0%,
        #fff5a3 20%,
        #ffd700 40%,
        #ffffff 50%,
        #ffd700 60%,
        #fff5a3 80%,
        #ffd700 100%
    );
    color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    font-size: 4rem;
    font-weight: bold;
    animation: shine 2s linear infinite;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 
        0 0 20px #ffd700,
        0 0 40px #ffd700,
        0 0 60px #ffd700;
    white-space: nowrap;
}

@keyframes shine {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* Test button styling */
.test-button {
    background: linear-gradient(135deg, #2B3253, #424869);
    color: white;
    margin-left: 0.5rem;
}

/* Exploding cube animation */
.cube.exploding {
    animation: explode 2s ease-out forwards;
    pointer-events: none;
    z-index: 1000;
}

@keyframes explode {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    20% {
        transform: scale(1.2) rotate(var(--rotation));
        opacity: 1;
    }
    100% {
        transform: scale(0) translate(var(--tx), var(--ty)) rotate(var(--final-rotation));
        opacity: 0;
    }
}

/* Enhanced win message */
.message.win {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: linear-gradient(
        45deg,
        #ffd700 0%,
        #fff5a3 20%,
        #ffd700 40%,
        #ffffff 50%,
        #ffd700 60%,
        #fff5a3 80%,
        #ffd700 100%
    );
    color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    font-size: 4rem;
    font-weight: bold;
    animation: shine 2s linear infinite;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 
        0 0 20px #ffd700,
        0 0 40px #ffd700,
        0 0 60px #ffd700;
    white-space: nowrap;
}

/* Win overlay enhancements */
.win-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Clear stats button styling */
.clear-stats-button {
    margin-top: 0.8rem;
    padding: 0.5rem 1rem;
    background: rgba(220, 53, 69, 0.8);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.clear-stats-button:hover {
    background: rgba(220, 53, 69, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.clear-stats-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Undo button styling */
#undo-button {
    background: linear-gradient(to right, #4a55e5, #3f3cbe);
    position: relative;
    overflow: hidden;
}

#undo-button:hover {
    background: linear-gradient(to right, #5560ff, #4a47e0);
}

#undo-button:disabled {
    background: linear-gradient(to right, #8a90c5, #7f7eae);
    opacity: 0.7;
    cursor: not-allowed;
}

/* Undo animation for cubes */
@keyframes undoCube {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateY(-20px) scale(1.1);
        opacity: 0.8;
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.cube-undone {
    animation: undoCube 0.6s ease-in-out;
    z-index: 10;
}

/* Mute button styling */
#mute-button {
    background: linear-gradient(to right, #7a55e5, #6a3cbe);
    position: relative;
    overflow: hidden;
}

#mute-button:hover {
    background: linear-gradient(to right, #8560ff, #7a47e0);
}

/* Game buttons common styling */
#start-button, #undo-button, #mute-button, #party-button {
    margin: 0 0.2rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

/* Party mode flashing effect */
body.flash::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    animation: screen-flash 0.5s linear infinite;
}

/* Screen Flash Effect */
@keyframes screen-flash {
    0%, 100% {
        background: transparent;
    }
    25% {
        background: rgba(255, 0, 255, 0.2);
    }
    50% {
        background: rgba(0, 255, 255, 0.2);
    }
    75% {
        background: rgba(255, 255, 0, 0.2);
    }
}

.party-overlay.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
} 