:root {
    --primary-color: #4caf50;
    --secondary-color: #2196f3;
    --background-color: #f5f5f5;
    --text-color: #333;
    --entrada-color: #4CAF50;
    --salida-color: #FF4081;
    --cell-size: 35px;
    --grid-gap: 1px;
    --sidebar-width: 300px;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

#game-container {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
    width: 90vw;
    max-width: 1200px;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 1rem;
}

h1 {
    color: var(--secondary-color);
    font-size: 2.5rem;
    margin: 0;
}

#game-area {
    display: flex;
    gap: 2rem;
    min-height: 0;
}

#laberinto-container {
    margin-top: 2rem;
    margin-bottom: auto;
    width: var(--cell-size)*21;
    height: var(--cell-size)*25;
    justify-content: center;
    align-items: center;
    background-color: #f0f0f0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

#laberinto {
    display: grid;
    gap: 0;
    background-color: #ccc;
    padding: var(--grid-gap);
    border-radius: var(--border-radius);
}

#sidebar {
    width: var(--sidebar-width);
    overflow-y: auto;
    padding-right: 1rem;
}

.control-group {
    background-color: #fff;
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--box-shadow);
}

h2 {
    font-size: 1.2rem;
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.celda {
    width: var(--cell-size);
    height: var(--cell-size);
    transition: background-color 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: white;
}

.entrada {
    background-color: var(--entrada-color);
}

.salida {
    background-color: var(--salida-color);
}

.entrada::after {
    content: "E";
}

.salida::after {
    content: "S";
}

.pared {
    background-color: #333;
}

.libre {
    background-color: white;
}

.actual {
    background-color: var(--primary-color);
}

.descartado {
    background-color: #ffa500;
}

.btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.1s;
    margin-bottom: 0.5rem;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    background-color: #45a049;
}

.secondary-btn {
    background-color: var(--secondary-color);
    color: white;
}

.secondary-btn:hover {
    background-color: #1976d2;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    height: 5px;
    border-radius: 5px;
    background: #d3d3d3;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--secondary-color);
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--secondary-color);
    cursor: pointer;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-weight: bold;
}

.pila {
    margin-top: 1rem;
    border: 1px solid #ccc;
    padding: 0.5rem;
    max-height: 175px;
    overflow-y: auto;
    border-radius: var(--border-radius);
    background-color: #f9f9f9;
}

.pila div {
    padding: 0.25rem;
    border-bottom: 1px solid #eee;
}

.pila div:last-child {
    border-bottom: none;
}

@media (max-width: 768px) {
    #game-area {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        padding-right: 0;
    }

    :root {
        --cell-size: 15px;
    }
}