/**
 * Word Guess Game Styles
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #121213;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 1rem;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.game-container {
    width: 100%;
    max-width: 400px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #3a3a3c;
}

.title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.stats {
    display: flex;
    gap: 0.5rem;
}

.stat-box {
    background: #3a3a3c;
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-box .label {
    font-size: 0.6rem;
    font-weight: 600;
    color: #818384;
    text-transform: uppercase;
}

.stat-box .value {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.best-streak {
    color: #538d4e;
    font-size: 0.8rem;
    min-height: 1rem;
}

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

.row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}

.tile {
    width: 52px;
    height: 52px;
    border: 2px solid #3a3a3c;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    transition: transform 0.1s;
}

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

.tile.revealed {
    animation: flip 0.5s ease forwards;
}

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

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

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

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

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

.message {
    color: #fff;
    font-size: 0.9rem;
    min-height: 1.25rem;
    font-weight: 600;
}

.message.error {
    color: #f87171;
}

/* Keyboard */
.keyboard {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 350px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 4px;
}

.key {
    min-width: 30px;
    height: 50px;
    border: none;
    border-radius: 4px;
    background: #818384;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
    transition: background 0.1s;
    flex: 1;
    max-width: 40px;
}

.key.wide {
    min-width: 50px;
    max-width: 60px;
    font-size: 0.75rem;
}

.key:active {
    background: #a0a1a2;
}

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

.key.present {
    background: #b59f3b;
}

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

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    background: #1a1a1b;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #3a3a3c;
}

.overlay-content h2 {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 0.5rem;
}

.overlay-content h2.win {
    color: #538d4e;
}

.overlay-content h2.lose {
    color: #f87171;
}

.overlay-content p {
    font-size: 1rem;
    color: #818384;
    margin-bottom: 1.5rem;
}

.restart-btn {
    background: #538d4e;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.restart-btn:hover {
    background: #4a7c46;
}

.restart-btn:focus-visible {
    outline: 3px solid #6aaa64;
    outline-offset: 2px;
}

/* Home link */
.home-link {
    margin-top: 0.5rem;
    color: #818384;
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.2s;
}

.home-link:hover {
    color: #a0a1a2;
    text-decoration: underline;
}

.home-link:focus-visible {
    outline: 2px solid #818384;
    outline-offset: 2px;
}

/* Responsive */
@media (max-width: 360px) {
    .tile {
        width: 46px;
        height: 46px;
        font-size: 1.5rem;
    }

    .key {
        height: 45px;
        font-size: 0.75rem;
    }
}

@media (min-height: 700px) {
    body {
        align-items: center;
        padding-top: 0;
    }
}
