:root {
    --primary: rgb(30, 75, 105);
    --accent: rgb(70, 180, 200);
    --light-bg: #f5f7fa;
    --border: #dde2e8;
    --text: #2c3e50;
    --text-light: #6c7a89;
    --vertical-color: #f59e0b;
    --horizontal-color: #3b82f6;
    --danger-color: #ef4444;
    --success-color: #22c55e;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--light-bg);
    color: var(--text);
    line-height: 1.5;
}

.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 24px 20px;
}

h2 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* Controls */
.controls-row {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
    align-items: stretch;
}

.slider-group {
    flex: 1;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
}

.slider-group label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.slider-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary);
}

.slider-value {
    font-size: 0.82rem;
    color: var(--accent);
    font-weight: 600;
}

.slider-group input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.slider-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.slider-range {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-light);
    margin-top: 4px;
}

/* Strategy Toggle */
.strategy-toggle {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 200px;
}

.toggle-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.toggle-buttons {
    display: flex;
    gap: 0;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid var(--border);
}

.toggle-btn {
    flex: 1;
    padding: 8px 14px;
    border: none;
    background: white;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-light);
}

.toggle-btn:first-child {
    border-right: 1px solid var(--border);
}

.toggle-btn.active[id="btn-vertical"] {
    background: var(--vertical-color);
    color: white;
}

.toggle-btn.active[id="btn-horizontal"] {
    background: var(--horizontal-color);
    color: white;
}

.toggle-btn:hover:not(.active) {
    background: var(--light-bg);
}

/* Canvas */
#canvas-container {
    margin-bottom: 14px;
    border-radius: var(--radius);
    overflow: hidden;
}

#canvas-container canvas {
    display: block;
}

/* Metrics */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.metric-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    box-shadow: var(--shadow);
}

.metric-icon {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.metric-label {
    font-size: 0.72rem;
    color: var(--text-light);
    margin-bottom: 4px;
}

.metric-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    font-family: 'SF Mono', 'Fira Code', monospace;
    transition: color 0.3s;
}

.metric-value.danger {
    color: var(--danger-color);
}

.metric-value.warning {
    color: var(--vertical-color);
}

.metric-value.good {
    color: var(--success-color);
}

/* Insight Panel */
.insight-panel {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
}

.insight-panel h4 {
    color: var(--primary);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.insight-panel p {
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 600px) {
    .controls-row {
        flex-direction: column;
    }

    .strategy-toggle {
        min-width: auto;
    }

    .metrics-row {
        grid-template-columns: repeat(2, 1fr);
    }
}
