.sphere-demo .wrap { width: min(1260px, calc(100% - 48px)); }
.demo-heading { max-width: 850px; padding-bottom: 32px; }
.back-link { display: inline-block; color: var(--muted); font-size: 13px; margin: 22px 0 27px; text-decoration: underline; text-underline-offset: 4px; }
.demo-heading .project-kicker { margin-bottom: 16px; }
.demo-heading h1 { font-size: clamp(32px, 4.2vw, 48px); margin-bottom: 20px; }
.demo-intro { max-width: 730px; margin: 0; color: #4b5563; font-size: 16px; line-height: 1.8; }
.simulator { display: grid; grid-template-columns: minmax(0, 1fr) 310px; border: 1px solid var(--line); background: var(--card); }
.scene-panel { min-width: 0; display: flex; flex-direction: column; }
.scene-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 20px 24px; font-size: 12px; color: #5d655f; border-bottom: 1px solid var(--line); }
.scene-top > span { font-size: 15px; }
.scene-top b { font-weight: 500; margin-left: 16px; color: var(--ink); }
.scene-top button { border: 0; background: none; font: inherit; color: #805018; cursor: pointer; padding: 5px 0; }
#scene { display: block; width: 100%; height: auto; flex: 1; min-height: 0; overflow: hidden; }
#scene text { font-family: ui-sans-serif, system-ui, sans-serif; }
#scene .axis-label { font-size: 15px; fill: #6b706b; }
#scene .tick-label { font-size: 12px; fill: #81847d; }
#scene .origin-label { font-size: 15px; fill: #58626d; }
#scene .point-label { font-size: 19px; font-weight: 600; fill: #1d6681; paint-order: stroke; stroke: #fffdf9; stroke-width: 5px; stroke-linejoin: round; }
#scene .camera-label { font-size: 17px; font-weight: 600; fill: #333e47; paint-order: stroke; stroke: #fffdf9; stroke-width: 5px; }
#scene .solution-label { font-size: 15px; font-weight: 700; paint-order: stroke; stroke: #fffdf9; stroke-width: 4px; }
#point-handle, #camera { cursor: grab; touch-action: none; outline: none; }
#point-handle:active, #camera:active { cursor: grabbing; }
#point-handle:focus-visible #point-halo { opacity: .3; stroke: #1d6681; stroke-width: 2; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 24px; border-top: 1px solid var(--line); padding: 17px 24px; color: #5c656e; font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 9px; }
.legend-line { width: 22px; border-top: 2px solid #a36220; }
.legend-line.candidates { border-top: 2px dashed #7c8a8d; }
.control-panel { border-left: 1px solid var(--line); padding: 25px 24px; }
.panel-kicker { color: #805018; text-transform: uppercase; letter-spacing: .13em; font-size: 10px; font-weight: 700; }
.panel-heading h2 { font: 400 28px/1.2 Georgia, serif; margin: 8px 0 10px; letter-spacing: -.025em; }
.panel-heading p { font-size: 12px; color: #65707a; line-height: 1.6; margin: 0; }
.coordinate-readout { display: flex; align-items: center; justify-content: space-between; padding: 15px 0; margin: 9px 0 5px; border-bottom: 1px solid var(--line); color: #1d6681; }
.coordinate-readout > span { font-weight: 700; }
.coordinate-readout output { font-size: 17px; font-variant-numeric: tabular-nums; }
.slider-label { display: flex; justify-content: space-between; margin-top: 16px; font-size: 12px; }
.slider-label output { font-variant-numeric: tabular-nums; color: #57616c; }
.control-panel input[type=range] { width: 100%; margin: 9px 0 0; accent-color: #805018; cursor: pointer; }
.camera-position { margin: 8px 0 23px; font-size: 11px; color: #65707a; }
.solution-heading { display: flex; align-items: baseline; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 18px; }
.solution-heading h3 { font-size: 14px; margin: 0; font-weight: 600; }
#root-count { font-size: 11px; color: #805018; }
.solution-help { font-size: 11px; color: #65707a; margin: 4px 0 12px; }
.solution-row { width: 100%; display: grid; grid-template-columns: 24px 1fr; gap: 9px; text-align: left; padding: 10px 8px; border: 1px solid transparent; background: transparent; cursor: pointer; font: inherit; color: var(--ink); }
.solution-row:hover { background: #f6f3ed; }
.solution-row[aria-pressed=true] { border-color: #b7b9ae; background: #f4f1ea; }
.solution-number { width: 22px; height: 22px; display: grid; place-items: center; color: white; border-radius: 50%; font-size: 11px; font-weight: 700; }
.solution-coordinate { display: block; font-size: 12px; font-variant-numeric: tabular-nums; }
.solution-status { display: block; font-size: 10px; color: #65707a; margin-top: 2px; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 11px; margin-top: 16px; cursor: pointer; }
.toggle input { accent-color: #805018; }
.valid-note { font-size: 11px; line-height: 1.6; color: #805018; margin: 12px 0 0; }
.equation-section { display: grid; grid-template-columns: 310px 1fr; gap: 40px; padding: 35px 0 25px; }
.equation-section h2 { font: 400 28px/1.25 Georgia, serif; margin: 8px 0 12px; letter-spacing: -.025em; }
.equation-note { color: #65707a; font-size: 12px; line-height: 1.7; margin: 0; }
.equation-panel { min-width: 0; padding: 20px 24px; border-left: 2px solid #b98d58; background: #eeeae2; align-self: center; }
.symbolic-equation { font: 17px/1.8 Georgia, serif; overflow-wrap: anywhere; }
.numeric-equation { font: 12px/1.8 ui-monospace, Menlo, monospace; margin-top: 9px; overflow-wrap: anywhere; color: #4c5861; }
.equation-panel p { font-size: 11px; color: #65707a; margin: 12px 0 0; }
.math-details { border-top: 1px solid var(--line); padding: 21px 0 30px; }
.math-details summary { cursor: pointer; font-size: 14px; font-weight: 600; }
.math-copy { max-width: 850px; font-size: 14px; color: #4b5563; line-height: 1.8; }
.noscript { padding: 16px; border: 1px solid var(--line); }
@media (max-width: 1000px) { .simulator { grid-template-columns: minmax(0, 1fr) 275px; } .control-panel { padding: 22px 18px; } .scene-top { padding: 17px; } .scene-top b { margin-left: 8px; } }
@media (max-width: 800px) {
  .sphere-demo .wrap { width: min(100% - 32px, 680px); }
  .back-link { margin-top: 10px; margin-bottom: 23px; }
  .demo-intro { font-size: 14px; }
  .simulator { grid-template-columns: minmax(0, 1fr); }
  .control-panel { border-left: 0; border-top: 1px solid var(--line); padding: 24px; }
  .equation-section { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  #scene { flex: none; }
  #solution-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .solution-heading { margin-top: 10px; }
  .legend { padding: 14px 17px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

#camera:focus-visible #camera-halo { opacity: .25; stroke: #333e47; stroke-width: 2; }
.camera-limits { margin: -15px 0 20px; color: #65707a; font-size: 11px; }

.reflection-status { margin: 0; padding: 12px 24px; font-size: 13px; font-weight: 600; color: #805018; background: #f4ede2; border-bottom: 1px solid var(--line); }
.reflection-status[data-valid="false"] { color: #633b36; background: #f4e8e4; }
