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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #fff5e6 0%, #e6f3ff 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 500px;
    width: 100%;
    background: white;
    border-radius: 30px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

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

h1 {
    color: #ff6b35;
    font-size: 2.2em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(255, 107, 53, 0.2);
}

.level-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    color: #4a90e2;
    font-size: 1.1em;
}

.subtitle {
    color: #6c757d;
    font-size: 1.2em;
    margin-top: 10px;
}

.mode-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.mode-card {
    background: white;
    border-radius: 20px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 3px solid transparent;
}

.mode-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: #ff6b35;
}

.mode-icon {
    font-size: 4em;
    margin-bottom: 15px;
}

.mode-card h2 {
    color: #ff6b35;
    font-size: 1.5em;
    margin-bottom: 10px;
}

.mode-card p {
    color: #6c757d;
    font-size: 0.9em;
    margin-bottom: 15px;
}

.mode-info {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 0.85em;
}

.mode-info span {
    background: #f8f9fa;
    padding: 5px 10px;
    border-radius: 15px;
    color: #495057;
}

.btn-start {
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    color: white;
    width: 100%;
    padding: 12px 20px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.btn-back {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
    padding: 8px 16px;
    font-size: 1em;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 20px;
    margin-bottom: 25px;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.05);
}

.cell {
    aspect-ratio: 1;
    background: white;
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border: 3px solid transparent;
    user-select: none;
}

.cell[data-size="4"], .cell[data-size="5"] {
    font-size: 2em;
}

.cell:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.cell.selected {
    border-color: #4a90e2;
    background: #e6f3ff;
    animation: pulse 1s infinite;
}

.cell.fixed {
    background: #f0f0f0;
    cursor: not-allowed;
    opacity: 0.7;
}

.cell.correct {
    background: #d4edda;
    border-color: #28a745;
    animation: success 0.5s ease;
}

.cell.error {
    background: #f8d7da;
    border-color: #dc3545;
    animation: shake 0.5s ease;
}

.cell.hint-highlight {
    background: #fff3cd;
    border-color: #ffc107;
    animation: glow 1s ease;
}

.selection-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 10px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 20px;
    margin-bottom: 25px;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.05);
}

.selection-item {
    aspect-ratio: 1;
    background: white;
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border: 3px solid transparent;
}

.selection-item:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.selection-item.selected {
    border-color: #ff6b35;
    background: #fff5e6;
}

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

.btn {
    padding: 12px 24px;
    font-size: 1.1em;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-speech {
    background: linear-gradient(135deg, #9c27b0, #7b1fa2);
    color: white;
}

.btn-check {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.btn-hint {
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: white;
}

.btn-answer {
    background: linear-gradient(135deg, #e91e63, #c2185b);
    color: white;
}

.btn-reset {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
}

.btn-next {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    font-size: 1.2em;
    padding: 15px 40px;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 30px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.5s ease;
}

.modal-content h2 {
    color: #ff6b35;
    font-size: 2.5em;
    margin-bottom: 15px;
}

.modal-content p {
    color: #6c757d;
    font-size: 1.3em;
    margin-bottom: 25px;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
    }
    50% {
        box-shadow: 0 4px 16px rgba(74, 144, 226, 0.6);
    }
}

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

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 4px 8px rgba(255, 193, 7, 0.3);
    }
    50% {
        box-shadow: 0 4px 16px rgba(255, 193, 7, 0.8);
    }
}

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

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

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.8em;
    }

    .cell {
        font-size: 2.5em;
        border-radius: 12px;
    }

    .selection-item {
        font-size: 2em;
    }

    .btn {
        padding: 10px 18px;
        font-size: 1em;
    }
}
