body {
    margin: 0;
    min-height: 90vh;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: #fafafa;
}

label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

#board {
    display: grid;
    width: 100%;
    height: 100%;
    border: 2px solid black;
}

.square {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.controls {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.square.hidden-number {
    color: transparent;
}

.white {
    background-color: #ffffff;
}

.black {
    background-color: #c0c0c0;
}

.knight {
    position: absolute;
    font-size: calc(var(--cell-font-size) * 1.9);
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 5;
}


.current {
    background-color: #ff5722 !important;
    color: white;
    font-size: 18px;
}

#status {
    height: 24px;              /* reserves space → no jumping. */
    margin-top: 36px;
    font-size: 18px;
    font-weight: 500;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;                /* hidden by default. */
    transition: opacity 0.2s ease;
}

#status.visible {
    visibility: visible;
}

#board-container {
    margin-top: 20px;
    position: relative;
    width: min(90vw, 400px);
    aspect-ratio: 1 / 1;
}

#arrows {
    position: absolute;
    inset: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.arrow {
    stroke: red;
    stroke-width: 2.5;
    fill: none;
    marker-end: url(#arrowhead);
}

.square {
    font-size: var(--cell-font-size);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}


button,
select {
    font-family: "Inter", sans-serif;
    font-size: 14px;
    font-weight: 500;

    padding: 8px 14px;
    border-radius: 8px;

    border: 1px solid #ccc;
    background: white;
    color: #222;

    cursor: pointer;
    transition: all 0.2s ease;
}

button:hover,
select:hover {
    border-color: #888;
}

button:disabled {
    background: #eee;
    color: #999;
    cursor: not-allowed;
}

button {
    background: #111;
    color: white;
    border-color: #111;
}

button:hover:not(:disabled) {
    background: #000;
}

.board-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}


/* ===== Slider container spacing ===== */
label input[type="range"] {
    margin-left: 8px;
}

/* ===== Base slider ===== */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 160px;
    height: 4px;
    background: #ddd;
    border-radius: 999px;
    outline: none;
    cursor: pointer;
}

/* ===== Track hover ===== */
input[type="range"]:hover {
    background: #ccc;
}

/* ===== Thumb (Chrome, Edge, Safari) ===== */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #222;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

/* ===== Thumb (Firefox) ===== */
input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #222;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}



/* ===== Speed control ===== */
.speed-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-family: "Inter", sans-serif;
    font-weight: 500;
}

/* Value under slider */
#speedValue {
    font-size: 13px;
    color: #555;
    min-height: 16px; /* prevents layout jump */
}



@media (max-width: 600px) {

    body {
        padding: 16px;
    }

    h1 {
        font-size: 20px;
        text-align: center;
        margin-bottom: 12px;
    }

    .controls {
        flex-direction: column;
        gap: 12px;
        width: 100%;
        max-width: 320px;
    }

    .controls label {
        justify-content: space-between;
        width: 100%;
    }

    button {
        width: 100%;
        padding: 12px;
        font-size: 15px;
    }

    select {
        width: 100%;
    }

    .speed-control {
        width: 100%;
    }

    input[type="range"] {
        width: 100%;
    }

    #status {
        font-size: 15px;
        margin-top: 24px;
    }
}