.wordle-page {
    width: 100%;
    padding-bottom: 24px;
}

.wordle-game {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    touch-action: manipulation;
}

.wordle-hud {
    width: 100%;
    text-align: center;
}

.wordle-hud h2 {
    font-family: 'Be My Glittertine', Arial, sans-serif;
    font-size: 36px;
    font-weight: normal;
    color: #FF0068;
    margin: 0 0 4px;
}

.wordle-date {
    font-family: Arial, sans-serif;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.55);
    margin: 0;
}

.wordle-message {
    font-family: Arial, sans-serif;
    font-size: 15px;
    color: #FE9091;
    min-height: 22px;
    text-align: center;
    margin: 0;
    padding: 0 8px;
}

.wordle-message.error {
    color: #ff6b8a;
}

.wordle-message.success {
    color: #ffffff;
}

.wordle-board {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 350px;
}

.wordle-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.wordle-tile {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
    font-size: clamp(18px, 5vw, 28px);
    font-weight: bold;
    text-transform: uppercase;
    color: #ffffff;
    border: 2px solid rgba(254, 144, 145, 0.45);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.5);
    box-sizing: border-box;
    transition: transform 0.15s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.wordle-tile.filled {
    border-color: rgba(254, 144, 145, 0.8);
    animation: wordle-pop 0.1s ease;
}

.wordle-tile.reveal {
    animation: wordle-flip 0.5s ease forwards;
}

.wordle-tile.correct {
    background: #FF0068;
    border-color: #FF0068;
    color: #ffffff;
}

.wordle-tile.present {
    background: #c9a227;
    border-color: #c9a227;
    color: #ffffff;
}

.wordle-tile.absent {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.55);
}

@keyframes wordle-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

.wordle-row.invalid {
    animation: wordle-shake 0.45s ease;
}

.wordle-row.invalid .wordle-tile {
    animation: wordle-invalid-blink 0.45s ease;
}

@keyframes wordle-shake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-6px); }
    30% { transform: translateX(6px); }
    45% { transform: translateX(-5px); }
    60% { transform: translateX(5px); }
    75% { transform: translateX(-3px); }
    90% { transform: translateX(3px); }
}

@keyframes wordle-invalid-blink {
    0%, 100% {
        border-color: rgba(254, 144, 145, 0.8);
        background: rgba(0, 0, 0, 0.5);
        color: #ffffff;
    }
    25%, 75% {
        border-color: #ff0068;
        background: rgba(255, 0, 104, 0.4);
        color: #ffb3cc;
    }
}

@keyframes wordle-flip {
    0% { transform: rotateX(0deg); }
    50% { transform: rotateX(90deg); }
    100% { transform: rotateX(0deg); }
}

.wordle-keyboard {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.wordle-keyboard-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.wordle-key {
    font-family: Arial, sans-serif;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.65);
    border: 2px solid rgba(254, 144, 145, 0.45);
    border-radius: 6px;
    min-width: 32px;
    height: 48px;
    padding: 0 8px;
    cursor: pointer;
    flex: 1;
    max-width: 44px;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.wordle-key.wide {
    flex: 1.5;
    max-width: 72px;
    font-size: 11px;
}

.wordle-key:hover {
    border-color: #FE9091;
    background: rgba(255, 0, 104, 0.2);
}

.wordle-key:active {
    transform: scale(0.95);
}

.wordle-key.correct {
    background: #FF0068;
    border-color: #FF0068;
}

.wordle-key.present {
    background: #c9a227;
    border-color: #c9a227;
}

.wordle-key.absent {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.45);
}

.wordle-keyboard-disabled .wordle-key {
    pointer-events: none;
    opacity: 0.45;
    cursor: default;
}

.wordle-result {
    text-align: center;
    padding: 20px 24px;
    border: 2px solid rgba(254, 144, 145, 0.8);
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.75);
    width: 100%;
    max-width: 350px;
    box-sizing: border-box;
    animation: wordle-result-in 0.4s ease;
}

.wordle-result[hidden] {
    display: none;
}

.wordle-result h3 {
    font-family: 'Be My Glittertine', Arial, sans-serif;
    font-size: 32px;
    font-weight: normal;
    color: #FF0068;
    margin: 0 0 8px;
}

.wordle-result p {
    font-family: Arial, sans-serif;
    font-size: 16px;
    color: #ffffff;
    margin: 0 0 6px;
}

.wordle-result .wordle-result-hint {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.55);
    margin-top: 12px;
}

.wordle-share-btn {
    font-family: Arial, sans-serif;
    font-size: 15px;
    font-weight: bold;
    color: #ffffff;
    background: #5865f2;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 14px;
    padding: 10px 20px;
    margin-top: 16px;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.wordle-share-btn:hover {
    background: #4752c4;
    transform: scale(1.03);
}

@keyframes wordle-result-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 520px) {
    .wordle-hud h2 {
        font-size: 28px;
    }

    .wordle-board {
        max-width: min(100%, calc(100vw - 56px));
        gap: 5px;
    }

    .wordle-row {
        gap: 5px;
    }

    .wordle-key {
        height: 44px;
        min-width: 28px;
        font-size: 12px;
        padding: 0 4px;
    }

    .wordle-key.wide {
        max-width: 60px;
        font-size: 10px;
    }

    .wordle-keyboard-row {
        gap: 4px;
    }
}
