/* CSS Variables for consistent theming */
:root {
    /* Colors */
    --color-red: #ED1C24;
    --color-blue: #00AEEF;
    --color-green: #00A650;
    --color-yellow: #FFF200;
    --color-purple: #91268F;
    --color-orange: #F7931D;
    --color-black: #000000;
    --color-white: #FFFFFF;
    --color-background: #1a1a1a;
    
    /* Spacing */
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 20px;
    --spacing-lg: 32px;
    
    /* Border Radius */
    --border-radius-sm: 12px;
    --border-radius-md: 20px;
    --border-radius-circle: 50%;
    
    /* Shadows */
    --shadow-card: 0 4px 15px rgba(0, 0, 0, 0.3),
                  inset 0 2px 10px rgba(255, 255, 255, 0.1);
    
    /* Transitions */
    --transition-default: all 0.3s ease;
}

/* Reset and Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    padding: 0;
    background: var(--color-background);
    color: var(--color-white);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

/* Video Background */
#webcam {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    transform: scaleX(-1);
    transition: filter 0.3s ease;
    filter: none;
    -webkit-filter: none;
}

#webcam.greyscale {
    filter: grayscale(100%) !important;
    -webkit-filter: grayscale(100%) !important;
}

.webcam-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1;
    display: block;
}

.game-ui:not(.hidden) ~ .webcam-overlay {
    display: none;
}

/* Game UI Layout */
.game-ui {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    padding: var(--spacing-md);
    background: none;
}

.game-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* padding: 20px; */
    box-sizing: border-box;
}

/* Section Layouts */
.top-section {
    flex: 0 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 7px;
    position: relative;
}

.middle-section {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    padding: 0px;
    z-index: 3;
}

.bottom-section {
    flex: 0 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    padding-bottom: max(var(--spacing-md), env(safe-area-inset-bottom));
}

/* Score Display */
.score-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 4rem;
    font-size: 32px;
    color: white;
    padding: 20px;
    border-radius: 50%;
    width: 6rem;
    height: 6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 5px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    z-index: 3;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px)
}

.score {
    color: white;
    font-weight: bold;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.score.animate {
    animation: scorePopAndGlow 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bonus-points-container {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
}

.bonus-points {
    font-size: 2rem;
    font-weight: bold;
    color: var(--color-yellow);
    text-shadow: 0 0 10px rgba(255, 242, 0, 0.8),
                 0 0 20px rgba(255, 242, 0, 0.5),
                 0 0 30px rgba(255, 242, 0, 0.3);
    white-space: nowrap;
}

.bonus-points-container.show {
    animation: bonusPointsAnimation 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes bonusPointsAnimation {
    0% {
        opacity: 0;
        transform: translate(-50%, 50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -20%) scale(1.2);
    }
    40% {
        transform: translate(-50%, -30%) scale(1);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -40%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5);
    }
}

.streak-counter {
    position: fixed;
    bottom: 280px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #f5f5f5;
    padding: 2rem;
    border-radius: 20px;
    font-size: 1.6em;
    font-weight: 800;
    text-align: center;
    text-shadow: #000000 3px 3px 15px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    letter-spacing: 0.5px;
}

.streak-counter.visible {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    animation: streakPulse 1.0s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.streak-counter.hiding {
    opacity: 0;
    transform: translateX(-50%) scale(0.9);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.streak-counter::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 20px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.streak-counter.visible::before {
    opacity: 1;
}

@keyframes streakPulse {
    0% {
        transform: translateX(-50%) scale(1);
    }
    50% {
        transform: translateX(-50%) scale(1.05);
    }
    100% {
        transform: translateX(-50%) scale(1);
    }
}

@keyframes scorePopAndGlow {
    0% {
        transform: scale(1);
        text-shadow: 0 0 0 rgba(255, 255, 255, 0);
    }
    50% {
        transform: scale(1.5);
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    }
    100% {
        transform: scale(1);
        text-shadow: 0 0 0 rgba(255, 255, 255, 0);
    }
}

/* Particle Canvas */
#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

/* Card Styles */
.card-container {
    width: 600px;
    max-width: 90%;
    aspect-ratio: 3/2;
    margin: 0 auto;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    padding: 5% 15px;
    box-sizing: border-box;
    position: relative;
    z-index: 2;
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 900;
    text-transform: uppercase;
    text-align: center;
    font-size: clamp(40px, 16vw, 140px);
    line-height: 1;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.card-container span {
    display: block;
    width: 90%;
    margin: 0 auto;
    transform-origin: center;
    transform: scale(var(--text-scale, 1));
    transition: transform 0.2s ease;
    box-sizing: border-box;
}

/* Add JavaScript to dynamically scale text */
/* <script>
function scaleCardText() {
    const cards = document.querySelectorAll('.card-container');
    cards.forEach(card => {
        const span = card.querySelector('span');
        if (!span) return;
        
        // Reset scale to measure true width
        span.style.setProperty('--text-scale', '1');
        
        // Get the desired width (85% of card width to ensure padding)
        const targetWidth = card.offsetWidth * 0.85;
        const currentWidth = span.offsetWidth;
        
        // Calculate and apply scale if text is too wide
        if (currentWidth > targetWidth) {
            const scale = targetWidth / currentWidth;
            span.style.setProperty('--text-scale', scale);
        }
    });
}

// Run on load and resize
window.addEventListener('load', scaleCardText);
window.addEventListener('resize', scaleCardText);

// Run when cards change
const observer = new MutationObserver(scaleCardText);
observer.observe(document.body, { childList: true, subtree: true });
</script> */

/* Tablet and up */
@media screen and (min-width: 768px) {
    .card-container {
        padding: 25px;
        font-size: clamp(60px, 15vw, 160px);
    }
}

/* Desktop and up */
@media screen and (min-width: 1200px) {
    .card-container {
        padding: 30px;
        width: 800px;
        font-size: clamp(80px, 13vw, 140px);
    }
}

/* Card Animations */
.card-container.correct {
    animation: correct-animation 1s ease-out forwards;
}

.card-container.incorrect {
    animation: incorrect-animation 1s ease-out forwards;
}

@keyframes correct-animation {
    0% {
        transform: scale(1) translate(0, 0) rotate(0deg);
        opacity: 1;
    }
    20% {
        transform: scale(0.8) translate(30px, 30px) rotate(10deg);
        opacity: 1;
    }
    100% {
        transform: scale(1.1) translate(100px, -50px) rotate(30deg);
        opacity: 0;
    }
}

@keyframes incorrect-animation {
    0% {
        transform: translateX(0) rotate(0deg);
        opacity: 1;
    }
    10%, 30%, 50% {
        transform: translateX(-10px) rotate(-2deg);
        opacity: 1;
    }
    20%, 40% {
        transform: translateX(10px) rotate(2deg);
        opacity: 1;
    }
    60% {
        transform: translateX(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(1000px) rotate(20deg);
        opacity: 0;
    }
}

/* Card Colors */
.card-container.red { background-color: var(--color-red); }
.card-container.blue { background-color: var(--color-blue); }
.card-container.green { background-color: var(--color-green); }
.card-container.yellow { background-color: var(--color-yellow); }
.card-container.purple { background-color: var(--color-purple); }
.card-container.orange { background-color: var(--color-orange); }

/* Text Colors */
.text-red { color: var(--color-red) !important; }
.text-blue { color: var(--color-blue) !important; }
.text-green { color: var(--color-green) !important; }
.text-yellow { color: var(--color-yellow) !important; }
.text-purple { color: var(--color-purple) !important; }
.text-orange { color: var(--color-orange) !important; }
.text-black { color: var(--color-black) !important; }

/* Voice Feedback */
.voice-feedback {
    position: relative;
    width: fit-content;
    text-align: center;
    padding: 10px;
    margin-top: 10px;
    white-space: nowrap;
    min-width: min-content;
    font-size: 1.0rem;
    font-weight: bold;
    color: white;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: var(--border-radius-sm);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
    z-index: 100;
}

.voice-feedback:not(:empty) {
    opacity: 1;
    transform: translateY(0);
}

.voice-feedback span {
    display: inline-block;
    margin: 0 5px;
}

.voice-feedback .separator {
    color: rgba(255, 255, 255, 0.5);
}

/* Tutorial Styles */
.tutorial {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.tutorial.hidden {
    display: none;
}

.tutorial-content {
    max-width: 90%;
    max-height: 90%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    text-align: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.tutorial-slides {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-md) 0;
}

.tutorial-image {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius-sm);
}

.close-tutorial {
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: 1.2em;
    font-weight: bold;
    border: none;
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.9);
    color: var(--color-black);
    cursor: pointer;
    transition: var(--transition-default);
}

.close-tutorial:hover {
    background: var(--color-white);
    transform: scale(1.05);
}

.tutorial-intro {
    font-size: 1.2rem;
    color: var(--color-white);
    text-align: center;
    margin: 1rem 0;
    line-height: 1.5;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.tutorial-bonus {
    font-size: 1.2rem;
    color: var(--color-yellow);
    text-align: center;
    margin: 1.5rem 0;
    line-height: 1.5;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    animation: glowPulse 2s infinite;
}

@keyframes glowPulse {
    0% {
        text-shadow: 0 0 5px rgba(255, 242, 0, 0.5);
    }
    50% {
        text-shadow: 0 0 20px rgba(255, 242, 0, 0.8),
                     0 0 30px rgba(255, 242, 0, 0.5);
    }
    100% {
        text-shadow: 0 0 5px rgba(255, 242, 0, 0.5);
    }
}

.tutorial-slides {
    margin: 2rem 0;
}

.game-over .tutorial-content {
    margin-top: 2rem;
    padding: 1rem;
}

.game-over .tutorial-content h3 {
    color: var(--color-white);
    margin-bottom: 1rem;
}

@media (max-width: 480px) {
    .tutorial-intro,
    .tutorial-bonus {
        font-size: 1rem;
        padding: 0 1rem;
    }
}

/* Timer Styles */
.timer-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.2);
    overflow: hidden;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.timer-container.hidden {
    display: block !important;
    opacity: 1;
    visibility: hidden;
}

.timer-bar {
    height: 100%;
    width: 100%;
    background-color: var(--color-white);
    transform-origin: center;
    transition: transform 0.1s linear;
}

.timer-container.urgent:not(.hidden) .timer-bar {
    background-color: var(--color-red);
}

.timer-container.urgent {
    animation: pulseUrgent 0.47s ease-in-out infinite;
}

@keyframes pulseUrgent {
    0% {
        opacity: 0.3;
        /* transform: scale(0.98); */
    }
    50% {
        opacity: 1;
        /* transform: scale(1.02); */
    }
    100% {
        opacity: 0.3;
        /* transform: scale(0.98); */
    }
}

.timer-container {
    width: 90%;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    position: relative;
    z-index: 3;
}

.timer {
    width: 100%;
    height: 40px;
    background: white;
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: center;
    transition: transform 0.1s linear, background-color 300ms ease-in;
    border-radius: 2rem;
}

@keyframes timerShrink {
    0% {
        transform: scaleX(1);
        background-color: white;
    }
    100% {
        transform: scaleX(0);
        background-color: var(--color-red);
    }
}

/* Animations */
@keyframes cardEnter {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

@keyframes wobble {
    0% { transform: translate(0); }
    25% { transform: translate(-10px, 0); }
    50% { transform: translate(10px, 0); }
    75% { transform: translate(-10px, 0); }
    100% { transform: translate(0); }
}

#emoji-container {
    animation: wobble 0.5s infinite;
}

/* Emoji Animation */
.emoji-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 120px;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.emoji-container.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    animation: emojiAnimation 3s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes emojiAnimation {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    10% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 1;
    }
    20% {
        transform: translate(-50%, -50%) scale(2);
    }
    30%, 50% {
        transform: translate(-50%, -50%) scale(2) rotate(-5deg);
    }
    40%, 60% {
        transform: translate(-50%, -50%) scale(2) rotate(5deg);
    }
    70% {
        transform: translate(-50%, -50%) scale(2) rotate(0);
    }
    90% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Override for timer container */
.timer-container.hidden {
    display: block !important;
    opacity: 1;
    visibility: hidden;
}

/* Responsive Design */
@media screen and (min-width: 922px) {
    .tutorial-content {
        max-width: 95%;
        max-height: 95%;
    }

    .tutorial-slides {
        grid-template-columns: repeat(2, minmax(400px, 1fr));
        gap: var(--spacing-lg);
    }

    .tutorial-image {
        width: 100%;
        max-width: 450px;
        height: auto;
    }
}

@media screen and (max-width: 768px) {
    .card-container {
        width: 90%;
        padding: var(--spacing-sm);
        margin: 1rem auto;
    }
    
    .tutorial-content {
        padding: var(--spacing-sm);
    }
    
    .tutorial-slides {
        grid-template-columns: 1fr;
    }
}

/* Main Menu Styles */
.menu-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    padding: var(--spacing-md);
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
}

.logo-container {
    margin-bottom: var(--spacing-lg);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    overflow: hidden;
    background: white;
    padding: 40px;
}

.logo {
    height: 200px;
    width: auto;
    object-fit: cover;
    border-radius: 0%;
    box-shadow: none;
}

.button-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.menu-button {
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: 1.2em;
    font-weight: bold;
    border: none;
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.9);
    color: var(--color-black);
    cursor: pointer;
    transition: var(--transition-default);
}

.menu-button:hover {
    background: var(--color-white);
    transform: scale(1.05);
}

/* Game Over Screen */
.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.game-over.hidden {
    display: none;
}

.game-over-content {
    margin-top: env(safe-area-inset-top, 20px);
    background-color: var(--color-background);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    max-width: 90%;
    width: 400px;
    height: auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.game-over h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    margin-top: 1rem;
    color: var(--color-text);
}

.game-over .final-score {
    font-size: 3rem;
    font-weight: bold;
    color: var(--color-primary);
    display: block;
    margin: 1rem 0;
}

#realGameImg {
    width: 8rem;
    height: 9rem;
    border-radius: 10px;
    align-self: center;

}

.share-container {
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.share-container .menu-button.reward {
    margin-top: 0.5rem;
    width: auto;
    min-width: 200px;
}

.share-container p {
    margin-bottom: 1rem;
}

.share-button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
    min-width: 200px;
}

.share-button.twitter {
    background-color: #1DA1F2;
    color: white;
}

.share-button.facebook {
    background-color: #4267B2;
    color: white;
}

.share-button.reddit {
    background-color: #FF4500;
    color: white;
}

.share-button.whatsapp {
    background-color: #25D366;
    color: white;
}

.share-button.email {
    background-color: #D44638;
    color: white;
}

.button-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.menu-button.reward {
    background-color: var(--color-success);
    color: white;
    font-size: 1.2rem;
    padding: 1rem;
    animation: pulse 2s infinite;
}

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

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .game-over {
        align-items: flex-start;
        padding-top: max(env(safe-area-inset-top), 40px);
    }
    
    .game-over-content {
        margin-top: 0;
        padding: 1.5rem;
    }
    
    .game-over h2 {
        font-size: 2rem;
        margin-top: 0;
    }
    
    .game-over .final-score {
        font-size: 2.5rem;
        margin: 0.5rem 0;
    }

    .social-buttons {
        flex-direction: column;
    }
}

/* How to Play Section */
.how-to-play {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.how-to-play.hidden {
    display: none;
}

.how-to-play-content {
    background-color: var(--color-background);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    max-width: 90%;
    width: 400px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.how-to-play h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--color-text);
}

.rules {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.rule {
    text-align: left;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.rule h3 {
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.rule p {
    color: var(--color-text);
    line-height: 1.4;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .how-to-play-content {
        padding: 1.5rem;
    }

    .how-to-play h2 {
        font-size: 1.75rem;
    }

    .rule {
        padding: 0.75rem;
    }
}

/* Bonus Points Styling */
/* Removed */

/* Animations */
/* Removed */

/* Share Button */
.share-button {
    background: linear-gradient(45deg, var(--color-blue), var(--color-purple));
    color: var(--color-white);
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius-md);
    font-size: 1.7rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition-default);
    box-shadow: var(--shadow-card);
    width: -webkit-fill-available;
    margin: 10px 0;
}

.share-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.share-button:active {
    transform: scale(0.95);
}

/* Error Message */
.error-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px;
    border-radius: 10px;
    z-index: 9999;
    max-width: 90%;
    text-align: center;
    white-space: pre-line;
    font-size: 16px;
    line-height: 1.5;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.error-message.hidden {
    display: none;
}

/* Ensure error message appears above everything */
#globalError {
    z-index: 10000;
}

/* Global Error Message */
.global-error {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px;
    border-radius: 10px;
    max-width: 80%;
    text-align: center;
    z-index: 1000;
    white-space: pre-line;
    font-size: 16px;
    line-height: 1.5;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.global-error:not(.hidden) {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Animation for claim reward button text change */
@keyframes textReveal {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    20% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.menu-button.reward.text-change {
    animation: textReveal 0.3s ease-out;
    background-color: var(--color-green) !important;
}
