* {
    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: #333;
    overflow: hidden;
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    color: #4a5568;
    font-size: 1.5rem;
}

.controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.controls button {
    background: #4299e1;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.controls button:hover {
    background: #3182ce;
}

.controls button.paused {
    background: #f56565;
}

.controls input[type="range"] {
    width: 120px;
}

main {
    flex: 1;
    display: flex;
    gap: 1rem;
    padding: 1rem;
    max-height: calc(100vh - 120px);
}

.simulation-area {
    flex: 1;
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

#simulationCanvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.error-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(245, 101, 101, 0.9);
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
}

.substance-panel {
    width: 250px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
}

.substance-panel h3 {
    margin-bottom: 1rem;
    color: #4a5568;
}

.substance-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.substance-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.substance-item:hover {
    background: rgba(66, 153, 225, 0.1);
}

.substance-item.selected {
    background: rgba(66, 153, 225, 0.2);
    border: 2px solid #4299e1;
}

.color-box {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.brush-controls {
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
}

.brush-controls label {
    display: block;
    margin-bottom: 0.5rem;
    color: #4a5568;
}

.brush-controls input[type="range"] {
    width: 100%;
    margin-bottom: 0.5rem;
}

.info-panel {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    min-width: 200px;
}

.info-panel h3 {
    margin-bottom: 0.5rem;
    color: #4a5568;
    font-size: 0.9rem;
}

.stats {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8rem;
}

.stats span {
    font-weight: bold;
    color: #2d3748;
}

span {
    color: #2d3748;
}

@media (max-width: 768px) {
    main {
        flex-direction: column;
    }

    .substance-panel {
        width: 100%;
        order: 2;
    }

    .info-panel {
        position: static;
        margin-top: 1rem;
    }
}