:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.5);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --coin-gold: #fbbf24;
    --coin-silver: #cbd5e1;
    --coin-border: #b45309;
    --coin-border-silver: #475569;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.container {
    text-align: center;
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
    font-weight: 300;
    margin-bottom: 3rem;
}

/* Coin Styles */
.coin-container {
    width: 200px;
    height: 200px;
    margin: 0 auto 3rem;
    perspective: 800px;
}

.coin {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Bouncy easing */
}

.face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.1);
    border: 10px solid;
}

.front {
    background: radial-gradient(circle at 30% 30%, #fcd34d, #f59e0b);
    border-color: var(--coin-border);
    transform: rotateX(0deg);
}

.back {
    background: radial-gradient(circle at 30% 30%, #e2e8f0, #94a3b8);
    border-color: var(--coin-border-silver);
    transform: rotateX(180deg);
}

.symbol {
    font-size: 4rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.label {
    font-size: 1.2rem;
    font-weight: 500;
    letter-spacing: 2px;
    margin-top: 0.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

/* Button Styles */
.flip-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.1rem;
    font-weight: 500;
    border-radius: 50px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 10px 20px -5px var(--primary-glow);
    margin-bottom: 3rem;
    font-family: inherit;
}

.flip-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px var(--primary-glow);
}

.flip-btn:active {
    transform: translateY(1px);
}

.flip-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Stats Styles */
.stats {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Animations */
@keyframes flip-heads {
    0% {
        transform: rotateX(0);
    }

    100% {
        transform: rotateX(1800deg);
    }

    /* 5 full rotations */
}

@keyframes flip-tails {
    0% {
        transform: rotateX(0);
    }

    100% {
        transform: rotateX(1980deg);
    }

    /* 5.5 full rotations */
}

/* Game Container */
#game-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Info Toggle Button */
#info-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 700;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

#info-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* SEO Overlay */
#seo-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.95);
    /* Dark background based on theme */
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.overlay-hidden {
    opacity: 0 !important;
    visibility: hidden;
    pointer-events: none;
}

.content-box {
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 40px;
    background: var(--card-bg);
    color: var(--text-main);
    border-radius: 20px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

#close-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#close-overlay:hover {
    color: var(--text-main);
}

/* SEO Content Styles within Overlay */
.seo-content {
    text-align: left;
    color: var(--text-muted);
    line-height: 1.6;
}

.seo-content h2,
.seo-content h3 {
    color: var(--text-main);
    margin: 1.5rem 0 1rem;
}

.seo-content h2 {
    font-size: 1.8rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: 0;
}

.seo-content h3 {
    font-size: 1.3rem;
    color: var(--primary);
}

.seo-content p {
    margin-bottom: 1.5rem;
}

.seo-content ul {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.seo-content li {
    margin-bottom: 0.5rem;
}

.seo-content strong {
    color: var(--text-main);
}

/* Scrollbar for content box */
.content-box::-webkit-scrollbar {
    width: 8px;
}

.content-box::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.content-box::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.content-box::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}