.level-selector {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.level-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--light-quaternary);
    background: var(--light-secondary);
    color: var(--dark);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.level-btn:hover {
    background: var(--light-tertiary);
    border-color: var(--primary);
    color: var(--primary);
}

.level-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.queens-board {
    display: grid;
    grid-template-columns: repeat(var(--board-size, 8), 1fr);
    max-width: 460px;
    width: 100%;
    margin: 0 auto;
    padding: 10px;
    border-radius: 18px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: linear-gradient(160deg, #243042, #0f172a);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.4);
}

.cell {
    aspect-ratio: 1 / 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    font-size: clamp(1.1rem, 4.4vw, 2rem);
}

.light-sq { background-color: #eef2f8; }
.dark-sq  { background-color: #d6deea; }

.cell:not(.placed):hover {
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.45);
    z-index: 1;
}

.cell.placed .queen-icon {
    color: #b9842b;
    font-size: clamp(1.1rem, 4.4vw, 2rem);
    line-height: 1;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.28));
    animation: queen-pop 0.22s ease;
}

@keyframes queen-pop {
    0% { transform: scale(0.4); opacity: 0; }
    70% { transform: scale(1.12); }
    100% { transform: scale(1); opacity: 1; }
}

.cell.attacking {
    background-color: #fde2e2 !important;
    box-shadow: inset 0 0 0 2px rgba(239, 68, 68, 0.7);
    z-index: 2;
}

.cell.attacking .queen-icon {
    color: #dc2626;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
    animation: none;
}

.cell.threatened:not(.placed):not(.attacking) {
    background-color: rgba(239, 68, 68, 0.12) !important;
}

.queens-remaining {
    text-align: center;
    font-size: 0.9rem;
    color: var(--gray);
    margin: 14px 0 4px 0;
}

.queens-remaining span { font-weight: 700; color: var(--dark); }

@media (max-width: 520px) {
    .queens-board {
        max-width: 98vw;
    }
}
