.lineslope-app {
  --paper: #f6f9fb;
  --surface: #ffffff;
  --grid: #dde7ef;
  --grid-major: #b4c7d7;
  --axis: #3d4f60;
  --ink: #17232e;
  --muted: #586a7b;
  --line: #1d5fc4;
  --pt-a: #c8364a;
  --pt-b: #13866b;
  --run: #b86e0b;
  --rise: #7a3fb8;
  --chip: #eaf1f7;
  --focus: #1d5fc4;
  --f-display: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-math: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
}
.lineslope-app, .lineslope-app * { box-sizing: border-box; }
.lineslope-app header { display: grid; gap: 4px; }
.lineslope-app h1 { font-family: var(--f-display); font-weight: 800; font-size: clamp(28px, 4vw, 40px); margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
.lineslope-app h1 .m { font-family: var(--f-math); font-weight: 600; color: var(--line); }
.lineslope-app header p { margin: 0; color: var(--muted); max-width: 62ch; }
.lineslope-app .main { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 860px) {
.lineslope-app .main { grid-template-columns: minmax(0, 1fr); } }
.lineslope-app .graph-col { display: grid; gap: 12px; min-width: 0; }
.lineslope-app .tabs { display: inline-flex; background: var(--chip); border-radius: 999px; padding: 3px; gap: 2px; justify-self: start; }
.lineslope-app .tabs button { border: 0; background: transparent; border-radius: 999px; padding: 6px 16px; cursor: pointer; font-weight: 700; color: var(--muted); }
.lineslope-app .tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }
.lineslope-app .toolbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 14px; color: var(--muted); }
.lineslope-app .toolbar label { display: inline-flex; align-items: center; gap: 6px; }
.lineslope-app #ls-gridCtl { display: contents; }
.lineslope-app #ls-gridCtl[hidden] { display: none !important; }
.lineslope-app select, .lineslope-app input, .lineslope-app button { font: inherit; color: var(--ink); }
.lineslope-app select { background: var(--surface); border: 1px solid var(--grid-major); border-radius: 6px; padding: 4px 8px; }
.lineslope-app .presets { display: flex; flex-wrap: wrap; gap: 6px; }
.lineslope-app .presets button, .lineslope-app .copy, .lineslope-app .chip-btn {
  background: var(--chip); border: 1px solid transparent; border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 14px;
}
.lineslope-app .presets button:hover, .lineslope-app .copy:hover, .lineslope-app .chip-btn:hover { border-color: var(--grid-major); }
.lineslope-app .chip-btn.primary { background: var(--line); color: var(--surface); font-weight: 700; }
.lineslope-app :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.lineslope-app .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lineslope-app .file-btn:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.lineslope-app .board { position: relative; width: 100%; max-width: 640px; aspect-ratio: 1; max-height: 80vh; background: var(--surface); border: 1px solid var(--grid-major); border-radius: 4px; }
.lineslope-app .board.drag-over { border: 2px dashed var(--line); }
.lineslope-app svg#ls-g { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; user-select: none; }
.lineslope-app svg#ls-g .pt { cursor: grab; }
.lineslope-app svg#ls-g .pt:focus { outline: none; }
.lineslope-app svg#ls-g .pt:focus-visible .halo { stroke: var(--focus); stroke-width: 3; }
.lineslope-app .drop { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); }
.lineslope-app .drop div { display: grid; gap: 12px; justify-items: center; max-width: 34ch; }
.lineslope-app .drop strong { font-family: var(--f-display); font-size: 20px; color: var(--ink); }
.lineslope-app .hint { font-size: 14px; color: var(--muted); margin: 0; }
.lineslope-app .tick-ask { position: absolute; left: 8px; right: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--surface); border: 2px solid var(--line); border-radius: 8px; padding: 8px 10px; box-shadow: 0 4px 14px rgb(0 0 0 / 0.18); font-size: 14px; font-weight: 700; }
.lineslope-app .tick-ask.top { top: 8px; }
.lineslope-app .tick-ask.bottom { bottom: 8px; }
.lineslope-app .tick-ask input { font-family: var(--f-math); width: 7em; background: var(--paper); border: 1px solid var(--grid-major); border-radius: 6px; padding: 4px 8px; }
.lineslope-app .tick-ask input.bad { border-color: var(--pt-a); }
.lineslope-app .photo-panel { display: grid; gap: 10px; }
.lineslope-app .photo-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.lineslope-app .steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; counter-reset: s; }
.lineslope-app .steps li { counter-increment: s; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 2px 10px; align-items: center; font-size: 15px; color: var(--muted); padding: 6px 10px; border-radius: 8px; border: 1px solid transparent; }
.lineslope-app .steps li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--chip); color: var(--muted); grid-row: span 2; }
.lineslope-app .steps li.done::before { content: "✓"; background: var(--pt-b); color: var(--surface); }
.lineslope-app .steps li.current { background: var(--surface); border-color: var(--line); color: var(--ink); }
.lineslope-app .steps li.current::before { background: var(--line); color: var(--surface); }
.lineslope-app .steps .val { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; }
.lineslope-app .steps input { font-family: var(--f-math); width: 6em; background: var(--paper); border: 1px solid var(--grid-major); border-radius: 6px; padding: 3px 8px; }
.lineslope-app .steps input.bad { border-color: var(--pt-a); }
.lineslope-app .steps .xk { color: var(--run); font-weight: 700; }
.lineslope-app .steps .yk { color: var(--rise); font-weight: 700; }
.lineslope-app .raw { font-size: 14px; color: var(--muted); margin: 0; font-variant-numeric: tabular-nums; }
.lineslope-app .raw b { font-family: var(--f-math); color: var(--ink); font-weight: 600; }
.lineslope-app .coords { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lineslope-app .pt-card { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--grid); border-radius: 8px; padding: 10px 12px; }
.lineslope-app .pt-card .tag { font-family: var(--f-math); font-weight: 600; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--surface); }
.lineslope-app .pt-card.a .tag { background: var(--pt-a); }
.lineslope-app .pt-card.b .tag { background: var(--pt-b); }
.lineslope-app .pt-card label { display: grid; gap: 2px; font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }
.lineslope-app .pt-card input { font-family: var(--f-math); width: 100%; min-width: 0; background: var(--paper); border: 1px solid var(--grid-major); border-radius: 6px; padding: 6px 8px; }
.lineslope-app .pt-card input[readonly] { background: transparent; border-style: dashed; }
.lineslope-app .pt-card input.bad { border-color: var(--pt-a); }
@media (max-width: 420px) {
.lineslope-app .coords { grid-template-columns: minmax(0, 1fr); } }
.lineslope-app .answer { display: grid; gap: 20px; min-width: 0; }
.lineslope-app .slope-box { display: grid; gap: 6px; }
.lineslope-app .eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; margin: 0; }
.lineslope-app .slope-big { font-family: var(--f-math); font-size: clamp(30px, 5vw, 44px); font-weight: 600; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; line-height: 1.1; }
.lineslope-app .slope-big .dec { font-size: 16px; color: var(--muted); font-weight: 400; }
.lineslope-app .slope-big .waiting { font-family: var(--f-body); font-size: 18px; color: var(--muted); font-weight: 400; }
.lineslope-app .badge { font-family: var(--f-body); font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--chip); color: var(--ink); }
.lineslope-app .work { font-family: var(--f-math); font-size: 15px; background: var(--surface); border: 1px solid var(--grid); border-radius: 8px; padding: 12px 14px; display: grid; gap: 8px; overflow-x: auto; }
.lineslope-app .work .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; white-space: nowrap; }
.lineslope-app .work .note { font-family: var(--f-body); color: var(--muted); font-size: 14px; white-space: normal; }
.lineslope-app .run-c { color: var(--run); font-weight: 600; }
.lineslope-app .rise-c { color: var(--rise); font-weight: 600; }
.lineslope-app .forms { display: grid; gap: 10px; }
.lineslope-app .form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; background: var(--surface); border: 1px solid var(--grid); border-radius: 8px; padding: 10px 14px; }
.lineslope-app .form .name { font-size: 13px; color: var(--muted); grid-column: 1 / -1; }
.lineslope-app .form .eq { font-family: var(--f-math); font-size: 20px; font-weight: 600; overflow-x: auto; white-space: nowrap; }
.lineslope-app .form.na .eq { color: var(--muted); font-weight: 400; font-size: 15px; font-family: var(--f-body); white-space: normal; }
.lineslope-app .intercepts { font-size: 15px; color: var(--muted); margin: 0; }
.lineslope-app .intercepts b { color: var(--ink); font-family: var(--f-math); font-weight: 600; }
.lineslope-app .frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1; font-size: 0.82em; margin: 0 1px; }
.lineslope-app .frac > span { padding: 1px 3px; }
.lineslope-app .frac > span:first-child { border-bottom: 1.5px solid currentColor; }
.lineslope-app .guide { display: grid; gap: 16px; padding-top: 8px; }
.lineslope-app .guide > h2 { font-family: var(--f-display); font-weight: 800; font-size: clamp(22px, 3vw, 28px); margin: 0; letter-spacing: -0.01em; }
.lineslope-app .guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 760px) {
.lineslope-app .guide-grid { grid-template-columns: minmax(0, 1fr); } }
.lineslope-app .howto { background: var(--surface); border: 1px solid var(--grid); border-radius: 8px; padding: 16px 20px; display: grid; gap: 10px; min-width: 0; scroll-margin-top: 16px; }
.lineslope-app .howto.wide { grid-column: 1 / -1; }
.lineslope-app .howto h3 { font-family: var(--f-display); font-size: 19px; margin: 0; }
.lineslope-app .howto h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 6px 0 0; }
.lineslope-app .howto p { margin: 0; max-width: 72ch; }
.lineslope-app .howto ol, .lineslope-app .howto ul { margin: 0; padding-left: 22px; display: grid; gap: 6px; max-width: 72ch; }
.lineslope-app .howto li::marker { color: var(--muted); font-weight: 700; }
.lineslope-app .howto code, .lineslope-app .howto .mth { font-family: var(--f-math); font-size: 0.92em; background: var(--chip); padding: 1px 5px; border-radius: 4px; white-space: nowrap; }
.lineslope-app .photo-guide-cols { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 8px 28px; }
@media (max-width: 760px) {
.lineslope-app .photo-guide-cols { grid-template-columns: minmax(0, 1fr); } }
.lineslope-app .photo-guide-cols > div { display: grid; gap: 8px; align-content: start; min-width: 0; }
.lineslope-app .fix { display: grid; gap: 8px; }
.lineslope-app .fix div { border-left: 3px solid var(--grid-major); padding-left: 10px; }
.lineslope-app .fix b { display: block; }
.lineslope-app .key { display: inline-block; font-family: var(--f-math); font-size: 0.85em; border: 1px solid var(--grid-major); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }
.lineslope-app .help-link { font-size: 14px; color: var(--line); align-self: center; }
.lineslope-app .error { color: var(--pt-a); font-weight: 700; }
@media (prefers-reduced-motion: no-preference) {
.lineslope-app .copy, .lineslope-app .steps li { transition: background .15s, border-color .15s; } }

.lineslope-app { color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.5; }
.lineslope-app.ls-tool, .lineslope-app.ls-guide { max-width: 1120px; margin-inline: auto; }
.lineslope-app [hidden] { display: none !important; }
.lineslope-app button { line-height: 1.3; }
