:root {
    --bg-dark: #07090f;
    --neon-cyan: #00f3ff;
    --neon-purple: #b521ff;
    --glass-bg: rgba(16, 18, 27, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #e2e8f0;
    --font-heading: 'Orbitron', sans-serif;
    --font-body: 'Rajdhani', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Background Glowing Orbs & Grid */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(rgba(0, 243, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 243, 255, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    z-index: 1;
    perspective: 500px;
    transform: rotateX(60deg) translateY(-100px) scale(1.5);
    opacity: 0.3;
}

.glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(150px);
    opacity: 0.25;
    animation: drift 20s infinite alternate ease-in-out;
    z-index: 0;
}

.glow-1 {
    top: -100px;
    left: -100px;
    background: var(--neon-purple);
}

.glow-2 {
    bottom: -100px;
    right: -100px;
    background: var(--neon-cyan);
    animation-delay: -10s;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(150px, 150px) scale(1.2); }
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 4rem;
    border-bottom: 1px solid var(--glass-border);
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 2px;
}

.accent-text {
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(0, 243, 255, 0.3);
}

nav {
    display: flex;
    gap: 2rem;
}

nav a {
    color: var(--text-main);
    text-decoration: none;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: 0.3s;
    position: relative;
    padding-bottom: 5px;
}

nav a.active, nav a:hover {
    color: var(--neon-cyan);
    text-shadow: 0 0 8px var(--neon-cyan);
}

nav a.active::after, nav a:hover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--neon-cyan);
    box-shadow: 0 0 10px var(--neon-cyan);
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    z-index: 10;
}

.game-container {
    padding: 3rem;
    border-radius: 24px;
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    position: relative;
    overflow: hidden;
}

/* Scanline effect over game container */
.game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 4px, 6px 100%;
    pointer-events: none;
    z-index: 10;
    opacity: 0.3;
}

.status-display {
    text-align: center;
    z-index: 20;
}

#result-text {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--neon-cyan);
    text-shadow: 0 0 15px rgba(0, 243, 255, 0.5);
    height: 2.2rem;
    transition: color 0.3s, text-shadow 0.3s;
}

/* 3D Coin Animation */
.scene {
    width: 220px;
    height: 220px;
    perspective: 1200px;
    z-index: 20;
}

.coin {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.coin-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 4px solid var(--neon-cyan);
    box-shadow: 0 0 40px rgba(0, 243, 255, 0.2), inset 0 0 30px rgba(0, 243, 255, 0.3);
    background: radial-gradient(circle at center, #1b2838 0%, #07090f 100%);
}

.coin-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

.coin-inner svg {
    color: var(--neon-cyan);
    filter: drop-shadow(0 0 8px var(--neon-cyan));
}

.coin-inner span {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-main);
    letter-spacing: 3px;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
}

.coin-front {
    transform: rotateY(0deg);
}

.coin-back {
    transform: rotateY(180deg);
    border-color: var(--neon-purple);
    box-shadow: 0 0 40px rgba(181, 33, 255, 0.2), inset 0 0 30px rgba(181, 33, 255, 0.3);
}

.coin-back .coin-inner svg {
    color: var(--neon-purple);
    filter: drop-shadow(0 0 8px var(--neon-purple));
}

/* Controls & Stats */
.controls {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 2rem;
    z-index: 20;
}

.neon-btn {
    background: rgba(0, 243, 255, 0.1);
    border: 2px solid var(--neon-cyan);
    color: var(--neon-cyan);
    padding: 1.2rem 2rem;
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    border-radius: 8px;
    text-transform: uppercase;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2), inset 0 0 10px rgba(0, 243, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.neon-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 243, 255, 0.4), transparent);
    transition: all 0.5s ease;
}

.neon-btn:hover::before {
    left: 100%;
}

.neon-btn:hover {
    background: var(--neon-cyan);
    color: var(--bg-dark);
    box-shadow: 0 0 30px var(--neon-cyan), inset 0 0 15px var(--neon-cyan);
}

.neon-btn:disabled {
    border-color: #4a5568;
    color: #4a5568;
    box-shadow: none;
    cursor: not-allowed;
    background: rgba(74, 85, 104, 0.1);
}

.neon-btn:disabled::before {
    display: none;
}

.stats {
    display: flex;
    justify-content: space-between;
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    padding: 1.2rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    transition: transform 0.2s;
}

.stat-label {
    font-size: 0.9rem;
    color: #a0aec0;
    font-weight: 700;
    letter-spacing: 1.5px;
    font-family: var(--font-heading);
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 900;
}

#heads-count { color: var(--neon-cyan); }
#tails-count { color: var(--neon-purple); }
#streak-count { color: #f6e05e; }

/* Responsive */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1.5rem 2rem;
    }
    .game-container {
        padding: 2rem 1.5rem;
    }
    .scene {
        width: 180px;
        height: 180px;
    }
}
