/* ============================================
   Anime Wordle - Shared Styles
   ============================================ */

:root {
    --bg-overlay: rgba(20, 50, 80, 0.5);
    --bg-card: rgba(20, 60, 100, 0.92);
    --bg-dropdown: #0f2d4b;
    --accent-sky: #5BA4D4;
    --accent-ocean: #2C5F8A;
    --accent-white: #F5F5F0;
    --color-correct: #4ADE80;
    --color-close: #FBBF24;
    --color-incorrect: #F87171;
    --text-primary: #F5F5F0;
    --text-secondary: rgba(245, 245, 240, 0.8);
    --grass-green: #5A8C4A;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: url('../1.jpg') no-repeat center center fixed;
    background-size: cover;
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(20, 50, 80, 0.15) 0%, rgba(20, 50, 80, 0.35) 100%);
    z-index: -1;
}

/* ============================================
   Navigation Buttons (Home, Help, etc.)
   ============================================ */

.nav-btn,
.home-btn,
.help-btn,
.history-btn {
    position: fixed;
    top: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    text-decoration: none;
}

.nav-btn:hover,
.home-btn:hover,
.help-btn:hover,
.history-btn:hover {
    background: white;
    color: var(--accent-sky);
    transform: scale(1.1);
}

.home-btn {
    left: 20px;
}

.help-btn {
    right: 20px;
}

.history-btn {
    right: 70px;
}

/* ============================================
   Header Styles
   ============================================ */

header {
    text-align: center;
    margin-bottom: 30px;
}

.game-instruction {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-top: 10px;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    position: relative;
}

.title-logo-container {
    position: relative;
    display: inline-block;
    margin-bottom: 10px;
}

.title-logo-container a {
    display: block;
    text-decoration: none;
}

.title-logo {
    max-width: 450px;
    width: 100%;
    height: auto;
    animation: floatCloud 6s ease-in-out infinite;
    position: relative;
    z-index: 1;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.title-logo:hover {
    transform: scale(1.02);
}

@keyframes floatCloud {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* Stars around logo */
.star {
    position: absolute;
    width: 14px;
    height: 14px;
    pointer-events: none;
    z-index: 0;
    animation: starSparkle 4s ease-in-out infinite;
}

.star::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 75%;
    height: 75%;
    background: linear-gradient(135deg, #FFFDE0 0%, #FFEB3B 35%, #FFD93D 65%, #FFEB3B 100%);
    transform: translate(-50%, -50%) rotate(45deg);
    border-radius: 20% 20% 20% 20%;
    box-shadow: 0 0 6px 1px rgba(255, 235, 59, 0.7);
}

.star:nth-child(1) {
    top: 8%;
    left: 15%;
    animation-delay: 0s;
}

.star:nth-child(2) {
    top: 3%;
    right: 20%;
    animation-delay: 1s;
}

.star:nth-child(3) {
    top: 28%;
    left: 5%;
    animation-delay: 2s;
    width: 16px;
    height: 16px;
}

.star:nth-child(4) {
    top: 22%;
    right: 8%;
    animation-delay: 3s;
    width: 18px;
    height: 18px;
}

@keyframes starSparkle {

    0%,
    100% {
        opacity: 0.3;
        transform: scale(0.5);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   Language Selector
   ============================================ */

.lang-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    font-size: 1.1rem;
    /* Slightly smaller for text fallback */
    font-weight: 700;
    /* Bold for text fallback */
    font-family: 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
    /* Better emoji support */
    padding: 0;
    line-height: 1;
    /* Fix vertical alignment */
    position: absolute;
    right: -60px;
    top: 50%;
    transform: translateY(-50%);
}

.lang-btn:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

/* Language Modal */
.lang-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.lang-modal-overlay.show {
    display: flex;
}

.lang-modal {
    background: linear-gradient(135deg, rgba(20, 50, 80, 0.95) 0%, rgba(44, 95, 138, 0.95) 100%);
    border: 3px solid var(--accent-sky);
    border-radius: 20px;
    padding: 30px 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(91, 164, 212, 0.3);
    animation: popIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    /* Fix for absolute close button */
}

.lang-modal h2 {
    color: var(--accent-sky);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.lang-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.lang-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-option:hover {
    background: rgba(91, 164, 212, 0.3);
    border-color: var(--accent-sky);
    transform: translateY(-2px);
}

.lang-option.active {
    background: rgba(91, 164, 212, 0.4);
    border-color: var(--accent-sky);
}

.lang-option .flag {
    font-size: 2rem;
}

.lang-option .lang-name {
    font-size: 0.85rem;
    color: var(--text-primary);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes popIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
    }
}

/* ============================================
   Modal Base Styles
   ============================================ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.5s ease;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, rgba(20, 50, 80, 0.95) 0%, rgba(44, 95, 138, 0.95) 100%);
    border: 3px solid var(--color-correct);
    border-radius: 20px;
    padding: 40px;
    padding-top: 50px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(124, 179, 86, 0.3);
    animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #fff;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    line-height: 1;
    background: none;
    border: none;
}

.close-btn:hover {
    color: var(--color-incorrect);
    transform: scale(1.1);
}

/* ============================================
   Footer / Developer Credit
   ============================================ */

.developer-credit {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    padding: 15px;
    color: #fff;
    font-size: 0.9rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 1);
    font-weight: bold;
    z-index: 2000;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.3) 0%, transparent 100%);
}

.developer-credit a {
    color: #fff;
    text-decoration: none;
    margin-left: 10px;
    font-size: 0.85rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.developer-credit a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ============================================
   Container
   ============================================ */

.container {
    width: 100%;
    max-width: 900px;
}

/* ============================================
   Suggestions (Shared)
   ============================================ */
.suggestion-item.guessed {
    text-decoration: line-through;
    opacity: 0.5;
    background: rgba(255, 0, 0, 0.1);
    cursor: default;
}

/* ============================================
   Confetti
   ============================================ */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3000;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confettiFall 3s linear forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 600px) {
    .lang-btn {
        right: -50px;
        width: 35px;
        height: 35px;
        font-size: 1.1rem;
    }

    .title-logo {
        max-width: 300px;
    }

    .lang-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}