body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #f0f2f5;
    color: #333;
    padding-top: 20px;
}

h1 {
    color: #1a2b4d;
}

.controls {
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 20px;
}
.controls button {
    font-size: 1rem;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: #007bff;
    color: white;
}
#solve-btn { background-color: #28a745; }
#solve-btn:disabled { background-color: #999; }

#hanoi-container {
    display: flex;
    justify-content: space-around;
    width: 90%;
    max-width: 800px;
    height: 300px;
    border-bottom: 5px solid #333;
    margin-top: 30px;
}

.tower {
    width: 30%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column-reverse; /* This is the magic! */
    align-items: center;
}

.peg {
    width: 10px;
    height: 90%;
    background-color: #555;
    position: absolute;
    bottom: 0;
}

.disk {
    height: 25px;
    border: 1px solid #333;
    border-radius: 5px;
    box-sizing: border-box;
    z-index: 10;
    margin-bottom: 2px;
    transition: all 0.3s ease; /* For user dragging */
}

/* Disk colors and widths */
.disk[data-disk="1"] { width: 60px; background-color: #dc3545; }
.disk[data-disk="2"] { width: 80px; background-color: #fd7e14; }
.disk[data-disk="3"] { width: 100px; background-color: #ffc107; }
.disk[data-disk="4"] { width: 120px; background-color: #28a745; }
.disk[data-disk="5"] { width: 140px; background-color: #007bff; }
.disk[data-disk="6"] { width: 160px; background-color: #6f42c1; }
.disk[data-disk="7"] { width: 180px; background-color: #e83e8c; }
.disk[data-disk="8"] { width: 200px; background-color: #343a40; }

#status-message {
    margin-top: 20px;
    font-size: 1.2rem;
    font-weight: bold;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    font-size: 1rem;
    color: #007bff;
    text-decoration: none;
}
.back-link:hover { text-decoration: underline; }