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

/* For transitions */
.screen, #category-display, .letter-button {
    transition: all 0.3s ease-in-out;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #000;
    color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 15px;
    background: linear-gradient(135deg, #000000, #1a0033);
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1rem;
    width: 100%;
}

/* Screen Management */
.screen {
    display: none;
    width: 100%;
    text-align: center;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Hide game screen contents completely when not active */
#game-screen:not(.active) {
    display: none !important;
    visibility: hidden;
    height: 0;
    overflow: hidden;
    position: absolute;
    pointer-events: none;
}

/* Ensure alphabet container is only visible in active game screen */
#alphabet-container {
    visibility: hidden;
    height: 0;
    opacity: 0;
}

#game-screen.active #alphabet-container {
    visibility: visible;
    height: auto;
    opacity: 1;
}

/* Timer */
#timer-container {
    text-align: center;
    margin: 1rem 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#timer-display {
    font-size: 3rem;
    font-weight: 700;
    color: white;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #8a2be2, #bb86fc);
    border-radius: 50%;
    box-shadow: 0 8px 20px rgba(187, 134, 252, 0.4);
    position: relative;
    transition: all 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#timer-display::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8a2be2, transparent);
    z-index: -1;
    animation: pulse 2s linear infinite;
}

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

/* Back Button */
.back-button {
    position: absolute;
    right: calc(50% - 140px);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8a2be2, #bb86fc);
    border: none;
    color: white;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(138, 43, 226, 0.5);
    transition: all 0.3s ease;
    z-index: 1000;
    outline: none;
}

/* Media query adjustments for back button positioning */
@media (max-width: 768px) {
    .back-button {
        right: calc(50% - 120px);
    }
}

@media (max-width: 480px) {
    .back-button {
        right: calc(50% - 100px);
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
    
    #timer-display {
        width: 80px;
        height: 80px;
        font-size: 2.5rem;
    }
}

.back-button:hover:not(.disabled) {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(138, 43, 226, 0.7);
}

.back-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(135deg, #888, #555);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.arrow-icon {
    display: inline-block;
    font-weight: bold;
    margin-right: 2px;
    line-height: 1;
}

/* Undo animation */
.undo-feedback {
    color: #bb86fc !important;
}

/* Time up message animation */
.time-up-message {
    animation: fadeInOut 2.5s ease-in-out;
}

/* Timer increased message animation */
.timer-message {
    animation: timerIncrease 2.5s ease-in-out;
}

@keyframes timerIncrease {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(-100px) scale(0.5);
    }
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    30% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.5);
    }
    70% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.5);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(-100px) scale(0.5);
    }
}

/* Headings */
h1 {
    font-size: 3.2rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(90deg, #9c27b0, #e040fb);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    text-shadow: 0 0 20px rgba(224, 64, 251, 0.4);
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    text-align: center;
    background: linear-gradient(90deg, #e040fb, #9c27b0);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    display: inline-block;
    box-shadow: 0 4px 20px rgba(156, 39, 176, 0.3);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    background-color: rgba(255, 255, 255, 0.05);
}

/* Start Screen */
.instructions {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    text-align: left;
    max-width: 600px;
    box-shadow: 0 8px 32px rgba(156, 39, 176, 0.2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.instructions h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    text-align: center;
}

.instructions ol {
    padding-left: 1.5rem;
}

.instructions li {
    margin-bottom: 0.8rem;
    line-height: 1.4;
}

/* Buttons */
.primary-button {
    background: linear-gradient(45deg, #8a2be2, #bb86fc);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(187, 134, 252, 0.5);
    font-family: 'Poppins', sans-serif;
    position: relative;
    overflow: hidden;
    letter-spacing: 1px;
}

.primary-button:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.primary-button:hover:before {
    left: 100%;
}

.primary-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(187, 134, 252, 0.7);
}

.primary-button:active {
    transform: translateY(0);
}

.button-container {
    margin-top: 1.5rem;
}

/* Alphabet Container */
#alphabet-container {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 10px;
    margin: 1.5rem 0;
    width: 100%;
    max-width: 900px;
    perspective: 1000px;
}

.letter-button {
    font-size: 1.6rem;
    font-weight: 700;
    padding: 8px 0;
    aspect-ratio: 1/1;
    border-radius: 10px;
    cursor: pointer;
    border: none;
    color: white;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 6px 15px -5px rgba(0, 0, 0, 0.5);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transform-style: preserve-3d;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #12c2e9, #c471ed);
}

.letter-button:before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.letter-button:hover:not(.disabled) {
    transform: scale(1.1) translateY(-5px) rotateX(5deg);
    box-shadow: 0 10px 25px -10px rgba(0, 0, 0, 0.6);
}

.letter-button:hover:not(.disabled):before {
    opacity: 1;
}

.letter-button.disabled {
    background: linear-gradient(135deg, #12c2e9, #c471ed);
    color: #666;
    cursor: not-allowed;
    transform: scale(0.9) rotateY(10deg);
    box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.3);
    opacity: 0.4;
    filter: grayscale(0.8);
}

/* Animation for letter click */
@keyframes clickEffect {
    0% {
        transform: scale(1) translateZ(0);
    }
    40% {
        transform: scale(0.85) translateZ(-50px) rotateX(-15deg);
    }
    80% {
        transform: scale(0.9) translateZ(-30px) rotateX(-10deg);
    }
    100% {
        transform: scale(0.9) translateZ(0) rotateY(10deg);
    }
}

.click-animation {
    animation: clickEffect 0.5s forwards;
}

/* Category Display */
#category-display {
    font-weight: 700;
    font-size: 1.8rem;
    background: linear-gradient(90deg, #FF416C, #FF4B2B);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 10px rgba(255, 75, 43, 0.3);
    letter-spacing: 1px;
    padding: 5px 0;
}

/* Fancy Animation */
@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
    100% {
        transform: translateY(0px);
    }
}

#game-screen h2 {
    animation: float 4s ease-in-out infinite;
}

/* Game screen specific sizing */
#game-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 90vh;
}

/* Responsive Adjustments */
@media (max-width: 980px) {
    #alphabet-container {
        grid-template-columns: repeat(7, 1fr);
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }
    
    h2 {
        font-size: 1.6rem;
    }
    
    #alphabet-container {
        grid-template-columns: repeat(6, 1fr);
        gap: 8px;
    }
    
    .letter-button {
        font-size: 1.4rem;
        padding: 8px 0;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2.1rem;
    }
    
    .instructions {
        padding: 1rem;
    }
    
    #alphabet-container {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }
    
    .letter-button {
        font-size: 1.3rem;
        padding: 6px 0;
    }
    
    #category-display {
        font-size: 1.5rem;
    }
}

/* Game Over Overlay */
#game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.5s ease-in-out;
}

.game-over-message {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    text-align: center;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #bb86fc, #8a2be2);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(187, 134, 252, 0.5);
    animation: gameOverPulse 2s infinite;
}

.restart-button {
    margin-top: 1rem;
    animation: bounce 1s infinite alternate;
}

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

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

@keyframes bounce {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-10px);
    }
} 