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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #66ea81 0%, #5759e4 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    overflow-x: hidden;
}

/* Language Switcher */
.language-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
}

.language-button {
    background: white;
    border: none;
    padding: 10px 15px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.flag-icon {
    width: 24px;
    height: 18px;
    object-fit: cover;
    border-radius: 2px;
}

.dropdown-arrow {
    font-size: 12px;
    color: #666;
    transition: transform 0.3s;
}

.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s, transform 0.3s;
}

.language-dropdown:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
}

.language-option {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    transition: background-color 0.2s;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
}

.language-option:hover {
    background-color: #f5f5f5;
}

.language-option span {
    color: #333;
}

.container {
    width: 90%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Tutorial Overlay */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.tutorial-overlay.hidden {
    display: none;
}

.tutorial-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.5s ease-out;
}

.tutorial-animation {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 30px 0;
    font-size: 24px;
    font-weight: 600;
}

.tutorial-word {
    color: #696ae9;
}

.tutorial-arrow {
    margin: 0 20px;
    color: #999;
}

.tutorial-verb {
    color: #66ea81;
    min-width: 80px;
    text-align: left;
}

.tutorial-content h2 {
    color: #333;
    margin-bottom: 20px;
}

.tutorial-content p {
    color: #666;
    margin: 10px 0;
    line-height: 1.6;
}

.start-btn {
    background: linear-gradient(135deg, #66ea81 0%, #5759e4 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 30px;
    cursor: pointer;
    margin-top: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 234, 129, 0.4);
}

/* Animated Title */
.animated-title {
    color: white;
    text-align: center;
    font-size: 48px;
    margin-bottom: 40px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.title-word {
    font-family: 'Space Mono', monospace;
    color: #ffd700;
    position: relative;
    display: inline-block;
    min-width: 20px;
    min-height: 1em;
    margin-right: 8px;
}

.title-word::after {
    content: '|';
    position: absolute;
    right: -0.4em;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

/* Game Area */
.game-area {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.5s ease-out;
}

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

/* Current Word Display */
.current-word-container {
    text-align: center;
    margin-bottom: 30px;
}

.emoji-display {
    font-size: 80px;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

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

.word-display {
    font-size: 36px;
    font-weight: 700;
    color: #696ae9;
}

/* Input Section */
.input-section {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.verb-input {
    flex: 1;
    padding: 15px 20px;
    font-size: 18px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    transition: border-color 0.3s;
    font-family: 'Poppins', sans-serif;
    overflow: hidden;
    text-overflow: ellipsis;
}

.verb-input:focus {
    outline: none;
    border-color: #696ae9;
}

.submit-btn {
    background: linear-gradient(135deg, #66ea81 0%, #5759e4 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    white-space: nowrap;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 234, 129, 0.4);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Response Section */
.response-section {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    animation: slideUp 0.5s ease-out;
}

.response-section.hidden {
    display: none;
}

.prompt-count {
    font-size: 14px;
    color: #888;
    margin-bottom: 10px;
    font-style: italic;
}

.llm-response {
    font-size: 16px;
    line-height: 1.6;
    color: #444;
}

/* Final Response Section (for game over) */
.final-response-section {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    animation: slideUp 0.5s ease-out;
}

.final-response-section.hidden {
    display: none;
}

/* Score Display */
.score-display {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: #696ae9;
    margin-bottom: 30px;
}

/* Used Items Container */
.used-items-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 30px;
}

.used-section h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #555;
}

.used-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 50px; /* Ensure consistent height */
    max-height: 150px;
    overflow-y: auto;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 10px;
}

.used-item {
    background: #696ae9;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 14px;
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Game Over Screen */
.game-over {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.5s ease-out;
}

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

.game-over h2 {
    font-size: 36px;
    color: #696ae9;
    margin-bottom: 20px;
}

.game-over p {
    font-size: 24px;
    margin-bottom: 20px;
}

#game-over-message {
    color: #666;
    margin-bottom: 30px;
    line-height: 1.6;
}

.new-game-btn {
    background: linear-gradient(135deg, #66ea81 0%, #5759e4 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 30px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.new-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 234, 129, 0.4);
}

/* Loading Spinner */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 999;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(128, 128, 128, 0.2);
    border-top-color: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 10px;
    }

    .language-switcher {
        top: 10px;
        right: 10px;
    }

    .animated-title {
        font-size: 28px;
        margin-bottom: 30px;
    }

    .word-display {
        font-size: 24px;
    }

    .emoji-display {
        font-size: 60px;
    }

    .game-area {
        padding: 20px;
    }

    .game-over {
        padding: 20px;
    }

    .used-items-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .tutorial-content {
        padding: 20px;
        margin: 20px;
        max-width: calc(100vw - 40px);
    }

    .tutorial-animation {
        font-size: 20px;
        flex-direction: column;
        gap: 10px;
    }

    .tutorial-arrow {
        transform: rotate(90deg);
        margin: 5px 0;
    }

    .input-section {
        flex-direction: column;
        gap: 15px;
    }

    .submit-btn {
        width: 100%;
    }

    .verb-input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .animated-title {
        font-size: 24px;
    }

    .word-display {
        font-size: 20px;
    }

    .emoji-display {
        font-size: 50px;
    }

    .tutorial-content {
        padding: 15px;
    }

    .game-area {
        padding: 15px;
    }

    .game-over {
        padding: 15px;
    }
}

/* Custom Scrollbar */
.used-list::-webkit-scrollbar {
    width: 6px;
}

.used-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.used-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.used-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}