/* Continuous tutorial presentation. Loaded after help.css; pose selection and
   playback/transition state belong to tutorial-controller.js and its adapter. */
.jsh-tutorial-editor-handle{position:fixed;z-index:2147483500;min-width:44px!important;min-height:44px!important;padding:4px 7px!important;border:2px solid #157d9d!important;border-radius:9px!important;background:#fff!important;color:#17354b!important;box-shadow:0 2px 8px #17354b30!important;touch-action:none;pointer-events:auto;font:650 11px/1.1 system-ui!important;cursor:move}
.jsh-tutorial-editor-handle[data-jase-editor-handle$="resize"]{cursor:nwse-resize;background:#eaf8fc!important}
.jsh-tutorial-editor-handle:focus-visible{outline:3px solid #ffb542;outline-offset:2px}
[data-jase-editor-pick-hover="true"]{outline:3px dashed #1385a4!important;outline-offset:4px!important}
#jsh-tour[data-continuous="true"][data-editor-editing="true"] #jsh-coach>.jsh-bubble{display:flex!important;visibility:visible!important;opacity:1!important;animation:none!important;transition:none!important}
#jsh-tour[data-editor-media="true"] #jsh-coach>.jsh-character,#jsh-tour[data-editor-media="true"] #jsh-coach>.jsh-bubble{visibility:hidden!important;pointer-events:none!important}
#jsh-tour .jsh-tutorial-video-panel{position:fixed;z-index:2147483400;width:min(560px,calc(100vw - 24px));transform:translateX(-50%);display:flex;flex-direction:column;gap:8px;padding:12px;border:1px solid var(--jsh-line);border-radius:16px;background:var(--jsh-paper);color:var(--jsh-ink);box-shadow:0 8px 30px #102e4133;overflow:auto;pointer-events:none;box-sizing:border-box}
#jsh-tour .jsh-tutorial-video-panel[hidden]{display:none}
#jsh-tutorial-video{display:block;width:100%;max-height:var(--jsh-video-height,45vh);object-fit:contain;background:#111;border-radius:8px;flex:0 1 auto;min-height:0}
#jsh-tutorial-video[hidden]{display:none}
.jsh-startup-status{position:fixed;z-index:2147483200;left:50%;top:calc(12px + env(safe-area-inset-top,0px));transform:translateX(-50%);box-sizing:border-box;width:min(420px,calc(100vw - 24px));padding:12px 16px;border:1px solid #cbd7df;border-radius:12px;background:#fff;color:#17354b;font:14px/1.45 system-ui;box-shadow:0 4px 20px #17354b20}
.jsh-startup-status p{margin:0 0 8px}.jsh-startup-status button{min-height:44px;margin-right:8px;padding:8px 12px;border:1px solid #b4c6d2;border-radius:8px;background:#fff;color:inherit;font:inherit}
#jsh-tour .jsh-dub-controls{display:grid;grid-template-columns:1fr 1fr;gap:8px;pointer-events:auto}
#jsh-tour .jsh-dub-controls[hidden]{display:none}
#jsh-tour .jsh-dub-controls label{display:grid;gap:3px;font:12px/1.3 system-ui}
#jsh-tour .jsh-dub-controls label:first-child{grid-column:1/-1}
#jsh-tour .jsh-dub-controls input{width:100%;min-width:0;min-height:44px;accent-color:#157d9d}
#jsh-tour .jsh-dub-controls button{min-height:44px;padding:8px;border:1px solid var(--jsh-line);border-radius:10px;background:var(--jsh-paper);color:var(--jsh-ink);font:inherit}
#jsh-tour .jsh-dub-controls :focus-visible,.jsh-startup-status button:focus-visible{outline:3px solid #157d9d;outline-offset:2px}
#jsh-video-transcript{white-space:pre-wrap;overflow:auto;max-height:100px;margin:0;font-size:14px}
#jsh-video-status{font-size:12px;margin:0}
#jsh-video-transcript [data-speaking="true"],#jsh-step-body [data-speaking="true"]{background:#fff0bb;color:#143b4e;border-radius:3px;text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:3px}
#jsh-tour .jsh-video-controls{display:flex;flex-wrap:wrap;gap:6px;pointer-events:auto}
#jsh-tour .jsh-video-controls button{min-height:44px;padding:8px 12px;border:1px solid var(--jsh-line);border-radius:10px;background:var(--jsh-paper);color:var(--jsh-ink);font:inherit;cursor:pointer}
#jsh-tour .jsh-video-controls button:focus-visible{outline:3px solid #157d9d;outline-offset:2px}
#jsh-tour:not([data-continuous="true"]) #jsh-tutorial-controls { display: none; }
#jsh-tour[data-continuous="true"] {
  --jsh-character-size: 160px;
  --jsh-control-size: 44px;
  --jsh-screen-gutter: 12px;
  --jsh-fade-ms: 160ms;
}

#jsh-tour[data-continuous="true"] #jsh-coach {
  display: grid;
  grid-template-columns: var(--jsh-character-size) minmax(0, 1fr);
  grid-template-areas: "character bubble";
  align-items: end;
  justify-items: stretch;
  width: min(600px, calc(100vw - 2 * var(--jsh-screen-gutter)));
  max-width: calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 2 * var(--jsh-screen-gutter));
  gap: 8px 12px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}

#jsh-tour[data-continuous="true"] #jsh-coach > .jsh-character {
  grid-area: character;
  justify-self: center;
  align-self: end;
  width: var(--jsh-character-size);
  height: calc(var(--jsh-character-size) * 1.2);
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0 !important;
  background: transparent;
  box-shadow: none;
}

#jsh-tour[data-continuous="true"] #jsh-coach > .jsh-character > .jsh-bob {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: 0;
  background-color: transparent;
  background-image: var(--jsh-pose-src, none);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center bottom;
  transform: none;
  filter: drop-shadow(0 4px 5px #102e411a);
  animation: none;
}

#jsh-tour[data-continuous="true"] #jsh-coach > .jsh-bubble {
  grid-area: bubble;
  align-self: end;
  min-width: 0;
  width: 100%;
  max-height: min(var(--jsh-bubble-max-height, 340px), calc(100dvh - 88px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
  padding: 12px 15px 14px;
  border-radius: 18px 18px 18px 6px;
  opacity: 1;
  visibility: visible;
  transition: none;
}

#jsh-tour[data-continuous="true"] #jsh-coach[data-bubble="fading"] > .jsh-bubble {
  animation: jsh-tutorial-bubble-out var(--jsh-fade-ms) linear both;
  pointer-events: none;
}

#jsh-tour[data-continuous="true"] #jsh-coach[data-paused="true"] > .jsh-bubble {
  animation-play-state: paused;
}

#jsh-tour[data-continuous="true"] #jsh-coach[data-bubble="hidden"] {
  grid-template-areas: "character bubble";
}

#jsh-tour[data-continuous="true"] #jsh-coach[data-bubble="hidden"] > .jsh-bubble {
  display: flex;
  pointer-events: auto;
}

/* Tutorial actions live inside the bubble's three-dot menu. */
#jsh-tour[data-continuous="true"] #jsh-tutorial-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--jsh-ink);
  box-shadow: none;
  pointer-events: auto;
}
#jsh-tour[data-continuous="true"] #jsh-coach .jsh-coach-options > :not(#jsh-tutorial-controls) { display: none !important; }

#jsh-tour[data-continuous="true"] #jsh-tutorial-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: var(--jsh-control-size);
  min-height: var(--jsh-control-size);
  width: var(--jsh-control-size);
  height: var(--jsh-control-size);
  margin: 0;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 999px !important;
  background: transparent;
  color: inherit;
  font-size: 12px;
  line-height: 1.25;
  font-weight: 700;
  white-space: nowrap;
  touch-action: manipulation;
}

#jsh-tour[data-continuous="true"] #jsh-tutorial-controls button:hover {
  background: var(--jsh-soft);
  border-color: var(--jsh-line);
}

#jsh-tour[data-continuous="true"] #jsh-tutorial-controls button:focus-visible,
#jsh-tour[data-continuous="true"] [data-written-ack]:focus-visible {
  outline: 3px solid #087b9a !important;
  outline-offset: 2px;
}

#jsh-tour[data-continuous="true"] #jsh-tutorial-controls svg {
  display: block;
  width: 19px;
  height: 19px;
  flex: none;
}

#jsh-tour[data-continuous="true"] #jsh-coach #jsh-audio-toggle,
#jsh-tour[data-continuous="true"] #jsh-coach #jsh-coach-minimize { display: none; }
#jsh-tour:not([data-continuous="true"]) #jsh-tutorial-mute { display: none; }
#jsh-tour[data-continuous="true"] #jsh-tutorial-mute,
#jsh-tour[data-continuous="true"] #jsh-coach-expand { width: var(--jsh-control-size); min-width: var(--jsh-control-size); height: var(--jsh-control-size); min-height: var(--jsh-control-size); }
#jsh-tour[data-continuous="true"] #jsh-coach[data-bubble="hidden"] .jsh-bubble-scroll > :not(.jsh-coach-options),
#jsh-tour[data-continuous="true"] #jsh-coach[data-bubble="hidden"] .jsh-step-footer { display: none; }
#jsh-tour[data-continuous="true"] #jsh-coach[data-bubble="hidden"] .jsh-bubble-scroll:not(:has(.jsh-coach-options:not([hidden]))) { display: none; }

#jsh-tour[data-continuous="true"] #jsh-coach #jsh-next,
#jsh-tour[data-continuous="true"] #jsh-step-number,
#jsh-tour[data-continuous="true"] #jsh-step-count,
#jsh-tour[data-continuous="true"] #jsh-step-progress,
#jsh-tour[data-continuous="true"] .jsh-progress {
  display: none !important;
}

#jsh-tour[data-continuous="true"] #jsh-coach [data-written-ack] {
  min-height: 44px;
  padding: 9px 12px;
  font-size: 13px;
  white-space: normal;
}

/* Only a small hand, never a second character, marks a named control. */
#jsh-tour[data-continuous="true"] #jsh-pointer .jsh-bob {
  display: none !important;
  background-image: none !important;
}

#jsh-tour[data-continuous="true"] #jsh-pointer svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  pointer-events: none;
}

#jsh-tour[data-continuous="true"] #jsh-spotlight {
  animation: none;
}

/* The welcome placement is calculated against the visual viewport by the
   adapter. A vertical stack keeps the message above the laptop character. */
#jsh-tour[data-continuous="true"] #jsh-coach[data-welcome="true"] {
  --jsh-character-size: clamp(190px, 22vw, 270px);
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "bubble" "character" "controls";
  justify-items: center;
  gap: 7px;
  width: min(560px, calc(100vw - 2 * var(--jsh-screen-gutter)));
}

#jsh-tour[data-continuous="true"] #jsh-coach[data-welcome="true"] > .jsh-character {
  height: var(--jsh-character-size);
}

#jsh-tour[data-continuous="true"] #jsh-coach[data-welcome="true"] > .jsh-bubble {
  border-radius: 18px;
  max-height: min(var(--jsh-bubble-max-height, 310px), calc(100dvh - var(--jsh-character-size) - 90px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
}

#jsh-tour[data-continuous="true"] #jsh-coach[data-welcome="true"] > .jsh-bubble::before {
  left: calc(50% - 7px);
  bottom: -8px;
  transform: rotate(-45deg);
}

/* Used only when the mapped speaking/up pose has a target directly above. */
#jsh-tour[data-continuous="true"] #jsh-coach[data-bubble-placement="below"] {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "character" "bubble" "controls";
  justify-items: center;
}

#jsh-tour[data-continuous="true"] #jsh-coach[data-bubble-placement="below"] > .jsh-bubble {
  border-radius: 18px;
}

#jsh-tour[data-continuous="true"] #jsh-coach[data-bubble-placement="below"] > .jsh-bubble::before {
  top: -8px;
  bottom: auto;
  left: calc(50% - 7px);
  transform: rotate(135deg);
}

/* The same actor remains in the coach. During practice the launcher is a
   plain resume control, not a separate bottom-corner chatbot. */
body[data-jase-tutorial="true"] .jsh-bob {
  display: none !important;
  background-image: none !important;
}

body[data-jase-tutorial="true"] #jsh-tour[data-continuous="true"] #jsh-coach > .jsh-character > .jsh-bob {
  display: block !important;
  background-image: var(--jsh-pose-src, none) !important;
}

body[data-jase-tutorial="true"] #jsh-launcher,
body[data-jase-tutorial="true"] #jsh-launcher[data-minimized="true"] {
  width: auto;
  min-width: 44px;
  max-width: calc(100vw - 24px);
  height: auto;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--jsh-line, #ccdeeb);
  border-radius: 999px !important;
  background: var(--jsh-paper, #fff);
  color: var(--jsh-ink, #132b40);
  box-shadow: 0 3px 12px #102e411a;
  animation: none;
}

body[data-jase-tutorial="true"] #jsh-launcher [data-launcher-label] {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  white-space: normal;
  font-size: 12px;
}

body[data-jase-tutorial="true"].jsh-guidance-open #jsh-launcher,
body[data-jase-tutorial="true"] #jsh-launcher-hint {
  display: none !important;
}

@keyframes jsh-tutorial-bubble-out {
  from { opacity: var(--jsh-fade-from, 1); }
  to { opacity: 0; }
}

@media (max-width: 899px) {
  #jsh-tour[data-continuous="true"] { --jsh-character-size: 112px; }
}

@media (max-width: 520px) {
  #jsh-tour[data-continuous="true"] { --jsh-character-size: 80px; --jsh-screen-gutter: 10px; }
  #jsh-tour[data-continuous="true"] #jsh-coach { gap: 7px; }
  #jsh-tour[data-continuous="true"] #jsh-coach > .jsh-bubble { padding: 10px 12px; }
  #jsh-tour[data-continuous="true"] #jsh-coach #jsh-step-body { font-size: 13px; line-height: 1.5; }
  #jsh-tour[data-continuous="true"] #jsh-coach[data-welcome="true"] { --jsh-character-size: 160px; }
  #jsh-tour[data-continuous="true"] #jsh-tutorial-controls { gap: 2px; padding: 3px; }
  #jsh-tour[data-continuous="true"] #jsh-tutorial-controls button { padding: 8px; }
}

@media (max-height: 560px) {
  #jsh-tour[data-continuous="true"] { --jsh-character-size: 76px; }
  #jsh-tour[data-continuous="true"] #jsh-coach[data-welcome="true"] { --jsh-character-size: 112px; }
  #jsh-tour[data-continuous="true"] #jsh-coach > .jsh-bubble { max-height: min(var(--jsh-bubble-max-height, 220px), calc(100dvh - 86px)); }
}

@media (prefers-reduced-motion: reduce) {
  #jsh-tour[data-continuous="true"] #jsh-coach,
  #jsh-tour[data-continuous="true"] #jsh-coach *,
  #jsh-tour[data-continuous="true"] #jsh-pointer,
  #jsh-tour[data-continuous="true"] #jsh-spotlight {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
