:root {
    --primary: rgb(30, 75, 105);
    --accent: rgb(70, 180, 200);
    --light-bg: #f5f7fa;
    --border: #dde2e8;
    --text: #2c3e50;
    --text-light: #6c7a89;
    --control-color: #3498db;
    --variant-color: #27ae60;
    --warning-bg: #fef3e2;
    --warning-border: #f39c12;
    --success-bg: #e8f8ef;
    --success-border: #27ae60;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 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: 20px;
}

/* Sliders */
.controls {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 14px;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.slider-group label {
    font-size: 0.82rem;
    color: var(--text);
}

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

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

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

/* Estimate Box */
.estimate-box {
    background: #eef6fa;
    border: 1px solid #c4dce8;
    border-radius: var(--radius);
    padding: 10px 16px;
    font-size: 0.85rem;
    color: var(--primary);
    margin-bottom: 14px;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.btn {
    padding: 9px 22px;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.run-btn {
    background: var(--variant-color);
    color: white;
}

.stop-btn {
    background: var(--warning-border);
    color: white;
}

.reset-btn {
    background: white;
    color: var(--text);
    border: 2px solid var(--border);
}

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

#canvas-container canvas {
    display: block;
}

/* Stats Panel */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-light);
    font-weight: 600;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    font-family: "SF Mono", "Fira Code", monospace;
}

.stat-interpretation {
    grid-column: 1 / -1;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.5;
    background: var(--light-bg);
    color: var(--text);
    border-left: 3px solid var(--border);
    margin-top: 4px;
}

.stat-interpretation.significant {
    background: var(--success-bg);
    border-left-color: var(--success-border);
    color: #1a6b35;
}

.stat-interpretation.inconclusive {
    background: #f5f7fa;
    border-left-color: var(--text-light);
}

/* Warning Panel */
.warning-panel {
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    border-left: 4px solid var(--warning-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 12px;
}

.warning-panel h4 {
    color: #8a5a00;
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.warning-panel p {
    font-size: 0.85rem;
    color: #6b4400;
    line-height: 1.6;
}

/* Complete Panel */
.complete-panel {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    border-left: 4px solid var(--success-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 12px;
}

.complete-panel h4 {
    color: #1a6b35;
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.complete-panel p {
    font-size: 0.85rem;
    color: #1a5c2e;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 640px) {
    .controls {
        grid-template-columns: 1fr;
    }

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

    .button-group {
        flex-wrap: wrap;
    }
}
