@font-face {
    font-family: "digital7";
    src: url("../assets/fonts/digital-7/digital-7.ttf") format("truetype");
}

body {
    background:#171512;
}

/* Contenedor principal para asegurar que no se desborde */
.contenedor-tablero {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #33312E;
    padding: 10px;
    width: 100%;
}

.board {
    display: block;
    width: 100%;
    /* Limitamos el tamaño máximo para que no se vea gigante en PC */
    max-width: 500px;
    aspect-ratio: 1 / 1;
    /* Mantiene el tablero cuadrado siempre */
    margin: 0 auto;
    background: #33312E;
}

.board-loading {
    color: #fff;
    font-size: 1rem;
    padding: 1.5rem;
    text-align: center;
}

.chessboard-svg {
    display: block;
    width: 100%;
    max-width: max-content;
    height: auto;
}


.chessboard-svg use {
    pointer-events: none;
}

.fallback-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 0;
    border: 2px solid #333;
    width: 100%;
    height: 100%;
    /* Importante para que ocupe todo el aspect-ratio */
}

.fallback-row {
    display: contents;
}

.fallback-square {
    /* Eliminamos width: 50px y height: 50px */
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    position: relative;
    overflow: hidden;
}

.piece-image {
    width: 95%;
    height: 95%;
    object-fit: contain;
}

.fallback-square.light {
    background: #EBECD0;
}

.fallback-square.dark {
    background: #739552;
}

.board-info {
    max-width: 560px;
    margin: 0 auto 1rem;
}

.board-controls button {
    min-width: 120px;
}

pre.fen {
    white-space: pre-wrap;
    word-break: break-word;
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 0.25rem;
    border: 1px solid #dee2e6;
}

.hidden-exercise-info {
    display: none !important;
}

#respuesta {
    background: #33312E;
    text-align: center;
    min-height: 60px;
    border: none;
    color: #BABABA;
}

#retroalimentacion {
    font-size: 1.8rem;
    line-height: 1;
    text-align: center;
    font-weight: 900;
    min-height: 60px;
    background: #33312E;
    color: #BABABA;
    border: none;
}

.fallback-square {
    position: relative;
    /* Para que las coordenadas se posicionen respecto a la casilla */
}

/* Ajuste para las coordenadas en pantallas pequeñas */
.coordinate {
    position: absolute;
    /* Usamos unidades 'vw' o 'em' para que escalen un poco con el tablero */
    font-size: clamp(8px, 2vw, 12px);
    font-weight: bold;
    pointer-events: none;
    z-index: 10;
}

/* Números en la esquina superior izquierda */
.rank-label {
    top: 2px;
    left: 2px;
}

/* Letras en la esquina inferior derecha */
.file-label {
    bottom: 2px;
    right: 2px;
}

/* Colores dinámicos para que contrasten con el fondo de la casilla */
.light .coordinate {
    color: #779556;
    /* O el color de tus casillas oscuras */
}

.dark .coordinate {
    color: #ebecd0;
    /* O el color de tus casillas claras */
}

/* Ajuste opcional para los botones en móvil */
@media (max-width: 480px) {
    .board-controls button {
        min-width: 80px;
        font-size: 0.8rem;
        padding: 0.5rem;
    }

    #timer-badge {
        min-width: 80px;
    }
}

.contenedor-btn {
    max-width: 500px;
    padding: 0;
    background: #33312E;
}

.card {
    color: #BABABA;
    text-shadow: 1px 1px 2px #000;
    font-weight: bolder;
    background: #262421;
}

.numero-ejercicio {
    background: #007bff;
    color: #fff;
    padding: 0.5rem;
    border-radius: 0.25rem;
    display: inline-block;
    text-align: center;
}

#timer-badge {
    background: whitesmoke;
    color: black;
    padding: 3px;
    border-radius: 0.25rem;
    display: inline-block;
    text-align: center;
    font-family: "digital7", Arial, Helvetica, sans-serif;
    font-size: 2rem;
    line-height: 1;
    border: 1px solid whitesmoke;
    font-weight: 600;
    letter-spacing: 0.07em;
}