html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    width: 100vw;
    overflow-y: auto;
    position: relative;
    background: #f8f9fa;
}

.background-grid {
    position: absolute;
    width: 100vw;
    height: 120vh;
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
    z-index: 1;
    pointer-events: none;
}

.background-grid div {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: 600;
    color: rgba(87, 189, 145, 0.18);
    letter-spacing: 2px;
}

.overlay {
    position: relative;
    z-index: 2;
    text-align: center;
    background-color: rgba(87, 189, 145, 0.07);
    backdrop-filter: blur(4px);
    padding: 32px 20px;
    border-radius: 16px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.13);
    width: 100%;
    max-width: 700px;
    margin: 12px auto 0 auto;
}

.title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 10vh;
    width: 100%;
    margin-bottom: 18px;
    background-color: #57BD91;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.13);
    padding: 2px;
    border-radius: 12px;
    color: white;
    width: 100%;
    padding: 18px;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.help-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #45a678;
    color: white;
    border: none;
    font-size: 1.2rem;
    font-weight: bold;
    position: absolute;
    right: 3rem;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
}

.help-btn:hover {
    background: #45a678;
    transform: scale(1.05);
}

.wordle-board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    justify-content: center;
    margin: 0 auto 24px auto;
    max-width: 340px;
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

.shake {
    animation: shake 0.3s ease-in-out;
}

.wordle-tile {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    line-height: 56px;
    background: #f8f9fa;
    color: #222;
    border: 2px solid #eaeaea;
    box-shadow: 0 2px 8px rgba(87,189,145,0.09);
    transition: background 0.2s, color 0.2s;
    margin: 0 auto;
}

.wordle-tile.correct { 
    background-color: #57BD91; 
    color: #fff; 
    border-color: #57BD91; 
}

.wordle-tile.present { 
    background-color: #c9b458; 
    color: #fff; 
    border-color: #c9b458; 
}

.wordle-tile.absent { 
    background-color: #787c7e; 
    color: #fff; 
    border-color: #787c7e; 
}

.wordle-keyboard {
    display: flex;
    flex-direction: column;
    gap: clamp(4px, 1vh, 8px);
    margin: 0 auto;
    width: min(95vw, 420px);
    margin-bottom: clamp(12px, 2vh, 18px);
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: clamp(3px, 0.8vw, 6px);
}

.key-btn {
    min-width: clamp(32px, 8.5vw, 38px);
    height: clamp(45px, 8vh, 55px);
    background: #f8f9fa;
    color: #222;
    border: none;
    border-radius: 8px;
    font-size: clamp(1.1em, 2.5vw, 1.3em);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(87,189,145,0.07);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.1s;
    outline: none;
    text-transform: uppercase;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.key-btn:focus-visible {
    outline: 2px solid #57BD91;
    outline-offset: 2px;
}

.key-btn.pressed {
    transform: scale(0.95);
    background-color: #e0e0e0;
}

.key-btn:active {
    transform: scale(0.95);
    background-color: #e0e0e0;
}

.key-btn::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 10px;
    pointer-events: none;
    transition: box-shadow 0.2s;
}

.key-btn:focus::before {
    box-shadow: 0 0 0 2px #57BD91;
}

.wordle-message {
    font-size: 1.1em;
    color: #45a678;
    margin-bottom: 12px;
    min-height: 24px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn {
    padding: 14px 32px;
    font-size: 1.1em;
    font-weight: bold;
    color: white;
    background-color: #57BD91;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    margin-top: 18px;
    text-decoration: none;
    display: inline-block;
}

.btn:hover { 
    background-color: #45a678; 
    transform: scale(1.05); 
}

.wordle-tile, .key-btn {
    touch-action: manipulation;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.key-btn.correct {
    background-color: #57BD91 !important;
    color: #fff !important;
    border-color: #57BD91 !important;
}

.key-btn.present {
    background-color: #c9b458 !important;
    color: #fff !important;
    border-color: #c9b458 !important;
}

.key-btn.absent {
    background-color: #787c7e !important;
    color: #fff !important;
    border-color: #787c7e !important;
}

/* Media Queries */
@media (max-width: 600px) {
    .overlay { 
        padding: 0;
        margin-top: 0;
        border-radius: 0;
        max-width: 100%;
    }

   

    .title {
        font-size: 1.1rem;
        padding: 4px;
        margin: 0;
        line-height: 1.2;
    }

    .help-btn {
        width: 30px;
        height: 30px;
        font-size: 1rem;
        right: 1rem;
    }

    .wordle-board { 
        max-width: 90vw; 
        gap: 4px; 
        margin-bottom: 16px;
    }

    .wordle-tile { 
        width: 4rem; 
        height: 4rem; 
        font-size: 1.4rem; 
        line-height: 4rem; 
    }

    .wordle-keyboard { 
        max-width: 98vw; 
        gap: 6px; 
        margin-top: 20px;
    }

    .keyboard-row {
        gap: 4px;
        margin-bottom: 4px;
    }

    .key-btn { 
        min-width: 32px; 
        height: 45px; 
        font-size: 1.2em; 
        padding: 0 6px;
    }

    .btn { 
        font-size: 1em; 
        padding: 12px 18px; 
        border-radius: 16px; 
    }

    .wordle-tile, .key-btn {
        touch-action: manipulation;
    }
}
