.pump-page {
  overflow-x: hidden;
}

.pump-app {
  width: min(1500px, calc(100% - 42px));
  margin: 0 auto;
  padding: 22px 0 32px;
}

.pump-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 0 18px 18px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 11px;
  color: var(--muted);
  font-size: 12px;
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--cyan);
  outline: none;
}

.back-link svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.pump-heading h1 {
  margin: 0 0 8px;
  padding-left: 20px;
  border-left: 4px solid var(--teal);
  font-size: clamp(28px, 3vw, 43px);
  line-height: 1.1;
}

.pump-heading p {
  margin: 0 0 0 24px;
  color: var(--muted);
  font-size: 15px;
}

.free-explore-button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(87, 232, 255, 0.38);
  border-radius: 4px;
  background: rgba(87, 232, 255, 0.06);
  color: var(--cyan);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.free-explore-button:hover,
.free-explore-button:focus-visible {
  border-color: var(--cyan);
  outline: none;
}

.pump-workspace {
  display: grid;
  grid-template-columns: minmax(0, 2.15fr) minmax(345px, 0.95fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.viewer-column {
  min-width: 0;
  padding: 18px 20px 20px 0;
}

.viewer-frame {
  position: relative;
  min-height: clamp(460px, 58vh, 700px);
  overflow: hidden;
  border: 1px solid rgba(87, 232, 255, 0.32);
  border-radius: 14px;
  background:
    radial-gradient(circle at 52% 43%, rgba(18, 75, 99, 0.28), transparent 38%),
    linear-gradient(180deg, #071725, #030c15);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.38);
}

.viewer-frame::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0.4;
  background-image:
    linear-gradient(rgba(87, 232, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(87, 232, 255, 0.04) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: radial-gradient(circle, #000, transparent 76%);
}

#pumpCanvas {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.viewer-fallback-image {
  position: absolute;
  z-index: 1;
  inset: 12% 8%;
  width: 84%;
  height: 76%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 200ms ease;
}

.viewer-frame.is-fallback .viewer-fallback-image {
  opacity: 0.82;
}

.viewer-frame.is-fallback #pumpCanvas,
.viewer-frame.is-fallback .viewer-toolbar {
  display: none;
}

.viewer-loading {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: rgba(2, 9, 16, 0.88);
  color: var(--cyan);
  font-size: 13px;
  letter-spacing: 0.05em;
}

.viewer-loading span {
  width: 38px;
  height: 38px;
  border: 2px solid rgba(87, 232, 255, 0.22);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: loading-spin 900ms linear infinite;
}

.viewer-loading[hidden] {
  display: none;
}

.viewer-fallback-text {
  position: absolute;
  z-index: 5;
  right: 20px;
  bottom: 20px;
  left: 20px;
  display: none;
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(255, 189, 62, 0.45);
  background: rgba(35, 24, 7, 0.9);
  color: #ffe5a2;
  font-size: 13px;
}

.viewer-frame.is-fallback .viewer-fallback-text {
  display: block;
}

.viewer-hint {
  position: absolute;
  z-index: 5;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid rgba(145, 172, 185, 0.32);
  border-radius: 7px;
  background: rgba(2, 10, 18, 0.78);
  color: #c8d9df;
  pointer-events: none;
  font-size: 12px;
  backdrop-filter: blur(10px);
}

.viewer-hint svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.viewer-toolbar {
  position: absolute;
  z-index: 6;
  top: 12px;
  right: 12px;
  display: grid;
  width: 86px;
  overflow: hidden;
  border: 1px solid rgba(145, 172, 185, 0.4);
  border-radius: 9px;
  background: rgba(2, 10, 18, 0.86);
  backdrop-filter: blur(12px);
}

.viewer-toolbar button {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-height: 68px;
  padding: 8px 4px;
  border: 0;
  border-bottom: 1px solid rgba(145, 172, 185, 0.22);
  background: transparent;
  color: #c9d7dc;
  cursor: pointer;
  font-size: 10px;
  line-height: 1.15;
  text-align: center;
}

.viewer-toolbar button:last-child {
  border-bottom: 0;
}

.viewer-toolbar button:hover,
.viewer-toolbar button:focus-visible,
.viewer-toolbar button.active,
.viewer-toolbar button[aria-pressed="true"] {
  background: rgba(87, 232, 255, 0.12);
  color: var(--cyan);
  outline: none;
}

.viewer-toolbar svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tour-panel {
  min-width: 0;
  padding: 22px 0 22px 20px;
  border-left: 1px solid var(--line);
}

.tour-panel > header {
  padding: 0 5px 8px;
}

.tour-panel h2,
.section-heading h2 {
  margin: 0 0 8px;
  color: var(--teal);
  font: 800 16px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tour-panel > header p,
.section-heading p {
  margin: 0;
  color: #b1c2ca;
  font-size: 14px;
  line-height: 1.55;
}

.start-tour-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  width: 100%;
  min-height: 62px;
  margin: 8px 0 20px;
  border: 1px solid var(--cyan);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(13, 159, 196, 0.95), rgba(0, 102, 139, 0.94));
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(0, 147, 187, 0.18);
}

.start-tour-button:hover,
.start-tour-button:focus-visible {
  filter: brightness(1.12);
  outline: 2px solid rgba(87, 232, 255, 0.55);
  outline-offset: 2px;
}

.start-tour-button svg {
  width: 27px;
  height: 27px;
  fill: currentColor;
  stroke: currentColor;
  stroke-linejoin: round;
}

.chapter-list h3 {
  margin: 0 0 10px 5px;
  color: var(--teal);
  font: 800 14px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  text-transform: uppercase;
}

.chapter {
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: start;
  gap: 12px;
  width: 100%;
  min-height: 78px;
  margin-bottom: 8px;
  padding: 11px 13px;
  border: 1px solid rgba(145, 172, 185, 0.3);
  border-radius: 8px;
  background: rgba(6, 21, 34, 0.54);
  color: #dce9ed;
  cursor: pointer;
  text-align: left;
}

.chapter:hover,
.chapter:focus-visible,
.chapter.active {
  border-color: rgba(87, 232, 255, 0.65);
  background: rgba(10, 45, 61, 0.62);
  outline: none;
}

.chapter > span:first-child {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  color: var(--cyan);
  font: 700 17px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.chapter > span:last-child {
  display: grid;
  gap: 4px;
}

.chapter strong {
  font-size: 14px;
}

.chapter small {
  display: -webkit-box;
  overflow: hidden;
  color: #9db1bb;
  font-size: 11px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tour-player {
  margin-top: 18px;
  padding: 15px;
  border: 1px solid rgba(145, 172, 185, 0.3);
  border-radius: 8px;
  background: rgba(5, 17, 28, 0.7);
}

.time-row {
  display: flex;
  justify-content: space-between;
  color: #b4c4cb;
  font: 500 11px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

#tourProgress {
  width: 100%;
  margin: 11px 0 16px;
  accent-color: var(--cyan);
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-controls > button,
.player-controls fieldset button {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  border: 1px solid rgba(145, 172, 185, 0.32);
  border-radius: 6px;
  background: rgba(9, 27, 40, 0.72);
  color: #dce7eb;
  cursor: pointer;
}

.player-controls > button:hover,
.player-controls > button:focus-visible,
.player-controls fieldset button:hover,
.player-controls fieldset button:focus-visible,
.player-controls fieldset button.active {
  border-color: var(--cyan);
  color: var(--cyan);
  outline: none;
}

.player-controls .play-pause {
  width: 46px;
  height: 46px;
  border-radius: 50%;
}

.player-controls svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.player-controls .play-pause svg {
  fill: currentColor;
}

.player-controls fieldset {
  display: flex;
  gap: 5px;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
}

.player-controls legend {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip: rect(0 0 0 0);
}

.player-controls fieldset button {
  min-width: 43px;
  padding: 0 7px;
  font-size: 10px;
}

.scenario-section {
  padding: 24px 8px 0;
}

.section-heading {
  margin-bottom: 13px;
}

.scenario-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.scenario-option {
  display: grid;
  grid-template-columns: 47px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 90px;
  padding: 12px;
  border: 1px solid rgba(145, 172, 185, 0.32);
  border-radius: 9px;
  background: rgba(6, 21, 34, 0.58);
  color: #dce8ec;
  cursor: pointer;
  text-align: left;
}

.scenario-option:hover,
.scenario-option:focus-visible,
.scenario-option.active {
  border-color: var(--cyan);
  background: rgba(7, 39, 53, 0.72);
  outline: none;
}

.scenario-option > span:last-child {
  display: grid;
  gap: 4px;
}

.scenario-option strong {
  font-size: 12px;
}

.scenario-option small {
  color: #98adb7;
  font-size: 10px;
  line-height: 1.35;
}

.scenario-icon {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border: 1px dashed currentColor;
  border-radius: 50%;
}

.scenario-icon.water {
  color: var(--cyan);
}

.scenario-icon.warning {
  color: var(--warning);
}

.scenario-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scenario-warning {
  margin: 13px 0 0;
  padding: 11px 13px;
  border-left: 3px solid var(--warning);
  background: rgba(77, 49, 5, 0.32);
  color: #ffd889;
  font-size: 12px;
  line-height: 1.5;
}

.pump-precision-note {
  margin-top: 16px;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1180px) {
  .pump-workspace {
    grid-template-columns: 1fr;
  }

  .viewer-column {
    padding-right: 0;
  }

  .tour-panel {
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .chapter-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
  }

  .chapter-list h3 {
    grid-column: 1 / -1;
  }

  .chapter {
    grid-template-columns: 35px 1fr;
  }
}

@media (max-width: 800px) {
  .pump-app {
    width: min(100% - 24px, 700px);
    padding-top: 14px;
  }

  .pump-heading {
    align-items: start;
    padding-inline: 0;
  }

  .pump-heading h1 {
    padding-left: 14px;
    font-size: clamp(27px, 8vw, 35px);
  }

  .pump-heading p {
    margin-left: 18px;
  }

  .free-explore-button {
    display: none;
  }

  .viewer-frame {
    min-height: 490px;
  }

  .viewer-toolbar {
    top: auto;
    right: 10px;
    bottom: 10px;
    left: 10px;
    grid-template-columns: repeat(7, 1fr);
    width: auto;
    overflow-x: auto;
  }

  .viewer-toolbar button {
    min-width: 54px;
    min-height: 58px;
    border-right: 1px solid rgba(145, 172, 185, 0.22);
    border-bottom: 0;
  }

  .viewer-toolbar span {
    font-size: 9px;
  }

  .viewer-hint {
    right: 12px;
    left: 12px;
    justify-content: center;
  }

  .scenario-options,
  .chapter-list {
    grid-template-columns: 1fr 1fr;
  }

  .chapter-list h3 {
    grid-column: 1 / -1;
  }

  .chapter:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .viewer-frame {
    min-height: 455px;
  }

  .scenario-options,
  .chapter-list {
    grid-template-columns: 1fr;
  }

  .chapter:last-child {
    grid-column: auto;
  }

  .player-controls {
    flex-wrap: wrap;
  }

  .player-controls fieldset {
    width: 100%;
    margin: 5px 0 0;
  }

  .player-controls fieldset button {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .viewer-loading span {
    animation: none;
  }
}
