@font-face {
    font-family: 'Palemonas';
    src: url('palemonas-normal.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Palemonas';
    src: url('palemonas-bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Palemonas', sans-serif;
    background-color: #121213;
    color: #ffffff;
    min-height: 100vh;
    padding: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

a {
    color: #ffffff;
    text-decoration: underline;
}

a:hover {
    color: #e0e0e0;
}

.container {
    width: 100%;
    max-width: 500px;
    padding: 0 20px;
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-bottom: 200px;
}

header {
    text-align: center;
    margin-bottom: 15px;
}

h1 {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    font-weight: bold;
    letter-spacing: 0.2em;
    border-bottom: 1px solid #3a3a3c;
    padding-bottom: 5px;
    padding-top: 5px;
}

.game-board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 5px;
    margin-bottom: 0;
    padding: 10px;
}

.row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: min(5px, 1vw);
    justify-content: center;
    max-width: min(400px, 95vw);
    margin: 0 auto;
}

.tile {
    aspect-ratio: 1;
    width: 100%;
    min-width: 50px;
    max-width: min(80px, 15vh);
    border: 2px solid #3a3a3c;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(1.2rem, 4vw, 2rem);
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.2s ease-in-out;
}

.tile.filled {
    border-color: #565758;
    animation: pop 0.1s ease-in-out;
}

.tile.correct {
    background-color: #538d4e;
    border-color: #538d4e;
    color: white;
}

.tile.present {
    background-color: #b59f3b;
    border-color: #b59f3b;
    color: white;
}

.tile.absent {
    background-color: #3a3a3c;
    border-color: #3a3a3c;
    color: white;
}

.tile.reveal {
    animation: flip 0.6s ease-in-out;
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes flip {
    0% { transform: rotateX(0deg); }
    50% { transform: rotateX(90deg); }
    100% { transform: rotateX(0deg); }
}

@keyframes bounce {
    0%, 20% { transform: translateY(0); }
    40% { transform: translateY(-30px); }
    50% { transform: translateY(5px); }
    60% { transform: translateY(-15px); }
    80% { transform: translateY(2px); }
    100% { transform: translateY(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.message {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 20px;
    min-height: 30px;
    color: #ffffff;
}

.game-over-overlay {
    position: absolute;
    top: 0;
    left: -20px;
    right: -20px;
    bottom: 0;
    background-color: rgba(18, 18, 19, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
}

.overlay-content {
    text-align: center;
    padding: 20px;
}

.game-over-message {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 20px;
}

.share-button {
    font-family: 'Palemonas', sans-serif;
    background-color: #538d4e;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 12px 24px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

.share-button:hover {
    background-color: #6aad5b;
}

.share-button:active {
    background-color: #486c41;
}

.keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100vw;
    background-color: #121213;
    padding: 10px 5px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    border-top: 1px solid #3a3a3c;
}

.keyboard-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    width: 100%;
}

.key {
    width: clamp(35px, 8vw, 50px);
    height: clamp(40px, 8vh, 58px);
    border: none;
    border-radius: 4px;
    background-color: #818384;
    color: #ffffff;
    font-family: 'Palemonas', sans-serif;
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.1s ease-in-out;
    touch-action: manipulation;
    user-select: none;
    -webkit-touch-callout: none;
}

.key:hover {
    background-color: #9ca3a4;
}

.key:active {
    background-color: #6e7071;
}

.key.wide {
    width: clamp(55px, 12vw, 80px);
    height: clamp(40px, 8vh, 58px);
    font-size: clamp(0.9rem, 2.4vw, 1.2rem);
}

#enter-key {
    font-size: clamp(0.7rem, 2vw, 1rem);
}

.key.correct {
    background-color: #538d4e;
}

.key.present {
    background-color: #b59f3b;
}

.key.absent {
    background-color: #3a3a3c;
}

@media (max-width: 480px) {
    .container {
        padding: 5px;
        max-width: 100%;
    }
    
    .row {
        max-width: min(95vw, 500px);
        gap: min(4px, 0.8vw);
    }
    
    .tile {
        min-width: 60px;
        max-width: min(20vw, 100px);
        font-size: clamp(1.4rem, 4.5vw, 2.2rem);
    }
    
    .keyboard {
        gap: 8px;
        padding: 12px 4px;
    }
    
    .keyboard-row {
        gap: 6px;
        padding: 0;
    }
    
    .key {
        width: clamp(32px, calc((100vw - 80px) / 10), 50px);
        height: clamp(48px, 9vh, 58px);
        font-size: clamp(1.1rem, 3.2vw, 1.4rem);
    }
    
    .key.wide {
        width: clamp(48px, calc((100vw - 80px) / 6.5), 75px);
        height: clamp(48px, 9vh, 58px);
        font-size: clamp(1rem, 2.8vw, 1.3rem);
    }
    
    #enter-key {
        font-size: clamp(0.8rem, 2.4vw, 1.1rem);
    }
}

@media (max-width: 380px) {
    .keyboard {
        padding: 10px 3px;
        gap: 6px;
    }
    
    .keyboard-row {
        gap: 6px;
        padding: 0;
    }
    
    .key {
        width: clamp(26px, calc((100vw - 72px) / 10), 38px);
        height: clamp(44px, 8vh, 52px);
        font-size: clamp(1rem, 2.8vw, 1.2rem);
    }
    
    .key.wide {
        width: clamp(39px, calc((100vw - 72px) / 6.5), 57px);
        height: clamp(44px, 8vh, 52px);
        font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    }
    
    #enter-key {
        font-size: clamp(0.7rem, 2.2vw, 0.95rem);
    }
}

@media (max-width: 320px) {
    h1 {
        font-size: clamp(1.4rem, 6vw, 2rem);
        letter-spacing: 0.1em;
    }
    
    .container {
        padding: 2px;
    }
    
    .row {
        max-width: 98vw;
        gap: 2px;
    }
    
    .tile {
        min-width: 50px;
        max-width: min(19.5vw, 75px);
        font-size: clamp(1.1rem, 4.2vw, 1.7rem);
    }
    
    .keyboard {
        padding: 8px 2px;
        gap: 6px;
    }
    
    .keyboard-row {
        gap: 6px;
        padding: 0;
    }
    
    .key {
        width: clamp(24px, calc((100vw - 68px) / 10), 32px);
        height: clamp(40px, 8vh, 48px);
        font-size: clamp(0.9rem, 2.8vw, 1.2rem);
    }
    
    .key.wide {
        width: clamp(36px, calc((100vw - 68px) / 6.5), 48px);
        height: clamp(40px, 8vh, 48px);
        font-size: clamp(0.8rem, 2.5vw, 1.1rem);
    }
    
    #enter-key {
        font-size: clamp(0.6rem, 2.2vw, 0.9rem);
    }
}