/* ── WELCOME GUIDE (tour.js) — everything scoped under .tour-* ───────────── */

:root {
  --t-src: #f85149; --t-dim: #58a6ff; --t-fact: #3fb950; --t-rpt: #d29922;
  --t-canvas: #f4f1ec;
}

/* Header help button */
.help-btn {
  position: relative; width: 28px; height: 28px; padding: 0;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--muted); font-size: 13px; font-weight: 700;
}
.help-btn:hover { color: var(--text); border-color: var(--accent); opacity: 1; }
.help-btn.pulse::after {
  content: ''; position: absolute; inset: -4px; border-radius: 10px;
  border: 2px solid var(--accent); animation: tour-ring 1.6s ease-out infinite;
}
@keyframes tour-ring { 0% { opacity: .9; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.25); } }

/* Overlay + card */
.tour-backdrop {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(1,4,9,.55); backdrop-filter: blur(2px);
  animation: tour-fade .25s ease;
}
@keyframes tour-fade { from { opacity: 0; } to { opacity: 1; } }
.tour-card {
  width: 580px; max-width: 100%; max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
  animation: tour-rise .3s cubic-bezier(.2,.8,.2,1);
}
@keyframes tour-rise { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.tour-card button { font-family: inherit; font-weight: 600; border-radius: 7px; transition: filter .15s; }
.tour-card button:active { transform: none; }
.tour-card button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tour-top { display: flex; align-items: center; gap: 8px; padding: 12px 16px 0; }
.tour-count { font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.tour-x { margin-left: auto; width: 26px; height: 26px; padding: 0; background: none; color: var(--muted); font-size: 12px; }
.tour-x:hover { background: var(--surface2); color: var(--text); opacity: 1; }
.tour-text { padding: 14px 20px 4px; }
.tour-text h2 { font-size: 17px; font-weight: 650; margin-bottom: 6px; color: var(--text); }
.tour-text p { color: #c9d1d9; font-size: 13.5px; line-height: 1.55; }
.tour-text code { font-family: 'SF Mono','Fira Code',monospace; font-size: 12.5px; }
.tour-foot { display: flex; align-items: center; gap: 8px; padding: 14px 16px 16px; flex-wrap: wrap; }
.tour-pips { display: flex; gap: 6px; }
.tour-pips button { width: 8px; height: 8px; padding: 0; border-radius: 50%; background: var(--border); }
.tour-pips button.on { width: 22px; border-radius: 4px; background: var(--accent); transition: width .2s; }
.tour-skip { margin-left: auto; background: none; color: var(--muted); font-size: 12.5px; padding: 7px 10px; }
.tour-skip:hover { color: var(--text); opacity: 1; }
.tour-btn { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 7px 14px; font-size: 12.5px; }
.tour-btn.pri { background: var(--accent); border-color: var(--accent); color: #0d1117; }
.tour-btn:hover { filter: brightness(1.1); opacity: 1; }
.tour-ctas { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

/* Stage: a fixed 546×260 scene, scaled down on narrow screens */
.tour-stage {
  --scale: 1;
  position: relative; margin: 10px 16px 0; height: calc(260px * var(--scale));
  border-radius: 10px; overflow: hidden; border: 1px solid var(--border);
  background-color: var(--t-canvas);
  background-image: radial-gradient(#d9d3c7 1px, transparent 1px); background-size: 18px 18px;
}
.tour-stage.dark { background: var(--bg); }
.tour-scene { position: absolute; left: 0; top: 0; width: 546px; height: 260px; transform: scale(var(--scale)); transform-origin: 0 0; }
.tour-scene > *, .tour-scene .qv > * { position: absolute; }
.tour-scene .fill { top: 0; right: 0; bottom: 0; }
.tour-scene .mb {
  width: 96px; height: 52px; border-radius: 5px; overflow: hidden;
  border: 1.5px solid var(--c); background: color-mix(in srgb, var(--c) 14%, #fff);
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.tour-scene .mb::before {
  content: attr(data-n); display: block; height: 15px; padding: 1px 6px;
  font: 700 8.5px/13px 'SF Mono','Fira Code',monospace; color: var(--c);
  background: color-mix(in srgb, var(--c) 28%, #fff);
}
.tour-scene .mb i { display: block; height: 3px; border-radius: 2px; margin: 5px 8px 0; background: var(--c); opacity: .35; }
.tour-scene .mb i:nth-child(2) { width: 60%; }
.tour-scene .mb i:nth-child(3) { width: 75%; }
.tour-scene .file {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px;
  background: #fff; border: 1px solid #d0d7de; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.08);
  font: 10.5px 'SF Mono','Fira Code',monospace; color: #24292f;
}
.tour-scene .file::before { content: ''; width: 9px; height: 11px; border-radius: 2px; background: var(--c); }
.tour-scene .arrow { font: 700 30px sans-serif; color: var(--accent); }
.tour-scene svg.edges { inset: 0; width: 100%; height: 100%; overflow: visible; }
.tour-scene svg.edges path { fill: none; stroke: #8c959f; stroke-width: 1.4; }
.tour-scene svg.edges path.hi { stroke: var(--accent); stroke-width: 2; }
.tour-scene .lbl { font: 700 8px 'SF Mono','Fira Code',monospace; color: #57606a; background: var(--t-canvas); padding: 0 2px; }
.tour-scene .cap { font: 10px 'SF Mono','Fira Code',monospace; color: #57606a; }
.tour-scene .cursor { left: 0; top: 0; width: 18px; height: 18px; z-index: 5; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.tour-scene .ripple { width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; z-index: 4; }

.tour-scene .mini-sb { left: 0; top: 0; bottom: 0; width: 178px; padding: 12px; background: var(--surface); border-right: 1px solid var(--border); }
.tour-scene .mini-label { font-size: 8.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.tour-scene .mini-ta { height: 96px; padding: 7px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface2); font: 9.5px/1.6 'SF Mono','Fira Code',monospace; color: #c9d1d9; }
.tour-scene .mini-ta span { display: block; white-space: nowrap; }
.tour-scene .mini-btn { display: inline-block; margin-top: 8px; padding: 5px 12px; border-radius: 5px; background: var(--accent); color: #0d1117; font: 700 10px sans-serif; }

.tour-scene .folder {
  width: 118px; height: 84px; border-radius: 8px; background: #fff; border: 1.5px dashed #8c959f;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font: 10px sans-serif; color: #57606a;
}
.tour-scene .folder b { font: 700 11px 'SF Mono','Fira Code',monospace; color: #24292f; }
.tour-scene .folder-ic { font-size: 22px; }

.tour-scene .ins {
  right: 10px; top: 10px; width: 168px; height: 182px; padding: 9px;
  background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--t-fact); border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,.35);
}
.tour-scene .ins-t { font: 700 10.5px 'SF Mono','Fira Code',monospace; color: var(--text); }
.tour-scene .ins-s { font: 8.5px 'SF Mono','Fira Code',monospace; color: var(--muted); margin: 2px 0 8px; }
.tour-scene .ins-k { font: 700 7.5px sans-serif; color: var(--muted); letter-spacing: .08em; margin: 6px 0 4px; }
.tour-scene .chipz { display: flex; flex-wrap: wrap; gap: 3px; }
.tour-scene .chipz span { font: 8px 'SF Mono','Fira Code',monospace; color: var(--text); background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 0 5px; }
.tour-scene .ins-open { margin-top: 12px; padding: 5px; border-radius: 5px; text-align: center; background: var(--accent); color: #0d1117; font: 700 9px sans-serif; }
.tour-scene .qv { inset: 0; }
.tour-scene .qv-bar {
  left: 0; right: 0; top: 0; height: 30px; padding: 0 10px; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border-bottom: 1px solid var(--border); font: 9.5px 'SF Mono','Fira Code',monospace; color: var(--muted);
}
.tour-scene .qv-bar b { color: var(--text); font-weight: 500; }
.tour-scene .qv-back { background: var(--surface2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; color: var(--text); }
.tour-scene .toast {
  left: 50%; bottom: 14px; transform: translateX(-50%); white-space: nowrap;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 16px; padding: 4px 12px; font-size: 11px;
}

.tour-scene .mhead { left: 0; right: 0; top: 0; height: 40px; padding: 0 12px; display: flex; align-items: center; gap: 10px; background: var(--surface); border-bottom: 1px solid var(--border); }
.tour-scene .mlogo { font: 700 11px 'SF Mono','Fira Code',monospace; color: var(--accent); }
.tour-scene .mseg { position: relative; display: flex; padding: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: 7px; }
.tour-scene .mseg span { position: relative; z-index: 1; width: 70px; padding: 3px 0; text-align: center; font: 600 10.5px sans-serif; color: var(--muted); }
.tour-scene .mseg .ind { position: absolute; top: 2px; bottom: 2px; left: 2px; width: 70px; border-radius: 5px; background: var(--surface2); box-shadow: inset 0 0 0 1px var(--border); }
.tour-scene .mbody { left: 0; right: 0; top: 40px; bottom: 58px; display: flex; align-items: center; justify-content: center; font: 12px sans-serif; color: var(--muted); }
.tour-scene .mbody .v { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tour-scene .mbody .v b { color: var(--text); font-size: 13px; }
.tour-scene .v-ic { font-size: 22px; }
.tour-scene .mpal { left: 50%; top: 56px; width: 250px; margin-left: -125px; z-index: 3; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; box-shadow: 0 12px 30px rgba(0,0,0,.6); }
.tour-scene .mpal-in { padding: 8px 10px; border-bottom: 1px solid var(--border); font: 11px 'SF Mono','Fira Code',monospace; color: var(--text); }
.tour-scene .caret { opacity: .5; }
.tour-scene .mpal .r { display: flex; align-items: center; gap: 6px; padding: 5px 10px; font: 10px 'SF Mono','Fira Code',monospace; color: var(--text); }
.tour-scene .mpal .r.on { background: var(--surface2); }
.tour-scene .mpal .r i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.tour-scene .keys { left: 0; right: 0; bottom: 12px; display: flex; justify-content: center; gap: 14px; }
.tour-scene .key { display: flex; flex-direction: column; align-items: center; gap: 4px; font: 9.5px sans-serif; color: var(--muted); }
.tour-scene .key kbd { font-size: 13px; padding: 4px 10px; min-width: 34px; text-align: center; color: var(--text); border-radius: 6px; }

/* Reduced motion: still final frame of each scene */
@media (prefers-reduced-motion: reduce) {
  .tour-scene *, .tour-scene *::before, .tour-backdrop, .tour-card, .help-btn.pulse::after { animation: none !important; }
}
