body {
    background-color: #121212;
    color: white;
    font-family: Arial, sans-serif;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.copyright {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    padding: 10px;
    z-index: 0;
}

#game-container {
    background-color: rgba(30, 30, 30, 0.9);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    width: 92%;
    max-width: 1200px;
    min-height: 80vh;
    height: 80vh;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow:
        0 0 20px rgba(0, 0, 0, 0.5),
        inset 0 0 30px rgba(0, 0, 0, 0.7);
}

#game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 15px;
    padding: 2px;
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.1) 0%,
            rgba(255, 255, 255, 0.05) 50%,
            transparent 50%);
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

#game-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(to bottom,
            rgba(0, 0, 0, 1) 0%,
            rgba(0, 0, 0, 0.7) 5%,
            rgba(0, 0, 0, 0.4) 10%,
            rgba(0, 0, 0, 0.1) 15%,
            transparent 25%,
            transparent 75%,
            rgba(0, 0, 0, 0.1) 85%,
            rgba(0, 0, 0, 0.4) 90%,
            rgba(0, 0, 0, 0.7) 95%,
            rgba(0, 0, 0, 1) 100%);
    pointer-events: none;
    border-radius: 15px;
}

.title {
    font-size: 64px;
    margin: 0 0 40px 0;
    text-shadow:
        3px 3px 0 #ff4444,
        6px 6px 0 #cc0000,
        9px 9px 15px rgba(0, 0, 0, 0.5);
    color: white;
    font-weight: 900;
    font-family: 'Arial Black', Arial, sans-serif;
    letter-spacing: 2px;
    position: relative;
    z-index: 2;
    text-transform: uppercase;
    -webkit-text-stroke: 2px rgba(255, 255, 255, 0.3);
}

.press-enter {
    color: #fff;
    font-size: 24px;
    margin: 0;
    animation: pulse 2s infinite;
    position: relative;
    z-index: 2;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 15px 30px;
    border: 3px solid #fff;
    border-radius: 5px;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
    box-shadow:
        0 0 0 3px rgba(0, 0, 0, 0.7),
        0 0 10px rgba(255, 255, 255, 0.3);
    cursor: pointer;
    user-select: none;
}

@keyframes pulse {
    0% {
        opacity: 0.7;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

    100% {
        opacity: 0.7;
        transform: scale(1);
    }
}

#greeting-screen,
#menu-screen,
#game-screen {
    display: none;
}

#greeting-screen {
    display: flex;
    flex-direction: column;
    justify-content: center !important;
    align-items: center;
    height: 100%;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.menu-button {
    display: block;
    width: 70%;
    min-width: 280px;
    min-height: 56px;
    margin: 18px auto;
    padding: 16px 24px;
    border: 3px solid transparent;
    border-radius: 10px;
    font-size: 22px;
    cursor: pointer;
    font-weight: bold;
    position: relative;
    transition: all 0.25s ease;
}

.menu-button.selected,
.menu-button:focus-visible {
    outline: none;
    border: 3px solid #fff;
    box-shadow:
        0 0 0 4px rgba(255, 255, 255, 0.95),
        0 0 0 8px rgba(255, 255, 255, 0.4),
        0 0 28px 2px rgba(255, 255, 255, 0.6),
        0 0 48px 6px rgba(255, 255, 255, 0.35),
        inset 0 0 20px rgba(255, 255, 255, 0.08);
    transform: scale(1.04);
}

.menu-button.selected:hover,
.menu-button:focus-visible:hover {
    transform: scale(1.07) !important;
    box-shadow:
        0 0 0 4px #fff,
        0 0 0 8px rgba(255, 255, 255, 0.6),
        0 0 36px 4px rgba(255, 255, 255, 0.7),
        0 0 60px 10px rgba(255, 255, 255, 0.4),
        inset 0 0 24px rgba(255, 255, 255, 0.12);
}

#easy {
    background-color: #4CAF50;
    color: white;
    animation: buttonPulse 2s infinite;
}

#medium {
    background-color: #FFD700;
    color: black;
    animation: buttonPulse 2s infinite 0.4s;
}

#expert {
    background-color: #FF6B6B;
    color: white;
    animation: buttonPulse 2s infinite 0.8s;
}

#emoji {
    background-color: #FF69B4;
    color: white;
    animation: buttonPulse 2s infinite 1.2s;
    box-shadow: 0 0 15px rgba(255, 105, 180, 0.3);
}

#hardcore {
    background-color: #8B0000;
    color: white;
    animation: buttonPulse 2s infinite 1.6s;
    box-shadow: 0 0 15px rgba(139, 0, 0, 0.3);
}

/* Keep same border space as other buttons to avoid layout shift when navigating */
#emoji:not(.selected):not(:focus-visible),
#hardcore:not(.selected):not(:focus-visible) {
    border: 3px solid transparent;
    background-image: none;
    background-origin: unset;
    background-clip: unset;
}

.menu-button:hover {
    transform: scale(1.05) !important;
    filter: brightness(1.2) !important;
}

.menu-button:not(.selected):not(:focus-visible):hover {
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

/* Update sparkle and ember effects to work without the gradient borders */
.emoji-sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
}

.ember-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #ff4400;
    border-radius: 50%;
    pointer-events: none;
    box-shadow:
        0 0 6px #ff4400,
        0 0 10px #ff8800;
    opacity: 0.8;
}

@keyframes ember {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translate(var(--moveX), var(--moveY)) scale(0);
        opacity: 0;
    }
}

.difficulty-hint {
    color: #888;
    font-style: italic;
    margin-top: 20px;
    font-size: 14px;
}

/* Game screen styles */
#game-screen {
    display: none;
    height: 100%;
    position: relative;
    margin-left: -40px;
    margin-right: -40px;
    width: calc(100% + 80px);
}

#game-area {
    height: calc(100% - 80px);
    position: relative;
    overflow: hidden;
    background-color: #1E1E1E;
    border: none;
    margin-bottom: 20px;
    min-height: 450px;
    width: 100%;
}

.falling-word {
    position: absolute;
    font-size: 24px;
    color: white;
    text-align: center;
    transform: translateX(-50%);
    white-space: nowrap;
    transition: top 0.016s linear;
    user-select: none;
}

.bottom-ui {
    height: 40px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    padding: 0 20px;
}

.input-row {
    display: flex;
    gap: 10px;
    height: 40px;
}

.go-back {
    background-color: #1E1E1E;
    color: #888;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    height: 100%;
    white-space: nowrap;
}

.go-back:hover {
    background-color: #444;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.input-field {
    flex-grow: 1;
    background-color: #1E1E1E;
    border: 2px solid #0078d4;
    color: white;
    padding: 8px 16px;
    font-size: 18px;
    outline: none;
    height: 100%;
    box-sizing: border-box;
}

.input-field:focus {
    border-color: rgba(255, 255, 255, 0.2);
}

.stats {
    display: flex;
    gap: 30px;
    font-size: 18px;
    color: white;
    height: 100%;
    align-items: center;
    white-space: nowrap;
}

.lives {
    color: #ff4444;
    font-weight: bold;
}

#score {
    font-weight: bold;
}

/* Emoji mode button special styling */
#emoji {
    position: relative;
}

#emoji::before {
    content: "🎮";
    position: absolute;
    left: 20px;
}

#emoji::after {
    content: "✨";
    position: absolute;
    right: 20px;
}

/* Particle styles */
.particle {
    position: absolute;
    background: white;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    animation: sparkle 1.5s ease-in-out infinite;
}

@keyframes sparkle {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* Background floating words */
.floating-word {
    position: fixed;
    pointer-events: none;
    white-space: nowrap;
    z-index: -1;
    opacity: 0.15;
    /* Slightly increased from 0.1 */
    font-family: Arial, sans-serif;
    /* Size and color will be set dynamically in JS */
}

.rainbow-line {
    position: absolute;
    /* width will be set dynamically in JS */
    height: 140%;
    background: linear-gradient(to bottom,
            rgba(255, 0, 0, 0) 0%,
            rgba(255, 0, 0, 0.1) 10%,
            rgba(255, 0, 0, 0.6) 20%,
            rgba(255, 153, 0, 0.6) 35%,
            rgba(255, 255, 0, 0.6) 50%,
            rgba(51, 255, 0, 0.6) 65%,
            rgba(0, 153, 255, 0.6) 80%,
            rgba(102, 51, 255, 0.6) 90%,
            rgba(102, 51, 255, 0.1) 95%,
            rgba(102, 51, 255, 0) 100%);
    opacity: 0;
    filter: blur(4px);
    transform-origin: center;
    z-index: 1;
    top: -20%;
}

@keyframes shoot-rainbow {
    0% {
        opacity: 0;
        transform: translateY(120%) scaleX(1);
    }

    15% {
        opacity: 0.8;
        transform: translateY(70%) scaleX(1.5);
    }

    85% {
        opacity: 0.8;
        transform: translateY(-70%) scaleX(1.5);
    }

    100% {
        opacity: 0;
        transform: translateY(-120%) scaleX(1);
    }
}

@keyframes shoot-rainbow-down {
    0% {
        opacity: 0;
        transform: translateY(-120%) scaleX(1);
    }

    15% {
        opacity: 0.8;
        transform: translateY(-70%) scaleX(1.5);
    }

    85% {
        opacity: 0.8;
        transform: translateY(70%) scaleX(1.5);
    }

    100% {
        opacity: 0;
        transform: translateY(120%) scaleX(1);
    }
}

.rainbow-line.down {
    animation: shoot-rainbow-down 3s ease-out forwards;
}

@keyframes buttonPulse {
    0% {
        transform: scale(1);
        filter: hue-rotate(0deg);
    }

    50% {
        transform: scale(1.02);
        filter: hue-rotate(10deg);
    }

    100% {
        transform: scale(1);
        filter: hue-rotate(0deg);
    }
}

/* Update ember animation for hover state */
@keyframes ember-hover {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translate(var(--moveX), var(--moveY)) scale(0);
        opacity: 0;
    }
}

#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 100px 0 0 100px;
    background-color: #1E1E1E;
}

#game-over-screen h2 {
    font-size: 64px;
    margin: 0;
    text-shadow:
        3px 3px 0 #ff4444,
        6px 6px 0 #cc0000;
    color: white;
    font-weight: 900;
    font-family: 'Arial Black', Arial, sans-serif;
    text-transform: uppercase;
    -webkit-text-stroke: 2px rgba(255, 255, 255, 0.3);
}

#game-over-screen p {
    font-size: 36px;
    margin: 20px 0 40px 0;
    color: #fff;
}

#game-over-screen .menu-button {
    background-color: #8B0000;
    border: none;
    color: white;
    width: 250px;
    height: 60px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
}

#game-over-screen .menu-button:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

.game-over-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 120px;
    font-weight: bold;
    color: white;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    animation: countdownPulse 1s ease-out;
    z-index: 10;
}

@keyframes countdownPulse {
    0% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }

    50% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
}

/* Hardcore mode text styling */
.falling-word.hardcore {
    font-family: 'Creepster', cursive;
    color: #ff0000;
    text-shadow:
        0 0 10px rgba(255, 0, 0, 0.5),
        0 0 20px rgba(255, 0, 0, 0.3);
    font-size: 28px;
    letter-spacing: 2px;
}

.game-sparkle {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    animation: gameSparkle 2s ease-out forwards;
}

@keyframes gameSparkle {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.game-ember {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    animation: gameEmber 2s ease-out forwards;
}

@keyframes gameEmber {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.8;
    }

    100% {
        transform: translateY(-100px);
        opacity: 0;
    }
}

/* Add screen shake effect */
@keyframes screenShake {

    0%,
    100% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(-5px, 5px);
    }

    50% {
        transform: translate(5px, -5px);
    }

    75% {
        transform: translate(-5px, -5px);
    }
}

/* Add emoji failure animations */
@keyframes floatUpAndRock {
    0% {
        transform: translateY(100%) rotate(-10deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    45% {
        transform: translateY(0) rotate(10deg);
    }

    90% {
        transform: translateY(-100%) rotate(-10deg);
        opacity: 1;
    }

    100% {
        transform: translateY(-150%) rotate(0deg);
        opacity: 0;
    }
}

/* Hardcore mode enhancements */
.falling-word.hardcore {
    font-family: 'Creepster', cursive;
    color: #ff0000;
    text-shadow:
        0 0 10px rgba(255, 0, 0, 0.5),
        0 0 20px rgba(255, 0, 0, 0.3),
        0 0 30px rgba(255, 0, 0, 0.2);
    font-size: 28px;
    letter-spacing: 2px;
    animation: textFlicker 2s infinite;
}

@keyframes textFlicker {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }

    25%,
    75% {
        text-shadow:
            0 0 10px rgba(255, 0, 0, 0.8),
            0 0 20px rgba(255, 0, 0, 0.5),
            0 0 30px rgba(255, 0, 0, 0.3);
    }
}

.failure-emoji {
    position: fixed;
    font-size: 40px;
    opacity: 0;
    z-index: -1;
    animation: floatUpAndRock 3s ease-out forwards;
    pointer-events: none;
}

.hardcore-failure {
    position: fixed;
    font-size: 40px;
    opacity: 0;
    z-index: -1;
    animation: floatUpAndRock 3s ease-out forwards;
    pointer-events: none;
    text-shadow:
        0 0 10px rgba(255, 0, 0, 0.8),
        0 0 20px rgba(255, 0, 0, 0.5),
        0 0 30px rgba(255, 0, 0, 0.3);
    filter: drop-shadow(0 0 15px rgba(255, 0, 0, 0.7));
}

/* Add rocking animation for emoji mode */
@keyframes rockingEmoji {
    0% {
        transform: translateX(-50%) rotate(-15deg);
    }

    50% {
        transform: translateX(-50%) rotate(15deg);
    }

    100% {
        transform: translateX(-50%) rotate(-15deg);
    }
}

.falling-word.emoji-mode {
    animation: rockingEmoji 2s infinite ease-in-out;
}
