/* ---- Guided tour (onboarding walkthrough) --------------------------------
   A self-contained overlay that explains the whole flow — new tour, places,
   narration, render — without touching anything real. Every panel it shows is
   a drawn mock-up filled with sample data, so the guide can run on an account
   with no tours, cannot leave half a tour behind, and never navigates away
   from the page it was opened on.

   Two prefixes, kept apart on purpose:
     .guide-*  the overlay chrome (rail, stage, footer) — real UI.
     .gm-*     the mock-ups inside the stage — pictures of the app.
   Nothing here leaks into the app's own classes, so the file can be dropped
   onto any page that already loads styles.css.
--------------------------------------------------------------------------- */

.guide-overlay {
  position: fixed; inset: 0; z-index: 120;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(5, 6, 10, 0.7);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.guide-overlay[hidden] { display: none; }

.guide-box {
  width: 100%; max-width: 1120px; max-height: calc(100vh - 40px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  animation: guide-in 0.22s cubic-bezier(.22,.85,.34,1);
}
@keyframes guide-in {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

/* ---- Head ---------------------------------------------------------------- */

.guide-head {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 20px 14px; border-bottom: 1px solid var(--border-soft);
}
.guide-head-text { flex: 1; min-width: 0; }
.guide-eyebrow {
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--accent);
}
.guide-head h2 {
  margin: 3px 0 0; font-size: 17px; font-weight: 800; letter-spacing: -0.015em; line-height: 1.3;
}

/* ---- Body: step rail + stage --------------------------------------------- */

.guide-body { display: grid; grid-template-columns: 238px 1fr; flex: 1; min-height: 0; }

.guide-steps {
  border-right: 1px solid var(--border-soft); background: var(--panel-soft);
  overflow-y: auto; padding: 10px 9px; display: flex; flex-direction: column; gap: 2px;
}
.guide-step {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; box-shadow: none;
  font-size: 12.4px; font-weight: 600; color: var(--muted); line-height: 1.35;
}
.guide-step:hover {
  background: var(--panel); border-color: var(--border-soft); color: var(--ink);
  transform: none; box-shadow: var(--shadow-sm);
}
.guide-step-num {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 10.5px; font-weight: 800;
  background: var(--border-soft); color: var(--muted-2);
}
/* Seen already, but not where you are — the tick is the only thing that says
   how far through the guide you have got when the rail is scrolled. */
.guide-step.is-done .guide-step-num { background: var(--good-soft); color: var(--good); }
.guide-step.is-current { background: var(--accent-soft); color: var(--ink); font-weight: 700; }
.guide-step.is-current .guide-step-num {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  box-shadow: 0 3px 8px -2px rgba(124,58,237,0.5);
}
.guide-step-label { flex: 1; min-width: 0; }

.guide-main {
  display: flex; flex-direction: column; min-width: 0;
  overflow-y: auto; padding: 18px 20px 20px; gap: 14px;
}
/* Column flex items shrink by default, and the stage clips what it cannot fit
   — so a tall mock-up lost its bottom instead of scrolling. Nothing in here
   shrinks; the column overflows, and the column is what scrolls. */
.guide-main > * { flex: 0 0 auto; }

/* ---- The explanation ------------------------------------------------------ */

.guide-desc { margin: 0; font-size: 13.6px; line-height: 1.68; color: var(--ink); }
.guide-desc b { font-weight: 700; }
/* Longer steps are written as paragraphs and lists, so the dialog contents can
   be read as a set of options rather than one run-on sentence. */
.guide-desc p { margin: 0 0 10px; }
.guide-desc > :last-child { margin-bottom: 0; }
.guide-desc ul { margin: 0 0 10px; padding-left: 19px; }
.guide-desc li { margin-bottom: 6px; }

/* Steps with nowhere in particular to point hide this row — and a display
   rule of its own would otherwise beat the hidden attribute. */
.guide-where[hidden] { display: none; }
.guide-where {
  display: flex; gap: 9px; align-items: flex-start;
  font-size: 12.4px; line-height: 1.55; color: var(--muted);
  background: var(--accent-soft); border-radius: 11px; padding: 10px 13px;
}
.guide-where svg { width: 14px; height: 14px; flex: none; margin-top: 3px; color: var(--accent); }
.guide-where b { color: var(--ink); font-weight: 700; }

/* ---- The stage: a picture of the app -------------------------------------- */

.guide-stage {
  position: relative; border-radius: 15px; border: 1px solid var(--border-soft);
  background: var(--bg); overflow: hidden;
  /* Room along the top for the sample badge, which would otherwise sit on top
     of whatever the first block of the mock-up happens to be. */
  padding: 34px 16px 16px;
}
/* Labels the stage as a drawing, not the live app, so nobody hunts for a
   "Kyoto Higashiyama Walk" tour they never made. */
.guide-sample {
  position: absolute; top: 10px; right: 12px; z-index: 2;
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px;
  background: var(--warn-soft); color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
}
.gm { display: grid; gap: 12px; animation: guide-step-in 0.24s ease both; }
@keyframes guide-step-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* Everything the step is not talking about steps back. Only blocks marked as
   parts dim — panel headings stay legible, so the highlight always keeps the
   context that says which panel you are looking at. */
.gm-part { border-radius: 13px; transition: opacity 0.25s ease, filter 0.25s ease, box-shadow 0.25s ease; }
.guide-stage.has-spot .gm-part:not(.is-spot) { opacity: 0.34; filter: saturate(0.3); }
/* Padding cancelled by an equal negative margin: the ring gets room to sit
   clear of the text it is ringing, without any block moving when it becomes
   the highlighted one. */
.gm-part.is-spot {
  padding: 8px; margin: -8px;
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 7px var(--accent-soft);
  animation: guide-spot 1.6s ease-in-out 0.25s 2;
}
@keyframes guide-spot {
  0%, 100% { box-shadow: 0 0 0 2px var(--accent), 0 0 0 7px var(--accent-soft); }
  50%      { box-shadow: 0 0 0 2px var(--accent), 0 0 0 11px transparent; }
}

/* ---- Mock components ------------------------------------------------------ */

.gm-panel {
  background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: 13px; padding: 15px 17px; box-shadow: var(--shadow-sm);
}
.gm-h {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-size: 13.2px; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 3px;
}
.gm-h-sub { font-size: 11px; font-weight: 600; color: var(--muted); }
.gm-hint { font-size: 11.6px; color: var(--muted); line-height: 1.5; margin-bottom: 11px; }
.gm-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.gm-stack { display: grid; gap: 9px; }
.gm-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.gm-label {
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 5px;
}
.gm-input {
  border: 1.5px solid var(--border); background: var(--panel-soft); border-radius: 9px;
  padding: 8px 11px; font-size: 12.3px; color: var(--ink); line-height: 1.45;
}
.gm-input.ph { color: var(--muted-2); }
.gm-input.ta { min-height: 44px; white-space: pre-wrap; }
.gm-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid var(--border); background: var(--panel); border-radius: 9px;
  padding: 7px 13px; font-size: 11.8px; font-weight: 700; color: var(--ink);
  box-shadow: var(--shadow-sm); white-space: nowrap;
}
.gm-btn.p {
  background: linear-gradient(95deg, #7C3AED, #EC4899); border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px -6px rgba(124,58,237,0.6);
}
.gm-btn.g { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.gm-btn svg { width: 13px; height: 13px; flex: none; }

.gm-tile {
  display: flex; align-items: center; gap: 11px;
  border: 1.5px solid var(--border); border-radius: 12px; padding: 10px 12px;
  background: var(--panel-soft);
}
.gm-tile-ico {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; font-size: 14px; color: #fff;
  background: var(--tc, var(--accent));
}
.gm-tile-t { display: block; font-size: 12.2px; font-weight: 700; }
.gm-tile-s { display: block; font-size: 10.6px; color: var(--muted); margin-top: 1px; }
.gm-tile-go { margin-left: auto; color: var(--muted-2); font-weight: 800; }

.gm-place {
  display: flex; align-items: center; gap: 11px;
  border: 1px solid var(--border-soft); border-radius: 12px; padding: 9px 11px;
  background: var(--panel-soft);
}
.gm-idx {
  flex: none; width: 21px; height: 21px; border-radius: 50%;
  display: grid; place-items: center; font-size: 10.5px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.gm-thumb {
  flex: none; width: 58px; height: 40px; border-radius: 8px;
  display: grid; place-items: center; font-size: 17px;
  background: linear-gradient(135deg, #c4b5fd, #f9a8d4);
}
.gm-place-name { display: block; font-size: 12.3px; font-weight: 700; }
.gm-place-meta { display: block; font-size: 10.6px; color: var(--muted); margin-top: 1px; }
.gm-place-body { flex: 1; min-width: 0; }

.gm-pill {
  display: inline-block; font-size: 9.8px; font-weight: 800; letter-spacing: 0.02em;
  padding: 3px 8px; border-radius: 999px; background: var(--good-soft); color: var(--good);
}
.gm-pill.no { background: var(--border-soft); color: var(--muted-2); }
.gm-pill.a { background: var(--accent-soft); color: var(--accent); }
.gm-pill.w { background: var(--warn-soft); color: var(--warn); }

.gm-stat {
  flex: 1; min-width: 96px; display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border-soft); border-radius: 12px; padding: 10px 12px;
  background: var(--panel);
}
.gm-stat-num { display: block; font-size: 17px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.gm-stat-lbl { display: block; font-size: 10px; color: var(--muted); font-weight: 700; }

/* The floating buttons, drawn where they really sit — bottom-right, stacked.
   The block holding them shrinks to the buttons themselves, so the spotlight
   rings the stack rather than the empty width of the page beside it. */
.gm-fabs { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
/* Anything that hangs off the right of the page — the floating stack, the menu
   one of them drops down — shrinks its block to its own width, so the spotlight
   rings the thing and not the empty page beside it. */
.gm-part:has(> .gm-fabs), .gm-part:has(> .gm-right) { width: max-content; margin-left: auto; }
.gm-fab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px; border-radius: 999px; font-size: 11.8px; font-weight: 700;
  border: 1.5px solid var(--border); background: var(--panel); color: var(--ink);
  box-shadow: var(--shadow-md);
}
.gm-fab.p { background: linear-gradient(95deg, #7C3AED, #EC4899); border-color: transparent; color: #fff; }

/* The numbered stage rail from the tour editor, drawn flat. */
.gm-stages { display: flex; gap: 6px; flex-wrap: wrap; }
.gm-stage-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 999px; font-size: 11px; font-weight: 700;
  border: 1.5px solid var(--border); background: var(--panel); color: var(--muted);
}
.gm-stage-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }

/* A drawn map: enough to read as one without a token, a network call, or a
   second library on a page that may not have Mapbox loaded. */
.gm-map {
  position: relative; height: 118px; border-radius: 11px; overflow: hidden;
  border: 1px solid var(--border);
  background:
    linear-gradient(115deg, rgba(124,58,237,0.10), rgba(6,182,212,0.10)),
    repeating-linear-gradient(0deg, var(--border-soft) 0 1px, transparent 1px 22px),
    repeating-linear-gradient(90deg, var(--border-soft) 0 1px, transparent 1px 22px),
    var(--panel-soft);
}
.gm-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.gm-sep { height: 1px; background: var(--border-soft); margin: 3px 0; }
.gm-note { font-size: 11px; color: var(--muted); }

/* A dialog drawn on top of the panel behind it — import, languages, advanced
   and the place picker are all dialogs in the real app, and drawing them any
   other way would send people looking for a panel that is not there. */
.gm-dialog {
  border: 1px solid var(--border); border-radius: 13px; background: var(--panel);
  box-shadow: var(--shadow-lg); padding: 14px 16px;
}
.gm-dialog-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 12.6px; font-weight: 800; margin-bottom: 10px;
}
.gm-dialog-head span:last-child { color: var(--muted-2); font-weight: 700; }

.gm-steps { display: grid; gap: 8px; }
.gm-step-li {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--border); border-radius: 11px; padding: 9px 11px;
  background: var(--panel-soft);
}
.gm-step-n {
  flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 10px; font-weight: 800; background: var(--accent-soft); color: var(--accent);
}

.gm-swatches { display: flex; gap: 7px; flex-wrap: wrap; }
.gm-swatch {
  width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* The watermark's nine positions, and the sliders beside them. */
.gm-wm-grid { display: grid; grid-template-columns: repeat(3, 17px); grid-auto-rows: 13px; gap: 3px; }
.gm-wm-cell { border: 1.5px solid var(--border); border-radius: 4px; background: var(--panel-soft); }
.gm-wm-cell.on { border-color: var(--accent); background: var(--accent-soft); }
.gm-wm-preview {
  width: 62px; height: 40px; border-radius: 8px; display: grid; place-items: end;
  padding: 4px; font-size: 12px; color: var(--muted);
  border: 1px solid var(--border); background: var(--panel-soft);
}
.gm-slider { position: relative; height: 5px; border-radius: 999px; background: var(--border-soft); }
.gm-slider i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(95deg, #7C3AED, #EC4899); }
.gm-slider::after {
  content: ''; position: absolute; top: 50%; left: var(--at, 50%);
  width: 11px; height: 11px; border-radius: 50%; transform: translate(-50%, -50%);
  background: var(--panel); border: 2px solid var(--accent);
}

/* The picked option in a list of them — export quality, the language menu. */
.gm-step-li.on { border-color: var(--accent); background: var(--accent-soft); }
.gm-step-li.on .gm-step-n { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }

.gm-langs { display: flex; gap: 7px; flex-wrap: wrap; }
.gm-lang {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: 11.4px; font-weight: 700;
  border: 1.5px solid var(--border); background: var(--panel-soft); color: var(--ink);
}
.gm-lang.on { border-color: var(--accent); background: var(--accent-soft); }

/* ---- Foot ---------------------------------------------------------------- */

.guide-foot {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 20px; border-top: 1px solid var(--border-soft); background: var(--panel);
}
.guide-bar { flex: 1; min-width: 60px; height: 5px; border-radius: 999px; background: var(--border-soft); overflow: hidden; }
.guide-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(95deg, #7C3AED, #EC4899); transition: width 0.3s ease; }
.guide-count { font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.guide-foot .row { gap: 8px; }

/* ---- Dashboard invitation ------------------------------------------------- */
/* Shown in place of "No tours yet" — an empty dashboard is exactly when the
   guide is worth offering, and the same card is how it is reopened later. */
.guide-invite {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 14px; padding: 18px 20px; background: var(--accent-soft);
}
.guide-invite-ico {
  flex: none; width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  font-size: 20px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  box-shadow: 0 8px 20px -6px rgba(124,58,237,0.6);
}
.guide-invite-text { flex: 1; min-width: 190px; }
.guide-invite-title { display: block; font-size: 14px; font-weight: 800; letter-spacing: -0.01em; }
.guide-invite-sub { display: block; font-size: 12.4px; color: var(--muted); margin-top: 3px; line-height: 1.5; }

/* ---- Narrow screens -------------------------------------------------------- */

@media (max-width: 880px) {
  .guide-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .guide-steps {
    flex-direction: row; border-right: 0; border-bottom: 1px solid var(--border-soft);
    overflow-x: auto; overflow-y: hidden; padding: 9px 10px; gap: 6px;
  }
  .guide-step { width: auto; flex: none; }
  /* The rail turns into a row of numbers: labels would make it wider than the
     screen, and the current step's name is already in the header above. */
  .guide-step-label { display: none; }
  .guide-step.is-current .guide-step-label { display: block; white-space: nowrap; }
  .gm-grid2 { grid-template-columns: 1fr; }
  .guide-count { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .guide-box, .gm { animation: none; }
  .gm-part.is-spot { animation: none; }
}
