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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

.page-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.game-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    width: 100%;
    max-width: min(90vh, 600px);
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 12px;
}

.game-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.95rem;
    color: #666;
    font-weight: 500;
}

.icon-button {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #666;
}

.icon-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: rotate(30deg);
}

.icon-button svg {
    width: 24px;
    height: 24px;
}

.icon-button .iconfont {
    color: #666;
    font-size: 20px;
}

#grid-container {
    flex: 1;
    display: grid;
    gap: 10px;
    width: 100%;
    aspect-ratio: 1;
}

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

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 90%;
    width: 400px;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 2rem;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

select, button:not(.icon-button) {
    padding: 0.8rem 1.2rem;
    border: 2px solid #3498db;
    border-radius: 8px;
    background: white;
    color: #3498db;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

button:not(.icon-button) {
    background: #3498db;
    color: white;
    font-weight: 600;
    width: 100%;
}

button:not(.icon-button):hover {
    background: #2980b9;
    border-color: #2980b9;
    transform: translateY(-2px);
}

select:hover {
    border-color: #2980b9;
}

.grid-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid #3498db;
    border-radius: 12px;
    font-size: clamp(1rem, 4vw, 1.8rem);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.grid-cell:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.grid-cell.highlighted {
    background: #2ecc71;
    color: white;
    border-color: #27ae60;
}

.grid-cell.wrong {
    animation: shake 0.5s;
}

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

.hidden {
    display: none !important;
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.8rem;
    font-weight: 600;
}

h2 {
    color: #2ecc71;
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 600;
}

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

    .game-container {
        padding: 1rem;
        border-radius: 12px;
    }

    .game-header {
        padding: 0.4rem 0.8rem;
    }

    .game-stats {
        font-size: 0.85rem;
        gap: 1rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .modal-content {
        padding: 1.5rem;
    }

    .icon-button {
        width: 36px;
        height: 36px;
    }

    .icon-button svg {
        width: 20px;
        height: 20px;
    }

    .grid-cell {
        border-radius: 8px;
    }
}
