@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&family=Inter:wght@300;400;500;600&display=swap');

:root {
    --primary-color: #961114;
    --secondary-color: #FFD700;
    --bg-dark: #070707;
    --bg-secondary: #1a1a1a;
    --text-color: #FCF7F8;
    --border-color: rgba(252, 247, 248, 0.1);
    
    --cell-default: #2a2a2a;
    --cell-wall: #865e7a;
    --cell-start: #00FF00;
    --cell-end: #FF0000;
    --cell-visited: #4A90E2;
    --cell-path: #FFD700;
    --cell-current: #FF6B6B;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-color);
    min-height: 100vh;
}

/* NAVBAR */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(7, 7, 7, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--primary-color);
    z-index: 1000;
}

.navbar-container {
    max-width: 1920px;
    height: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-family: 'Press Start 2P', monospace;
    font-size: 1.2rem;
    color: var(--primary-color);
}

.nav-btn {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* CONTAINER */
.container {
    margin-top: 90px;
    padding: 2rem;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    min-height: calc(100vh - 90px);
}

/* CONTROLS */
.controls-panel {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.control-group {
    margin-bottom: 2rem;
}

.control-group h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.action-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    border: none;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 0.75rem;
}

.action-btn:hover:not(:disabled) {
    background: #7a0d0f;
    transform: translateY(-2px);
}

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

.action-btn.secondary {
    background: var(--bg-dark);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.action-btn.secondary:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
}

.slider {
    width: 100%;
    height: 6px;
    background: rgba(150, 17, 20, 0.2);
    border-radius: 3px;
    outline: none;
    margin-bottom: 0.5rem;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    cursor: pointer;
    border-radius: 50%;
}

.slider-value {
    display: block;
    text-align: right;
    font-weight: 700;
    color: var(--secondary-color);
}

.stats-panel {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    opacity: 0.7;
}

.stat-value {
    font-weight: 700;
    color: var(--secondary-color);
}

/* GRID */
.grid-container {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.grid {
    display: grid;
    gap: 1px;
    background: #000;
    border: 2px solid var(--primary-color);
    width: fit-content;
    margin: 0 auto;
}

.cell {
    width: 30px;
    height: 30px;
    background: var(--cell-default);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.cell:hover:not(.start):not(.end) {
    background: rgba(150, 17, 20, 0.3);
}

.cell.wall {
    background: var(--cell-wall);
    border: 1px solid #fffafa;
}

.cell.start {
    background: var(--cell-start);
    box-shadow: 0 0 20px var(--cell-start);
}

.cell.start::after {
    content: 'S';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-weight: 900;
    font-size: 1.2rem;
}

.cell.end {
    background: var(--cell-end);
    box-shadow: 0 0 20px var(--cell-end);
}

.cell.end::after {
    content: 'E';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 900;
    font-size: 1.2rem;
}

.cell.visited {
    background: var(--cell-visited);
    animation: visitedPop 0.3s ease-out;
}

.cell.path {
    background: var(--cell-path);
    animation: pathPulse 0.5s ease-out;
    box-shadow: 0 0 15px var(--cell-path);
}

.cell.current {
    background: var(--cell-current);
    animation: currentBounce 0.4s ease-in-out;
    box-shadow: 0 0 20px var(--cell-current);
}

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

@keyframes pathPulse {
    0% {
transform: scale(0.5);
opacity: 0;
    }
    50% {
transform: scale(1.3);
    }
    100% {
transform: scale(1);
opacity: 1;
    }
}

@keyframes currentBounce {
    0%, 100% {
transform: scale(1);
    }
    50% {
transform: scale(1.4);
    }
}

.algo-info {
    background: rgba(150, 17, 20, 0.1);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    padding: 1.5rem;
}

.algo-info h3 {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.algo-info p {
    margin-bottom: 1rem;
    opacity: 0.9;
    line-height: 1.6;
}

/* LEGEND */
.legend {
    bottom: 20px;
    left: 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    z-index: 100;
}

.legend h4 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.color-box {
    width: 20px;
    height: 20px;
    border-radius: 3px;
}

.color-box.default { background: var(--cell-default); }
.color-box.wall { background: var(--cell-wall); border: 1px solid #333; }
.color-box.start { background: var(--cell-start); }
.color-box.end { background: var(--cell-end); }
.color-box.visited { background: var(--cell-visited); }
.color-box.path { background: var(--cell-path); }

/* RESPONSIVE */
@media (max-width: 1024px) {
    .container {
grid-template-columns: 1fr;
    }
    .controls-panel {
position: static;
    }
}

@media (max-width: 768px) {
    .navbar-container {
padding: 0 1rem;
    }
    .logo {
font-size: 0.9rem;
    }
    .container {
padding: 1rem;
margin-top: 80px;
    }
    .cell {
width: 20px;
height: 20px;
    }
    .legend {
bottom: 10px;
left: 10px;
padding: 0.75rem;
    }
}