@import url('https://fonts.googleapis.com/css2?family=Righteous&display=swap');

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Music Notes Animation */
.music-notes-container {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.music-note {
    position: absolute;
    font-size: 3rem;
    color: rgba(233, 69, 96, 0.7);
    text-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
    animation-name: float, pulse;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-fill-mode: both;
}

.music-note.paused {
    animation-play-state: paused;
}

.note1 {
    top: 20%;
    left: 10%;
    animation-duration: 4s, 1s;
}

.note2 {
    top: 30%;
    left: 80%;
    animation-duration: 6s, 1.5s;
    animation-delay: 0.5s;
}

.note3 {
    top: 70%;
    left: 15%;
    animation-duration: 5s, 1.2s;
    animation-delay: 1s;
}

.note4 {
    top: 15%;
    left: 70%;
    animation-duration: 7s, 0.8s;
    animation-delay: 1.5s;
}

.note5 {
    top: 80%;
    left: 85%;
    animation-duration: 5.5s, 1.3s;
    animation-delay: 0.3s;
}

.note6 {
    top: 60%;
    left: 45%;
    animation-duration: 4.5s, 1.1s;
    animation-delay: 0.7s;
}

@keyframes float {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-40px) rotate(10deg);
    }
    100% {
        transform: translateY(0) rotate(0deg);
    }
}

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

.menu-container {
    text-align: center;
    padding: 2rem;
    position: relative;
    z-index: 2;
}

.title-wrapper {
    position: relative;
    padding: 2rem;
}

.game-title {
    font-family: 'Righteous', cursive;
    font-size: 4.5rem;
    color: #e94560;
    text-shadow: 0 0 10px rgba(233, 69, 96, 0.5),
                 0 0 20px rgba(233, 69, 96, 0.3),
                 0 0 30px rgba(233, 69, 96, 0.2);
    margin: 0;
    padding: 1rem 2rem;
    animation: glow 2s ease-in-out infinite alternate;
}

.game-title .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(-50px);
    animation: slideIn 0.5s ease forwards;
}

.game-title .letter:nth-child(1) { animation-delay: 0.1s; }
.game-title .letter:nth-child(2) { animation-delay: 0.2s; }
.game-title .letter:nth-child(3) { animation-delay: 0.3s; }
.game-title .letter:nth-child(4) { animation-delay: 0.4s; }
.game-title .letter:nth-child(5) { animation-delay: 0.5s; }
.game-title .letter:nth-child(6) { animation-delay: 0.6s; }
.game-title .letter:nth-child(7) { animation-delay: 0.7s; }
.game-title .letter:nth-child(8) { animation-delay: 0.8s; }
.game-title .letter:nth-child(9) { animation-delay: 0.9s; }
.game-title .letter:nth-child(10) { animation-delay: 1.0s; }

.title-decoration {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 3px;
    background: linear-gradient(90deg, 
        transparent 0%,
        #e94560 50%,
        transparent 100%
    );
}

.title-decoration.top {
    top: 0;
    transform: translateX(-50%) scaleX(0);
    animation: expandLine 0.5s ease forwards;
    animation-delay: 1.2s;
}

.title-decoration.bottom {
    bottom: 0;
    transform: translateX(-50%) scaleX(0);
    animation: expandLine 0.5s ease forwards;
    animation-delay: 1.2s;
}

@keyframes glow {
    from {
        text-shadow: 0 0 10px rgba(233, 69, 96, 0.5),
                     0 0 20px rgba(233, 69, 96, 0.3),
                     0 0 30px rgba(233, 69, 96, 0.2);
    }
    to {
        text-shadow: 0 0 20px rgba(233, 69, 96, 0.6),
                     0 0 30px rgba(233, 69, 96, 0.4),
                     0 0 40px rgba(233, 69, 96, 0.3);
    }
}

.difficulty-buttons {
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
    animation-delay: 1.5s;
}

.sound-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(233, 69, 96, 0.5);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.3);
}

.sound-toggle:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(233, 69, 96, 0.5);
}

.difficulty-btn {
    padding: 0.8rem 1.5rem;
    font-family: 'Righteous', cursive;
    font-size: 1.2rem;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.difficulty-btn.easy {
    background: #4CAF50;
    color: white;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.difficulty-btn.medium {
    background: #2196F3;
    color: white;
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.5);
}

.difficulty-btn.hard {
    background: #FF9800;
    color: white;
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
}

.difficulty-btn.expert {
    background: #f44336;
    color: white;
    box-shadow: 0 0 10px rgba(244, 67, 54, 0.5);
}

.difficulty-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.difficulty-btn:active {
    transform: translateY(1px);
}

.level-selection {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 2rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
}

.level-selection.visible {
    opacity: 1;
    visibility: visible;
}

.level-btn {
    width: 200px;
    height: 250px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    transform: scale(0);
    animation: popIn 0.5s ease forwards;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.level-btn:nth-child(1) { animation-delay: 0.1s; }
.level-btn:nth-child(2) { animation-delay: 0.2s; }
.level-btn:nth-child(3) { animation-delay: 0.3s; }

.level-btn:hover {
    transform: translateY(-10px) scale(1.05);
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(233, 69, 96, 0.5);
    box-shadow: 0 0 20px rgba(233, 69, 96, 0.3);
}

.level-number {
    font-family: 'Righteous', cursive;
    font-size: 1.5rem;
    color: #e94560;
    margin-bottom: 0.5rem;
}

.level-name {
    font-family: 'Righteous', cursive;
    font-size: 2rem;
    color: white;
}

.hidden {
    display: none;
}

@keyframes popIn {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Add fade out animation for difficulty buttons */
.difficulty-buttons.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

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

.title-wrapper.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

.level-selection.slide-left {
    animation: slideLeft 0.5s ease forwards;
}

@keyframes slideLeft {
    to {
        transform: translate(-150%, -50%);
        opacity: 0;
    }
}

.game-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    opacity: 0;
    visibility: hidden;
}

.game-container.visible {
    opacity: 1;
    visibility: visible;
}

.letter-display {
    font-family: 'Righteous', cursive;
    font-size: 8rem;
    color: white;
    margin: 2rem;
}

/* Special styling only for when there are dual letters */
.letter-display.dual {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 80vw;
    max-width: 800px;
    margin: 2rem auto;
}

.letter-left, .letter-right {
    font-family: 'Righteous', cursive;
    font-size: 8rem;
    color: white;
}

.letter-display.correct,
.letter-left.correct, 
.letter-middle.correct,
.letter-right.correct {
    color: #4CAF50;
    animation: fadeOut 0.5s ease forwards;
}

.lives {
    font-family: 'Righteous', cursive;
    font-size: 2rem;
    color: #e94560;
    margin-bottom: 1rem;
}

.timer {
    font-family: 'Righteous', cursive;
    font-size: 2rem;
    color: white;
    margin-bottom: 1rem;
}

.game-over, .victory-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.game-over.visible, .victory-screen.visible {
    display: flex;
    animation: fadeIn 0.5s ease forwards;
}

.result-screen {
    text-align: center;
    padding: 3rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    border: 2px solid rgba(233, 69, 96, 0.5);
    box-shadow: 0 0 30px rgba(233, 69, 96, 0.3);
    transform: scale(0);
    animation: popIn 0.5s ease forwards;
}

.result-title {
    font-family: 'Righteous', cursive;
    font-size: 4rem;
    color: #e94560;
    margin: 0 0 1rem 0;
    text-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
}

.result-icon {
    font-size: 5rem;
    margin: 1rem 0;
    animation: bounce 1s ease infinite;
}

.result-text {
    font-family: 'Righteous', cursive;
    font-size: 2rem;
    color: white;
    margin: 1rem 0;
}

.return-text {
    font-family: 'Righteous', cursive;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 1rem 0 0 0;
    animation: pulse 1.5s ease infinite;
}

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

@keyframes pulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 0.3;
    }
}

@keyframes popIn {
    0% {
        transform: scale(0) rotate(-10deg);
    }
    80% {
        transform: scale(1.1) rotate(2deg);
    }
    100% {
        transform: scale(1) rotate(0);
    }
}

.countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Righteous', cursive;
    opacity: 0;
    visibility: hidden;
}

.countdown.visible {
    opacity: 1;
    visibility: visible;
}

.countdown-number {
    font-size: 8rem;
    color: #e94560;
    animation: countdownPulse 1s ease-in-out;
}

@keyframes countdownPulse {
    0% {
        transform: scale(2);
        opacity: 0;
    }
    50% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.gift-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gift-notification.visible {
    opacity: 1;
    visibility: visible;
}

.notification-content {
    font-family: 'Righteous', cursive;
    font-size: 3rem;
    color: #e94560;
    text-shadow: 0 0 10px rgba(233, 69, 96, 0.5),
                 0 0 20px rgba(233, 69, 96, 0.3),
                 0 0 30px rgba(233, 69, 96, 0.2);
    padding: 2rem 4rem;
    background: rgba(0, 0, 0, 1);
    border-radius: 20px;
    border: 2px solid rgba(233, 69, 96, 0.5);
    box-shadow: 0 0 30px rgba(233, 69, 96, 0.3);
    animation: notificationPop 0.5s ease forwards;
}

@keyframes notificationPop {
    0% {
        transform: scale(0) rotate(-10deg);
        opacity: 0;
    }
    80% {
        transform: scale(1.1) rotate(2deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes slideIn {
    0% {
        opacity: 0;
        transform: translateY(-50px) rotate(-30deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
}

@keyframes expandLine {
    to {
        transform: translateX(-50%) scaleX(1);
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.letter-display.triple {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 80vw;
    max-width: 800px;
    margin: 2rem auto;
}

.letter-middle {
    font-family: 'Righteous', cursive;
    font-size: 8rem;
    color: white;
}

.danger {
    color: #ff0033 !important;
    text-shadow: 0 0 10px rgba(255, 0, 51, 0.5),
                 0 0 20px rgba(255, 0, 51, 0.3);
}

.letter-middle.correct {
    color: #4CAF50;
    animation: fadeOut 0.5s ease forwards;
}

/* Base letter styling */
.letter-display div,
.letter-left, 
.letter-right,
.letter-middle {
    font-family: 'Righteous', cursive;
    font-size: 8rem;
    color: white;
    transition: all 0.5s ease;
}

/* Update the correct letter animations for all cases */
.letter-display div.correct,
.letter-left.correct, 
.letter-right.correct,
.letter-middle.correct {
    color: #4CAF50 !important;
    animation: fadeOut 0.5s ease forwards !important;
}

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

.letter-display.quad {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2rem;
    width: 80vw;
    max-width: 800px;
    height: 400px;
    margin: 2rem auto;
}

.letter-top-left, .letter-top-right, 
.letter-bottom-left, .letter-bottom-right {
    font-family: 'Righteous', cursive;
    font-size: 8rem;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
}

.letter-display div.correct,
.letter-left.correct, 
.letter-right.correct,
.letter-middle.correct,
.letter-top-left.correct,
.letter-top-right.correct,
.letter-bottom-left.correct,
.letter-bottom-right.correct {
    color: #4CAF50 !important;
    animation: fadeOut 0.5s ease forwards !important;
}

.letter-display.penta {
    position: relative;
    display: grid;
    grid-template-areas: 
        "left . right"
        ". middle ."
        "bottomleft . bottomright";
    gap: 1rem;
    width: 80vw;
    max-width: 800px;
    height: 300px;
    margin: 1rem auto;
}

.letter-display.penta .letter-left,
.letter-display.penta .letter-right,
.letter-display.penta .letter-bottom-left,
.letter-display.penta .letter-bottom-right,
.letter-display.penta .letter-middle {
    font-size: 6rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.letter-display.penta .letter-left { grid-area: left; }
.letter-display.penta .letter-right { grid-area: right; }
.letter-display.penta .letter-bottom-left { grid-area: bottomleft; }
.letter-display.penta .letter-bottom-right { grid-area: bottomright; }
.letter-display.penta .letter-middle {
    grid-area: middle;
    justify-self: center;
}
