:root {
    --cell-size: 80px;
}
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
}
.container {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    max-width: 800px;
    text-align: center;
}
h1 {
    color: #333;
    margin-top: 0;
}
.controls, .actions, .legend {
    margin: 20px 0;
}
.controls input {
    width: 60px;
    padding: 5px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    margin: 0 5px;
}
button:hover:not(:disabled) {
    background-color: #0056b3;
}
button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}
#status-msg {
    display: block;
    margin-top: 10px;
    font-weight: bold;
    color: #555;
}
#grid-container {
    display: grid;
    gap: 2px;
    background-color: #333;
    padding: 2px;
    border-radius: 4px;
    margin: 0 auto;
    width: fit-content;
}
.cell {
    width: var(--cell-size);
    height: var(--cell-size);
    background-color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    user-select: none;
    font-size: 14px;
    transition: background-color 0.2s;
}
.cell:hover {
    background-color: #f0f0f0;
}
.cell.start {
    background-color: #4CAF50;
    color: white;
}
.cell.goal {
    background-color: #f44336;
    color: white;
}
.cell.obstacle {
    background-color: #9e9e9e;
    cursor: not-allowed;
}
.cell.obstacle:hover {
    background-color: #9e9e9e;
}
.cell.path {
    background-color: #ffeb3b; /* yellow */
}
.cell .value {
    font-weight: bold;
    margin-top: 4px;
}
.cell .policy {
    font-size: 24px;
    line-height: 1;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 20px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}
.legend-color.start { background-color: #4CAF50; }
.legend-color.goal { background-color: #f44336; }
.legend-color.obstacle { background-color: #9e9e9e; }

.state-id {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 10px;
    color: #888;
}

.footer-name {
    margin-top: 30px;
    font-size: 14px;
    color: #777;
    text-align: right;
}

