* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: #eaf4fb;
    color: #1d2b36;
}

main {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px 48px;
    text-align: center;
}

h1 { margin-bottom: 8px; }

.ayuda { color: #475966; max-width: 600px; margin: 0 auto 16px; }

.mensaje {
    min-height: 44px;
    padding: 10px 14px;
    margin: 12px auto;
    max-width: 600px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #c8d8e4;
}
.mensaje.error { background: #fdecea; border-color: #e5a29b; }
.mensaje.exito { background: #e8f6ec; border-color: #8fcba0; }

#tablero {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    width: min(92vw, 480px);
    aspect-ratio: 1 / 1;
    margin: 20px auto;
    border: 4px solid #1d2b36;
    border-radius: 6px;
    overflow: hidden;
}

.casilla {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.2rem, 5vw, 2.2rem);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}
.casilla.clara { background: #f0d9b5; }
.casilla.oscura { background: #b58863; }
.casilla.atacada { background: #e57373; }
.casilla.atacada::after { content: "✕"; font-size: 0.8em; color: rgba(255,255,255,0.8); }
.casilla.tiene-reina::after { content: ""; }
.casilla.reina-nueva { animation: pulso 0.4s ease; }
.casilla.rechazada { animation: sacudir 0.35s ease; }

@keyframes pulso {
    0% { transform: scale(0.6); }
    100% { transform: scale(1); }
}
@keyframes sacudir {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.controles {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 12px;
}

button {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}
button:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.secundario { background: #64748b; }
button.resolver { background: #16a34a; }

.contador { margin: 12px 0 0; }
.info { margin: 6px 0 0; color: #475966; }