/* Linear Forms Lab — Algebra I Module 2, Topic B.
   Tokens only: the three forms take the course hues of the daylight band
   (--c-alg1 blue, --c-alg2 violet, --c-geo teal), deepened for text on white.
   They are declared on the light band itself: declared on <main>, var()
   would resolve to the dark-theme hues before the band redefines them. */

.lf-page .light-band {
  --lf-si: var(--c-alg1);
  --lf-si-tint: var(--c-alg1-tint);
  --lf-ps: var(--c-alg2);
  --lf-ps-tint: var(--c-alg2-tint);
  --lf-std: var(--c-geo);
  --lf-std-tint: var(--c-geo-tint);
  --lf-good: var(--c-geo);
  --lf-warn: var(--gold);
  --lf-bad: var(--c-calc);
}
.lf-page .container { max-width: 1180px; }
/* Keyboard focus and in-page jumps land below the sticky site header. */
html:has(.lf-page) { scroll-padding-top: calc(var(--header-height, 72px) + 16px); }
/* Grid children may shrink below their content (wide equations scroll
   inside their own box instead of widening the column past the screen). */
.lf-graph-grid > *, .lf-conv-body > *, .lf-compare > *, .lf-life > *, .lf-explorer-grid > *, .lf-next > *, .lf-hero-forms > * { min-width: 0; }
.lf-form-card { min-width: 0; overflow: hidden; }

/* ── back bar + hero ─────────────────────────────────────────────── */
.lf-backbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin: 0 0 1.25rem; }
.lf-back { font-family: var(--font-mono); font-size: .78rem; font-weight: 600; letter-spacing: .04em; color: var(--accent); text-decoration: none; }
.lf-back:hover, .lf-back:focus-visible { text-decoration: underline; }
.lf-crumbs { font-family: var(--font-mono); font-size: .7rem; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }

.lf-hero {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: 22px;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1.1rem, 4vw, 3rem);
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(135deg, var(--lf-si-tint), var(--lf-ps-tint) 55%, var(--lf-std-tint));
  box-shadow: var(--arch-shadow-md);
}
.lf-hero .eyebrow { display: inline-block; margin-bottom: .5rem; }
.lf-hero h1 { font-family: var(--font-display); color: var(--ink); font-size: clamp(1.9rem, 4.6vw, 3.1rem); line-height: 1.08; margin: 0 0 .75rem; letter-spacing: -.01em; }
.lf-hero h1 span { color: var(--accent); }
.lf-hero p.lf-lede { color: var(--ink-2); font-size: clamp(1rem, 1.6vw, 1.12rem); line-height: 1.65; max-width: 760px; margin: 0; }
.lf-hero-forms { display: grid; gap: .85rem; margin-top: 1.6rem; }
@media (min-width: 760px) { .lf-hero-forms { grid-template-columns: repeat(3, 1fr); } }
.lf-hero-form {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 1rem 1.1rem; border-top: 5px solid var(--lf-c);
  box-shadow: var(--arch-shadow-sm);
}
.lf-hero-form .lf-name { font-family: var(--font-mono); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--lf-c); }
.lf-hero-form .lf-eq { font-size: 1.3rem; color: var(--ink); margin: .35rem 0 .3rem; min-height: 1.9rem; }
.lf-hero-form p { margin: 0; color: var(--ink-2); font-size: .9rem; line-height: 1.5; }
.lf-c-si { --lf-c: var(--lf-si); --lf-t: var(--lf-si-tint); }
.lf-c-ps { --lf-c: var(--lf-ps); --lf-t: var(--lf-ps-tint); }
.lf-c-std { --lf-c: var(--lf-std); --lf-t: var(--lf-std-tint); }

.lf-jump { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.4rem; padding: 0; list-style: none; }
.lf-jump a {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 40px;
  padding: .45rem .9rem; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: .88rem; text-decoration: none;
}
.lf-jump a:hover, .lf-jump a:focus-visible { border-color: var(--accent); color: var(--accent); }

/* ── sections ───────────────────────────────────────────────────── */
.lf-section { margin: 3rem 0 0; scroll-margin-top: calc(var(--header-height, 72px) + 16px); }
.lf-section-head { display: flex; gap: .9rem; align-items: flex-start; margin-bottom: 1.1rem; }
.lf-step-no {
  flex: none; width: 2.4rem; height: 2.4rem; border-radius: 12px; display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 700; color: var(--accent); background: var(--accent-tint); border: 1px solid var(--line);
}
.lf-section-head h2 { margin: 0; color: var(--ink); font-family: var(--font-display); font-size: clamp(1.35rem, 2.6vw, 1.75rem); }
.lf-section-head p { margin: .25rem 0 0; color: var(--ink-2); line-height: 1.55; }
.lf-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: clamp(1rem, 2.4vw, 1.5rem); box-shadow: var(--arch-shadow-sm); }

/* ── 1 · live graph ─────────────────────────────────────────────── */
.lf-graph-grid { display: grid; gap: 1.1rem; }
@media (min-width: 980px) { .lf-graph-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; } }
.lf-graph-wrap { position: relative; }
.lf-graph { width: 100%; height: auto; display: block; touch-action: none; user-select: none; -webkit-user-select: none; border-radius: 14px; background: var(--surface); }
.lf-graph .g-minor { stroke: var(--line); stroke-width: 1; }
.lf-graph .g-major { stroke: var(--line-strong); stroke-width: 1; }
.lf-graph .g-axis { stroke: var(--ink-2); stroke-width: 1.6; }
.lf-graph .g-tick { fill: var(--muted); font-family: var(--font-mono); font-size: 10px; }
.lf-graph .g-axis-label { fill: var(--ink-2); font-family: var(--font-mono); font-size: 12px; font-weight: 700; }
.lf-graph .g-line { stroke: var(--ink); stroke-width: 3.2; stroke-linecap: round; }
.lf-graph .g-tri { fill: var(--lf-t); stroke: var(--lf-c); stroke-width: 2.2; stroke-dasharray: 6 4; }
.lf-graph .g-tri-label { fill: var(--lf-c); font-family: var(--font-mono); font-size: 12px; font-weight: 700; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.lf-graph .g-mark { fill: var(--surface); stroke: var(--lf-c); stroke-width: 3.5; }
.lf-graph .g-mark-label { fill: var(--lf-c); font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; paint-order: stroke; stroke: var(--surface); stroke-width: 5px; }
.lf-graph .g-handle { cursor: grab; outline: none; }
.lf-graph .g-handle:active { cursor: grabbing; }
.lf-graph .g-handle .h-hit { fill: transparent; }
.lf-graph .g-handle .h-dot { fill: var(--ink); stroke: var(--surface); stroke-width: 3; }
.lf-graph .g-handle .h-ring { fill: none; stroke: var(--accent); stroke-width: 2.5; opacity: 0; }
.lf-graph .g-handle:focus-visible .h-ring, .lf-graph .g-handle.is-drag .h-ring { opacity: 1; }
.lf-graph .g-handle-label { fill: var(--ink); font-family: var(--font-mono); font-size: 12px; font-weight: 700; paint-order: stroke; stroke: var(--surface); stroke-width: 5px; pointer-events: none; }
.lf-graph-hint { margin: .6rem 0 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }

.lf-points { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; margin-top: .85rem; }
.lf-points fieldset { border: 1px solid var(--line); border-radius: 12px; padding: .35rem .7rem .55rem; margin: 0; display: flex; gap: .4rem; align-items: center; }
.lf-points legend { font-family: var(--font-mono); font-size: .72rem; font-weight: 700; color: var(--muted); padding: 0 .3rem; }
.lf-points input { width: 3.6rem; }

.lf-forms { display: grid; gap: .8rem; }
.lf-form-card {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--lf-c);
  border-radius: 14px; padding: .9rem 1rem; font: inherit; color: inherit;
  transition: box-shadow .18s ease, transform .18s ease, background-color .18s ease;
}
.lf-form-card:hover { box-shadow: var(--arch-shadow-md); }
.lf-form-card:focus-visible { outline: 3px solid var(--lf-c); outline-offset: 2px; }
.lf-form-card[aria-pressed="true"] { background: var(--lf-t); box-shadow: var(--arch-shadow-md); }
.lf-form-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.lf-form-card .lf-name { font-family: var(--font-mono); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--lf-c); }
.lf-form-card .lf-show { font-size: .74rem; font-weight: 700; color: var(--lf-c); border: 1px solid var(--lf-c); border-radius: 999px; padding: .1rem .55rem; }
.lf-form-card[aria-pressed="true"] .lf-show { background: var(--lf-c); color: var(--surface); }
.lf-form-card .lf-eq { font-size: 1.45rem; color: var(--ink); margin: .45rem 0 .35rem; min-height: 2.1rem; overflow-x: auto; overflow-y: hidden; }
.lf-form-card p { margin: 0; color: var(--ink-2); font-size: .9rem; line-height: 1.5; }
.lf-form-card p strong { color: var(--ink); }

.lf-readout { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin-top: .9rem; }
.lf-readout div { background: var(--recessed); border-radius: 12px; padding: .55rem .7rem; }
.lf-readout dt { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lf-readout dd { margin: .15rem 0 0; color: var(--ink); font-weight: 700; font-size: 1.05rem; }

.lf-btn-row { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .85rem; }
.lf-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 42px;
  padding: .5rem 1rem; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
}
.lf-btn:hover { border-color: var(--accent); color: var(--accent); }
.lf-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.lf-btn--primary { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.lf-btn--primary:hover { background: var(--accent-bright); border-color: var(--accent-bright); color: var(--surface); }
.lf-btn[disabled] { opacity: .5; cursor: not-allowed; }

.lf-input {
  font: inherit; font-family: var(--font-mono); font-size: 1rem; text-align: center;
  min-height: 42px; padding: .35rem .45rem; border-radius: 10px;
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
.lf-input:focus { outline: 3px solid var(--accent-tint); border-color: var(--accent); }
.lf-input::placeholder { color: var(--muted); opacity: 1; }
.lf-select { font: inherit; min-height: 42px; padding: .35rem .6rem; border-radius: 10px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); }

/* ── 2 · converter ──────────────────────────────────────────────── */
.lf-conv-dirs { display: grid; gap: .55rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.lf-dir {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; justify-content: center;
  min-height: 48px; padding: .5rem .7rem; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer;
}
.lf-dir .from { color: var(--lf-from); }
.lf-dir .to { color: var(--lf-to); }
.lf-dir[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent); }
.lf-dir:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.lf-conv-body { display: grid; gap: 1rem; margin-top: 1rem; }
@media (min-width: 900px) { .lf-conv-body { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.lf-steps { list-style: none; margin: 0; padding: 0; counter-reset: lfstep; }
.lf-steps li {
  counter-increment: lfstep; position: relative; padding: .8rem .9rem .8rem 3rem;
  border: 1px solid var(--line); border-radius: 12px; margin-bottom: .55rem; background: var(--surface);
  animation: lf-in .28s ease both;
}
.lf-steps li::before {
  content: counter(lfstep); position: absolute; left: .8rem; top: .85rem;
  width: 1.55rem; height: 1.55rem; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: .75rem; font-weight: 700; background: var(--accent-tint); color: var(--accent);
}
.lf-steps li.is-final { border-color: var(--lf-good); background: var(--lf-std-tint); }
.lf-steps li.is-final::before { content: "\2713"; background: var(--lf-good); color: var(--surface); }
.lf-steps .lf-step-tex { font-size: 1.15rem; color: var(--ink); overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; }
.lf-steps .lf-step-say { margin: .3rem 0 0; color: var(--ink-2); font-size: .9rem; line-height: 1.5; }
@keyframes lf-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .lf-steps li, .lf-feedback { animation: none !important; } .lf-form-card { transition: none; } }
.lf-conv-side h3 { margin: 0 0 .5rem; font-size: 1rem; color: var(--ink); }
.lf-conv-side p { margin: 0 0 .6rem; color: var(--ink-2); font-size: .9rem; line-height: 1.55; }
.lf-conv-start { font-size: 1.25rem; color: var(--ink); padding: .7rem .8rem; border-radius: 12px; background: var(--recessed); overflow-x: auto; }

/* ── 3 · strengths ──────────────────────────────────────────────── */
.lf-compare { display: grid; gap: 1rem; }
@media (min-width: 900px) { .lf-compare { grid-template-columns: repeat(3, 1fr); } }
.lf-compare-card { background: var(--surface); border: 1px solid var(--line); border-top: 6px solid var(--lf-c); border-radius: 16px; padding: 1.1rem 1.15rem; box-shadow: var(--arch-shadow-sm); }
.lf-compare-card h3 { margin: 0; color: var(--lf-c); font-size: 1.1rem; }
.lf-compare-card .lf-eq { font-size: 1.25rem; color: var(--ink); margin: .35rem 0 .6rem; }
.lf-compare-card .lf-best { background: var(--lf-t); border-radius: 10px; padding: .55rem .7rem; color: var(--ink); font-size: .9rem; line-height: 1.5; margin-bottom: .7rem; }
.lf-compare-card h4 { margin: .7rem 0 .3rem; font-size: .78rem; font-family: var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lf-compare-card ul { margin: 0; padding: 0; list-style: none; }
.lf-compare-card li { position: relative; padding: .28rem 0 .28rem 1.45rem; color: var(--ink-2); font-size: .9rem; line-height: 1.5; }
.lf-compare-card li::before { position: absolute; left: 0; top: .28rem; font-weight: 800; }
.lf-pros li::before { content: "+"; color: var(--lf-good); }
.lf-cons li::before { content: "\2212"; color: var(--lf-bad); }
.lf-meter { display: grid; grid-template-columns: auto 1fr; gap: .25rem .6rem; align-items: center; margin-top: .4rem; font-size: .82rem; color: var(--ink-2); }
.lf-dots { display: inline-flex; gap: 4px; }
.lf-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--recessed); border: 1px solid var(--line-strong); }
.lf-dots i.on { background: var(--lf-c); border-color: var(--lf-c); }

.lf-pick { margin-top: 1.1rem; }
.lf-pick-q { font-size: 1.05rem; color: var(--ink); line-height: 1.55; margin: .3rem 0 .8rem; min-height: 3.2em; }
.lf-pick-opts { display: grid; gap: .55rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.lf-pick-opt { min-height: 48px; border-radius: 12px; border: 2px solid var(--lf-c); background: var(--surface); color: var(--lf-c); font: inherit; font-weight: 700; cursor: pointer; }
.lf-pick-opt:hover { background: var(--lf-t); }
.lf-pick-opt:focus-visible { outline: 3px solid var(--lf-c); outline-offset: 2px; }
.lf-pick-opt.is-right { background: var(--lf-c); color: var(--surface); }
.lf-pick-opt:disabled { cursor: default; }
.lf-pick-opt.is-wrong { border-style: dashed; text-decoration: line-through; }
.lf-pick-meta { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; font-family: var(--font-mono); font-size: .76rem; color: var(--muted); }

/* ── 4 · real life ──────────────────────────────────────────────── */
.lf-life { display: grid; gap: 1rem; }
@media (min-width: 900px) { .lf-life { grid-template-columns: repeat(3, 1fr); } }
.lf-life-col h3 { margin: 0 0 .6rem; color: var(--lf-c); font-size: 1.05rem; display: flex; align-items: center; gap: .45rem; }
.lf-life-col h3::before { content: ""; width: .7rem; height: .7rem; border-radius: 3px; background: var(--lf-c); }
.lf-case { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem; margin-bottom: .75rem; }
.lf-case .lf-case-title { font-weight: 700; color: var(--ink); margin: 0 0 .25rem; }
.lf-case p { margin: 0 0 .45rem; color: var(--ink-2); font-size: .9rem; line-height: 1.5; }
.lf-case .lf-eq { color: var(--ink); font-size: 1.12rem; padding: .45rem .6rem; border-radius: 10px; background: var(--lf-t); overflow-x: auto; }
.lf-case dl { margin: .45rem 0 0; display: grid; grid-template-columns: auto 1fr; gap: .2rem .6rem; font-size: .85rem; }
.lf-case dt { font-family: var(--font-mono); font-weight: 700; color: var(--lf-c); }
.lf-case dd { margin: 0; color: var(--ink-2); }

.lf-explorer { margin-top: 1.2rem; border-top: 6px solid var(--lf-std); }
.lf-explorer-grid { display: grid; gap: 1.1rem; }
@media (min-width: 900px) { .lf-explorer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.lf-explorer h3 { margin: 0; color: var(--ink); font-size: 1.15rem; }
.lf-explorer .lf-sub { margin: .25rem 0 .9rem; color: var(--ink-2); font-size: .92rem; line-height: 1.55; }
.lf-story { color: var(--ink); line-height: 1.6; margin: .6rem 0; }
.lf-ex-eq { font-size: 1.4rem; color: var(--ink); padding: .6rem .8rem; border-radius: 12px; background: var(--lf-std-tint); overflow-x: auto; }
.lf-range { width: 100%; accent-color: var(--lf-std); margin: .4rem 0; min-height: 32px; }
.lf-ex-read { border-radius: 12px; padding: .75rem .9rem; background: var(--recessed); color: var(--ink); line-height: 1.55; font-size: .95rem; }
.lf-ex-read strong { color: var(--ink); }
.lf-ex-read .ok { color: var(--lf-good); font-weight: 700; }
.lf-ex-read .no { color: var(--lf-bad); font-weight: 700; }
.lf-ex-graph { width: 100%; height: auto; display: block; background: var(--surface); border-radius: 12px; }
.lf-ex-graph .e-grid { stroke: var(--line); }
.lf-ex-graph .e-axis { stroke: var(--ink-2); stroke-width: 1.6; }
.lf-ex-graph .e-tick { fill: var(--muted); font-family: var(--font-mono); font-size: 10px; }
.lf-ex-graph .e-title { fill: var(--ink-2); font-family: var(--font-mono); font-size: 11px; font-weight: 700; }
.lf-ex-graph .e-line { stroke: var(--lf-std); stroke-width: 3; }
.lf-ex-graph .e-lattice { fill: var(--lf-std); }
.lf-ex-graph .e-int { fill: var(--surface); stroke: var(--lf-std); stroke-width: 3; }
.lf-ex-graph .e-int-label { fill: var(--lf-std); font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.lf-ex-graph .e-cur { fill: var(--gold); stroke: var(--surface); stroke-width: 2.5; }
.lf-ex-graph .e-guide { stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 4 4; }
.lf-int-notes { display: grid; gap: .5rem; margin-top: .7rem; }
.lf-int-notes div { border-left: 4px solid var(--lf-std); padding: .35rem .65rem; color: var(--ink-2); font-size: .9rem; line-height: 1.5; background: var(--surface-2); border-radius: 0 10px 10px 0; }

/* ── 5 · practice ───────────────────────────────────────────────── */
.lf-modes { display: flex; flex-wrap: wrap; gap: .45rem; }
.lf-mode { min-height: 40px; padding: .4rem .9rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; }
.lf-mode[aria-pressed="true"] { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.lf-mode:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.lf-score { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin: 1rem 0; }
.lf-score div { background: var(--recessed); border-radius: 12px; padding: .5rem .65rem; text-align: center; }
.lf-score dt { font-family: var(--font-mono); font-size: .64rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lf-score dd { margin: .1rem 0 0; font-size: 1.25rem; font-weight: 800; color: var(--ink); }
.lf-progress { height: 8px; border-radius: 999px; background: var(--recessed); overflow: hidden; margin-bottom: 1rem; }
.lf-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--lf-si), var(--lf-ps), var(--lf-std)); transition: width .3s ease; }
.lf-problem { border: 1px solid var(--line); border-radius: 16px; padding: clamp(1rem, 2.4vw, 1.4rem); background: var(--surface); }
.lf-problem-tag { font-family: var(--font-mono); font-size: .7rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
.lf-problem-story { margin: .5rem 0 0; color: var(--ink); line-height: 1.6; font-size: 1rem; }
.lf-problem-prompt { margin: .5rem 0 0; color: var(--ink-2); line-height: 1.55; }
.lf-problem-tex { font-size: 1.45rem; color: var(--ink); margin: .7rem 0 .2rem; padding: .55rem .8rem; border-radius: 12px; background: var(--recessed); overflow-x: auto; overflow-y: hidden; }
.lf-answer { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin: 1rem 0 .4rem; font-family: var(--font-mono); font-size: 1.15rem; color: var(--ink); }
.lf-answer .lf-input { width: 4.6rem; }
.lf-answer .lf-glue { white-space: nowrap; }
.lf-answer-hint { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.lf-feedback { margin-top: .8rem; border-radius: 12px; padding: .7rem .9rem; font-weight: 600; line-height: 1.5; animation: lf-in .2s ease both; }
.lf-feedback:empty { display: none; }
.lf-feedback.is-ok { background: var(--lf-std-tint); color: var(--lf-good); border: 1px solid var(--lf-good); }
.lf-feedback.is-close { background: var(--c-sci-tint); color: var(--lf-warn); border: 1px solid var(--lf-warn); }
.lf-feedback.is-no { background: var(--c-calc-tint); color: var(--lf-bad); border: 1px solid var(--lf-bad); }
.lf-solution { margin-top: .9rem; }
.lf-solution h4 { margin: 0 0 .5rem; color: var(--ink); font-size: .95rem; }
.lf-done { text-align: center; padding: 1.4rem 1rem; }
.lf-done h3 { margin: 0 0 .3rem; color: var(--ink); font-size: 1.4rem; }
.lf-done p { color: var(--ink-2); margin: 0 0 1rem; }
.lf-setcode { margin-top: .8rem; color: var(--muted); font-size: .84rem; }
.lf-setcode summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.lf-setcode .lf-btn-row { align-items: center; }

.lf-savebar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; margin: 0 0 1rem; padding: .7rem .9rem; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink-2); font-size: .9rem; line-height: 1.5; }
.lf-savebar:empty { display: none; }
.lf-savebar span { flex: 1 1 260px; }
.lf-savebar .lf-savebar-lost { flex-basis: 100%; }
.lf-savebar.is-in, .lf-savebar.is-saved { border-color: var(--lf-good); background: var(--lf-std-tint); color: var(--ink); }
.lf-savebar.is-failed, .lf-savebar.is-offline { border-color: var(--lf-warn); background: var(--c-sci-tint); color: var(--ink); }

/* ── next ───────────────────────────────────────────────────────── */
.lf-next { display: grid; gap: 1rem; }
@media (min-width: 760px) { .lf-next { grid-template-columns: repeat(3, 1fr); } }
.lf-next .lf-panel h3 { margin: 0 0 .35rem; font-size: 1.05rem; color: var(--ink); }
.lf-next .lf-panel p { margin: 0 0 .8rem; color: var(--ink-2); font-size: .9rem; line-height: 1.5; }
.lf-credit { text-align: center; color: var(--muted); font-size: .85rem; line-height: 1.6; margin: 2.5rem auto 0; max-width: 760px; }
.lf-credit a { color: var(--accent); }

.lf-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* The graph's viewBox shrinks on a phone, so its text is set larger in
   viewBox units to stay readable (~10px on screen). */
@media (max-width: 640px) {
  .lf-graph .g-tick { font-size: 18px; }
  .lf-graph .g-axis-label { font-size: 21px; }
  .lf-graph .g-tri-label, .lf-graph .g-handle-label { font-size: 20px; }
  .lf-graph .g-mark-label { font-size: 20px; }
  .lf-ex-graph .e-tick, .lf-ex-graph .e-title { font-size: 13px; }
  .lf-ex-graph .e-int-label { font-size: 14px; }
}
@media (max-width: 520px) {
  .lf-readout { grid-template-columns: 1fr 1fr; }
  .lf-readout div:last-child { grid-column: 1 / -1; }
  .lf-score { grid-template-columns: 1fr 1fr; }
  .lf-answer { font-size: 1.02rem; }
  .lf-answer .lf-input { width: 4rem; }
  .lf-form-card .lf-eq { font-size: 1.25rem; }
  .lf-problem-tex { font-size: 1.2rem; }
}
