.pack-control {
  --travel: 0;
  --position: clamp(0, var(--travel), 1);
  --rail-slot: 88px;
  --spring-height: 84px;
  --grip-width: 44px;
  --grip-height: 41px;
  --rail-top: #383631;
  --rail-background: #49463e;
  --rail-edge: #a39783;
  --thumb-ink: #304238;
  --hint-color: #60584c;
  display: grid;
  grid-template-rows: var(--rail-slot) 20px;
  justify-items: center;
  align-items: center;
  width: 100%;
  min-width: 0;
  height: calc(var(--rail-slot) + 20px);
}

.animal-app .pack-control {
  --rail-top: #1a1d27;
  --rail-background: #303645;
  --rail-edge: #676d7a;
  --hint-color: #c5c8d0;
}

.pack-track {
  position: relative;
  width: min(100%, 240px);
  height: var(--grip-height);
  border: 0;
  padding: 0;
  touch-action: none;
  user-select: none;
  isolation: isolate;
}

.pack-track::before,
.pack-track::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.pack-track::before {
  inset: 5px 0;
  border: 1px solid var(--rail-edge);
  border-radius: 7px;
  background: linear-gradient(180deg, var(--rail-top), var(--rail-background));
  box-shadow: inset 0 1px 3px #211c16b3, 0 1px #ffffffc9;
}

.pack-track::after {
  z-index: 1;
  inset: 50% 12px auto;
  height: 2px;
  translate: 0 -50%;
  background: repeating-linear-gradient(90deg, #ede1c671 0 3px, transparent 3px 8px);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 91%, transparent);
}

.pack-control .pack-grip {
  position: absolute;
  z-index: 2;
  top: 0;
  left: calc(var(--position) * (100% - var(--grip-width)));
  box-sizing: border-box;
  width: var(--grip-width);
  height: var(--grip-height);
  border: 1px solid #b9b3a1;
  border-radius: 7px;
  padding: 0;
  appearance: none;
  background: linear-gradient(147deg, #fffdf7, #e4e5d8);
  color: var(--thumb-ink);
  box-shadow: inset 0 -1px #b2b2a3a0, 0 2px 5px #26241eb3;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.pack-grip::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  translate: -62% -50%;
  rotate: 45deg;
  border-top: 1.7px solid currentColor;
  border-right: 1.7px solid currentColor;
  pointer-events: none;
}

.pack-grip:hover {
  border-color: #8b9886;
  background: linear-gradient(147deg, #fffefb, #e6eadf);
}

.pack-grip:focus-visible { outline: 2px solid #3c6151; outline-offset: 3px; }
.pack-control[data-active="true"] .pack-grip {
  cursor: grabbing;
  background: linear-gradient(147deg, #eff3e9, #cad5c4);
  box-shadow: inset 0 1px 3px #858e8055, 0 1px 3px #241f1b69;
}

.pack-hint {
  margin: 0;
  color: var(--hint-color);
  text-align: center;
  font-size: .81rem;
  font-weight: 540;
  line-height: 1.25;
  white-space: nowrap;
}

.pack-control[data-step="spring"] .pack-track { width: var(--grip-width); height: var(--spring-height); }
.pack-control[data-step="spring"] .pack-track::before { inset: 0 5px; }
.pack-control[data-step="spring"] .pack-track::after { display: none; }
.pack-control[data-step="spring"] .pack-grip {
  left: 0;
  top: calc(var(--position) * (100% - var(--grip-height)));
}
.pack-control[data-step="spring"] .pack-grip::after { translate: -50% -62%; rotate: 135deg; }

.pack-coil { display: none; }
.pack-control[data-step="spring"] .pack-coil {
  display: block;
  position: absolute;
  z-index: 1;
  top: calc(var(--grip-height) + var(--position) * (100% - var(--grip-height)));
  left: 50%;
  width: 15px;
  height: calc(100% - var(--grip-height) - 4px);
  translate: -50% 0;
  scale: 1 calc(1 - var(--position));
  transform-origin: center top;
  border-radius: 2px;
  background: repeating-linear-gradient(162deg, #322f28 0 2px, #948b77 3px, #e7dbbd 4px, #857867 5px 6px, #3c352d 7px);
  box-shadow: inset 2px 0 2px #322c24b5, inset -2px 0 2px #322c24b5;
  pointer-events: none;
}

.pack-control[data-step="done"] .pack-track { visibility: hidden; pointer-events: none; }

@media (max-width: 640px) {
  .pack-control { --rail-slot: 76px; --spring-height: 74px; --grip-height: 38px; }
  .pack-track { width: min(100%, 212px); }
}
