/* ThermaTech 3D tutorial: minimal player over the system studio. */
html.tt-shell {
  --tt-bar: calc(52px + env(safe-area-inset-bottom));
  --tt-red: #e0453a;
  --tt-ink: #0d1517;
}

html.tt-shell body {
  margin: 0;
  background: var(--tt-ink);
}

html.tt-shell .system-studio {
  height: 100dvh;
  min-height: 0;
  background: #c5cdc8;
}

/* While the tutorial plays, the control row sits under the model, never on it. */
html.tt-shell.tt-playing,
html.tt-shell.tt-playing body {
  height: 100%;
  overflow: hidden;
}

html.tt-shell.tt-playing .system-studio {
  height: calc(100dvh - var(--tt-bar)) !important;
  max-height: calc(100dvh - var(--tt-bar));
  overflow: hidden;
}

html.tt-shell .studio-stage,
html.tt-shell .studio-canvas {
  flex: 1;
  min-height: 0 !important;
}

html.tt-shell.tt-playing .studio-stage,
html.tt-shell.tt-playing .studio-canvas {
  height: 100% !important;
  max-height: none;
}

/* Everything the studio draws around the model is replaced by the player. */
html.tt-shell .studio-masthead,
html.tt-shell .system-tabs,
html.tt-shell .studio-visibility,
html.tt-shell .studio-mode-switch,
html.tt-shell .studio-mobile-lesson,
html.tt-shell .studio-footer,
html.tt-shell .studio-experience-bar,
html.tt-shell .studio-audio-bar,
html.tt-shell .studio-audio-status,
html.tt-shell .studio-bottom,
html.tt-shell .studio-voice-notice,
html.tt-shell .studio-welcome-card,
html.tt-shell .studio-panel-handle,
html.tt-shell .studio-journeys,
html.tt-shell .studio-detail,
html.tt-shell .studio-reset-view,
html.tt-shell .studio-completion,
html.tt-shell .studio-source-links,
html.tt-shell .appearance-toggle {
  display: none !important;
}

html.tt-shell .studio-loading {
  background:
    linear-gradient(180deg, rgba(10, 18, 20, 0.25), rgba(10, 18, 20, 0.6)),
    url('/walkthrough/poster.webp') center/cover;
  color: #f4f7f4;
  font-family: Arial, Helvetica, sans-serif;
}

/* Start screen: one big play button. */
.tt-welcome,
.tt-boot-loading {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 20px;
  text-align: center;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(8, 14, 16, 0.2) 0%, rgba(8, 14, 16, 0.62) 100%),
    url('/walkthrough/poster.webp') center/cover no-repeat;
  font-family: Arial, Helvetica, sans-serif;
}

.tt-welcome[hidden],
.tt-boot-loading[hidden],
.tt-player[hidden],
.tt-menu[hidden],
.tt-sound[hidden],
.tt-ic[hidden] {
  display: none !important;
}

.tt-start {
  appearance: none;
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--tt-ink);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35), 0 0 0 6px rgba(255, 255, 255, 0.18);
  cursor: pointer;
}

.tt-start svg {
  width: 44px;
  height: 44px;
  margin-left: 5px;
  color: var(--tt-red);
}

.tt-start:focus-visible,
.tt-link:focus-visible,
.tt-ic:focus-visible,
.tt-menu button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.tt-start-title {
  margin: 8px 0 0;
  max-width: 560px;
  font-size: clamp(20px, 3.2vw, 30px);
  line-height: 1.2;
  font-weight: 700;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

.tt-start-sub {
  margin: 0;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.tt-link {
  appearance: none;
  border: 0;
  padding: 6px 2px;
  background: none;
  color: #fff;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.tt-boot-loading p {
  margin: 0;
  font-size: 18px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

/* Player */
.tt-player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  font-family: Arial, Helvetica, sans-serif;
  color: #fff;
}

/* Caption: a thin translucent strip on the bottom edge of the model. */
.tt-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 7px 16px;
  background: linear-gradient(180deg, rgba(8, 12, 14, 0.38), rgba(8, 12, 14, 0.58));
  border-left: 3px solid var(--tt-red);
  pointer-events: none;
}

.tt-caption {
  flex: 1;
  min-width: 0;
  max-width: 920px;
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.tt-cap:has(.tt-caption:empty):has(.tt-sound[hidden]) {
  display: none;
}

.tt-sound {
  pointer-events: auto;
  flex: none;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  background: var(--tt-red);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.tt-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 52px;
  padding: 0 calc(8px + env(safe-area-inset-right)) env(safe-area-inset-bottom) calc(8px + env(safe-area-inset-left));
  box-sizing: content-box;
  background: var(--tt-ink);
}

.tt-ic {
  appearance: none;
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.tt-ic svg {
  width: 22px;
  height: 22px;
}

.tt-ic:hover {
  background: rgba(255, 255, 255, 0.12);
}

.tt-play {
  width: 44px;
  height: 44px;
}

.tt-play svg {
  width: 26px;
  height: 26px;
}

.tt-sys {
  width: auto;
  height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.tt-scrub {
  position: relative;
  flex: 1;
  min-width: 60px;
  height: 40px;
  display: flex;
  align-items: center;
  margin: 0 6px;
}

.tt-ticks {
  position: absolute;
  left: 7px;
  right: 7px;
  top: 50%;
  height: 8px;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 1;
}

.tt-ticks i {
  position: absolute;
  top: 0;
  width: 2px;
  height: 8px;
  margin-left: -1px;
  background: rgba(13, 21, 23, 0.85);
}

.tt-scrub input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 40px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  --pct: 0%;
}

.tt-scrub input[type='range']::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--tt-red) 0, var(--tt-red) var(--pct), rgba(255, 255, 255, 0.28) var(--pct));
}

.tt-scrub input[type='range']::-moz-range-track {
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--tt-red) 0, var(--tt-red) var(--pct), rgba(255, 255, 255, 0.28) var(--pct));
}

.tt-scrub input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 2;
}

.tt-scrub input[type='range']::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border: 0;
  border-radius: 50%;
  background: #fff;
}

.tt-scrub input[type='range']:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.tt-left {
  flex: none;
  min-width: 46px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.85);
  text-align: right;
  margin-right: 4px;
}

/* One menu: steps and voice. */
.tt-menu {
  position: absolute;
  right: calc(8px + env(safe-area-inset-right));
  bottom: calc(100% + 8px);
  width: min(320px, calc(100vw - 16px));
  max-height: min(62vh, 440px);
  overflow: auto;
  box-sizing: border-box;
  padding: 6px;
  border-radius: 12px;
  background: rgba(13, 21, 23, 0.97);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  z-index: 3;
}

.tt-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 6px 10px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.tt-voice {
  appearance: none;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.tt-voice[aria-pressed='true'] {
  background: rgba(255, 255, 255, 0.14);
}

.tt-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: tt-step;
}

.tt-steps li {
  counter-increment: tt-step;
}

.tt-steps button {
  appearance: none;
  display: flex;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 14px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.tt-steps button::before {
  content: counter(tt-step);
  flex: none;
  width: 1.6em;
  color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
}

.tt-steps button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.tt-steps button[aria-current] {
  background: rgba(224, 69, 58, 0.22);
  font-weight: 700;
}

.tt-steps button[aria-current]::before {
  color: var(--tt-red);
}

/* World callouts stay, but smaller so they do not crowd the model. */
html.tt-shell .studio-world-callout {
  font-size: 12px;
}

@media (max-width: 600px) {
  html.tt-shell {
    --tt-bar: calc(48px + env(safe-area-inset-bottom));
  }
  .tt-bar {
    height: 48px;
    gap: 2px;
    padding-left: calc(4px + env(safe-area-inset-left));
    padding-right: calc(4px + env(safe-area-inset-right));
  }
  .tt-ic {
    width: 38px;
    height: 38px;
  }
  .tt-sys {
    height: 26px;
    padding: 0 8px;
    font-size: 11px;
  }
  .tt-left {
    min-width: 40px;
    font-size: 12px;
  }
  .tt-scrub {
    margin: 0 4px;
  }
  .tt-cap {
    padding: 5px 10px 6px 12px;
  }
  .tt-caption {
    font-size: 14px;
    line-height: 1.3;
  }
  .tt-start {
    width: 76px;
    height: 76px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tt-start {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  }
}
