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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 20px;
    gap: 20px;
}

@media (min-width: 1000px) {
    .container {
        flex-direction: row;
    }
}

.info-panel {
    background: #16213e;
    padding: 20px;
    border-radius: 10px;
    min-width: 280px;
    max-width: 320px;
    overflow-y: auto;
    max-height: calc(100vh - 40px);
}

@media (min-width: 1000px) {
    .info-panel {
        flex-shrink: 0;
    }
}

.info-panel h1 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: #e94560;
}

.description {
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 20px;
    line-height: 1.5;
}

.controls {
    background: #0f3460;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.control-group {
    margin-bottom: 15px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: #aaa;
}

.button-group {
    display: flex;
    gap: 10px;
}

.button-group button {
    flex: 1;
    padding: 8px 16px;
    border: 2px solid #0f3460;
    background: #1a1a2e;
    color: #aaa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    margin: 0;
    width: auto;
}

.button-group button.active {
    background: #e94560;
    color: white;
    border-color: #e94560;
}

.button-group button:hover:not(.active) {
    border-color: #e94560;
    color: #e94560;
}

.stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.stat-box {
    padding: 10px 12px;
    border-radius: 8px;
    background: #0f3460;
}

.ideal-stat {
    border-left: 4px solid #4ade80;
}

.polar-stat {
    border-left: 4px solid #e94560;
}

.rejection-stat {
    border-left: 4px solid #00d9ff;
}

.sine-stat {
    border-left: 4px solid #a855f7;
}

.sine-square-stat {
    border-left: 4px solid #ff69b4;
}

.walk-stat {
    border-left: 4px solid #f97316;
}

.stat-box h3 {
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: #fff;
}

.stat-box p {
    font-size: 0.8rem;
    margin: 3px 0;
    font-family: 'Monaco', 'Consolas', monospace;
}

.uniformity {
    font-weight: bold;
    font-size: 0.9rem !important;
}

.uniformity span {
    font-size: 1rem;
}

.formula {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #1a1a2e;
    color: #ffd700;
    font-size: 0.75rem !important;
}

button {
    width: 100%;
    padding: 12px 20px;
    margin-top: 10px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
}

button:hover {
    transform: scale(1.02);
}

button:active {
    transform: scale(0.98);
}

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

#startBtn {
    background: #e94560;
    color: white;
}

#startBtn:hover:not(:disabled) {
    background: #ff6b6b;
}

#resetBtn {
    background: #0f3460;
    color: #aaa;
    border: 2px solid #0f3460;
}

#resetBtn:hover:not(:disabled) {
    background: #16213e;
    border-color: #e94560;
    color: #e94560;
}

.canvas-container {
    flex: 1;
    display: flex;
    flex-direction: row;
    gap: 15px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    align-content: center;
}

@media (min-width: 1600px) {
    .canvas-container {
        flex-wrap: nowrap;
    }
}

.canvas-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.canvas-wrapper h3 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 1rem;
    color: #aaa;
}

.canvas-wrapper:nth-child(1) h3 {
    color: #4ade80;
}

.canvas-wrapper:nth-child(2) h3 {
    color: #e94560;
}

.canvas-wrapper:nth-child(3) h3 {
    color: #00d9ff;
}

.canvas-wrapper:nth-child(4) h3 {
    color: #a855f7;
}

.canvas-wrapper:nth-child(5) h3 {
    color: #ff69b4;
}

.canvas-wrapper:nth-child(6) h3 {
    color: #f97316;
}

canvas {
    background: #0f0f23;
    border-radius: 10px;
    aspect-ratio: 1;
}

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 0;
    background: #e94560;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle:hover {
    background: #ff6b6b;
    transform: scale(1.05);
}

@media (max-width: 999px) {
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .info-panel {
        position: fixed;
        top: 0;
        left: 0;
        width: 320px;
        max-width: 85vw;
        height: 100vh;
        max-height: 100vh;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        border-radius: 0;
        padding-top: 60px;
    }

    .info-panel.open {
        transform: translateX(0);
    }

    .container {
        padding: 10px;
        padding-top: 60px;
    }

    .canvas-container {
        width: 100%;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }

    .sidebar-overlay.open {
        display: block;
    }
}
