/* Main CSS for LexiDrop Game */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #000;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Game Container */
.game-container {
    position: relative;
    height: 100vh; /* Use full viewport height */
    width: calc(100vh * 9/16); /* Calculate width based on 9:16 ratio */
    max-width: 100vw; /* Prevent horizontal overflow */
    display: flex;
    flex-direction: column;
}

/* For screens where width would be the constraint */
@media (max-aspect-ratio: 9/16) {
    .game-container {
        width: 100vw;
        height: calc(100vw * 16/9);
        max-height: 100vh;
    }
}

/* Game Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1vh 1.5vw;
    background-color: #222;
    border-top-left-radius: 1.5vh;
    border-top-right-radius: 1.5vh;
}

.score-container, .level-container {
    font-size: 2.2vh;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
}

.score-container span, .level-container span {
    margin-left: 0.5vw;
}

.pause-button {
    background-color: #444;
    color: #fff;
    border: none;
    padding: 0.8vh;
    width: 3.5vh;
    height: 3.5vh;
    border-radius: 0.8vh;
    cursor: pointer;
    font-size: 1.8vh;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
}

.pause-button:hover {
    background-color: #555;
}

/* Game Board */
.game-board {
    flex: 1;
    background-color: #111;
    position: relative;
    overflow: hidden;
    border-left: 0.3vh solid #333;
    border-right: 0.3vh solid #333;
}

/* Game Footer */
.game-footer {
    padding: 1.5vh;
    background-color: #222;
    border-bottom-left-radius: 1.5vh;
    border-bottom-right-radius: 1.5vh;
    display: flex; /* Use flexbox for layout */
    justify-content: space-between; /* Space between word and power-ups */
    align-items: center; /* Center items vertically */
    position: relative;
}

.word-display {
    font-size: 3vh;
    min-height: 4vh;
    text-align: left;
    padding-left: 1.5vw;
}

/* Letter Styles */
.letter {
    position: absolute;
    width: 5vh;
    height: 5vh;
    border-radius: 0.6vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5vh;
    font-weight: bold;
    cursor: grab;
    user-select: none;
    transition: transform 0.2s ease;
}

.letter.dragging {
    z-index: 100;
    cursor: grabbing;
    transform: scale(1.1);
}

/* Overlay Screens */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.overlay-content {
    background-color: #222;
    padding: 4vh 3vw;
    border-radius: 1.5vh;
    text-align: center;
    max-width: 80%;
}

.overlay h1 {
    margin-bottom: 3vh;
    color: #fff;
    font-size: 4vh;
}

.overlay p {
    margin-bottom: 3vh;
    color: #ddd;
    font-size: 2.5vh;
}

.action-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 1.5vh 3vw;
    margin: 1vh;
    border-radius: 0.8vh;
    cursor: pointer;
    font-size: 2.5vh;
}

.action-button:hover {
    background-color: #45a049;
}

.hidden {
    display: none;
}

/* High Score Styles */
.high-score {
    font-size: 2.5vh;
    color: gold;
    margin-bottom: 2vh;
    text-shadow: 0 0 0.8vh rgba(255, 215, 0, 0.5);
}

.new-high-score {
    font-size: 3vh;
    color: gold;
    font-weight: bold;
    margin: 2vh 0;
    text-shadow: 0 0 1.5vh rgba(255, 215, 0, 0.7);
}

/* Level Up Notification */
.level-up-notification-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none; /* Allow clicks to pass through */
    z-index: 50;
}

.level-up-notification {
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 3vh 5vh;
    border-radius: 1.5vh;
    font-size: 5vh;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 0 2vh rgba(255, 255, 255, 0.5);
}

/* Power-up Styles */
.power-up {
    position: absolute;
    width: 4vh;
    height: 4vh;
    right: 0.25vw;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2vh;
    font-weight: bold;
    z-index: 50;
    box-shadow: 0 0 1vh rgba(255, 255, 255, 0.7);
    cursor: grab;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.3s ease;
    border: 0.25vh solid rgba(255, 255, 255, 0.8);
}

.power-up.dragging {
    cursor: grabbing;
    z-index: 100;
    transform: scale(1.2);
    box-shadow: 0 0 1.5vh rgba(255, 255, 255, 0.8);
}

/* Power-up Inventory Styles */
.power-up-inventory {
    position: absolute;
    right: 0vw; /* Increase margin from right edge */
    top: 0;
    bottom: 0;
    display: flex;
    gap: 8vh; /* Slightly increase gap */
    z-index: 100;
    padding: 0 2vw; /* Add horizontal padding */
    align-items: center;
    justify-content: center;
    width: auto; /* Let width be determined by content */
    min-width: 8vw; /* Ensure minimum width to fit all icons */
}

.power-up-container {
    position: relative;
    padding: 1vh;
    display: flex;
    align-items: center;
}

.power-up-counter {
    position: absolute;
    top: -0.8vh;
    right: -0.8vh;
    background-color: #fff;
    color: #000;
    border-radius: 50%;
    width: 2.5vh;
    height: 2.5vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5vh;
    font-weight: bold;
    z-index: 101; /* Increased to be above power-up inventory */
    box-shadow: 0 0 0.5vh rgba(0, 0, 0, 0.5);
    opacity: 0.7;
}

.power-up-slow {
    background-color: #2196F3; /* Blue */
}

.power-up-freeze {
    background-color: navy; /* Light Blue */
}

.power-up-correct {
    background-color: #4CAF50; /* Green */
}

/* Effect Styles */
.slow-effect {
    box-shadow: 0 0 1.5vh rgba(33, 150, 243, 0.7);
}

.freeze-effect {
    box-shadow: 0 0 1.5vh rgba(0, 188, 212, 0.7);
}

.correct-effect {
    box-shadow: 0 0 1.5vh rgba(76, 175, 80, 0.7);
}

/* Countdown Display */
.countdown-display {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 6vh;
    font-weight: bold;
    color: #00BCD4;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 10vh;
    height: 10vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    text-shadow: 0 0 1.5vh rgba(0, 188, 212, 0.7);
}

/* Responsive Design */
@media (max-width: 600px) {
    .game-container {
        border-radius: 0;
    }

    .game-header, .game-footer {
        border-radius: 0;
    }

    .level-up-notification {
        font-size: 4vh;
        padding: 2vh 4vh;
    }

    /* Power-up inventory adjustments for mobile */
    .power-up-inventory {
        gap: 3vh; /* Smaller spacing for touch targets on mobile */
        padding: 1vh;
    }
}

/* Letter Colors - will be assigned randomly */
.letter-color-1 { background-color: #FF5252; } /* Red */
.letter-color-2 { background-color: #4CAF50; } /* Green */
.letter-color-3 { background-color: #2196F3; } /* Blue */
.letter-color-4 { background-color: #FFC107; } /* Yellow */
.letter-color-5 { background-color: #9C27B0; } /* Purple */
.letter-color-6 { background-color: #FF9800; } /* Orange */
.letter-color-7 { background-color: #00BCD4; } /* Cyan */
.letter-color-8 { background-color: #E91E63; } /* Pink */
