/* The printed scale runs upwards. The numeric readout is also the keyboard and no-script control. */
.health-scale {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(5rem, 7.3rem);
  column-gap: clamp(.35rem, 2vw, 1.25rem);
  max-width: 34rem;
  align-items: start;
  color: #171717;
}
.scale-text { min-width: 0; }
.scale-instructions { margin: .55rem 0 1rem; padding-inline-start: 1.15em; font-size: 1em; line-height: 1.36; }
.scale-instructions li + li { margin-top: .45em; }
.health-scale .scale-value {
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  width: fit-content; max-width: 100%; margin: .75rem auto .25rem; padding: .5rem .8rem;
  background: #111; color: white; border-radius: .15rem; text-align: center;
}
.health-scale .scale-value label { color: white; font-size: .88em; font-weight: 650; margin: 0; display: block; }
.health-scale input[data-scale-number] {
  width: 4ch; min-width: 0; text-align: center; color: white; background: #111;
  border: 1px solid #aaa; border-radius: .15rem; box-sizing: content-box; padding: .15em .25em;
  font: 700 1.25rem/1.25 system-ui,sans-serif; appearance: textfield; -moz-appearance: textfield;
}
.health-scale input::-webkit-inner-spin-button { -webkit-appearance: none; }
.health-scale input:focus-visible, .health-scale button:focus-visible { outline: 3px solid #1680c4; outline-offset: 2px; }
.scale-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.health-scale .scale-adjust { display: flex; justify-content: center; gap: .35rem; }
.health-scale .scale-adjust[hidden], .health-scale [data-scale-marker][hidden] { display: none; }
.scale-adjust button {
  width: 2.55rem; min-height: 2.55rem; padding: 0; font: 700 1.25rem/1 system-ui,sans-serif;
  border: 1px solid #7a7f85; border-radius: .35rem; color: #1b2430; background: white; cursor: pointer;
}
.scale-adjust button:disabled { color: #777; background: #eee; }
.scale-graphic { display: grid; justify-items: center; gap: .3rem; min-width: 0; }
.scale-anchor { display: block; text-align: center; font-size: .84em; line-height: 1.14; overflow-wrap: break-word; }
.scale-target {
  width: 100%; height: clamp(12.5rem, 44vh, 21rem); height: clamp(12.5rem, 44svh, 21rem);
  position: relative; user-select: none;
}
health-scale:defined .scale-target { cursor: crosshair; touch-action: none; }
health-scale:has(input:disabled) .scale-target { cursor: default; touch-action: auto; }
.scale-ruler {
  position: absolute; top: 0; bottom: 0; left: 28%; width: .65rem;
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(to bottom, #444 0 1px, transparent 1px);
  background-size: 100% calc(100% / var(--scale-units)); pointer-events: none;
}
.scale-major { position: relative; height: 0; width: 1.2rem; align-self: center; border-top: 1.5px solid #222; }
.scale-major > span { position: absolute; left: calc(100% + .28rem); top: -1px; transform: translateY(-50%); font: 500 .74rem/1 system-ui,sans-serif; }
.scale-marker {
  position: absolute; right: calc(100% + .28rem); transform: translateY(-50%);
  height: 0; width: 0; border-style: solid; border-width: .35rem 0 .35rem .55rem; border-color: transparent transparent transparent #075b95;
}
@media (max-width: 27rem) { .health-scale { grid-template-columns: minmax(0, 1fr) minmax(4.4rem, 27%); } }
@media (forced-colors: active) {
  .scale-ruler { background-image: linear-gradient(to bottom, CanvasText 0 1px, transparent 1px); forced-color-adjust: none; }
  .scale-major { border-color: CanvasText; } .scale-marker { border-left-color: Highlight; }
}
