* {
    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%);
    color: #2c3e50;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 10px;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 100%;
}

h1 {
    color: #ffffff;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
    margin: 0;
}

.main-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    max-width: 100%;
}

.controls {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
    justify-content: center;
    padding: 25px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.control-group input,
.control-group select {
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #f8f9fa;
    color: #2c3e50;
    font-size: 14px;
    width: 80px;
    transition: all 0.3s ease;
}

.control-group select {
    width: 180px;
    cursor: pointer;
}

.control-group input:focus,
.control-group select:focus {
    outline: none;
    border-color: #667eea;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn {
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary:hover:not(:disabled) {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.4);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.canvas-container {
    background: #0f0f0f;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
    overflow: auto;
    max-width: 100%;
    max-height: 80vh;
}

#mazeCanvas {
    display: block;
    background: #0f0f0f;
}

.matrix-footer {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    text-align: center;
    border-top: 2px solid rgba(72, 187, 120, 0.3);
    border-radius: 0 0 20px 20px;
}

#status {
    font-weight: 600;
    color: #ffffff;
    font-size: 13px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    letter-spacing: 1px;
}

.matrix-panel {
    background: #2d3748;
    border: none;
    border-radius: 20px;
    width: 350px;
    height: 600px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.matrix-header {
    background: rgba(0, 0, 0, 0.3);
    color: #48bb78;
    padding: 12px;
    text-align: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: bold;
    font-size: 14px;
    border-bottom: 2px solid rgba(72, 187, 120, 0.3);
    letter-spacing: 2px;
    border-radius: 20px 20px 0 0;
}

.matrix-content {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: #48bb78;
    line-height: 1.3;
    text-shadow: 0 0 3px rgba(72, 187, 120, 0.5);
}

.matrix-content::-webkit-scrollbar {
    width: 8px;
}

.matrix-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.matrix-content::-webkit-scrollbar-thumb {
    background: rgba(72, 187, 120, 0.3);
    border-radius: 4px;
}

.matrix-content::-webkit-scrollbar-thumb:hover {
    background: rgba(72, 187, 120, 0.5);
}

.matrix-line {
    margin-bottom: 3px;
    opacity: 0;
    animation: fadeIn 0.3s ease-in forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.matrix-line.phase {
    color: #4fd1c5;
    font-weight: bold;
    margin-top: 8px;
    margin-bottom: 3px;
}

.matrix-line.header {
    color: #fff;
    font-weight: bold;
    font-family: 'Arial', sans-serif;
    padding: 4px 0;
    margin: 8px 0;
    text-shadow: 0 0 8px rgba(72, 187, 120, 0.6);
}

.matrix-line.success {
    color: #68d391;
}

.matrix-line.error {
    color: #fc8181;
}

.matrix-line.info {
    color: #f6e05e;
}

