#demo .demo-console {
  min-width: 0;
  border-block: 1px solid var(--line);
  background: var(--bg);
}

#demo .tour-shell {
  min-width: 0;
  padding-block: 30px;
  color: var(--text);
}

#demo .tour-shell [hidden] {
  display: none !important;
}

#demo :is(.tour-paths, .tour-steps, .tour-controls) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#demo .tour-shell button {
  max-width: 100%;
  line-height: 1.4;
  touch-action: manipulation;
}

#demo :is(.tour-paths, .tour-steps, .tour-controls) button,
#demo :is(.tour-dialog-close, .tour-image-error button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: center;
  overflow-wrap: anywhere;
}

#demo .tour-paths button[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
}

#demo .tour-steps {
  gap: 4px 18px;
  margin-block: 18px 28px;
  padding-bottom: 1px;
  border-bottom: 1px solid var(--line);
}

#demo .tour-steps button {
  padding-inline: 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
}

#demo .tour-steps button[aria-current='step'] {
  border-bottom-color: var(--accent);
  color: var(--text);
}

#demo .tour-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  align-items: start;
  gap: 32px;
  min-width: 0;
}

#demo :is(.tour-stage-column, .tour-detail) {
  min-width: 0;
}

/* Keep the overlay on the image itself, never on a contain letterbox. */
#demo .tour-image-wrap {
  position: relative;
  isolation: isolate;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  line-height: 0;
  background: var(--surface);
  outline: 1px solid var(--line);
}

#demo .tour-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 620px;
  object-fit: contain;
}

/* The quota panel is a portrait source, not a landscape slide. */
#demo .tour-workbench:has(.tour-image[src*='/usage.webp']) {
  grid-template-columns: minmax(0, 440px) minmax(280px, 420px);
  justify-content: center;
}

#demo .tour-hotspots {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#demo .tour-hotspot-region {
  position: absolute;
  z-index: 1;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 1px var(--bg);
  pointer-events: none;
}

#demo .tour-hotspot {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  isolation: isolate;
}

#demo .tour-hotspot::before {
  position: absolute;
  z-index: -1;
  inset: 7px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 0 0 2px var(--bg);
  content: '';
}

#demo .tour-hotspot[aria-pressed='true'] {
  z-index: 3;
  color: var(--bg);
}

#demo .tour-hotspot[aria-pressed='true']::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent);
}

#demo .tour-hotspot-label {
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  width: max-content;
  max-width: 130px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  overflow-wrap: anywhere;
  transform: translateX(-50%);
  visibility: hidden;
  pointer-events: none;
}

#demo .tour-hotspot:is(:hover, :focus-visible, [aria-pressed='true']) .tour-hotspot-label {
  visibility: visible;
}

#demo .tour-caption {
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

#demo .tour-controls {
  margin-top: 14px;
}

#demo .tour-controls button {
  padding-inline: 12px;
  font-size: 12px;
}

#demo .tour-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#demo .tour-detail {
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

#demo .tour-detail-kicker {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: .1em;
  text-transform: uppercase;
}

#demo .tour-detail-title {
  margin: 0 0 12px;
  font-size: clamp(20px, 2vw, 25px);
  font-weight: 560;
  line-height: 1.3;
  letter-spacing: -.025em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

#demo .tour-detail-copy {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

#demo .tour-detail-image {
  display: block;
  width: 100%;
  height: clamp(180px, 22vw, 280px);
  margin-block: 22px;
  border: 1px solid var(--line);
  background: var(--surface);
}

#demo .tour-hotspot-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

#demo .tour-hotspot-list button {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 12px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-left: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  overflow-wrap: anywhere;
}

#demo .tour-hotspot-list button[aria-pressed='true'] {
  border-left-color: var(--accent);
  color: var(--accent);
}

#demo .tour-progress {
  margin-top: 18px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

#demo :is(.tour-image-loading, .tour-image-error) {
  padding: 32px 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  text-align: center;
  overflow-wrap: anywhere;
}

#demo .tour-image-wrap:has(.tour-image[hidden]) {
  width: 100%;
  min-height: 180px;
}

#demo .tour-image-wrap[aria-busy='true'] {
  cursor: progress;
}

#demo .tour-image-error button {
  margin: 14px auto 0;
}

#demo .tour-dialog {
  width: min(1500px, calc(100vw - 48px));
  max-width: none;
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: contain;
}

#demo .tour-dialog:not([open]) {
  display: none;
}

#demo .tour-dialog::backdrop {
  background: rgb(0 0 0 / 85%);
}

#demo .tour-dialog-bar {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

#demo .tour-dialog-title {
  min-width: 0;
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

#demo .tour-dialog-close {
  flex: 0 0 auto;
}

#demo .tour-dialog-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 140px);
  margin-inline: auto;
  object-fit: contain;
}

#demo .tour-shell button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

#demo .tour-hotspot:focus-visible {
  z-index: 4;
  outline-offset: 1px;
}

#demo .tour-shell button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

@media (hover: hover) {
  #demo :is(.tour-paths, .tour-steps, .tour-controls, .tour-hotspot-list) button:not(:disabled):hover,
  #demo :is(.tour-dialog-close, .tour-image-error button):not(:disabled):hover {
    border-color: var(--accent);
    color: var(--accent);
  }

  #demo .tour-paths button[aria-pressed='true']:hover {
    color: var(--bg);
  }
}

@media (max-width: 1100px) {
  #demo .tour-workbench {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
    gap: 24px;
  }

  #demo .tour-detail {
    padding-left: 20px;
  }

  #demo .tour-hotspot-label {
    display: none;
  }
}

@media (max-width: 800px) {
  #demo .tour-workbench,
  #demo .tour-workbench:has(.tour-image[src*='/usage.webp']) {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  #demo .tour-detail {
    padding: 24px 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  #demo .tour-detail-image {
    height: clamp(200px, 48vw, 320px);
  }

  #demo .tour-image {
    max-height: 520px;
  }
}

@media (max-width: 480px) {
  #demo .tour-shell {
    padding-block: 24px;
  }

  #demo .tour-paths {
    gap: 6px;
  }

  #demo .tour-paths button {
    flex: 1 1 130px;
    padding-inline: 10px;
  }

  #demo .tour-steps {
    gap: 4px 14px;
    margin-bottom: 22px;
  }

  #demo .tour-controls {
    gap: 6px;
  }

  #demo .tour-controls button {
    flex: 1 1 auto;
    padding-inline: 9px;
  }

  #demo .tour-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  #demo .tour-dialog-bar {
    gap: 10px;
    padding: 10px;
  }

  #demo .tour-dialog-image {
    max-height: calc(100dvh - 124px);
  }
}

@media (prefers-reduced-motion: reduce) {
  #demo .tour-shell *,
  #demo .tour-shell *::before {
    animation: none;
    transition: none;
    scroll-behavior: auto;
  }
}

@media (forced-colors: active) {
  #demo .tour-hotspot-region,
  #demo .tour-hotspot[aria-pressed='true']::before {
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }

  #demo .tour-paths button[aria-pressed='true'],
  #demo .tour-hotspot-list button[aria-pressed='true'],
  #demo .tour-steps button[aria-current='step'] {
    border-color: Highlight;
    color: Highlight;
  }
}
