/* Password Game Styles */

.game-container {
    display: flex;
    gap: 30px;
    margin-top: 20px;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
}

.board-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    order: 1;
}

.keyboard {
    order: 2;
}

.game-board {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.word-row {
    display: flex;
    gap: 5px;
}

.letter-box {
    width: 46.5px;
    height: 46.5px;
    border: 2px solid #d3d6da;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    text-transform: uppercase;
    background: white;
    transition: all 0.3s;
}

.letter-box.filled {
    border-color: #878a8c;
}

.letter-box.correct {
    background: #6aaa64;
    color: white;
    border-color: #6aaa64;
    animation: flip 0.5s ease;
}

.letter-box.present {
    background: #c9b458;
    color: white;
    border-color: #c9b458;
    animation: flip 0.5s ease;
}

.letter-box.absent {
    background: #787c7e;
    color: white;
    border-color: #787c7e;
    animation: flip 0.5s ease;
}

.letter-box.current {
    border-color: #667eea;
    border-width: 3px;
    animation: pulse 0.5s ease;
}

.letter-box.answer-reveal {
    background: #f59e0b;
    color: white;
    border-color: #f59e0b;
    animation: flip 0.5s ease;
}

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

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.keyboard {
    width: auto;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-right: 30px;
}

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

.key {
    min-width: 43px;
    height: 44px;
    border-radius: 4px;
    border: none;
    background: #d3d6da;
    color: #000;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.key svg {
    display: block;
}

.key:hover {
    background: #bbbec2;
}

.key:active {
    transform: scale(0.95);
}

.key-wide {
    min-width: 65px;
}

.key.correct {
    background: #6aaa64;
    color: white;
}

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

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

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.new-game-section {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.right-side {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 250px;
}

.instructions {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.instructions h3 {
    margin-bottom: 10px;
    color: #667eea;
}

.instructions p {
    margin-bottom: 10px;
    color: #666;
}

.instructions ul {
    margin-left: 20px;
    color: #666;
}

.instructions li {
    margin-bottom: 5px;
}

.game-status {
    color: #666;
    font-weight: 500;
}

.current-level {
    background: #667eea;
    color: white;
    padding: 6px 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: auto;
}

.revealed-word {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin: 20px 0;
}

.revealed-word .letter-box {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
}

/* Dialog styles */
.dialog-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 20px;
}

.dialog-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 500px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.dialog-content h3 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: #333;
}

.dialog-content p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 20px;
}

.dialog-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.invalid-word {
    animation: shake 0.5s;
}

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

/* Help button in header */
.header-left {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-start;
}

.help-button-header {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.help-button-header:hover {
    background: #5568d3;
}

/* Help dialog content */
.help-list {
    text-align: left;
    margin: 20px auto;
    max-width: 350px;
    color: #666;
    list-style: disc;
    padding-left: 20px;
}

.help-list li {
    margin-bottom: 10px;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .game-container {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }

    .keyboard {
        max-width: 100%;
        margin-right: 0;
        order: 2;
        gap: 6px;
    }

    .keyboard-row {
        gap: 4px;
    }

    .key {
        min-width: 28px;
        height: 40px;
        font-size: 0.75rem;
        padding: 0 6px;
    }

    .key-wide {
        min-width: 50px;
        font-size: 0.7rem;
    }

    .board-container {
        order: 1;
        gap: 15px;
    }

    .game-board {
        padding: 15px;
        gap: 4px;
    }

    .word-row {
        gap: 4px;
    }

    .letter-box {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }

    .controls {
        width: 100%;
    }

    .controls .btn {
        width: 100%;
    }

    .right-side {
        max-width: 100%;
        width: 100%;
    }

    .instructions {
        padding: 15px;
    }

    .instructions h3 {
        font-size: 1.1rem;
    }

    .instructions p,
    .instructions li {
        font-size: 0.9rem;
    }

    .revealed-word .letter-box {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .dialog-content {
        padding: 30px 20px;
        margin: 0 10px;
    }

    .dialog-content h3 {
        font-size: 1.5rem;
    }

    .dialog-content p {
        font-size: 1rem;
    }

    .help-list {
        font-size: 0.9rem;
        max-width: 100%;
    }
}

/* Tablet portrait optimization (iPad, etc) */
@media (min-width: 600px) and (max-width: 900px) {
    .container {
        padding: 10px;
        max-width: 100%;
        max-height: 100vh;
        overflow-y: hidden;
    }
    
    .game-container {
        gap: 8px;
        margin-top: 5px;
    }
    
    .game-board {
        width: fit-content;
        max-width: 85vw;
        padding: 8px;
    }
    
    .word-row {
        gap: 2px;
    }
    
    .letter-box {
        width: calc((85vw - 30px) / 5);
        height: calc((85vw - 30px) / 5);
        max-width: 80px;
        max-height: 80px;
        font-size: 2rem;
    }
    
    .keyboard {
        width: 85vw;
        max-width: 85vw;
        gap: 3px;
    }
    
    .keyboard-row {
        gap: 2px;
    }
    
    .key {
        min-width: calc((85vw - 60px) / 11);
        height: calc((85vw - 60px) / 11);
        max-height: 50px;
        font-size: 0.85rem;
        padding: 0 4px;
    }
    
    .key-wide {
        min-width: calc((85vw - 60px) / 11 * 1.5);
        font-size: 0.75rem;
    }
}

/* Extra small devices (very narrow phones) */
@media (max-width: 380px) {
    .letter-box {
        width: 31.5px;
        height: 31.5px;
        font-size: 1rem;
    }

    .key {
        min-width: 24px;
        height: 38px;
        font-size: 0.7rem;
        padding: 0 4px;
    }

    .key-wide {
        min-width: 45px;
        font-size: 0.65rem;
    }
}

/* Very small screens (iPhone SE) */
@media (max-width: 400px) {
    .game-container {
        gap: 5px;
        padding-bottom: 100px;
    }

    .keyboard {
        gap: 2px;
        margin-bottom: 5px;
        width: 95vw;
        max-width: 360px;
    }

    .keyboard-row {
        gap: 2px;
        justify-content: center;
    }

    .key {
        min-width: 24px;
        height: 32px;
        font-size: 0.65rem;
        padding: 0 4px;
    }

    .key-wide {
        min-width: 45px;
        font-size: 0.6rem;
    }

    .game-board {
        width: 95vw;
        max-width: 360px;
    }

    .word-row {
        height: calc((95vw - 40px) / 5);
        max-height: 62px;
        gap: 3px;
    }

    .letter-box {
        width: auto;
        height: 100%;
        flex: 1;
        font-size: 1.5rem;
    }

    .game-board {
        gap: 3px;
    }
}
