/* Theme Variables */
:root {
    /* Light theme (default) */
    --bg-color: #f0f0f0;
    --text-color: #333;
    --button-bg: white;
    --button-border: #ddd;
    --button-hover-bg: #e9e9e9;
    --button-active-bg: #d9d9d9;
    --reset-bg: #ff6b6b;
    --reset-hover-bg: #ff5252;
    --reset-active-bg: #e55555;
    --instructions-color: #666;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    /* Dark theme */
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --button-bg: #333;
    --button-border: #555;
    --button-hover-bg: #444;
    --button-active-bg: #222;
    --reset-bg: #ff4757;
    --reset-hover-bg: #ff3742;
    --reset-active-bg: #e63946;
    --instructions-color: #aaa;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

body {
    font-family: Arial, sans-serif;
    text-align: center;
    padding: 2rem;
    background: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Theme toggle button */
.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--button-bg);
    border: 2px solid var(--button-border);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.theme-toggle:hover {
    background: var(--button-hover-bg);
    transform: scale(1.05);
    box-shadow: 0 4px 8px var(--shadow-color);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.choices button {
    font-size: 1.2rem;
    padding: 1rem 2rem;
    margin: 0.5rem;
    cursor: pointer;
    border: 2px solid var(--button-border);
    border-radius: 8px;
    background: var(--button-bg);
    color: var(--text-color);
    transition: all 0.2s ease;
}

.choices button:hover {
    background: var(--button-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-color);
}

.choices button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px var(--shadow-color);
}

/* Disabled button state */
.choices button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.choices button:disabled:hover {
    background: white;
    transform: none !important;
    box-shadow: none !important;
}

/* Touch-friendly interactions */
.choices button:focus {
    outline: 2px solid #007acc;
    outline-offset: 2px;
}

.choices button:focus:not(:focus-visible) {
    outline: none;
}

/* Enhanced touch feedback for mobile */
@media (hover: none) and (pointer: coarse) {
    .choices button:active {
        background: var(--button-active-bg);
        transform: scale(0.98);
        transition: all 0.1s ease;
    }
    
    .reset:active {
        background: var(--reset-active-bg) !important;
        transform: scale(0.98);
    }
}

.reset {
    background: var(--reset-bg) !important;
    color: white;
    border-color: var(--reset-bg) !important;
}

.reset:hover {
    background: var(--reset-hover-bg) !important;
}

.score,
.result {
    margin-top: 1rem;
}

.instructions {
    color: var(--instructions-color);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.result {
    font-weight: bold;
    min-height: 1.5rem;
    font-size: 1.1rem;
}

.score {
    font-size: 1.1rem;
    font-weight: bold;
}

.computer-choice-display {
    margin-top: 2rem;
}

.emoji {
    font-size: 6rem;
    margin-top: 0.5rem;
    display: inline-block;
    transition: all 0.3s ease;
}

/* Computer thinking animation */
.emoji.thinking {
    animation: bounce 0.6s infinite alternate;
}

@keyframes bounce {
    0% {
        transform: translateY(0px);
    }
    100% {
        transform: translateY(-20px);
    }
}

/* Reveal animation when showing computer choice */
.emoji.reveal {
    animation: reveal 0.5s ease;
}

@keyframes reveal {
    0% {
        transform: scale(0.5);
        opacity: 0.5;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive Design for Mobile Devices */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }
    
    .choices button {
        font-size: 1.1rem;
        padding: 1rem 1.5rem;
        margin: 0.5rem;
        display: block;
        width: 90%;
        max-width: 300px;
        margin: 0.5rem auto;
        min-height: 48px; /* Ensures minimum touch target size */
        min-width: 48px;
    }
    
    .score {
        font-size: 1rem;
        margin: 1rem 0;
    }
    
    .score p {
        margin: 0.5rem 0;
    }
    
    .emoji {
        font-size: 4rem;
    }
    
    .computer-choice-display {
        margin-top: 1.5rem;
    }
    
    .computer-choice-display h2 {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }
    
    .result {
        margin: 1.2rem 0;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.5rem;
    }
    
    h1 {
        font-size: 1.5rem;
        margin-bottom: 0.8rem;
    }
    
    .choices button {
        font-size: 1rem;
        padding: 1rem 1.2rem;
        width: 95%;
        min-height: 50px; /* Larger touch targets for smaller screens */
        margin: 0.4rem auto;
    }
    
    .instructions {
        font-size: 0.8rem;
        margin-bottom: 0.8rem;
    }
    
    .emoji {
        font-size: 3rem;
    }
    
    .result {
        font-size: 1rem;
        margin: 1rem 0;
    }
    
    .computer-choice-display {
        margin-top: 1rem;
    }
    
    .computer-choice-display h2 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
}

/* Large screen optimizations */
@media (min-width: 1200px) {
    .game-area {
        max-width: 800px;
        margin: 0 auto;
    }
    
    .choices {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 1rem;
        margin: 2rem 0;
    }
    
    .choices button {
        flex: 0 1 180px;
        max-width: 200px;
        margin: 0;
    }
    
    .emoji {
        font-size: 7rem;
    }
}