body {
    font-family: Arial, sans-serif;
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
    user-select: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

h1 {
    font-size: 36px;
    margin: 0 0 20px 0;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
}

.mode-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.mode-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    background: #f0f0f0;
}

.mode-btn.active {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.ai-section {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    display: none;
}

.ai-section.active {
    display: block;
    animation: slideIn 0.3s ease;
}

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

.ai-section h3 {
    margin: 0 0 15px 0;
    color: #333;
}

.ai-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.ai-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    margin: 5px;
}

.ai-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(238, 90, 36, 0.4);
}

.ai-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ai-response {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 15px;
    margin-top: 15px;
    text-align: left;
    max-height: 200px;
    overflow-y: auto;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 5px;
    width: 350px;
    height: 420px;
    margin-bottom: 20px;
}

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

.tile {
    width: 100%;
    height: 100%;
    border: 2px solid #d3d6da;
    font-size: 32px;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
    transition: transform 0.1s;
    border-radius: 8px;
    background: white;
}

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

@keyframes flip {
    0% {
        transform: rotateX(0);
        background: white;
        border-color: #d3d6da;
    }
    45% {
        transform: rotateX(90deg);
        background: white;
        border-color: #d3d6da;
    }
    55% {
        transform: rotateX(90deg);
        background: var(--background);
        border-color: var(--border);
        color: white;
    }
    100% {
        transform: rotateX(0);
        background: var(--background);
        border-color: var(--border);
        color: white;
    }
}

.tile.shake {
    animation: shake 0.5s;
}

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

.keyboard {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
}

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

.key {
    min-width: 30px;
    height: 50px;
    border-radius: 8px;
    background-color: #d3d6da;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.key:hover {
    background-color: #c0c3c7;
    transform: scale(1.05);
}

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

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

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

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

.message {
    height: 20px;
    font-weight: bold;
    margin: 10px 0;
    transition: all 0.3s ease;
}

.message.error {
    color: #f00;
    animation: pulse 0.5s;
}

.message.success {
    color: #6aaa64;
    animation: bounce 0.5s;
}

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

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.stats {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #a8e6cf 0%, #dcedc8 100%);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.stats h3 {
    margin: 0 0 15px 0;
    color: #2e7d32;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.7);
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
}

.new-game-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    margin-top: 15px;
    transition: all 0.3s ease;
}

.new-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 20px;
    }
    
    .board {
        width: 300px;
        height: 360px;
    }
    
    .tile {
        font-size: 24px;
    }
    
    .key {
        min-width: 25px;
        height: 45px;
        font-size: 14px;
    }
}

