/* ===== Diseño base ===== */
html {
box-sizing: border-box;
font-size: 16px;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
background: #f2f2f2;
font-family: Arial, sans-serif;
color: #222;
text-align: center;
margin: 0;
min-height: 100vh;
}
/* ===== Encabezado ===== */
h1 {
color: #d7263d;
margin-top: 2rem;
font-size: clamp(2rem, 4vw, 2.5rem);
}
/* ===== Tablero ===== */
#board {
display: grid;
grid-template-columns: repeat(10, 1fr);
gap: 0.7vw;
margin: 2.5rem auto 1.7rem auto;
background: #1565c0;
padding: 2vw;
border-radius: 1rem;
width: 100%;
max-width: 98vw;
}
/* Una celda */
.cell {
aspect-ratio: 1 / 1;
width: 100%;
background: #fff;
border-radius: 0.7rem;
box-shadow: 0 2px 8px #bbb;
font-size: clamp(1rem, 2.5vw, 1.4rem);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.15s;
user-select: none;
}
.cell.revealed { background: #bbdefb; cursor: default; }
.cell.mine { background: #d7263d; color: #fff; }
.cell.flag { background: #ffe082; color: #d7263d; }
/* ===== Estado y botón ===== */
#status {
font-size: 1.1rem;
min-height: 2em;
margin: 0.5em 0 0.7em 0;
}
#restart-btn {
background: #d7263d;
color: #fff;
font-size: clamp(1rem, 2vw, 1.3rem);
border: none;
border-radius: 0.7rem;
padding: 0.5em 2em;
cursor: pointer;
transition: background 0.2s;
margin-bottom: 1.2em;
margin-top: 1em;
}
#restart-btn:hover { background: #920c22; }
/* ========================================
===== Pantallas pequeñas (<720px) ====
======================================== */
@media (max-width: 720px) {
h1 {
margin-top: 3vw;
font-size: clamp(1.3rem, 6vw, 2.1rem);
}
#board {
/* Cambia columnas si el tablero lo permite */
grid-template-columns: repeat(6, 1fr);
padding: 4vw;
border-radius: 4vw;
gap: 2.8vw;
margin-top: 4vw;
margin-bottom: 6vw;
max-width: 99vw;
}
.cell {
font-size: clamp(1.2rem, 8vw, 2.5rem);
border-radius: 3vw;
}
#restart-btn {
font-size: clamp(1rem, 8vw, 2rem);
padding: 3vw 12vw;
border-radius: 3vw;
margin-bottom: 6vw;
margin-top: 3vw;
}
#status {
font-size: clamp(1rem, 7vw, 1.7rem);
}
}
/* ========================================
===== Pantallas muy pequeñas (<400px) ==
======================================== */
@media (max-width: 400px) {
#board {
grid-template-columns: repeat(4, 1fr);
padding: 2vw;
gap: 2vw;
border-radius: 5vw;
}
.cell { font-size: clamp(1rem, 10vw, 2.2rem); }
#restart-btn {
padding: 3vw 4vw;
font-size: clamp(0.9rem, 7vw, 1.5rem);
border-radius: 5vw;
}
}
/* ========================================
===== Pantallas grandes (>1200px) ====
======================================== */
@media (min-width: 1200px) {
#board {
max-width: 700px;
padding: 2rem;
gap: 0.7rem;
}
h1 {
font-size: clamp(2.5rem, 3vw, 3.5rem);
}
.cell {
font-size: clamp(1.3rem, 2vw, 2rem);
}
}
/* :::::::::::::::::::::::::::::: */
/* Controles (tamaño/minas) y contador de banderas */
#controls {
margin: 0.8rem auto 0.4rem auto;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
}
#controls select {
font-size: 1em;
padding: 6px 10px;
border-radius: 8px;
border: 1px solid #ddd;
}
#counters {
font-size: 1rem;
color: #333;
margin-bottom: 0.4rem;
}
/* Accesibilidad: foco visible en celdas */
.cell {
border: none;
outline: none;
}
.cell:focus-visible {
box-shadow: 0 0 0 4px rgba(215, 38, 61, 0.35);
}
/* Estado deshabilitado para botón reinicio */
#restart-btn:disabled {
opacity: 0.6;
cursor: not-allowed;
box-shadow: none;
}
/* Modo oscuro mejorado */
@media (prefers-color-scheme: dark) {
body {
background: #0f1222;
color: #eaeaf0;
}
#board {
background: #182a46;
box-shadow: 0 6px 24px rgba(61, 90, 254, 0.12);
border: 1px solid rgba(255,255,255,0.06);
}
.cell {
background: #20233a;
color: #eaeaf0;
box-shadow: 0 2px 10px rgba(61, 90, 254, 0.12);
}
.cell.revealed { background: #264b74; }
.cell.mine { background: #7c1f2a; color: #fff; }
.cell.flag { background: #8a6d28; color: #ffd54f; }
#status, #counters {
color: #a0a3b0;
}
#restart-btn {
background: #3d5afe;
}
#restart-btn:hover {
background: #0a2459;
}
#controls select {
background: #20233a;
color: #eaeaf0;
border-color: #2c3252;
}
.cell:focus-visible {
box-shadow: 0 0 0 4px rgba(61, 90, 254, 0.35);
}
}