/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #6a5acd 0%, #8b5cf6 50%, #9333ea 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo h1 {
    color: white;
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.wallet-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.wallet-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.wallet-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.wallet-info {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 20px;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 0.9rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 40px 0;
}

/* Welcome Section */
.welcome-section {
    text-align: center;
    margin-bottom: 40px;
}

.welcome-section h2 {
    color: white;
    font-size: 3rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.welcome-section p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
    margin-bottom: 40px;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.feature {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    transition: transform 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.feature .icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 15px;
}

.feature h3 {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.feature p {
    color: rgba(255, 255, 255, 0.8);
}

/* Game Selection */
.game-selection {
    text-align: center;
}

.game-selection h2 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 40px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.game-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.game-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
}

.game-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15);
}

.game-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.game-card h3 {
    color: white;
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.game-card p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 25px;
}

.play-btn {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

.play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.4);
}

/* Game Sections */
.game-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.game-header h2 {
    color: white;
    font-size: 2rem;
}

.back-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Coin Flip Styles */
.coin-container {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
}

.coin {
    width: 150px;
    height: 150px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1s ease-in-out;
}

.coin-side {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    backface-visibility: hidden;
}

.heads {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
}

.tails {
    background: linear-gradient(45deg, #c0392b, #e74c3c);
    transform: rotateY(180deg);
}

.coin.flipping {
    animation: flip 1s ease-in-out;
}

@keyframes flip {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(900deg); }
    100% { transform: rotateY(1800deg); }
}

/* Dice Styles */
.dice-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40px;
    perspective: 1000px;
}

.dice {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 50%, #e9ecef 100%);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    color: #333;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.8),
        inset 0 -2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    transform-style: preserve-3d;
    border: 2px solid rgba(0, 0, 0, 0.1);
    position: relative;
}

.dice::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, rgba(255,255,255,0.3), transparent, rgba(0,0,0,0.1));
    border-radius: 17px;
    z-index: -1;
}

.dice:hover {
    transform: translateY(-3px) rotateX(5deg) rotateY(5deg);
    box-shadow: 
        0 12px 35px rgba(0, 0, 0, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.9),
        inset 0 -2px 4px rgba(0, 0, 0, 0.15);
}

.dice.rolling {
    animation: roll3d 1.5s ease-in-out;
}

@keyframes roll3d {
    0% { 
        transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
    }
    25% { 
        transform: rotateX(180deg) rotateY(90deg) rotateZ(45deg) scale(1.1);
    }
    50% { 
        transform: rotateX(360deg) rotateY(180deg) rotateZ(90deg) scale(1.2);
    }
    75% { 
        transform: rotateX(540deg) rotateY(270deg) rotateZ(135deg) scale(1.1);
    }
    100% { 
        transform: rotateX(720deg) rotateY(360deg) rotateZ(180deg) scale(1);
    }
}

/* Dice Dots */
.dice-dots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 3px;
    width: 60px;
    height: 60px;
}

.dot {
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, #1a1a1a 0%, #333 70%, #555 100%);
    border-radius: 50%;
    opacity: 0;
    box-shadow: 
        inset 0 1px 2px rgba(0, 0, 0, 0.8),
        0 1px 2px rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.dot.active {
    opacity: 1;
    transform: translateZ(2px);
}

/* Game Controls */
.game-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.choice-section, .prediction-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.prediction-section label {
    color: white;
    font-weight: 600;
}

.prediction-section select {
    padding: 10px 15px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    text-align: center;
    width: 150px;
}

.choice-section {
    flex-direction: row;
    gap: 20px;
}

.choice-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 15px 30px;
    border-radius: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.choice-btn:hover, .choice-btn.selected {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
}

.action-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.action-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Result Styles */
.result {
    margin-top: 30px;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
}

.result.win {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    border: 2px solid #2ecc71;
}

.result.lose {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 2px solid #e74c3c;
}

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

.score-container {
    display: flex;
    gap: 20px;
}

.score-box {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 15px 25px;
    text-align: center;
    min-width: 100px;
}

.score-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.score-value {
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
}

.game-controls-2048 {
    display: flex;
    gap: 15px;
}

.grid-2048 {
    position: relative;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 15px;
    margin: 30px auto;
    width: 500px;
    height: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.grid-container {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 470px;
    height: 470px;
}

.grid-row {
    display: flex;
    margin-bottom: 10px;
}

.grid-row:last-child {
    margin-bottom: 0;
}

.grid-cell {
    width: 110px;
    height: 110px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    margin-right: 10px;
}

.grid-cell:last-child {
    margin-right: 0;
}

.tile-container {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 470px;
    height: 470px;
}

.tile {
    position: absolute;
    width: 110px;
    height: 110px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 2rem;
    transition: all 0.15s ease-in-out;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Tile Colors */
.tile-2 { background: #eee4da; color: #776e65; }
.tile-4 { background: #ede0c8; color: #776e65; }
.tile-8 { background: #f2b179; color: #f9f6f2; }
.tile-16 { background: #f59563; color: #f9f6f2; }
.tile-32 { background: #f67c5f; color: #f9f6f2; }
.tile-64 { background: #f65e3b; color: #f9f6f2; }
.tile-128 { background: #edcf72; color: #f9f6f2; font-size: 1.7rem; }
.tile-256 { background: #edcc61; color: #f9f6f2; font-size: 1.7rem; }
.tile-512 { background: #edc850; color: #f9f6f2; font-size: 1.7rem; }
.tile-1024 { background: #edc53f; color: #f9f6f2; font-size: 1.5rem; }
.tile-2048 { background: #edc22e; color: #f9f6f2; font-size: 1.5rem; box-shadow: 0 0 30px rgba(237, 194, 46, 0.5); }

.game-instructions {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 20px;
    font-size: 0.9rem;
}

.game-over {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    z-index: 100;
}

.game-over-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.game-over-content h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 2rem;
}

.game-over-content p {
    color: #666;
    margin-bottom: 25px;
    font-size: 1.1rem;
}

/* History Section */
.history-section {
    margin-top: 40px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.history-section h3 {
    color: white;
    margin-bottom: 20px;
    text-align: center;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.win {
    color: #4CAF50;
}

.lose {
    color: #f44336;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 20px;
    }
    
    .welcome-section h2 {
        font-size: 2rem;
    }
    
    .game-cards {
        grid-template-columns: 1fr;
    }
    
    .game-section {
        padding: 20px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .dice-container {
        gap: 15px;
    }
    
    .dice {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .coin {
        width: 120px;
        height: 120px;
    }
    
    .choice-section {
        flex-direction: column;
    }
}