/* ---------- the first-run tour (/welcome) ---------- */

/* No status line (model, library, / for commands) while touring: the chips say what to do. */
body.touring #meta, body.touring #appbox { display: none; }

/* Example chips under the message box, on the empty screen only. */
#onboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  animation: onboard-in 0.6s var(--ease) both;
}
/* Kept under an opened app too, so the other examples stay one click away; only the tutorial hides them. */
body.tutoring #app.active #onboard { display: none; }
/* One row, always: when the window is narrow the chips shrink and their labels are cut short, never wrap. */
#onboard { width: 100%; }
#onboard .chips { display: flex; flex-wrap: nowrap; justify-content: center; gap: 8px; width: 100%; }
#onboard .chip > span:not(.ic) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#onboard .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(8px);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s var(--ease), border-color 0.15s, box-shadow 0.15s;
}
#onboard .chip:nth-child(2) { animation-delay: 0.05s; }
#onboard .chip:hover, #onboard .chip:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 18%, transparent);
  transform: translateY(-2px);
  outline: none;
}
#onboard .chip:active { transform: scale(0.97); }
#onboard .chip.start { margin-left: 8px; border-color: var(--accent); flex-shrink: 0; }
#onboard .chip .ic { font-size: 15px; line-height: 1; }
#onboard .skip, #caption .onboard-acts .link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
#onboard .skip:hover, #onboard .skip:focus-visible,
#caption .onboard-acts .link:hover, #caption .onboard-acts .link:focus-visible { color: var(--accent); outline: none; }

/* Under a sample: what it is, and what to do next. */
#caption:has(.onboard-say) { justify-content: center; text-align: center; }
#caption .text:has(.onboard-say) { flex: 0 1 auto; max-width: 640px; }
#caption .onboard-say { display: block; color: var(--fg); line-height: 1.5; text-wrap: balance; }
#caption .onboard-say .onboard-lead { color: var(--muted); }
#caption .onboard-say strong { font-weight: 600; }
#caption .onboard-acts { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 10px; white-space: nowrap; }
#caption .onboard-acts .primary {
  padding: 8px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
#caption .onboard-acts .primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 45%, transparent); }
#caption .onboard-acts .primary:active { transform: scale(0.97); }
#caption .onboard-acts .primary:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

/* The share button, once, after the first thing made with a model. */
#share.onboard-pulse { animation: onboard-pulse 1.3s var(--ease) 3; color: var(--accent); }

@keyframes onboard-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes onboard-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  100% { box-shadow: 0 0 0 12px transparent; }
}
@media (prefers-reduced-motion: reduce) {
  #onboard, #share.onboard-pulse { animation: none; }
}

/* ---------- the Tutorial chip: a brief animation on the main screen ---------- */
#tut-pointer { position: fixed; z-index: 100; left: 0; top: 0; width: 28px; height: 28px; pointer-events: none; opacity: 0; transform: translate(var(--x, 50vw), var(--y, 50vh)); transition: transform 0.8s var(--ease), opacity 0.3s; }
#tut-pointer.on { opacity: 1; }
#tut-pointer svg { width: 28px; height: 28px; fill: var(--fg); stroke: var(--surface); stroke-width: 1.5; filter: drop-shadow(0 3px 5px rgb(0 0 0 / 0.35)); }
#tut-pointer i { position: absolute; left: -6px; top: -6px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; }
#tut-pointer.click i { animation: t-ripple 0.5s var(--ease); }
#tut-bubble { --edge: color-mix(in srgb, var(--accent) 35%, var(--border)); position: fixed; z-index: 100; width: max-content; max-width: min(384px, calc(100vw - 16px)); padding: 12px 19px; border: 1px solid var(--edge); border-radius: min(calc(var(--slot-radius, 18px) * 1.2), 26px); background: var(--surface); color: var(--fg); font-family: var(--font); font-size: 17px; text-align: center; line-height: 1.4; pointer-events: none; opacity: 0; transform: translateX(-50%); box-shadow: var(--shadow), 0 6px 20px color-mix(in srgb, var(--accent) 25%, transparent); }
#tut-bubble.on { animation: t-bubble 0.4s var(--ease) both; }
/* Its pointer: a slanted triangle from the bubble's edge, its point at --tip. The second triangle, 1px inside the
   first, is the fill: it leaves the outline and covers the bubble's border where they join. */
#tut-bubble::before, #tut-bubble::after { content: ""; position: absolute; top: 100%; left: var(--tip, 50%); width: 24px; height: 20px; }
#tut-bubble::before { background: var(--edge); clip-path: polygon(0 0, 100% 0, 0 100%); }
#tut-bubble::after { background: var(--surface); clip-path: polygon(1px 0, 22.44px 0, 1px 17.86px); }
#tut-bubble.below::before, #tut-bubble.below::after { top: auto; bottom: 100%; }
#tut-bubble.below::before { clip-path: polygon(0 100%, 100% 100%, 0 0); }
#tut-bubble.below::after { clip-path: polygon(1px 100%, 22.44px 100%, 1px 2.14px); }
#tut-app { position: absolute; inset: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 16px 40px rgb(0 0 0 / 0.2); opacity: 0; transform: translateY(16px) scale(0.96); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease), box-shadow 0.6s, inset 0.8s var(--ease); }
#tut-app.built { opacity: 1; transform: none; }
#tut-app.smaller { inset: 10%; } /* "20% smaller" */
#tut-app.shared { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 40%, transparent), 0 16px 40px rgb(0 0 0 / 0.2); }
/* Watched, not played: a click on it stops the tutorial like any other. */
#tut-app iframe { pointer-events: none; }
@keyframes t-ripple { from { opacity: 1; transform: scale(0.5); } to { opacity: 0; transform: scale(3.2); } }
@keyframes t-bubble { from { opacity: 0; margin-top: 8px; } to { opacity: 1; margin-top: 0; } }
@media (prefers-reduced-motion: reduce) {
  #tut-pointer, #tut-app { transition-duration: 0.01s; }
  #tut-bubble.on { animation: none; opacity: 1; }
}
