/* The finish line: a plate, three worms, and a sibling as the ruler. */
#fig-goal .gl-stage {
  position: relative;
  height: clamp(21rem, 48vh, 29rem);
  border-radius: 1.1rem;
  overflow: hidden;
  background: #0d0b16;
  box-shadow: inset 0 0 0 1px rgba(255, 213, 154, 0.14), 0 0 60px rgba(255, 159, 178, 0.07), 0 30px 80px rgba(0, 0, 0, 0.45);
}
#fig-goal .gl-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

#fig-goal .gl-panel {
  display: grid;
  grid-template-columns: minmax(15rem, 1.15fr) minmax(15rem, 1fr) auto;
  gap: 1.2rem 2.6rem;
  align-items: center;
  padding: 1.5rem 0.4rem 0.2rem;
}
#fig-goal .gl-lab {
  display: block;
  font: 400 0.64rem/1 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
}
#fig-goal .gl-s { display: flex; align-items: baseline; gap: 0.7rem; margin: 0.5rem 0 0.1rem; }
#fig-goal .gl-s output {
  font: 400 clamp(2.4rem, 1.6rem + 2vw, 3.4rem)/1 var(--display);
  color: var(--a1);
  text-shadow: 0 0 28px rgba(255, 213, 154, 0.45);
  font-variant-numeric: tabular-nums;
}
#fig-goal .gl-s span { font: italic 300 1rem/1 var(--serif); color: var(--ink-2); }

#fig-goal input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 2.7rem; margin: 0; background: transparent; cursor: pointer; touch-action: pan-y;
}
#fig-goal input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, rgba(243, 236, 230, 0.18), var(--a3));
}
#fig-goal input[type=range]::-moz-range-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, rgba(243, 236, 230, 0.18), #9fc8ff);
}
#fig-goal input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 1.7rem; height: 1.7rem; margin-top: calc(2px - 0.85rem); border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff4e0, var(--a1) 55%, #e8a85a);
  box-shadow: 0 0 0 5px rgba(255, 213, 154, 0.14), 0 0 22px rgba(255, 213, 154, 0.55);
  border: 0;
}
#fig-goal input[type=range]::-moz-range-thumb {
  width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 0;
  background: radial-gradient(circle at 35% 35%, #fff4e0, #ffd59a 55%, #e8a85a);
  box-shadow: 0 0 0 5px rgba(255, 213, 154, 0.14), 0 0 22px rgba(255, 213, 154, 0.55);
}
#fig-goal input[type=range]:focus-visible { outline: none; }
#fig-goal input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 5px rgba(255, 213, 154, 0.4), 0 0 22px rgba(255, 213, 154, 0.6); }
#fig-goal .gl-ends { display: flex; justify-content: space-between; font: italic 300 0.82rem/1.2 var(--serif); color: var(--ink-3); }

#fig-goal .gl-blots { position: relative; text-align: center; }
#fig-goal .gl-blots canvas { display: block; width: 100%; height: 9.6rem; }
#fig-goal .gl-names { display: grid; grid-template-columns: 1fr 1fr; font: 400 0.64rem/1 var(--mono); letter-spacing: 0.18em; text-transform: uppercase; }
#fig-goal .gl-names span:first-child { color: var(--a2); }
#fig-goal .gl-names span:last-child { color: var(--a3); }
#fig-goal .gl-ratio { margin: 0.7rem 0 0; font: italic 300 0.95rem/1.35 var(--serif); color: var(--ink-2); min-height: 1.35em; }
#fig-goal .gl-ratio b { font: 400 0.82rem var(--mono); font-style: normal; color: var(--ink); letter-spacing: 0; }

#fig-goal .gl-again {
  justify-self: end;
  min-height: 2.9rem; padding: 0 1.4rem;
  font: 400 0.7rem/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--a1); background: rgba(255, 213, 154, 0.06);
  border: 1px solid rgba(255, 213, 154, 0.45); border-radius: 999px; cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}
#fig-goal .gl-again:hover { background: rgba(255, 213, 154, 0.14); box-shadow: 0 0 26px rgba(255, 213, 154, 0.3); }
#fig-goal .gl-again:active { transform: scale(0.97); }
#fig-goal .gl-again:focus-visible { outline: 2px solid var(--a1); outline-offset: 3px; }
#fig-goal .gl-again.pulse { animation: glpulse 2.4s ease-in-out infinite; }
@keyframes glpulse { 50% { box-shadow: 0 0 28px rgba(255, 213, 154, 0.38); } }
@media (prefers-reduced-motion: reduce) { #fig-goal .gl-again.pulse { animation: none; } }

#fig-goal .gl-cap {
  position: relative;
  margin: 2.2rem auto 0; padding-top: 1.5rem; max-width: 36rem;
  text-align: center;
  font: italic 300 1.05rem/1.55 var(--serif); color: var(--ink-2);
}
#fig-goal .gl-cap::before {
  content: ''; position: absolute; left: 50%; top: 0; width: min(18rem, 60%); height: 1px; transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(255, 213, 154, 0.55), transparent);
}
#fig-goal .gl-cap::after {
  content: ''; position: absolute; left: 50%; top: -3px; width: 7px; height: 7px; transform: translateX(-50%);
  border-radius: 50%; background: var(--a1); box-shadow: 0 0 14px 3px rgba(255, 213, 154, 0.6);
}
#fig-goal .gl-k { display: block; margin-bottom: 0.25rem; font: 400 1.5rem/1.2 var(--display); font-style: normal; color: var(--a1); text-shadow: 0 0 30px rgba(255, 213, 154, 0.4); }

@media (max-width: 900px) {
  #fig-goal .gl-panel { grid-template-columns: 1fr; gap: 1.4rem; }
  #fig-goal .gl-again { justify-self: stretch; }
}
@media (max-width: 700px) {
  #fig-goal .gl-stage { height: min(34rem, 78vh); border-radius: 0.9rem; }
  #fig-goal .gl-blots canvas { height: 8.6rem; }
}
