:root { color-scheme: light; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #17233a; background: #f4f7fc; }
* { box-sizing: border-box; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
body { margin: 0; font-size: 16px; line-height: 1.5; }
.app-shell { max-width: 1600px; padding: 32px 38px 18px; margin: auto; }
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 28px; }
.title-group { display: flex; gap: 18px; align-items: center; }
.step-number { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 14px; background: #172c55; color: white; font-weight: 600; }
.eyebrow { font-size: 12px; font-weight: 650; letter-spacing: .13em; color: #64748b; margin: 0 0 4px; }
h1 { font-size: clamp(24px, 2.3vw, 34px); font-weight: 650; letter-spacing: -.035em; line-height: 1.2; margin: 0; }
.header-note { color: #64748b; font-size: 14px; margin: 0; }
.dashboard { display: grid; grid-template-columns: 292px minmax(0, 1fr); gap: 24px; align-items: start; }
.controls { background: white; border: 1px solid #e2e8f0; border-radius: 16px; padding: 22px; }
.control-section { border-bottom: 1px solid #e9edf5; margin-bottom: 20px; padding-bottom: 20px; }
.last-section { border: 0; margin: 0; padding: 0; }
h2 { font-size: 16px; font-weight: 650; margin: 0 0 14px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.field-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 8px; }
.hint { font-size: 13px; color: #64748b; margin: 12px 0 0; line-height: 1.6; }
.radio-list label, .check-list label { display: flex !important; align-items: start; gap: 8px; font-size: 14px; margin: 10px 0; }
input[type="checkbox"], input[type="radio"] { accent-color: #2563eb; margin-top: 4px; flex-shrink: 0; }
.matrix-block { margin-top: 20px; }
.matrix-determinant { margin-top: 16px; font-size: 20px; font-weight: 550; font-variant-numeric: tabular-nums; }
.matrix-editor { display: flex; gap: 14px; align-items: center; }
.matrix-symbol { font-size: 22px; white-space: nowrap; }
.matrix-grid { display: grid; flex: 1; min-width: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; border-left: 2px solid #94a3b8; border-right: 2px solid #94a3b8; padding: 8px; }
.matrix-input { width: 100%; min-width: 0; padding: 9px 3px; border: 1px solid #cbd5e1; border-radius: 6px; background: #f8fafc; font-size: 16px; text-align: center; color: #17233a; font-variant-numeric: tabular-nums; }
.matrix-input:disabled { color: #475569; background: #eef2f7; }
.matrix-input:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.matrix-input.dash-input-container { padding: 0; height: 44px; }
.matrix-input .dash-input-element { width: 100%; min-width: 0; padding: 8px 3px; height: 100%; border: 0; background: transparent; font-size: 16px; text-align: center; color: #17233a; }
.matrix-input .dash-input-stepper { display: none; }
.parameter-group { margin-top: 20px; }
.parameter-group .field-label { margin-top: 20px; }
.parameter-group .hint { margin-top: 24px; }
.error { color: #b91c1c; font-size: 13px; margin-top: 8px; }
.workspace { min-width: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; align-items: center; margin: 0 2px 12px; }
.legend-a { color: #2563eb; } .legend-b { color: #c2410c; } .legend-c { color: #7c3aed; }
.scale-note { color: #64748b; margin-left: auto; }
.plots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.plot-panel { min-width: 0; background: white; border: 1px solid #e2e8f0; border-radius: 14px; overflow: hidden; }
.plot-heading { display: flex; align-items: baseline; justify-content: space-between; padding: 18px 22px 4px; }
.plot-heading h2 { font-size: 18px; margin: 0; }
.plot-subtitle { font-size: 14px; color: #64748b; }
.graph-frame { height: 460px; }
.click-hint { font-size: 13px; color: #64748b; text-align: center; margin: 12px 0 16px; }
.point-detail { background: #eaf1fc; border: 1px solid #d8e4f9; border-radius: 12px; padding: 16px 20px; }
.point-row { display: flex; gap: 20px; align-items: center; }
.point-tag { font-size: 13px; font-weight: 600; white-space: nowrap; padding: 6px 10px; border-radius: 6px; background: #d7e4fa; color: #25426e; }
.point-calculation { font-size: 14px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.point-calculation strong { display: block; font-size: 16px; font-weight: 550; margin-bottom: 6px; }
.insights { display: grid; grid-template-columns: minmax(170px, .8fr) minmax(0, 1.4fr); gap: 24px; padding: 24px 4px 0; }
.det-value { font-size: 22px; font-weight: 550; font-variant-numeric: tabular-nums; }
.reading-panel p { font-size: 14px; margin: 0; line-height: 1.7; }
.reading-panel .hint { font-size: 13px; margin-top: 12px; }
.basis-first { color: #0f766e; } .basis-second { color: #be185d; }
footer { color: #64748b; font-size: 12px; margin-top: 28px; text-align: center; }
.page-nav { max-width: 1600px; margin: 0 auto; padding: 18px 38px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.page-link { font-size: 14px; color: #52647f; text-decoration: none; padding: 10px 16px; border-radius: 8px; }
.page-link:hover { background: #e8eef8; }
.page-link.active { background: #172c55; color: white; }
.coordinate-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.coordinate-fields > div { min-width: 0; }
.vector-input { width: 100%; min-width: 0; border: 1px solid #cbd5e1; border-radius: 6px; padding: 8px; font-size: 16px; color: #17233a; background: #f8fafc; }
.vector-input.dash-input-container { height: 44px; padding: 0; }
.vector-input .dash-input-element { width: 100%; min-width: 0; height: 100%; padding: 8px; border: 0; background: transparent; color: #17233a; font-size: 16px; }
.vector-input .dash-input-stepper { display: none; }
.vector-color { color: #2563eb; } .direction-color { color: #be185d; }
.projection-color { color: #0f766e; } .residual-color { color: #c2410c; }
.example-section { padding-top: 22px; }
.example-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.example-button { border: 1px solid #d8e1ee; background: #f1f5fb; border-radius: 6px; font: inherit; font-size: 13px; padding: 8px 10px; color: #25426e; cursor: pointer; }
.example-button:hover { background: #dce8fb; }
.projection-top { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 18px; }
.projection-graph-frame { height: 530px; }
#projection-graph .shapelayer .shape-group path { pointer-events: all !important; cursor: grab; stroke-width: 10px !important; stroke-opacity: .25 !important; touch-action: none; }
#projection-graph.is-dragging, #projection-graph.is-dragging .shapelayer .shape-group path { cursor: grabbing; touch-action: none; }
#diag-graph-0 .shapelayer .shape-group path { pointer-events: all !important; cursor: grab; stroke-width: 14px !important; stroke-opacity: .2 !important; touch-action: none; }
#diag-graph-0.is-dragging, #diag-graph-0.is-dragging .shapelayer .shape-group path { cursor: grabbing; touch-action: none; }
.projection-stats { display: flex; flex-direction: column; gap: 16px; }
.projection-stat { padding: 20px 18px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; }
.projection-stat strong { display: block; font-size: 27px; font-weight: 550; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.projection-stat .eyebrow { font-size: 11px; letter-spacing: .07em; }
.projection-stat .hint { margin-top: 6px; }
.projection-calculations { padding: 20px 24px; border: 1px solid #d8e4f9; border-radius: 12px; background: #eaf1fc; margin-top: 20px; font-variant-numeric: tabular-nums; }
.projection-calculations p { font-size: 14px; margin: 8px 0; overflow-wrap: anywhere; }
.projection-calculations h3 { margin-bottom: 16px; }
.orthogonality { font-weight: 600; }
.unit-explanation { margin: 16px 0; padding: 14px 16px; background: #d9ece8; border-left: 3px solid #0f766e; border-radius: 4px; }
.unit-explanation h3 { color: #0f766e; }
.eigen-definition { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.eigen-definition strong { font-size: 26px; font-weight: 550; }
.eigen-definition span { font-size: 15px; color: #475569; }
.eigen-example-detail { font-size: 14px; color: #475569; margin: 0 0 18px; }
.eigen-graph-frame { height: 530px; }
.eigen-probe-detail { margin-top: 16px; font-size: 14px; }
.eigen-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.eigen-result { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 18px; }
.eigen-result p { font-size: 14px; overflow-wrap: anywhere; margin: 8px 0; }
.eigen-result .hint { font-size: 12px; }
.eigen-special { grid-column: 1 / -1; margin: 0; font-size: 14px; }
.eigen-effect { font-weight: 550; }
.diag-fields { margin-top: 20px; }
.diag-field { margin: 12px 0; }
.diag-basis p { margin: 5px 0; font-size: 14px; }
.diag-factorization { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin: 20px 0; }
.diag-matrix-row { display: flex; align-items: center; gap: 10px; }
.diag-matrix-row .matrix-symbol { font-size: 17px; }
.diag-matrix-values { display: grid; grid-template-columns: repeat(2, minmax(45px, auto)); gap: 6px 14px; padding: 5px 10px; border-left: 2px solid #94a3b8; border-right: 2px solid #94a3b8; font-size: 14px; text-align: center; font-variant-numeric: tabular-nums; }
.diag-order { font-size: 14px; margin: 0 0 18px; }
.diag-stages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.diag-stage-heading { padding: 18px 18px 0; }
.diag-stage-heading h2 { margin-bottom: 6px; }
.diag-stage-heading .hint { min-height: 42px; margin-top: 0; }
.diag-operation { padding: 14px 18px 0; }
.diag-graph-frame { height: 330px; }
.diag-vector { padding: 0 18px 16px; font-size: 15px; font-weight: 550; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .diag-factorization { gap: 14px; } }
@media (max-width: 850px) { .diag-stages { grid-template-columns: 1fr; } .diag-graph-frame { height: 340px; } }
@media (max-width: 600px) { .diag-matrix-values { gap: 4px 10px; } }
@media (max-width: 850px) { .eigen-results { grid-template-columns: 1fr; } .eigen-graph-frame { height: 420px; } }
@media (max-width: 600px) { .eigen-graph-frame { height: 360px; } }
.projection-matrix-detail { margin-top: 22px; }
.projection-matrix-detail p { font-size: 14px; color: #475569; }
.projection-matrix-row { display: flex; gap: 16px; align-items: center; font-size: 18px; }
.projection-matrix { display: grid; grid-template-columns: repeat(2, 90px); gap: 8px 18px; border-left: 2px solid #94a3b8; border-right: 2px solid #94a3b8; padding: 8px 18px; text-align: center; font-variant-numeric: tabular-nums; }
@media (max-width: 1100px) { .page-nav { padding-left: 24px; padding-right: 24px; } .projection-top { grid-template-columns: 1fr; } .projection-stats { flex-direction: row; } .projection-stat { flex: 1; min-width: 0; padding: 14px 10px; } .projection-stat strong { font-size: 22px; } .projection-graph-frame { height: 440px; } }
@media (max-width: 850px) { .projection-stats { flex-direction: column; } .projection-stat { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center; } .projection-stat .hint { grid-column: 1 / -1; } }
@media (max-width: 600px) { .page-nav { padding: 12px 12px 0; } .page-link { padding: 9px 10px; font-size: 13px; } .projection-graph-frame { height: 360px; } .projection-calculations { padding: 16px; } }
@media (min-width: 1450px) { .graph-frame { height: 520px; } }
@media (max-width: 1100px) { .app-shell { padding: 24px; } .dashboard { grid-template-columns: 265px minmax(0, 1fr); gap: 18px; } .controls { padding: 18px; } .graph-frame { height: 380px; } .header-note { display: none; } .scale-note { margin-left: 0; } }
@media (max-width: 850px) { .plots { grid-template-columns: 1fr; } .graph-frame { height: 400px; } .insights { grid-template-columns: 1fr; gap: 20px; } .point-row { align-items: start; flex-direction: column; gap: 10px; } }
@media (max-width: 600px) { .app-shell { padding: 18px 12px; } .dashboard { grid-template-columns: 1fr; } .title-group { gap: 12px; } .controls { padding: 20px; } .matrix-grid { max-width: 210px; } .graph-frame { height: 360px; } .point-detail { padding: 16px; } }

/* Dash wraps number inputs: style the disabled inner field as well. */
.diag-fields .matrix-input:has(input:disabled) { background: #e2e8f0; border-color: #cbd5e1; }
.diag-fields .matrix-input input:disabled { color: #64748b; cursor: not-allowed; opacity: 1; -webkit-text-fill-color: #64748b; }

.eigen-matrix-editor .matrix-input:has(input:disabled) { background: #e2e8f0; border-color: #cbd5e1; }
.eigen-matrix-editor .matrix-input input:disabled { color: #64748b; cursor: not-allowed; opacity: 1; -webkit-text-fill-color: #64748b; }

.eigen-calculated-input.dash-input-container { width: 100%; height: 42px; padding: 0; border: 1px solid #cbd5e1; border-radius: 6px; background: #e2e8f0; }
.eigen-calculated-input .dash-input-element, input.eigen-calculated-input { width: 100%; height: 42px; padding: 8px; border: 0; border-radius: 6px; background: #e2e8f0; color: #475569; -webkit-text-fill-color: #475569; opacity: 1; text-align: center; font-size: 16px; font-variant-numeric: tabular-nums; cursor: not-allowed; }
.eigen-calculated-field { min-width: 0; }
.eigen-calculated-field .field-label { margin: 8px 0 5px; }
.eigen-vector-output { display: flex; align-items: center; gap: 12px; margin: 10px 0 16px; }
.eigen-vector-values { display: grid; gap: 6px; padding: 6px 10px; border-left: 2px solid #94a3b8; border-right: 2px solid #94a3b8; width: 130px; }
.eigen-vector-values label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.eigen-complex-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.eigen-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.eigen-comparison-frame { height: 410px; }
.eigen-plot-title { padding: 18px 18px 0; font-size: 16px; }
@media (max-width: 700px) { .eigen-comparison { grid-template-columns: 1fr; } }

.diag-inverse { padding: 18px; margin-bottom: 20px; background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 12px; }
.diag-inverse h2 { font-size: 18px; margin-top: 0; }
.diag-inverse p { font-size: 14px; }
.diag-roundtrip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-top: 12px; }
.diag-roundtrip-vector { display: grid; gap: 8px; }
.diag-roundtrip-vector .diag-matrix-values { grid-template-columns: 1fr; background: #e2e8f0; border-radius: 4px; }
.diag-roundtrip-actions { display: grid; gap: 10px; }
.diag-roundtrip-step { display: flex; align-items: center; gap: 16px; }
.diag-direction-arrow { font-size: 28px; font-weight: 600; color: #172c55; }
.diag-return-step .diag-direction-arrow, .diag-return-result { color: #0f766e; }
.diag-return-result { font-weight: 600; }

/* A consistent learning hierarchy: manipulate, observe, then explain. */
:root { background: #f5f6f8; color: #1e293b; }
.app-shell { max-width: 1440px; padding: 24px 28px; }
.page-nav { max-width: 1440px; padding: 18px 28px 0; gap: 6px; }
.page-link { background: #e9edf2; font-size: 13px; padding: 9px 14px; border-radius: 24px; white-space: nowrap; }
.page-link.active { background: #172c55; box-shadow: 0 3px 10px #172c5517; }
.page-header { margin-bottom: 22px; }
h1 { font-size: clamp(23px, 2.3vw, 31px); }
.step-number { width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0; }
.dashboard { grid-template-columns: 270px minmax(0, 1fr); gap: 20px; }
.controls { padding: 20px; border: 1px solid #dce2ea; box-shadow: 0 2px 8px #172c5504; }
.controls h2 { margin-bottom: 12px; font-size: 14px; }
.controls .hint { font-size: 12px; }
.controls .example-section { padding-top: 18px; }
.control-section { padding-bottom: 16px; margin-bottom: 16px; }
.input-key { font-size: 11px !important; letter-spacing: .01em; }
.learning-prompt { margin: 0 0 16px; padding: 16px 20px; background: #eaf3f2; border-left: 3px solid #0f766e; border-radius: 0 10px 10px 0; }
.learning-label { display: block; color: #0f766e; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 5px; }
.learning-prompt strong { font-size: 16px; font-weight: 600; }
.learning-prompt p { margin: 5px 0 0; font-size: 13px; color: #526577; line-height: 1.55; }
.disclosure { border: 1px solid #dce2ea; border-radius: 10px; margin-top: 14px; background: #fff; overflow: hidden; }
.disclosure summary { cursor: pointer; padding: 14px 18px; font-size: 14px; font-weight: 600; color: #334155; list-style: none; display: flex; align-items: center; gap: 12px; }
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::before { content: '+'; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: #eef2f6; color: #475569; font-size: 18px; flex-shrink: 0; }
.disclosure[open] > summary::before { content: '−'; }
.disclosure[open] > summary { border-bottom: 1px solid #e9edf2; }
.disclosure summary:hover { background: #f8fafc; }
.disclosure summary:focus-visible { outline: 2px solid #0f766e; outline-offset: -3px; }
.disclosure-content { padding: 18px; }
.disclosure-content > .hint:first-child { margin-top: 0; }
.disclosure.compact summary { padding: 10px 12px; font-size: 12px; }
.disclosure.compact .disclosure-content { padding: 12px; }
.disclosure-content .projection-calculations, .disclosure-content .diag-inverse { margin: 0; padding: 0; border: 0; background: transparent; }
.disclosure-content .projection-matrix-detail { margin-top: 0; }
.insights { gap: 16px; padding-top: 18px; align-items: start; }
.insights .disclosure { margin-top: 0; }
.det-panel { background: #fff; border: 1px solid #dce2ea; padding: 18px; border-radius: 10px; }
.matrix-determinant { font-size: 18px; }
.plot-panel { border-color: #dce2ea; border-radius: 12px; }
.graph-frame { height: 410px; }
.eigen-comparison-frame { height: 370px; }
.eigen-definition { padding: 0 2px; margin-bottom: 12px; gap: 12px; }
.eigen-definition strong { font-size: 23px; }
.eigen-definition span { font-size: 13px; }
.eigen-result { padding: 16px; }
.eigen-result h3 { font-size: 15px; }
.eigen-result .hint { margin-top: 0; }
.eigen-result .eigen-effect { font-size: 13px; font-weight: 500; }
.eigen-calculated-input input:disabled { opacity: 1; color: #475569; -webkit-text-fill-color: #475569; }
.diag-stage-heading h2 { font-size: 15px; }
.diag-stage-heading .hint { font-size: 12px; min-height: 38px; }
.diag-operation { padding-top: 10px; }
.diag-graph-frame { height: 270px; }
.diag-vector { font-size: 13px; padding-bottom: 14px; }
.legend { font-size: 12px; gap: 12px; }
.projection-top { grid-template-columns: minmax(0, 1fr); }
.projection-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.projection-stat { padding: 14px; }
.projection-stat strong { font-size: 24px; }
.projection-graph-frame { height: 410px; }
footer { margin-top: 24px; }
@media (max-width: 1100px) {
 .app-shell { padding: 22px; } .page-nav { padding-left: 22px; padding-right: 22px; }
 .dashboard { grid-template-columns: 235px minmax(0, 1fr); gap: 16px; }
 .controls { padding: 16px; } .graph-frame, .eigen-comparison-frame { height: 330px; }
 .diag-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
 .diag-graph-frame { height: 250px; }
 .eigen-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
 .app-shell { padding: 18px 14px; } .page-nav { padding: 12px 14px 0; display: grid; grid-template-columns: 1fr 1fr; }
 .page-link { padding: 9px 10px; text-align: center; font-size: 12px; }
 .dashboard { grid-template-columns: 1fr; }
 .controls { padding: 16px; }
 .plots, .eigen-comparison, .diag-stages { grid-template-columns: 1fr; }
 .projection-stats { gap: 8px; }
 .projection-stat { display: block; padding: 12px 8px; }
 .projection-stat strong { font-size: 19px; } .projection-stat .hint { font-size: 11px; }
 .projection-stat .eyebrow { font-size: 9px; }
 .graph-frame, .eigen-comparison-frame, .projection-graph-frame { height: 350px; }
 .eigen-results { grid-template-columns: 1fr; }
 .diag-graph-frame { height: 300px; }
 .learning-prompt { padding: 14px; } .learning-prompt strong { font-size: 15px; }
 .diag-roundtrip { display: grid; grid-template-columns: 1fr 1fr; }
 .diag-roundtrip-vector:first-child { grid-row: 1; grid-column: 1; }
 .diag-roundtrip-vector:last-child { grid-row: 1; grid-column: 2; }
 .diag-roundtrip-actions { grid-row: 2; grid-column: 1 / -1; }
 .diag-roundtrip-step { justify-content: center; }
}
