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

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

:root {
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --header-bg-start: #ffffff;
    --header-bg-end: #f5f7fa;
    --header-text: #667eea;
    --text-primary: #ffffff;
    --text-shadow: rgba(0, 0, 0, 0.3);
    --border-color: #ffffff;
    --choice-bg: rgba(255, 255, 255, 0.1);
    --choice-hover-bg: rgba(255, 255, 255, 0.2);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --hover-glow: rgba(255, 215, 0, 0.5);
}

@media (prefers-color-scheme: light) {
    :root {
        --bg-gradient-start: #f0f4ff;
        --bg-gradient-end: #e8eef7;
        --header-bg-start: #667eea;
        --header-bg-end: #764ba2;
        --header-text: #ffffff;
        --text-primary: #2d3748;
        --text-shadow: rgba(0, 0, 0, 0.1);
        --border-color: #667eea;
        --choice-bg: rgba(102, 126, 234, 0.1);
        --choice-hover-bg: rgba(102, 126, 234, 0.2);
        --glass-bg: rgba(255, 255, 255, 0.8);
        --shadow-color: rgba(0, 0, 0, 0.15);
        --hover-glow: rgba(102, 126, 234, 0.5);
    }
    
    .choice::before {
        background: rgba(102, 126, 234, 0.3);
    }
}

body {
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    font-family: 'Poppins', sans-serif;
}

/* ==================== HEADER ==================== */
header {
    background: linear-gradient(135deg, var(--header-bg-start) 0%, var(--header-bg-end) 100%);
    padding: 30px 20px;
    box-shadow: 0 10px 30px var(--shadow-color);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

header > h1 {
    color: var(--header-text);
    text-align: center;
    font-size: 2.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 2px 2px 4px var(--text-shadow);
}

/* ==================== SCORE BOARD ==================== */
.score-board {
    margin: 40px auto;
    border: 4px solid var(--border-color);
    border-radius: 20px;
    text-align: center;
    width: 240px;
    color: var(--text-primary);
    font-size: 50px;
    padding: 20px 25px;
    font-weight: 700;
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    box-shadow: 0 15px 35px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.score-board:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px var(--shadow-color);
}

#user-score, #bot-score {
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: inline-block;
}

.badge {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    font-size: 14px;
    padding: 6px 15px;
    font-weight: 600;
    border-radius: 20px;
    box-shadow: 0 5px 15px rgba(245, 87, 108, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

#user-label {
    position: absolute;
    top: 35px;
    left: -32px;
    animation: pulse 2s infinite;
}

#bot-label {
    position: absolute;
    top: 35px;
    right: -26px;
    animation: pulse 2s infinite 0.5s;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ==================== EMOJIS ==================== */
#user-emoji, #bot-emoji {
    font-size: 28px;
    position: absolute;
    bottom: 10px;
    display: inline-block;
    transition: all 0.3s ease;
    transform-origin: center;
}

#user-emoji {
    left: 5px;
}

#bot-emoji {
    right: 5px;
}

/* ==================== RESULT ==================== */
.result {
    font-size: 50px;
    color: var(--text-primary);
    text-align: center;
    font-weight: 800;
    text-shadow: 0 5px 15px var(--text-shadow);
    margin-top: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin: 20px auto;
    max-width: 90%;
    box-shadow: 0 8px 32px var(--shadow-color);
    animation: fadeIn 0.5s ease;
}

.result > p {
    transition: opacity 0.5s ease, transform 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== CHOICES ==================== */
.choices {
    text-align: center;
    margin-top: 60px;
}

.choice {
    border: 5px solid var(--border-color);
    border-radius: 50%;
    padding: 30px;
    margin: 0 20px;
    display: inline-block;
    transition: all 0.3s ease;
    background: var(--choice-bg);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 25px var(--shadow-color);
    position: relative;
    overflow: hidden;
    transform-origin: center;
    will-change: transform;
}

.choice img {
    max-width: 100%;
    height: auto;
    display: block;
}

.choice::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.choice:hover::before {
    width: 300px;
    height: 300px;
}

.choice:hover {
    cursor: pointer;
    background: var(--choice-hover-bg);
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 15px 40px var(--hover-glow);
    animation: hover-float 2s ease-in-out infinite;
}

@keyframes hover-float {
    0%, 100% {
        transform: translateY(-5px) scale(1.15) rotate(5deg);
    }
    50% {
        transform: translateY(-10px) scale(1.15) rotate(5deg);
    }
}

.choice:active {
    transform: scale(1.05) rotate(0deg) !important;
    transition: transform 0.1s ease !important;
}

.choice.selected {
    animation: choiceGlow 0.5s ease;
}

@keyframes choiceGlow {
    0%, 100% { box-shadow: 0 10px 25px var(--shadow-color); }
    50% { box-shadow: 0 0 40px var(--hover-glow), 0 0 60px var(--hover-glow); }
}

/* ==================== COUNTDOWN ==================== */
#countdown {
    font-size: 55px;
    font-weight: 800;
    text-align: center;
    color: #FFD700;
    text-shadow: 
        0 0 20px #FFA500,
        0 0 30px #FF8C00;
    margin-bottom: 20px;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 3px;
}

.countdown-pulse {
    animation: pulse-countdown 0.7s ease-in-out infinite;
}

@keyframes pulse-countdown {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* ==================== MESSAGE ==================== */
#message {
    text-align: center;
    color: var(--text-primary);
    font-size: 45px;
    font-weight: 700;
    margin: 40px auto;
    text-shadow: 0 5px 15px var(--text-shadow);
    letter-spacing: 2px;
    animation: float-message 3s ease-in-out infinite;
}

@keyframes float-message {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ==================== ANIMATIONS ==================== */

/* Winner Glow */
.winner-glow {
    animation: enhanced-winner-glow 1s ease-in-out infinite, sparkle 0.5s ease-in-out infinite !important;
    filter: drop-shadow(0 0 10px #FFD700);
}

@keyframes enhanced-winner-glow {
    0%, 100% {
        text-shadow:
            0 0 10px #FFD700,
            0 0 20px #FFD700,
            0 0 30px #FFA500,
            0 0 40px #FFA500,
            0 0 50px #FF8C00;
        transform: scale(1);
    }
    50% {
        text-shadow:
            0 0 20px #FFFF00,
            0 0 30px #FFA500,
            0 0 40px #FF8C00,
            0 0 50px #FF4500,
            0 0 60px #FF0000;
        transform: scale(1.1);
    }
}

@keyframes sparkle {
    0%, 100% {
        filter: brightness(1) drop-shadow(0 0 5px #FFD700);
    }
    50% {
        filter: brightness(1.5) drop-shadow(0 0 15px #FFD700);
    }
}

/* Bounce */
.bounce {
    animation: enhanced-bounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes enhanced-bounce {
    0%, 100% { 
        transform: translateY(0) scale(1);
    }
    25% {
        transform: translateY(-20px) scale(1.1);
    }
    50% { 
        transform: translateY(-25px) scale(1.15);
    }
    75% {
        transform: translateY(-15px) scale(1.05);
    }
}

/* Shake */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(15deg); }
    50% { transform: rotate(-15deg); }
    75% { transform: rotate(15deg); }
}

/* Button Press Effect */
.button-pressed {
    transform: scale(0.9) !important;
    opacity: 0.7;
    transition: all 0.15s ease !important;
}

/* Confetti */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    z-index: 9999;
    pointer-events: none;
    animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ==================== DRAW EFFECTS ==================== */

/* Screen Flash */
.draw-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, transparent 70%);
    z-index: 9998;
    pointer-events: none;
    animation: flash-fade 0.8s ease-out forwards;
}

@keyframes flash-fade {
    0% { opacity: 0; }
    20% { opacity: 1; }
    100% { opacity: 0; }
}

/* Draw Explosion Text */
.draw-explosion {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 120px;
    font-weight: 900;
    color: #FFD700;
    text-shadow: 
        0 0 20px #FFA500,
        0 0 40px #FF8C00,
        0 0 60px #FF6347,
        0 0 80px #FF4500;
    z-index: 9999;
    pointer-events: none;
    animation: draw-explode 2s ease-out forwards;
    letter-spacing: 10px;
}

@keyframes draw-explode {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.3) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5) rotate(10deg);
        opacity: 0;
    }
}

/* Draw Particles */
.draw-particle {
    position: fixed;
    color: #FFD700;
    font-weight: bold;
    z-index: 9997;
    pointer-events: none;
    animation: particle-float 2s ease-out forwards;
    text-shadow: 0 0 10px #FFA500;
    top: 50%;
}

@keyframes particle-float {
    0% {
        transform: translateY(0) scale(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-300px) scale(1.5) rotate(360deg);
        opacity: 0;
    }
}

/* Screen Shake */
.screen-shake {
    animation: screen-shake 0.5s ease-in-out;
}

@keyframes screen-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Score Board Flash */
.draw-board-flash {
    animation: board-flash 0.5s ease-in-out 3;
    border-color: #FFD700 !important;
}

@keyframes board-flash {
    0%, 100% {
        background: var(--glass-bg);
        box-shadow: 0 15px 35px var(--shadow-color);
    }
    50% {
        background: rgba(255, 215, 0, 0.3);
        box-shadow: 
            0 0 30px #FFD700,
            0 0 60px #FFA500,
            0 15px 35px var(--shadow-color);
    }
}

/* Tie Glow */
.tie-glow {
    animation: super-tie-glow 0.4s ease-in-out 4 !important;
    text-shadow: 
        0 0 20px #FFD700,
        0 0 30px #FFA500,
        0 0 40px #FF8C00,
        0 0 50px #FF6347 !important;
}

@keyframes super-tie-glow {
    0%, 100% { 
        opacity: 1;
        transform: scale(1) rotate(-5deg);
        filter: brightness(1);
    }
    50% { 
        opacity: 0.8;
        transform: scale(1.3) rotate(5deg);
        filter: brightness(1.5) hue-rotate(20deg);
    }
}

/* Draw Count Badge */
.draw-count {
    display: inline-block;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.7em;
    font-weight: 900;
    margin: 0 10px;
    box-shadow: 0 5px 15px rgba(255, 165, 0, 0.5);
    animation: badge-pulse 0.5s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ==================== UTILITY CLASSES ==================== */

/* Prevent text selection during game */
.choices, .score-board, .result {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

/* Loading state */
body.playing {
    cursor: wait;
}

.choice.disabled {
    pointer-events: none;
    opacity: 0.5;
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 768px) {
    header > h1 {
        font-size: 1.8rem;
        letter-spacing: 2px;
    }
    
    .score-board {
        width: 200px;
        font-size: 40px;
    }
    
    .choice {
        padding: 20px;
        margin: 0 10px;
    }
    
    .choice:hover {
        transform: scale(1.1) rotate(3deg);
    }
    
    #message, .result {
        font-size: 32px;
    }
    
    .confetti {
        width: 8px;
        height: 8px;
    }
    
    #countdown {
        font-size: 40px;
        min-height: 55px;
    }
    
    .draw-explosion {
        font-size: 70px;
        letter-spacing: 5px;
    }
    
    .draw-particle {
        font-size: 25px !important;
    }
    
    .draw-count {
        font-size: 0.6em;
        padding: 3px 10px;
    }
}

.footer-buttons button {
    padding: 8px 18px;
    margin: 6px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid #fff3;
    background: #222;
    color: white;
    transition: 0.3s;
}

.footer-buttons button.active-theme {
    background: #ffcc00;
    color: black;
    border-color: #ffcc00;
    transform: scale(1.05);
}

footer {
    text-align: center;          /* Centers text */
    display: flex;               /* Flexbox layout */
    flex-direction: column;      /* Stack items vertically */
    align-items: center;         /* Center horizontally */
    justify-content: center;     /* Center vertically (if height increases) */
    margin-top: 40px;
}

.footer-buttons {
    margin-top: 10px;
    display: flex;
    gap: 12px;                    /* Space between buttons */
    justify-content: center;     /* Center the buttons */
}
