* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.grid-container {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    transition: transform 0.3s ease;
}

.grid-container:hover {
    transform: translateY(-5px);
}

.controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

button {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

button::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

button:hover::after {
    transform: translateX(0);
}

#setStart {
    background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%);
}

#setEnd {
    background: linear-gradient(135deg, #e53935 0%, #c62828 100%);
}

#setWalls {
    background: linear-gradient(135deg, #424242 0%, #212121 100%);
}

#importJson {
    background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%);
}

#saveJson {
    background: linear-gradient(135deg, #7e57c2 0%, #5e35b1 100%);
}

#setMultiWall {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

#setMoveCount {
    background: linear-gradient(135deg, #03a9f4 0%, #0288d1 100%);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

button:active {
    transform: translateY(0);
}

canvas {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    min-width: 300px;
    max-width: 90%;
    animation: modalShow 0.3s ease;
}

@keyframes modalShow {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal h2 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 1.5em;
    text-align: center;
}

.modal-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.modal-input:focus {
    outline: none;
    border-color: #7e57c2;
    box-shadow: 0 0 0 3px rgba(126, 87, 194, 0.1);
}

.modal-input.error {
    border-color: #e53935;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn.confirm {
    background: linear-gradient(135deg, #7e57c2 0%, #5e35b1 100%);
    color: white;
    border: none;
}

.modal-btn.cancel {
    background: white;
    color: #666;
    border: 2px solid #e0e0e0;
}

.modal-btn:hover {
    transform: translateY(-2px);
}

.modal-btn.confirm:hover {
    box-shadow: 0 4px 8px rgba(94, 53, 177, 0.2);
}

.modal-btn.cancel:hover {
    background: #f5f5f5;
}

@media (max-width: 600px) {
    .container {
        padding: 20px 10px;
    }
    
    .controls {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
    }
    
    button {
        width: 100%;
    }

    .modal-content {
        width: 90%;
        padding: 20px;
    }
}

#moveCountDisplay {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}