* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: linear-gradient(to bottom, #a8e063, #56ab2f);
}

.container {
    max-width: 600px;
    width: 95%;
    margin: 0 auto;
    padding: 20px;
}

.game-screen {
    background-color: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-align: center;
}

h1 {
    margin-bottom: 20px;
    color: #4a8f29;
    font-size: 2.2rem;
}

h3 {
    margin: 10px 0;
    color: #4a8f29;
}

.slots-machine {
    background-color: #f9f6e8;
    border-radius: 10px;
    padding: 20px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.reels-container {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
    padding: 15px;
    background-color: #8b4513;
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.reel {
    width: 80px;
    height: 120px;
    background-color: white;
    border: 3px solid #d4ac0d;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.symbol {
    font-size: 3rem;
    transition: transform 0.2s;
}

.spinning .symbol {
    animation: spin 0.5s infinite linear;
}

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

/* Animation when the spinning class is applied */
.reel.spinning {
    border-color: #ff8c00;
    box-shadow: 0 0 12px rgba(255, 140, 0, 0.7);
}

.reel[data-spinning="true"] {
    border-color: #ff8c00;
    box-shadow: 0 0 12px rgba(255, 140, 0, 0.7);
}

.reel[data-spinning="true"] .symbol {
    animation: slotSpin 0.2s linear infinite;
}

@keyframes slotSpin {
    0% { transform: translateY(-300%); }
    100% { transform: translateY(300%); }
}

.result-message {
    font-size: 1.2rem;
    font-weight: bold;
    color: #4a8f29;
    margin: 15px 0;
    min-height: 40px;
    padding: 8px;
    background-color: #f5f5f5;
    border-radius: 8px;
    transition: color 0.3s, background-color 0.3s;
}

.stats {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
}

.stat {
    background-color: #fff;
    padding: 10px 15px;
    border-radius: 30px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.stat-label {
    font-weight: bold;
    margin-right: 5px;
}

.stat-value {
    color: #d4ac0d;
    font-weight: bold;
}

.primary-button {
    background-color: #56ab2f;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
    margin: 15px 0;
    box-shadow: 0 4px 0 #458526;
}

.primary-button:hover {
    background-color: #4a8f29;
}

.primary-button:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #458526;
}

.primary-button:disabled {
    background-color: #888;
    color: #ddd;
    box-shadow: 0 2px 0 #666;
    cursor: not-allowed;
    transform: translateY(2px);
}

.secondary-button {
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    padding: 10px 15px;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.secondary-button:hover {
    background-color: #e0e0e0;
}

.payout-table {
    background-color: #fff8e1;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.payout-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #d4ac0d;
}

.payout-row:last-child {
    border-bottom: none;
}

.payout-combo {
    font-weight: bold;
}

.payout-value {
    color: #d4ac0d;
    font-weight: bold;
}

.win-animation {
    animation: winPulse 0.5s ease-in-out 3;
}

@keyframes winPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Result animations */
.big-win {
    animation: bigWinAnimation 1s ease-in-out;
    color: #ff8c00;
    font-size: 1.5rem;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.7);
}

@keyframes bigWinAnimation {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Responsive adjustments */
@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
    }
    
    .reels-container {
        padding: 10px;
    }
    
    .reel {
        width: 70px;
        height: 100px;
    }
    
    .symbol {
        font-size: 2.5rem;
    }
    
    .primary-button {
        font-size: 1rem;
        padding: 10px 20px;
    }
    
    .payout-row {
        font-size: 0.9rem;
    }
}

/* Banana rain animation for jackpot */
.banana-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.falling-banana {
    position: absolute;
    font-size: 30px;
    animation: fall linear;
    top: -40px;
}

@keyframes fall {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(100vh) rotate(360deg); }
}

.hidden {
    display: none;
}

h2 {
    margin-bottom: 15px;
    color: #4a8f29;
}

p {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 15px;
    transition: border-color 0.3s;
}

input:focus {
    border-color: #56ab2f;
    outline: none;
}

button {
    cursor: pointer;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s;
    padding: 12px 24px;
}

/* Spinner for Matchmaking */
.spinner {
    width: 60px;
    height: 60px;
    margin: 20px auto;
    border: 6px solid #f5f5f5;
    border-top: 6px solid #56ab2f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Game Screen */
.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.player-info {
    text-align: center;
    flex: 1;
}

.player {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.player-avatar {
    font-size: 2rem;
    margin-right: 10px;
}

.player-name {
    font-weight: bold;
    font-size: 1.1rem;
}

.vs {
    font-weight: bold;
    font-size: 1.2rem;
    color: #888;
    padding: 0 15px;
}

.turn-indicator {
    font-size: 0.9rem;
    padding: 4px 8px;
    border-radius: 12px;
    display: inline-block;
}

#player-turn-indicator.active {
    background-color: #ddf7cb;
    color: #4a8f29;
    font-weight: bold;
}

#opponent-turn-indicator.active {
    background-color: #ffe7e7;
    color: #d45c5c;
    font-weight: bold;
}

/* Checkerboard */
.board-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto 20px;
}

.checkerboard {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    aspect-ratio: 1/1;
    border: 2px solid #333;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.square {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    position: relative;
}

.square.light {
    background-color: #f5dec4;
}

.square.dark {
    background-color: #bb8f61;
}

.square.highlighted {
    background-color: rgba(86, 171, 47, 0.5);
}

.square.selected {
    background-color: rgba(86, 171, 47, 0.8);
}

.piece {
    font-size: 2rem;
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s;
    z-index: 1;
}

.piece.player-piece {
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

.piece.opponent-piece {
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

.piece.player-king {
    position: relative;
}

.piece.player-king::after {
    content: '👑';
    position: absolute;
    font-size: 1rem;
    top: -10px;
    right: -10px;
}

.piece.opponent-king {
    position: relative;
}

.piece.opponent-king::after {
    content: '👑';
    position: absolute;
    font-size: 1rem;
    top: -10px;
    right: -10px;
}

.game-status {
    background-color: #f9f9f9;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: bold;
    text-align: center;
}

/* Results Screen */
.results-container {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
}

.result-item {
    text-align: center;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
    min-width: 120px;
}

.banana-count {
    font-size: 1.5rem;
    font-weight: bold;
    color: #4a8f29;
    margin-top: 10px;
}

/* Username Screen */
.username-container {
    width: 80%;
    max-width: 300px;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* Matchmaking Screen */
#matchmaking-screen {
    text-align: center;
}

.monkey-loading {
    font-size: 48px;
    margin: 20px 0;
    animation: bounce 1s infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-20px); }
}

#cancel-matchmaking {
    margin-top: 30px;
    background-color: #d9534f;
}

#cancel-matchmaking:hover {
    background-color: #c9302c;
}

/* Game Screen */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: #f5deb3;
    border-radius: 10px;
    margin-bottom: 10px;
    width: 100%;
    position: relative;
}

.player {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    text-align: center;
    padding: 5px;
}

.player-score {
    font-size: 16px;
    font-weight: bold;
    color: #d4ac0d;
}

.timer {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #8b4513;
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: bold;
}

.game-arena {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    margin-top: 25px;
}

.power-ups {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
    padding: 5px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
}

.power-up {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    background-color: rgba(255, 255, 255, 0.7);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #deb887;
}

.power-up:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.power-up-icon {
    font-size: 20px;
    margin-bottom: 5px;
}

.power-up-name {
    font-size: 10px;
    text-align: center;
}

#effects-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

#player-side, #opponent-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    position: relative;
    height: 40%;
}

#player-side {
    margin-top: auto;
}

#opponent-side {
    margin-bottom: auto;
    transform: rotate(180deg);
}

#monkey-container, #opponent-monkey-container {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#monkey, #opponent-monkey {
    font-size: 50px;
    transition: transform 0.1s;
}

.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

#tap-area {
    width: 100%;
    height: 120px;
    background-color: rgba(222, 184, 135, 0.3);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: background-color 0.3s;
}

#tap-area:active {
    background-color: rgba(222, 184, 135, 0.5);
}

#tap-text {
    color: #8b4513;
    font-weight: bold;
    font-size: 18px;
}

/* Results Screen */
#results-screen {
    background-color: rgba(255, 248, 225, 0.95);
    text-align: center;
}

#result-title {
    font-size: 28px;
    margin-bottom: 10px;
}

#result-message {
    font-size: 20px;
    margin-bottom: 20px;
    color: #d4ac0d;
    font-weight: bold;
}

.result-stats {
    width: 80%;
    max-width: 300px;
    margin: 0 auto 30px;
    background-color: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.stat {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 5px 0;
    border-bottom: 1px solid #f5deb3;
}

.stat:last-child {
    border-bottom: none;
}

.stat-label {
    font-weight: bold;
    color: #8b4513;
}

.stat-value {
    font-weight: bold;
    color: #d4ac0d;
}

#play-again {
    padding: 10px 30px;
    font-size: 18px;
    background-color: #8b4513;
}

/* Special Effects */
.banana {
    position: absolute;
    font-size: 24px;
    transform: translateY(0);
    opacity: 1;
    pointer-events: none;
    z-index: 50;
}

.banana-collected {
    animation: collectBanana 0.8s forwards;
}

@keyframes collectBanana {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-80px); opacity: 0; }
}

.effect-text {
    position: absolute;
    color: #8b4513;
    font-weight: bold;
    font-size: 20px;
    text-shadow: 0 0 5px white;
    animation: fadeOut 1.5s forwards;
    pointer-events: none;
}

@keyframes fadeOut {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-30px); }
}

.freeze-effect {
    background-color: rgba(173, 216, 230, 0.5);
    border: 2px solid #add8e6;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(173, 216, 230, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(173, 216, 230, 0); }
    100% { box-shadow: 0 0 0 0 rgba(173, 216, 230, 0); }
}

.steal-effect {
    position: absolute;
    font-size: 24px;
    animation: steal 1s forwards;
    pointer-events: none;
}

@keyframes steal {
    0% { transform: translateX(0) translateY(0); opacity: 1; }
    100% { transform: translateX(calc(-50vw + 50px)) translateY(calc(-50vh + 50px)); opacity: 0; }
}

.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.score {
    display: flex;
    align-items: center;
    font-size: 20px;
    font-weight: bold;
    background-color: #FFD700;
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#banana-icon {
    margin-right: 5px;
    font-size: 24px;
}

.footer {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#multiplier {
    font-size: 18px;
    font-weight: bold;
}

#upgrade-button, #leaderboard-button {
    background-color: #4CAF50;
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: bold;
    box-shadow: 0 4px 0 #2E7D32;
    cursor: pointer;
    text-align: center;
    width: 100%;
    max-width: 300px;
}

#leaderboard-button {
    background-color: #2196F3;
    box-shadow: 0 4px 0 #0D47A1;
}

#upgrade-button:active, #leaderboard-button:active, button:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #2E7D32;
}

#leaderboard-button:active {
    box-shadow: 0 2px 0 #0D47A1;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #FFEB99;
    padding: 20px;
    border-radius: 15px;
    width: 90%;
    max-width: 350px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.leaderboard-content {
    max-width: 90%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.close-modal {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #8B4513;
}

.challenge-link {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.challenge-link input {
    flex: 1;
    margin-bottom: 0;
}

.challenge-link button {
    width: auto;
    white-space: nowrap;
}

#share-challenge {
    background-color: #0088cc;
    box-shadow: 0 4px 0 #006699;
}

/* Tabs */
.tabs {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 2px solid #8B4513;
}

.tab-button {
    flex: 1;
    padding: 10px;
    background-color: transparent;
    color: #8B4513;
    border: none;
    border-radius: 10px 10px 0 0;
    font-weight: bold;
    box-shadow: none;
}

.tab-button.active {
    background-color: #8B4513;
    color: white;
}

.tab-content {
    margin-bottom: 15px;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

th, td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #8B4513;
    color: white;
}

tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.3);
}

.your-rank {
    font-weight: bold;
    text-align: center;
    margin-bottom: 15px;
    font-size: 18px;
}

/* Animation for coin collection */
@keyframes coinFloat {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) scale(0.5);
        opacity: 0;
    }
}

.banana-animation {
    position: absolute;
    font-size: 24px;
    animation: coinFloat 1s forwards;
    pointer-events: none;
}

/* Shake animation for monkey */
@keyframes monkeyShake {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    50% { transform: rotate(0deg); }
    75% { transform: rotate(5deg); }
    100% { transform: rotate(0deg); }
}

.monkey-shake {
    animation: monkeyShake 0.3s;
} 