body{
    background-color: #fbfbfb;
    margin: 0;
    padding: 10px 5px;
    min-height: 100vh;
    box-sizing: border-box;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    touch-action: manipulation;
}

/* iPhone specific optimizations */
@media screen and (max-width: 390px) {
    body {
        padding: 5px 2px;
    }
}

.container{
  display: -webkit-box;  /* OLD - iOS 6-, Safari 3.1-6, BB7 */
  display: -ms-flexbox;  /* TWEENER - IE 10 */
  display: -webkit-flex; /* NEW - Safari 6.1+. iOS 7.1+, BB10 */
  display: flex;         /* NEW, Spec - Firefox, Chrome, Opera */
  
  justify-content: center;
  align-items: center;
}

.game-board-container{
    margin: 0px auto 20px auto;
    min-width: 280px;
    max-width: 350px;
}

.game-keyboard-container{
    margin: 20px auto 0px auto;
    max-width: 350px;
    width: 100%;
}

/* Mobile optimizations */
@media screen and (max-width: 390px) {
    .game-board-container {
        margin: 0px auto 15px auto;
        min-width: 300px;
        max-width: 95%;
        width: 95%;
    }
    
    .game-keyboard-container {
        margin: 15px auto 0px auto;
        max-width: 100%;
        width: 100%;
        padding: 0 5px;
    }
}

.game-board-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 4px;
}

.tile {
    width: 40px;
    height: 40px;
    font-size: 20px;
    line-height: 40px;
    text-transform: uppercase;
    font-weight: bold;
    text-align: center;
    border: 2px solid #ccc;
    outline: none;
    border-radius: 4px;
    margin: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    /* Prevent iOS keyboard from appearing */
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

/* Mobile tile optimizations */
@media screen and (max-width: 390px) {
    .game-board-row {
        gap: 6px;
        margin-bottom: 6px;
    }
    
    .tile {
        width: 55px;
        height: 55px;
        font-size: 22px;
        line-height: 55px;
        margin: 0;
        border-radius: 4px;
        box-sizing: border-box;
    }
}

.tile:focus{
    border-color: #888;
}

.tile.read-only {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

.tile.disabled:not(.correct):not(.present):not(.absent) {
    background-color: #f5f5f5;
    color: #ccc;
    cursor: not-allowed;
}

.tile.active-row {
    background-color: white;
}

/* Farve feedback for tiles */
.tile.correct {
    background-color: #6aaa64;
    color: white;
    border-color: #6aaa64;
}

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

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

/* Flip animation */
.tile.flip {
    animation: flip 0.6s ease-in-out;
}

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

/* Shake animation for invalid words */
.game-board-row.shake {
    animation: shake 0.5s ease-in-out;
}

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

/* Bounce animation for correct guess */
.tile.bounce {
    animation: bounce 0.6s ease-in-out;
}

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


.keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 6px;
}

.key {
    min-width: 28px;
    height: 40px;
    border: none;
    border-radius: 3px;
    background-color: #e9eaec;
    color: #333;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
    transition: background-color 0.1s ease;
    touch-action: manipulation;
}

/* Mobile keyboard optimizations */
@media screen and (max-width: 390px) {
    .key {
        flex: 1;
        min-width: 0;
        height: 40px;
        font-size: 0.85rem;
        border-radius: 3px;
        max-width: 35px;
    }
    
    .keyboard-row {
        gap: 2px;
        margin-bottom: 4px;
        display: flex;
        width: 100%;
    }
}

.key:hover {
    background-color: #c4c7ca;
}

.key:active {
    background-color: #b0b3b6;
}

.key.action-key {
    min-width: 50px;
    font-size: 0.7rem;
    padding: 0 6px;
}

/* Mobile action key optimizations */
@media screen and (max-width: 390px) {
    .key.action-key {
        flex: 1.5;
        min-width: 0;
        font-size: 0.7rem;
        padding: 0 2px;
        max-width: 55px;
    }
}

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

.key.wrong-position {
    background-color: #b59f3b;
}

.key.wrong {
    background-color: #787c7e;
}

/* Keyboard feedback colors */
.key.correct {
    background-color: #6aaa64;
    color: white;
}

.key.present {
    background-color: #c9b458;
    color: white;
}

.key.absent {
    background-color: #787c7e;
    color: white;
}

.key:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}