* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 800px;
    width: 100%;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 2.5rem;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.controls label {
    font-weight: bold;
    color: #555;
}

.controls input {
    width: 80px;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.controls button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

.controls button:hover {
    background: #5a67d8;
}

.game-field {
    display: grid;
    gap: 2px;
    background: #333;
    padding: 2px;
    border-radius: 10px;
    margin: 0 auto 20px;
    width: fit-content;
}

.cell {
    width: 50px;
    height: 50px;
    background: #f0f0f0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cell.wall {
    background: #666;
}

.cell img {
    position: absolute;
    width: 80%;
    height: 80%;
    object-fit: contain;
}

.cell.robot img {
    z-index: 2;
    transition: all 0.3s ease;
}

.cell.finish {
    background: #ffd700;
}

.command-section {
    margin-bottom: 20px;
}

.command-section h3 {
    color: #333;
    margin-bottom: 10px;
}

.command-display {
    min-height: 60px;
    background: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 24px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.command-display span {
    display: inline-block;
}

.command-display .arrow {
    font-size: 28px;
    color: #667eea;
}

.command-display .count {
    font-size: 16px;
    color: #999;
    vertical-align: super;
}

.command-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.action-btn {
    padding: 12px 30px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

#start-btn {
    background: #48bb78;
    color: white;
}

#start-btn:hover {
    background: #38a169;
}

#reset-btn {
    background: #f56565;
    color: white;
}

#reset-btn:hover {
    background: #e53e3e;
}

#finish-btn {
    background: #4299e1;
    color: white;
}

#finish-btn:hover {
    background: #3182ce;
}

.status-message {
    text-align: center;
    font-size: 48px;
    margin-top: 20px;
    min-height: 60px;
}

@keyframes move {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.moving {
    animation: move 0.3s ease;
}