:root {
    --primary-color: #ffd700;
    --secondary-color: #c0c0c0;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-light: #f8fafc;
    --accent: #38bdf8;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
}

body {
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
    color: var(--text-light);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.game-container {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2.5rem;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
}

/* Coin Styles */
.coin-wrapper {
    perspective: 1000px;
    margin: 3rem auto;
    width: 200px;
    height: 200px;
}

#coin {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.1s;
}

.coin-side {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: bold;
    border: 8px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.2), 0 10px 25px rgba(0, 0, 0, 0.3);
}

.heads {
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: #451a03;
    z-index: 2;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tails {
    background: linear-gradient(135deg, #f8fafc, #94a3b8);
    color: #0f172a;
    transform: rotateY(180deg);
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Animations */
@keyframes spin-heads {
    from { transform: rotateY(0); }
    to { transform: rotateY(1800deg); }
}

@keyframes spin-tails {
    from { transform: rotateY(0); }
    to { transform: rotateY(1980deg); }
}

.animate-heads {
    animation: spin-heads 3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-tails {
    animation: spin-tails 3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Stats & Results */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--glass);
    padding: 1.25rem;
    border-radius: 1.25rem;
    border: 1px solid var(--glass-border);
    transition: transform 0.2s ease, background 0.2s ease;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.result-banner {
    min-height: 80px;
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all 0.3s ease;
}

.result-text {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.action-msg {
    font-size: 1rem;
    opacity: 0.8;
}

/* Buttons */
.btn-toss {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.25rem;
    font-weight: 600;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

.btn-toss:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(99, 102, 241, 0.4);
}

.btn-toss:active:not(:disabled) {
    transform: translateY(0);
}

.btn-toss:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* History List */
.history-list {
    margin-top: 2rem;
    text-align: left;
}

.history-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tag-heads { color: #ffd700; font-weight: bold; }
.tag-tails { color: #94a3b8; font-weight: bold; }

/* Responsive */
@media (max-width: 480px) {
    .game-container {
        margin: 1rem;
        padding: 1rem;
    }
    .coin-wrapper {
        width: 150px;
        height: 150px;
    }
}

/* AdSense Provision */
.ad-container {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    background: var(--bg-dark); /* Solid background for sticky effect */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1000;
}

.sticky-top-ad {
    position: sticky;
    top: 0;
    width: 100%;
}

.ad-placeholder {
    position: absolute;
    color: rgba(255, 255, 255, 0.1);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    pointer-events: none;
}

/* Responsive Enhancements */
@media (max-width: 576px) {
    .game-container {
        margin: 0.5rem;
        padding: 1.5rem 1rem;
        border-radius: 1rem;
    }
    
    .stats-grid {
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: 0.75rem;
    }
    
    .stat-card .h3 {
        font-size: 1.25rem;
    }
    
    .coin-wrapper {
        width: 160px;
        height: 160px;
        margin: 2rem auto;
    }
    
    .btn-toss {
        width: 100%;
        padding: 1rem;
        font-size: 1.1rem;
    }
    
    h1 {
        font-size: 1.75rem !important;
    }
}
