:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.9);
    --text: #1e293b;
    --text-muted: #64748b;
    --border: rgba(226, 232, 240, 0.8);
    --radius: 12px;
    --ocean: #e0f2fe;
    --mainland: #166534;
    --island: #15803d;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.8);
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: rgba(51, 65, 85, 0.5);
    --ocean: #1e293b;
    --mainland: #064e3b;
    --island: #065f46;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Header */
.simulation-header {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.sim-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.back-link {
    text-decoration: none;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge {
    background: var(--primary);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

/* Layout */
.sim-main {
    padding: 2rem 0;
}

.sim-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    .sim-layout {
        grid-template-columns: 1fr;
    }
}

/* Controls */
.controls-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 2rem;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: fit-content;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05);
}

.control-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

input[type="range"] {
    width: 100%;
    margin-bottom: 0.4rem;
    cursor: pointer;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn {
    flex: 1;
    padding: 0.75rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: 0.2s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }

.theory-box {
    margin-top: 1rem;
    padding: 1.25rem;
    background: rgba(37, 99, 235, 0.05);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.theory-box h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.theory-box p {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-muted);
}

/* Visualizer */
.visualizer {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.canvas-container {
    position: relative;
    width: 100%;
    height: 400px;
    background: var(--ocean);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
}

#simCanvas {
    width: 100%;
    height: 100%;
}

.mainland-label, .island-label {
    position: absolute;
    top: 10px;
    font-weight: 800;
    font-family: 'Outfit';
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    pointer-events: none;
}

.mainland-label { left: 20px; color: white; opacity: 0.8; }
.island-label { color: white; opacity: 0.9; text-shadow: 0 2px 4px rgba(0,0,0,0.2); }

.charts-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: var(--radius);
    height: 300px;
}
