/* ── First-run walkthrough ──────────────────────────────────────────
   The mask is a single box whose enormous shadow spread dims the whole
   viewport while its own footprint stays clear — that hole is the
   spotlight. Cheaper and sharper than four edge divs or an SVG mask. */

.tour-root {
  position: fixed;
  inset: 0;
  z-index: 4000;
  pointer-events: none;
}

/* Catches every click so the page underneath cannot be driven mid-tour.
   The mask's box-shadow only paints the dim — it captures nothing. */
.tour-block {
  position: fixed;
  inset: 0;
  pointer-events: auto;
}

.tour-mask {
  position: fixed;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px oklch(0.12 0.02 285 / 0.78);
  outline: 2.5px solid var(--amber);
  outline-offset: 0;
  pointer-events: none;
  will-change: top, left, width, height, border-radius;
  transition:
    top 0.18s cubic-bezier(0.32, 0.72, 0, 1),
    left 0.18s cubic-bezier(0.32, 0.72, 0, 1),
    width 0.18s cubic-bezier(0.32, 0.72, 0, 1),
    height 0.18s cubic-bezier(0.32, 0.72, 0, 1),
    border-radius 0.18s cubic-bezier(0.32, 0.72, 0, 1);
  animation: tour-ring 2s ease-in-out infinite;
}

/* Ensure the cutout hugs rounded / pill targets */
.tour-mask[style*="999px"] {
  outline-offset: 1px;
}

/* Welcome step: no target, so just dim the page. */
.tour-mask-plain {
  position: fixed;
  inset: 0;
  background: oklch(0.12 0.02 285 / 0.78);
  pointer-events: none;
}

@keyframes tour-ring {
  0%, 100% { outline-color: oklch(0.80 0.20 68 / 0.95); }
  50%      { outline-color: oklch(0.80 0.20 68 / 0.35); }
}

.tour-card {
  position: fixed;
  width: 320px;
  max-width: calc(100vw - 24px);
  padding: 14px 16px 13px;
  background: oklch(0.17 0.02 285 / 0.97);
  border: 1px solid oklch(1 0 0 / 0.10);
  border-radius: 14px;
  box-shadow: 0 18px 50px oklch(0 0 0 / 0.55);
  backdrop-filter: blur(14px);
  pointer-events: auto;
  animation: tour-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 1;
  box-sizing: border-box;
}

@media (max-width: 480px) {
  .tour-card {
    width: min(320px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
  }
}

@keyframes tour-in {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.tour-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.tour-step {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
}

.tour-skip {
  background: none;
  border: none;
  padding: 2px 0;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.15s ease;
}
.tour-skip:hover { color: var(--text); text-decoration: underline; }

.tour-title {
  margin: 0 0 5px;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.tour-body {
  margin: 0 0 11px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-dim);
}

.tour-dots {
  display: flex;
  gap: 5px;
  margin-bottom: 11px;
}

.tour-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: oklch(1 0 0 / 0.18);
  transition: background 0.2s ease, width 0.2s ease;
}
.tour-dot.on { width: 16px; border-radius: 3px; background: var(--amber); }

.tour-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.tour-back,
.tour-next {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 15px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease;
}

.tour-back {
  background: transparent;
  border: 1px solid oklch(1 0 0 / 0.14);
  color: var(--text-dim);
}
.tour-back:hover { border-color: oklch(1 0 0 / 0.28); color: var(--text); }

.tour-next {
  background: var(--amber);
  border: 1px solid var(--amber);
  color: oklch(0.16 0.02 285);
}
.tour-next:hover { transform: translateY(-1px); filter: brightness(1.06); }

@media (max-width: 640px) {
  .tour-card { width: calc(100vw - 24px); }
}

@media (prefers-reduced-motion: reduce) {
  .tour-mask { animation: none; transition: none; }
  .tour-card { animation: none; }
}

/* ── Per-screen first-visit coach ───────────────────────── */
.screen-guide {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--mobile-nav-h, 72px) + 12px);
  z-index: 3500;
  display: flex;
  justify-content: center;
  padding: 0 14px;
  pointer-events: none;
  animation: screen-guide-in 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
@media (min-width: 769px) {
  .screen-guide {
    bottom: 28px;
    justify-content: flex-end;
    padding-right: 24px;
  }
}

@keyframes screen-guide-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.screen-guide-card {
  pointer-events: auto;
  width: min(360px, calc(100vw - 28px));
  padding: 14px 16px 13px;
  background: oklch(0.17 0.02 285 / 0.97);
  border: 1px solid oklch(1 0 0 / 0.12);
  border-radius: 14px;
  box-shadow: 0 16px 40px oklch(0 0 0 / 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.screen-guide-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.screen-guide-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan);
}

.screen-guide-x {
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.screen-guide-x:hover { color: var(--text); }

.screen-guide-title {
  margin: 0 0 5px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.screen-guide-body {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-dim);
}

.screen-guide-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--violet);
  background: var(--violet);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.screen-guide-cta:hover { filter: brightness(1.06); }

@media (prefers-reduced-motion: reduce) {
  .screen-guide { animation: none; }
}
