/* Presentation controls are separate from the interactive BM screens. */
.banner-tour {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-width: 0; min-height: 34px; padding: 3px 4px; border: 0;
  font-size: 12px; color: var(--text); white-space: nowrap;
}
.banner-tour svg { width: 13px; height: 13px; color: var(--accent); fill: color-mix(in srgb,var(--accent) 25%,transparent); }
.banner-tour:hover { color: var(--accent); }
.tour-profile-replay { margin: 0 0 8px; display: flex; justify-content: center; align-items: center; gap: 7px; color: var(--accent); }
.tour-profile-replay svg { width: 17px; height: 17px; }
.general-fields { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 10px 0 16px; }
.general-fields label { min-width: 0; display: block; font-size: 13px; color: var(--muted); font-weight: var(--bm-weight-semibold); }
.general-fields input { display: block; margin-top: 6px; min-height: 44px; font-size: 15px; padding: 8px 10px; font-weight: var(--bm-weight-normal); }

body.tour-open { overflow: hidden; overscroll-behavior: none; }
.bm-tour {
  position: fixed; inset: 0; width: 100%; max-width: none; height: 100vh; height: 100dvh;
  max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; overflow: hidden;
  color: var(--text); background: var(--bg);
}
.bm-tour[open] { display: block; }
.bm-tour::backdrop { background: var(--bg); }
.tour-shell {
  width: 100%; max-width: 1050px; height: 100%; display: grid; margin: auto;
  grid-template-rows: auto auto minmax(0,1fr) auto; gap: 5px;
  padding: max(8px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(9px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
}
.tour-header,.tour-header-brand,.tour-controls,.tour-transport { display: flex; align-items: center; }
.tour-header,.tour-controls { justify-content: space-between; gap: 8px; }
.tour-header-brand { min-width: 0; gap: 10px; }
.tour-logo {
  display: block; flex: 0 0 94px; height: 29px;
  background: url('./assets/portrait.jpg') no-repeat -17.5px -24px / 394px auto;
  filter: grayscale(1) contrast(1.7); mix-blend-mode: screen;
}
html[data-theme="light"] .tour-logo { filter: grayscale(1) invert(1); mix-blend-mode: multiply; }
.tour-header-detail { color: var(--muted); font-size: 12px; }
.tour-skip { min-height: 36px; border-radius: 11px; padding: 4px 10px; font-size: 13px; color: var(--accent); }
.tour-steps { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 5px; }
.tour-step { display: flex; align-items: center; width: 100%; min-height: 12px; height: 12px; border: 0; border-radius: 5px; padding: 0; }
.tour-step-track { position: relative; display: block; width: 100%; height: 3px; border-radius: 4px; background: var(--line); overflow: hidden; }
.tour-step[aria-current="step"] .tour-step-track { background: color-mix(in srgb,var(--accent) 32%,var(--line)); }
.tour-step-fill { position: absolute; inset: 0; transform-origin: left center; transform: scaleX(var(--tour-fill,0)); background: var(--accent); border-radius: inherit; }
.tour-story { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr); gap: 6px; }
.tour-caption { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: baseline; gap: 4px 11px; padding: 0 2px; min-width: 0; }
.tour-caption h1 { font-size: clamp(17px,4.8vw,22px); line-height: 1.16; margin: 0; letter-spacing: -.025em; }
.tour-kicker { color: var(--accent); margin: 0; font-size: 12px; line-height: 1.2; font-weight: var(--bm-weight-semibold); white-space: nowrap; }
#tourSection { display: none; }
.tour-text { margin: 0; grid-column: 1/-1; font-size: 14px; line-height: 1.4; }
@media (max-width: 739px) and (orientation: portrait) {
  .bm-tour:not(.show-transcript) .tour-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
.tour-stage { position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; container-type: size; isolation: isolate; }
.tour-phone {
  --handset-width: min(calc(100cqw - 9px),60cqh,414px);
  position: relative; width: var(--handset-width); height: min(100cqh,calc(var(--handset-width) * 2.12));
  padding: 4px; border: 1px solid #66666a; border-radius: clamp(29px,9cqw,49px);
  background: linear-gradient(113deg,#aaaaad 0%,#4c4d50 10%,#212224 27%,#494a4d 62%,#8d8e91 90%,#363639);
  box-shadow: inset 0 0 0 1px #ffffff42, 0 0 0 1px #050506, 0 6px 13px #0005;
}
.phone-keys { position: absolute; left: -3px; top: 24%; width: 2px; height: 6%; border-radius: 2px 0 0 2px; background: linear-gradient(#76777b,#3e3e41); box-shadow: 0 30px 0 #515155; }
.tour-phone::after { content: ''; position: absolute; top: 32%; right: -3px; height: 10%; width: 2px; border-radius: 0 2px 2px 0; background: linear-gradient(#797a7e,#3d3d40); }
.phone-glass {
  height: 100%; width: 100%; display: grid; grid-template-rows: clamp(25px,6.6cqw,32px) minmax(0,1fr) 12px;
  overflow: hidden; border: 3px solid #080809; border-radius: inherit; background: var(--bg); box-shadow: 0 0 0 1px #111;
}
.phone-status { position: relative; display: flex; align-items: center; justify-content: space-between; background: var(--bg); padding: 0 7.5%; line-height: 1; }
.phone-status>span { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.phone-status>svg { width: 44px; height: 12px; }
.phone-camera { position: absolute; inset-inline-start: 50%; top: 50%; transform: translate(-50%,-50%); width: 17%; height: 55%; max-height: 19px; border-radius: 20px; background: #030304; box-shadow: inset 0 0 0 1px #19191d; }
.phone-camera::after { content: ''; position: absolute; right: 12%; top: 32%; height: 36%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%,#414557,#161923 53%,#090a0d 75%); }
.phone-display { position: relative; min-height: 0; min-width: 0; overflow: hidden; background: var(--bg); }
.phone-display iframe { display: block; position: absolute; inset: 0 auto auto 0; width: 100%; height: 100%; border: 0; transform-origin: top left; pointer-events: none; background: var(--bg); }
.phone-home { display: grid; place-items: center; background: var(--bg); }
.phone-home span { height: 3px; width: 25%; max-width: 104px; background: var(--text); opacity: .76; border-radius: 5px; }
.tour-footer { min-width: 0; }
.tour-audio-notice { margin: 0 0 4px; font-size: 12px; line-height: 1.3; color: var(--muted); }
.tour-transport { gap: 5px; }
.tour-icon-button,.tour-voice-button,.tour-next { height: 44px; min-height: 44px; border-radius: 11px; touch-action: manipulation; }
.tour-icon-button { display: grid; place-items: center; width: 41px; padding: 0; }
.tour-icon-button svg { width: 18px; height: 18px; }
.tour-voice-button { display: inline-flex; gap: 5px; align-items: center; justify-content: center; padding: 4px 9px; font-size: 12px; white-space: nowrap; }
.tour-voice-button svg { width: 17px; height: 17px; }
.tour-voice-button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb,var(--accent) 8%,var(--bg)); }
.tour-next { flex: 1; max-width: 300px; min-width: 0; padding: 3px 8px; font-size: 14px; line-height: 1.13; }
@media (min-width: 740px), (orientation: landscape) and (min-width: 540px) {
  .tour-shell { gap: 8px; padding: max(12px,env(safe-area-inset-top)) max(25px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(25px,env(safe-area-inset-left)); }
  .tour-logo { flex-basis: 114px; height: 34px; background-size: 476px auto; background-position: -21px -29px; }
  .tour-story { grid-template: minmax(0,1fr) / minmax(0,.92fr) minmax(0,1fr); align-items: center; gap: clamp(16px,5vw,75px); }
  .tour-stage { align-self: stretch; }
  .tour-phone { --handset-width: min(calc(100cqw - 10px),52cqh,402px); border-radius: min(10cqw,49px); }
  .tour-caption { display: block; }
  .tour-kicker { font-size: 14px; margin-bottom: 12px; }
  #tourSection { display: inline; }
  #tourSection::before { content: ' · '; }
  .tour-caption h1 { font-size: clamp(26px,4vw,47px); letter-spacing: -.04em; max-width: 17ch; margin: 0 0 14px; }
  .tour-text { font-size: clamp(16px,1.55vw,19px); line-height: 1.5; max-width: 38ch; }
  .tour-header-detail { font-size: 13px; }
}
@media (max-height: 465px) and (orientation: landscape) {
  .tour-shell { grid-template: auto minmax(0,1fr) auto / minmax(0,1fr) minmax(0,1fr); gap: 4px 16px; }
  .tour-header { grid-row: 1; grid-column: 1; }
  .tour-steps { grid-row: 1; grid-column: 2; align-self: center; }
  .tour-story { grid-row: 2; grid-column: 1/-1; gap: 12px; }
  .tour-caption h1 { font-size: 24px; }
  .tour-controls { gap: 6px; }
  .tour-footer { grid-row: 3; grid-column: 1/-1; }
  .tour-phone { --handset-width: min(calc(100cqw - 8px),62cqh,402px); padding: 2px; border-radius: 26px; }
  .phone-glass { grid-template-rows: 18px minmax(0,1fr) 7px; border-width: 2px; }
  .phone-status>span { font-size: 9px; }
}
@media(max-width: 350px) {
  .tour-shell { padding-inline: 8px; }
  .tour-caption { column-gap: 7px; }
  .tour-transport { gap: 3px; }
  .tour-icon-button { width: 36px; }
  .tour-voice-button { padding-inline: 6px; }
}

/* Only the recording viewport gets handset chrome. All page content uses
   the same mobile stylesheet and renderers as the independently usable app. */
html:has(body.tour-handset-ui) { height: 100%; min-height: 0; overflow: hidden; }
body.tour-handset-ui {
  --banner-height: 0px; --safe-bottom: 0px;
  display: grid; grid-template-rows: minmax(0,1fr) auto auto; width: 100%; height: 100vh; min-height: 0; overflow: hidden;
}
.phone-scroll { grid-row: 1; min-height: 0; min-width: 0; overflow: hidden auto; scrollbar-width: none; overscroll-behavior: contain; overflow-anchor: none; }
.phone-scroll::-webkit-scrollbar { display: none; }
.tour-handset-ui #app { min-height: 100%; padding-bottom: 20px; }
.tour-handset-ui .clientnav { grid-row: 3; position: static; transform: none; width: 100%; border-width: 1px 0 0; border-radius: 0; padding: 3px 2px 1px; }
.tour-handset-ui .rest-dock { grid-row: 2; position: static; transform: none; width: 100%; }
.tour-handset-ui .clientnav button { min-height: 46px; }
.tour-handset-ui .workout-top { top: 0; }
.tour-handset-ui .workout-matrix-header { position: sticky; z-index: 8; top: var(--running-title-height,64px); background: var(--matrix-surface,var(--card)); }
.tour-handset-ui input.phone-field-current { outline: 2px solid var(--accent); outline-offset: -2px; }
.tour-handset-ui .measure-grid { table-layout: fixed; min-width: 0; width: 100%; }
.tour-handset-ui .measure-grid :is(th,td) { min-width: 0; max-width: none; font-size: 11px; text-align: center; padding: 6px 1px; line-height: 1.25; }
.tour-handset-ui .measure-grid th:first-child { position: static; width: 28%; min-width: 0; max-width: none; box-shadow: none; text-align: left; padding-inline: 5px; white-space: normal; overflow-wrap: anywhere; }
.tour-handset-ui .measure-grid thead th { font-size: 10px; }
.tour-handset-ui .measure-grid-total small { display: none; }
.phone-touch { position: fixed; z-index: 40; pointer-events: none; transform: translate(-50%,-50%); width: 17px; height: 17px; background: #fffc; border: 1.5px solid #fff; box-shadow: 0 1px 4px #0009; border-radius: 100%; }
.phone-touch::before { content: ''; position: absolute; inset: -10px; background: color-mix(in srgb,var(--accent) 20%,transparent); border: 2px solid var(--accent); border-radius: 50%; transform: scale(var(--halo,1)); }
.phone-touch.is-swipe::before { inset: -6px; }
.tour-events { display: grid; gap: 0; }
.tour-event { display: grid; grid-template-columns: 35px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tour-event:last-child { border-bottom: 0; }
.tour-event-icon { width: 35px; height: 35px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb,var(--accent) 12%,var(--card)); color: var(--accent); }
.tour-event-icon svg { width: 16px; height: 16px; }
.tour-event strong { display: block; font-size: 14px; line-height: 1.25; }
.tour-event small { display: block; margin-top: 4px; font-size: 11px; line-height: 1.3; }
.tour-event>b { color: var(--accent); font-size: 13px; font-weight: var(--bm-weight-bold); font-variant-numeric: tabular-nums; }
