:root {
    --bg-color: #1a1a2e;
    --primary-color: #e0e0e0;
    --secondary-color: #a0a0c0;
    --accent-color: #4CAF50;
    --accent-hover: #66bb6a;
    --border-color: #404060;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html, body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--primary-color);
    font-family: var(--font-family);
    line-height: 1.6;
    scroll-behavior: smooth;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    box-sizing: border-box;
}

header {
    text-align: center;
    padding-bottom: 1rem;
}

h1, h2, h3 {
    color: var(--primary-color);
    font-weight: 300;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.controls button, .controls select {
    background-color: var(--border-color);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    font-family: inherit;
    font-size: 0.9rem;
}

.controls button:hover, .controls select:hover {
    background-color: #505070;
}

.controls button:active {
    transform: scale(0.95);
}

.controls button.active {
    background-color: var(--accent-color);
    font-weight: bold;
}

.controls .demo-button {
    background-color: #a33e3e;
}
.controls .demo-button:hover {
    background-color: #c75656;
}
.controls .demo-button.active {
    background-color: #e57373;
}

.simulation-container {
    width: 100%;
    height: 80vh;
    position: relative;
    background-color: #101020;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#puzzle-canvas {
    width: 25%;
    height: auto;
    aspect-ratio: 4 / 5; /* Common aspect ratio for these puzzles */
    max-width: 200px;
    max-height: 250px;
    background-color: rgba(10, 10, 20, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin: 10px;
    pointer-events: none; /* Let clicks pass through to the graph canvas */
}

.info-section {
    padding: 2rem 1rem;
}

.info-section h2 {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

code {
    background-color: var(--border-color);
    padding: 2px 5px;
    border-radius: 3px;
}

a {
    color: var(--accent-color);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

.controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(16, 16, 32, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--primary-color);
    font-size: 1.2rem;
    z-index: 10;
}

.loading-overlay.hidden {
    display: none;
}

.error-message {
    background-color: #8b0000;
    color: white;
    padding: 1rem;
    border-radius: 5px;
    margin: 1rem 0;
    text-align: center;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 768px) {
    .app-container {
        padding: 0.5rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .controls button, .controls select {
        margin: 0.25rem 0;
    }
    
    #puzzle-canvas {
        width: 30%;
        max-width: 150px;
        max-height: 190px;
    }
}
