@import url('https://fonts.googleapis.com/css2?family=Bai+Jamjuree:wght@400;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Bai Jamjuree', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 800px;
    padding: 30px;
    text-align: center;
}

h1 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 2.5rem;
}

.subtitle {
    color: #7f8c8d;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.coin-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 30px;
    perspective: 1000px;
}

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

.coin-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 80px;
    color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

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

.tails {
    background: linear-gradient(45deg, #6c5ce7, #a29bfe);
    background-color: #6c5ce7;
    transform: rotateY(180deg);
}

.controls {
    margin-bottom: 30px;
}

.btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 25px;
    margin: 0 10px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-flip {
    background: linear-gradient(45deg, #e74c3c, #e67e22);
}

.btn-reset {
    background: linear-gradient(45deg, #2ecc71, #27ae60);
}

.stats-container {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.stat {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    min-width: 150px;
    margin: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.stat h3 {
    color: #7f8c8d;
    margin-bottom: 5px;
    font-size: 1rem;
}

.stat p {
    color: #2c3e50;
    font-size: 1.8rem;
    font-weight: bold;
}

.history {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    max-height: 200px;
    overflow-y: auto;
    text-align: left;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.history h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.3rem;
}

.history-item {
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
}

.heads-bg {
    background-color: rgba(255, 215, 0, 0.2);
    border-left: 4px solid #ffd700;
}

.tails-bg {
    background-color: rgba(108, 92, 231, 0.2);
    border-left: 4px solid #6c5ce7;
}

.flip-count {
    color: #7f8c8d;
    font-weight: 500;
}

@keyframes flip {
    0% {
        transform: rotateY(0);
    }
    100% {
        transform: rotateY(1800deg); /* Multiple rotations for smooth effect */
    }
}

.flipping {
    animation: flip 1.5s ease-out;
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .coin-container {
        width: 150px;
        height: 150px;
    }
    
    .btn {
        padding: 10px 20px;
        margin: 5px;
    }
    
    .stats-container {
        flex-direction: column;
        align-items: center;
    }
}