:root {
  --cv-tourbar-height: 54px;
}

html {
  background: #100f0f;
}

body.tour-page {
  min-height: 100vh;
  background: radial-gradient(1000px 560px at 50% 0%, #26131a 0%, #100f0f 68%);
  color: var(--bone);
}

.tour-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.cv-tour-toolbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--cv-tourbar-height);
  padding: 0 14px;
  border-bottom: 2px solid #68011e;
  background: linear-gradient(180deg, #291017 0%, #190d11 100%);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.28);
}

.cv-tour-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  white-space: nowrap;
}

.cv-tour-home {
  color: var(--bone);
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
}

.cv-tour-home:hover,
.cv-tour-home:focus-visible {
  color: #fff;
  text-decoration: underline;
}

.cv-tour-left i {
  width: 1px;
  height: 22px;
  background: rgba(207, 116, 129, 0.28);
}

.cv-tour-left strong {
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.cv-tour-views {
  display: flex;
  flex: 1;
  justify-content: center;
  gap: 6px;
}

.cv-tour-views button {
  min-height: 32px;
  padding: 0.45rem 0.78rem;
  border: 1px solid rgba(207, 116, 129, 0.24);
  border-radius: 999px;
  background: transparent;
  color: #c8bbb8;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.cv-tour-views button:hover,
.cv-tour-views button:focus-visible {
  border-color: rgba(207, 116, 129, 0.65);
  color: #fff;
}

.cv-tour-views button.is-active {
  border-color: #8f1738;
  background: #8f1738;
  color: #fff4f1;
}

.cv-tour-picker {
  display: none;
  flex: 1;
  align-items: center;
  gap: 8px;
  color: #c8bbb8;
  font-size: 0.7rem;
  font-weight: 800;
}

.cv-tour-picker select {
  min-width: 150px;
  padding: 0.48rem 2rem 0.48rem 0.7rem;
  border: 1px solid rgba(207, 116, 129, 0.34);
  border-radius: 8px;
  background: #2a1219;
  color: var(--bone);
  font-size: 0.72rem;
  font-weight: 800;
}

.cv-tour-status {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.cv-tour-machine {
  padding: 0.4rem 0.62rem;
  border: 1px solid rgba(207, 116, 129, 0.45);
  border-radius: 999px;
  color: var(--bone);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.cv-tour-machine:hover,
.cv-tour-machine:focus-visible {
  border-color: var(--gold);
  color: #fff;
}

.cv-tour-status b {
  color: #fff;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cv-tour-status span {
  padding: 0.38rem 0.58rem;
  border: 1px solid rgba(207, 116, 129, 0.45);
  border-radius: 999px;
  color: var(--gold);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.cv-tour-stage {
  display: grid;
  grid-template-rows: auto auto;
  place-content: center;
  min-height: calc(100vh - var(--cv-tourbar-height));
  padding: 16px 16px 12px;
}

.cv-tour-shell {
  position: relative;
  width: min(1622px, calc(100vw - 32px), calc((100vh - 112px) * 1.6721649));
  aspect-ratio: 1622 / 970;
  overflow: hidden;
  border: 1px solid rgba(239, 197, 34, 0.25);
  border-radius: 7px;
  background: #f3ece4;
  box-shadow: 0 26px 76px rgba(0, 0, 0, 0.58);
  touch-action: none;
  user-select: none;
}

.cv-tour-shell .preview-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.cv-tour-note {
  margin: 9px 0 0;
  color: #8f8582;
  font-size: 0.7rem;
  text-align: center;
}

.cv-tour-hotspots,
.cv-tour-hotspots > section {
  position: absolute;
  z-index: 8;
  inset: 0;
  pointer-events: none;
}

.cv-tour-hotspots label,
.cv-tour-hotspots fieldset,
.cv-tour-hotspots button {
  position: absolute;
  margin: 0;
  padding: 0;
  border: 0;
  pointer-events: auto;
}

.cv-tour-hotspots label {
  border-radius: 50%;
  cursor: ns-resize;
  font-size: 0;
}

.cv-tour-hotspots label:hover,
.cv-tour-hotspots label:focus-within,
.cv-tour-hotspots fieldset:focus-within {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  background: rgba(239, 197, 34, 0.08);
}

.cv-tour-hotspots label::after,
.cv-tour-hotspots label output {
  position: absolute;
  bottom: calc(100% + 7px);
  display: none;
  min-height: 24px;
  padding: 0.28rem 0.48rem;
  background: #100f0f;
  color: var(--bone);
  font-size: clamp(8px, 0.72vw, 11px);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  text-transform: uppercase;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.45);
}

.cv-tour-hotspots label::after {
  right: 50%;
  content: attr(data-hotspot);
  border-radius: 6px 0 0 6px;
  color: #c9bebb;
}

.cv-tour-hotspots label output {
  left: 50%;
  border-radius: 0 6px 6px 0;
  color: var(--gold);
}

.cv-tour-hotspots label:hover::after,
.cv-tour-hotspots label:hover output,
.cv-tour-hotspots label:focus-within::after,
.cv-tour-hotspots label:focus-within output {
  display: block;
}

.cv-tour-hotspots input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0.002;
  cursor: ns-resize;
}

.cv-tour-hotspots fieldset {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: visible;
}

.cv-tour-hotspots fieldset legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.cv-tour-hotspots fieldset button,
.cv-tour-hotspots .scene-step {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  background: transparent;
  color: transparent;
  cursor: pointer;
  opacity: 0.01;
}

.cv-tour-hotspots fieldset button:focus-visible,
.cv-tour-hotspots .scene-step:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  opacity: 1;
}

/* Direct control hit areas live in the accepted 1622 by 970 screen geometry:
 * the tour positions every [data-hotspot] and .scene-step element from
 * static/js/tour/geometry.js HOTSPOTS at load, so hit areas can never drift
 * from the overlay geometry. Only their look is styled here. */
.cv-tour-hotspots .scene-step {
  position: absolute;
  border-radius: 8px;
}

@media (max-width: 1040px) {
  .cv-tour-views { display: none; }
  .cv-tour-picker { display: flex; justify-content: center; }
}

@media (max-width: 720px) {
  :root { --cv-tourbar-height: 50px; }
  .cv-tour-toolbar { gap: 8px; padding: 7px 9px; }
  .cv-tour-left { flex: 0 0 26px; }
  .cv-tour-home span:last-child { display: none; }
  .cv-tour-home { display: block; font-size: 1.1rem; }
  .cv-tour-left i,
  .cv-tour-left strong,
  .cv-tour-picker > span,
  .cv-tour-status span { display: none; }
  .cv-tour-picker { justify-content: flex-start; }
  .cv-tour-picker select { width: 100%; min-width: 108px; }
  .cv-tour-status { display: none; }
  .cv-tour-stage { min-height: 0; padding: 12px 6px 9px; }
  .cv-tour-shell { width: calc(100vw - 12px); }
  .cv-tour-note { max-width: calc(100vw - 24px); font-size: 0.62rem; }
}

@media (max-width: 720px) and (orientation: portrait) {
  .cv-tour-stage::before {
    content: "Rotate to landscape for the full control surface.";
    margin-bottom: 8px;
    color: var(--gold);
    font-size: 0.68rem;
    font-weight: 800;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cv-tour-toolbar,
  .cv-tour-hotspots * {
    transition: none !important;
  }
}
