:root {
    --bg: #faf9f7;
    --bg-card: #fff;
    --bg-code: #fafafa;
    --text: #37352f;
    --text-muted: #6b7280;
    --accent: #c45d4a;
    --accent-light: rgba(196, 93, 74, 0.1);
    --border: #e5e4e2;
    --success: #2ea043;
    --success-light: rgba(46, 160, 67, 0.1);
    --blue: #4a90e2;
    --blue-light: rgba(74, 144, 226, 0.1);
    --font-sans: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.7;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 740px; margin: 0 auto; padding: 60px 24px 100px; }

header { margin-bottom: 48px; padding-bottom: 32px; border-bottom: 1px solid var(--border); }

h1 { font-size: 32px; font-weight: 700; line-height: 1.2; margin-bottom: 12px; }
h2 { font-size: 22px; font-weight: 600; margin: 48px 0 16px; }
h3 { font-size: 17px; font-weight: 600; margin: 32px 0 12px; }
p { margin-bottom: 16px; }

.subtitle { font-size: 18px; color: var(--text-muted); }

.section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 8px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; }

.equation-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 24px;
    margin: 20px 0;
    text-align: center;
}

.equation-block.hero {
    background: linear-gradient(135deg, var(--accent-light) 0%, #fff 100%);
    border-color: var(--accent);
}

.equation-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    display: block;
}

.equation-explanation {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 12px;
    text-align: left;
}

.code-breakdown {
    background: var(--bg-code);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 20px 0;
    overflow: hidden;
}

.code-breakdown-header {
    background: #f5f4f2;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-breakdown-header .title { font-family: var(--font-mono); font-size: 13px; font-weight: 500; }
.code-breakdown-header .lang { font-size: 10px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); background: var(--bg); padding: 3px 8px; border-radius: 4px; }

.code-breakdown pre {
    margin: 0;
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 2;
    overflow-x: auto;
}

.code-breakdown .comment { color: #6b7280; font-style: italic; }
.code-breakdown .keyword { color: #9333ea; }
.code-breakdown .function { color: var(--accent); }
.code-breakdown .variable { color: #1e40af; }
.code-breakdown .number { color: #0891b2; }
.code-breakdown .string { color: #16a34a; }

.code-breakdown .highlight-line {
    display: inline-block;
    width: calc(100% + 40px);
    margin-left: -20px;
    padding-left: 17px;
    background: linear-gradient(90deg, var(--accent-light) 0%, transparent 100%);
    border-left: 3px solid var(--accent);
}

.visualization {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
}

.viz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.viz-title { font-weight: 600; font-size: 15px; }

.viz-canvas-container {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.viz-canvas-container canvas { display: block; width: 100%; height: auto; }

.viz-controls { display: flex; gap: 12px; align-items: center; margin-top: 16px; flex-wrap: wrap; }

.viz-stats {
    display: flex;
    gap: 24px;
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: 8px;
    flex-wrap: wrap;
}

.stat-item { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.stat-label { color: var(--text-muted); }
.stat-value { font-family: var(--font-mono); font-weight: 500; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-line { width: 16px; height: 3px; border-radius: 2px; }

.slider-container { display: flex; align-items: center; gap: 12px; }
.slider-label { font-size: 14px; color: var(--text-muted); }

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

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.parameter-display {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent);
    background: var(--accent-light);
    padding: 4px 10px;
    border-radius: 4px;
    min-width: 50px;
    text-align: center;
}

button {
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s ease;
}

button:hover { background: var(--bg); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.success { background: var(--accent); color: white; border-color: var(--accent); }
button.success:hover { background: #b54d3a; }
button.secondary { background: transparent; }
button.active { background: var(--accent); color: white; border-color: var(--accent); }

.toggle-group {
    display: flex;
    background: var(--bg);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid var(--border);
}

.toggle-group button {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 6px;
}

.toggle-group button.active {
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    color: var(--text);
}

select {
    font-family: var(--font-sans);
    font-size: 14px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    cursor: pointer;
}

.progress-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); transition: width 0.1s ease; }

.callout { padding: 16px 20px; border-radius: 8px; margin: 20px 0; font-size: 15px; }
.callout p { margin: 0; }
.callout-title { font-weight: 600; margin-bottom: 6px; }
.callout.blue { background: var(--blue-light); border-left: 3px solid var(--blue); }
.callout.accent { background: var(--accent-light); border-left: 3px solid var(--accent); }
.callout.success { background: var(--success-light); border-left: 3px solid var(--success); }

.divider { height: 1px; background: var(--border); margin: 48px 0; }

footer { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); font-size: 14px; color: var(--text-muted); }

.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 120px; padding: 16px; background: var(--bg); border-radius: 8px; margin: 16px 0; }
.bar { flex: 1; background: var(--accent); border-radius: 4px 4px 0 0; position: relative; transition: height 0.3s ease; min-width: 30px; }
.bar-label { position: absolute; bottom: -24px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.bar-value { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 11px; font-family: var(--font-mono); }

.param-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 20px 0; }
.param-card { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 16px; text-align: center; }
.param-symbol { font-family: var(--font-mono); font-size: 18px; color: var(--accent); margin-bottom: 4px; }
.param-desc { font-size: 13px; color: var(--text-muted); }

@media (max-width: 768px) {
    .container { padding: 40px 16px 60px; }
    h1 { font-size: 26px; }
    .viz-controls { flex-direction: column; align-items: stretch; }
}
