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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background-color: #fafafa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

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

#title {
    font-size: 2rem;
    font-weight: 700;
    color: #222;
    line-height: 1.2;
    margin-bottom: 20px;
}

#title span {
    font-size: 1.5rem;
    font-weight: 400;
    color: #666;
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

/* Hidden input for mobile keyboard support */
#mobile-input {
    position: fixed;
    top: -100px;
    left: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 0;
    margin: 0;
    z-index: -1;
}

/* Tile base styles */
.tile {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 4px;
    user-select: none;
}

/* Rack styles */
#rack {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

.rack-tile {
    background-color: transparent;
    color: #333;
    border: none;
    font-size: 2rem;
    font-weight: 700;
    width: auto;
    height: auto;
    transition: transform 1.5s cubic-bezier(0.4, 0.0, 0.2, 1);
    display: inline-block;
}

.rack-tile.locked {
    background-color: transparent;
    color: #4caf50;
    border: none;
}

/* Guess area styles */
#guess {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.guess-tile {
    border: 3px solid #d0d0d0;
    background-color: #fff;
    color: #333;
    transition: all 0.2s ease;
}

.guess-tile.empty {
    background-color: #fafafa;
    color: transparent;
}

.guess-tile.filled {
    background-color: #fff;
    border-color: #999;
}

.guess-tile.locked {
    background-color: #4caf50;
    color: white;
    border-color: #4caf50;
}

.guess-tile.focus {
    outline: 3px solid #2196f3;
    outline-offset: 2px;
}

/* Status area */
#status {
    min-height: 30px;
    text-align: center;
    font-size: 1rem;
    padding: 10px;
    border-radius: 4px;
}

#status.info {
    color: #666;
}

#status.error {
    color: #d32f2f;
    font-weight: 500;
}

#status.success {
    color: #388e3c;
    font-weight: 600;
    font-size: 1.2rem;
}

/* Controls */
#controls {
    text-align: center;
}

#play-again {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background-color: #2196f3;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#play-again:hover {
    background-color: #1976d2;
}

#play-again:active {
    background-color: #1565c0;
}

/* Stats */
#stats {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    margin-top: 20px;
}

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

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


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

    #title {
        font-size: 1.75rem;
    }

    #title span {
        font-size: 1.25rem;
    }

    #rack, #guess {
        gap: 6px;
    }
}
