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

body {
    font-family: 'Baloo 2', cursive;
    background: #077DFF;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    background: #077DFF;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.screen {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
}

.screen.active {
    display: flex;
}

/* Start Screen */
.start-screen {
    background: #077DFF;
    position: relative;
}

.start-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.game-title {
    font-size: 96px;
    font-weight: 700;
    color: white;
    text-shadow: 4px 4px 0px rgba(0, 0, 0, 0.2);
    margin-top: -50px;
}

.start-button {
    font-family: 'Baloo 2', cursive;
    font-size: 48px;
    font-weight: 700;
    color: #4a3428;
    background: #FFB9FF;
    border: none;
    border-radius: 40px;
    padding: 25px 100px;
    cursor: pointer;
    box-shadow: 0 8px 0 #C896C8;
    transition: all 0.2s ease;
    margin-top: 390px;
}

.start-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 11px 0 #C896C8;
}

.start-button:active {
    transform: translateY(6px);
    box-shadow: 0 2px 0 #C896C8;
}

/* How to Play Button */
.how-to-play-button {
    position: absolute;
    top: 20px;
    left: 20px;
    font-family: 'Baloo 2', cursive;
    font-size: 24px;
    font-weight: 700;
    color: white;
    background: rgba(0, 0, 0, 0.3);
    border: 3px solid white;
    border-radius: 20px;
    padding: 15px 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.how-to-play-button:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: scale(1.05);
}

/* Player Screen */
.player-screen {
    background: #077DFF;
    position: relative;
}

.background-image {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.player-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Player Info - Both Players Side by Side */
.players-info {
    position: absolute;
    top: 50px;
    right: 90px;
    display: flex;
    gap: 30px;
    z-index: 10;
}

.player-box {
    text-align: center;
}

.player-name {
    font-size: 32px;
    font-weight: 700;
    color: white;
    text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.3);
    margin-bottom: 15px;
    opacity: 0.5;
}

.player-name.active-player {
    opacity: 1;
}

.score {
    font-size: 36px;
    font-weight: 700;
    color: white;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px 30px;
    border-radius: 20px;
}

.dice-container {
    margin-bottom: 10px;
    margin-top: 0px;
}

.dice {
    width: 1000px;
    height: auto;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3));
    transition: transform 0.1s ease;
}

.dice.rolling {
    animation: diceRoll 0.1s ease-in-out infinite;
}

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

.button-container {
    display: flex;
    gap: 30px;
    position: absolute;
    bottom: 80px;
}

.game-button {
    font-family: 'Baloo 2', cursive;
    font-size: 32px;
    font-weight: 700;
    color: white;
    border: none;
    border-radius: 25px;
    padding: 20px 60px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.roll-button {
    background: #FFA040;
    box-shadow: 0 6px 0 #D97B2D;
}

.roll-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #D97B2D;
}

.roll-button:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #D97B2D;
}

.pass-button {
    background: #FFB9FF;
    box-shadow: 0 6px 0 #C896C8;
    color: #4a3428;
}

.pass-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #C896C8;
}

.pass-button:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #C896C8;
}

.game-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Winner Screen */
.winner-screen {
    background: #077DFF;
    position: relative;
}

.winner-text {
    position: absolute;
    top: 40px;
    font-family: 'Baloo 2', cursive;
    font-size: 72px;
    font-weight: 700;
    color: white;
    text-shadow: 4px 4px 0px rgba(0, 0, 0, 0.3);
    z-index: 20;
    animation: bounce 0.6s ease infinite alternate;
}

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

.winner-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.winner-animation {
    animation: winnerFlip 0.8s steps(1) infinite;
}

@keyframes winnerFlip {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.winner-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.winner-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.winner-image:nth-child(2) {
    animation: winnerFlip2 0.8s steps(1) infinite;
}

@keyframes winnerFlip2 {
    0%, 49% { opacity: 0; }
    50%, 100% { opacity: 1; }
}

.restart-button {
    position: absolute;
    bottom: 30px;
    font-family: 'Baloo 2', cursive;
    font-size: 32px;
    font-weight: 700;
    color: #4a3428;
    background: #E8B4E8;
    border: none;
    border-radius: 25px;
    padding: 20px 60px;
    cursor: pointer;
    box-shadow: 0 6px 0 #C896C8;
    transition: all 0.2s ease;
    z-index: 10;
}

.restart-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #C896C8;
}

.restart-button:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #C896C8;
}

/* Sushi Collection Styling */
.sushi-collection-container {
    position: absolute;
    bottom: 210px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 25;
    max-width: 90%;
}

.sushi-collection-title {
    display: none;
}

.sushi-collection-scroll {
    max-width: 1200px;
}

.sushi-collection {
    display: flex;
    gap: 0px;
    align-items: center;
    justify-content: center;
}

.sushi-item {
    width: 350px;
    height: 350px;
    object-fit: contain;
    object-position: center;
    flex-shrink: 0;
    animation: popIn 0.4s ease;
}

@keyframes popIn {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(0deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Popup Styles */
.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.popup-overlay.active {
    display: flex !important;
}

.popup-content {
    background: white;
    border-radius: 30px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: popupAppear 0.3s ease;
}

@keyframes popupAppear {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #FF6B6B;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.popup-close:hover {
    background: #FF5252;
    transform: scale(1.1);
}

.popup-title {
    font-family: 'Baloo 2', cursive;
    font-size: 42px;
    font-weight: 700;
    color: #077DFF;
    margin-bottom: 20px;
    text-align: center;
}

.popup-text {
    font-family: 'Baloo 2', cursive;
    font-size: 18px;
    color: #4a3428;
    line-height: 1.6;
}

.popup-text p {
    margin-bottom: 15px;
}

.popup-text ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.popup-text li {
    margin-bottom: 10px;
}

.popup-text strong {
    color: #077DFF;
}

/* No Sushi Popup */
.no-sushi-popup {
    background: #FFA040;
    color: white;
    text-align: center;
    padding: 50px 60px;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.no-sushi-popup .popup-title {
    color: white;
    font-size: 56px;
    margin-bottom: 15px;
    text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.3);
}

.popup-message {
    font-family: 'Baloo 2', cursive;
    font-size: 36px;
    font-weight: 700;
    color: white;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
}

.popup-submessage {
    font-family: 'Baloo 2', cursive;
    font-size: 24px;
    color: white;
    text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.3);
}

/* Footer */
footer {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1;
}

footer a {
    font-family: 'Baloo 2', cursive;
    font-size: 16px;
    color: white;
    text-decoration: underline;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 15px;
    border-radius: 10px;
    transition: background 0.3s ease;
}

footer a:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Mobile Styles - 390x844px and smaller */
@media (max-width: 844px) {
    /* Use mobile background images */
    .start-screen .background-image {
        content: url('images/start-mobile.png');
    }
    
    #player1Screen .background-image {
        content: url('images/player-1-mobile.png');
    }
    
    #player2Screen .background-image {
        content: url('images/player-2-mobile.png');
    }
    
    #winner1Screen .winner-image:first-child {
        content: url('images/winner-1-1-mobile.png');
    }
    
    #winner1Screen .winner-image:last-child {
        content: url('images/winner-1-2-mobile.png');
    }
    
    #winner2Screen .winner-image:first-child {
        content: url('images/winner-2-1-mobile.png');
    }
    
    #winner2Screen .winner-image:last-child {
        content: url('images/winner-2-2-mobile.png');
    }
    
    /* Adjust layout for mobile */
    .game-title {
        font-size: 56px;
        margin-top: 5px;
    }
    
    .start-button {
        font-size: 32px;
        padding: 20px 60px;
        margin-top: 380px;
    }
    
    .how-to-play-button {
        font-size: 18px;
        padding: 10px 20px;
        top: 20px;
        left: 20px;
    }
    
    /* Player info - stack vertically on mobile */
    .players-info {
        flex-direction: column;
        top: 20px;
        right: 20px;
        gap: 15px;
    }
    
    .player-name {
        font-size: 24px;
    }
    
    .score {
        font-size: 28px;
        padding: 10px 20px;
    }
    
    /* Smaller dice on mobile */
    .dice-container {
        margin-top: 150px;
    }
    
    .dice {
        width: 800px;
    }
    
    /* Button adjustments */
    .button-container {
        bottom: 80px;
        gap: 20px;
    }
    
    .game-button {
        font-size: 24px;
        padding: 15px 40px;
    }
    
    /* Winner text */
    .winner-text {
        font-size: 48px;
        top: 30px;
    }
    
    /* Sushi collection on mobile */
    .sushi-collection-container {
        bottom: 180px;
    }
    
    .sushi-item {
        width: 80px;
        height: 80px;
    }
    
    .restart-button {
        font-size: 24px;
        padding: 15px 40px;
        bottom: 100px;
    }
    
    /* Popup adjustments */
    .popup-content {
        padding: 30px;
        max-width: 90%;
    }
    
    .popup-title {
        font-size: 32px;
    }
    
    .popup-text {
        font-size: 16px;
    }
    
    .no-sushi-popup .popup-title {
        font-size: 42px;
    }
    
    .popup-message {
        font-size: 28px;
    }
    
    footer a {
        font-size: 14px;
        padding: 6px 12px;
    }
}