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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 650px;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 40px 30px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

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

h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -1px;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.game-info-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.game-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 200px;
}

.game-number {
    font-size: 0.95rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
}

.game-author {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
}

.suggest-link {
    display: inline-block;
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.25s ease;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.suggest-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.completed-groups {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.group {
    background-color: #f9df6d;
    padding: 22px;
    border-radius: 16px;
    text-align: center;
    animation: slideDown 0.3s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.group.difficulty-1 { 
    background: linear-gradient(135deg, #ffd93d 0%, #f9df6d 100%);
    color: #333;
}
.group.difficulty-2 { 
    background: linear-gradient(135deg, #a0c35a 0%, #88b04b 100%);
    color: #fff;
}
.group.difficulty-3 { 
    background: linear-gradient(135deg, #b0c4ef 0%, #7a9cc6 100%);
    color: #fff;
}
.group.difficulty-4 { 
    background: linear-gradient(135deg, #ba81c5 0%, #9d5ca3 100%);
    color: #fff;
}

.group-category {
    font-weight: 800;
    font-size: 1.05rem;
    text-transform: uppercase;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.group-items {
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.95;
}

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

.game-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.word-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 24px 12px;
    border-radius: 12px;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 2px solid transparent;
    user-select: none;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.5px;
}

.word-card:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.word-card.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.word-card.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.game-info {
    text-align: center;
    margin-bottom: 18px;
}

.mistakes {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.5px;
}

#mistakes-count {
    color: #ffffff;
    font-weight: 700;
}

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

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.95);
    color: #667eea;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
}

.result-message {
    text-align: center;
    min-height: 30px;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.result-message.error {
    color: #ff6b6b;
}

.result-message.success {
    color: #51cf66;
}

.result-message.close {
    color: #ffd93d;
}

.result-message.completed-info {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    padding: 20px;
    border-radius: 12px;
    line-height: 1.8;
    margin-bottom: 10px;
    font-weight: 600;
}

.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-in;
}

.game-over.hidden {
    display: none;
}

.game-over-content {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95) 0%, rgba(118, 75, 162, 0.95) 100%);
    padding: 45px;
    border-radius: 24px;
    max-width: 520px;
    width: 90%;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.game-over-content h2 {
    font-size: 2.5rem;
    margin-bottom: 25px;
    color: white;
    font-weight: 800;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

#final-groups {
    margin-bottom: 30px;
}

#final-groups .group {
    margin-bottom: 10px;
}

.game-over-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.share-feedback {
    margin-top: 15px;
    color: #51cf66;
    font-weight: 700;
    font-size: 1rem;
    animation: fadeIn 0.3s ease-in;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.share-feedback.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 30px 20px;
    }
    
    h1 {
        font-size: 2.2rem;
    }
    
    .game-info-header {
        gap: 10px;
    }
    
    .game-meta {
        min-width: 150px;
    }
    
    .nav-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    
    .word-card {
        padding: 18px 8px;
        font-size: 0.85rem;
    }
    
    .controls {
        flex-wrap: wrap;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 0.85rem;
    }
    
    .game-over-content {
        padding: 35px 25px;
    }
    
    .game-over-content h2 {
        font-size: 2rem;
    }
}
