/* ─── Onboarding / Guided product tour ──────────────────────────────────── */

/* Force-show connector anchor dots on demo elements (step 6 ghost-connect state) */
.tour-show-cps .cp {
  opacity: 0.9 !important;
  transform: translate(-50%, -50%) scale(1) !important;
}

/* Root wrapper — fades in once layout is computed */
.tour-root {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
}
.tour-root.tour-visible {
  opacity: 1;
}

/* ── Overlay (pointer-events blocker) ────────────────────────────────────── */
.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 9001;
  pointer-events: all;
  background: transparent;
}
/* When there is no spotlight, the overlay itself dims everything */
.tour-overlay.tour-overlay-dim {
  background: rgba(9, 14, 31, 0.65);
}

/* ── Tooltip card — light mode ───────────────────────────────────────────── */
.tour-tooltip {
  position: fixed;
  z-index: 9004;
  pointer-events: all;
  width: 340px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 20px;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 12px 40px rgba(0, 0, 0, 0.22);
  transition:
    left 280ms cubic-bezier(0.4, 0, 0.2, 1),
    top  280ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Tooltip card — dark mode ────────────────────────────────────────────── */
[data-theme="dark"] .tour-tooltip {
  background: rgb(24, 26, 33);
  border-color: rgba(255, 255, 255, 0.10);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.40),
    0 12px 40px rgba(0, 0, 0, 0.55);
}

/* ── Progress counter row ────────────────────────────────────────────────── */
.tour-counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 13px;
}
.tour-dots {
  display: flex;
  align-items: center;
  gap: 5px;
}
.tour-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e5e7eb;
  transition: background 200ms ease, transform 200ms ease;
}
.tour-dot.done {
  background: #9ca3af;
}
.tour-dot.active {
  background: #0A0E1F;
  transform: scale(1.3);
}
[data-theme="dark"] .tour-dot          { background: rgba(255, 255, 255, 0.15); }
[data-theme="dark"] .tour-dot.done     { background: rgba(255, 255, 255, 0.35); }
[data-theme="dark"] .tour-dot.active   { background: #FFFB63; transform: scale(1.3); }

.tour-counter-label {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  letter-spacing: 0.4px;
  font-variant-numeric: tabular-nums;
}
[data-theme="dark"] .tour-counter-label { color: rgb(131, 132, 139); }

/* ── Step title ──────────────────────────────────────────────────────────── */
.tour-title {
  font-size: 15px;
  font-weight: 700;
  color: #0A0E1F;
  letter-spacing: -0.2px;
  line-height: 1.3;
  margin-bottom: 8px;
}
[data-theme="dark"] .tour-title { color: rgb(255, 255, 255); }

/* ── Step description ────────────────────────────────────────────────────── */
.tour-desc {
  font-size: 13px;
  line-height: 1.6;
  color: #374151;
  margin-bottom: 18px;
}
[data-theme="dark"] .tour-desc { color: rgba(255, 255, 255, 0.75); }

/* ── Keyboard shortcut chip ──────────────────────────────────────────────── */
.tour-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 5px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: #111827;
  line-height: 18px;
  white-space: nowrap;
}
[data-theme="dark"] .tour-kbd {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.90);
}

/* ── Shortcut row label ──────────────────────────────────────────────────── */
.tour-shortcut-label {
  font-size: 13px;
  color: #374151;
}
[data-theme="dark"] .tour-shortcut-label { color: rgba(255, 255, 255, 0.75); }

/* ── Action row ──────────────────────────────────────────────────────────── */
.tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tour-skip {
  background: none;
  border: none;
  padding: 6px 2px;
  font-size: 12px;
  font-family: inherit;
  color: #9ca3af;
  cursor: pointer;
  border-radius: 6px;
  transition: color 130ms ease;
}
.tour-skip:hover { color: #374151; }
[data-theme="dark"] .tour-skip           { color: rgb(131, 132, 139); }
[data-theme="dark"] .tour-skip:hover     { color: rgba(255, 255, 255, 0.80); }

/* Matches .btn.primary — yellow background, black label, yellow glow */
.tour-next {
  background: #FFFB63;
  color: #0A0E1F;
  border: 1px solid #FFFB63;
  border-radius: 8px;
  padding: 8px 22px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.1px;
  transition: background 130ms ease, border-color 130ms ease, box-shadow 130ms ease, transform 100ms ease;
  box-shadow: 0 4px 12px rgba(255, 251, 99, 0.30);
}
.tour-next:hover {
  background: #FFFAB4;
  border-color: #FFFAB4;
  box-shadow: 0 8px 24px rgba(255, 251, 99, 0.30);
}
.tour-next:active { transform: scale(0.97); }
/* Next button keeps yellow in dark mode — no override needed */

/* ── Help button — fixed bottom-right of screen ──────────────────────────── */
.tour-help-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--bd-1, #e5e7eb);
  background: var(--bg-surface, #ffffff);
  color: var(--fg-muted, #9ca3af);
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  font-family: 'Georgia', serif;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: border-color 130ms, color 130ms, background 130ms, box-shadow 130ms, transform 100ms;
}
.tour-help-btn:hover {
  border-color: var(--bd-strong);
  color: var(--fg-default);
  background: var(--bg-surface-2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14), 0 1px 3px rgba(0, 0, 0, 0.08);
  transform: scale(1.06);
}
[data-theme="dark"] .tour-help-btn {
  background: rgb(24, 26, 33);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgb(131, 132, 139);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.40), 0 1px 3px rgba(0, 0, 0, 0.30);
}
[data-theme="dark"] .tour-help-btn:hover {
  border-color: #FFFB63;
  color: #FFFB63;
  background: rgb(30, 32, 40);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.50), 0 1px 3px rgba(0, 0, 0, 0.30);
}

/* ─── Tutorial hint bubble ───────────────────────────────────────────────── */
@keyframes tour-hint-nudge {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(-8px); }
}

.tour-hint-wrap {
  position: fixed;
  /* Vertically centered with the 44 px button (bottom:24px) */
  bottom: 31px;
  /* button right(24) + button width(44) + gap(10) */
  right: 78px;
  z-index: 7999;
  display: flex;
  align-items: center;
  pointer-events: none;
  opacity: 1;
  transition: opacity 400ms ease;
}
.tour-hint-wrap.tour-hint-gone {
  opacity: 0;
}

.tour-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-surface, #ffffff);
  border: 1.5px solid var(--bd-1, #e5e7eb);
  border-radius: 20px;
  padding: 6px 9px 6px 13px;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-muted, #6b7280);
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.09), 0 1px 2px rgba(0, 0, 0, 0.05);
  animation: tour-hint-nudge 1.4s ease-in-out infinite;
}
.tour-hint svg {
  flex-shrink: 0;
  color: var(--accent-1, #3b59ce);
}

[data-theme="dark"] .tour-hint {
  background: rgb(24, 26, 33);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgb(131, 132, 139);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.40), 0 1px 3px rgba(0, 0, 0, 0.25);
}
[data-theme="dark"] .tour-hint svg {
  color: #FFFB63;
}

/* ─── Welcome / start screen ─────────────────────────────────────────────── */

.welcome-overlay {
  position: absolute;
  inset: 0;
  z-index: 180;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Blur the UI behind instead of hiding it */
  background: rgba(235, 236, 240, 0.55);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  pointer-events: all;
  animation: welcome-fade-in 0.2s ease both;
}
[data-theme="dark"] .welcome-overlay {
  background: rgba(18, 20, 28, 0.65);
}
@keyframes welcome-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Hide canvas resize borders and selection ring when welcome screen is active */
.work:has(.welcome-overlay) .crh,
.work:has(.welcome-overlay) .canvas-sel-ring {
  display: none !important;
}

.welcome-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 360px;
  max-width: calc(100vw - 48px);
  background: var(--bg-panel, #fff);
  border: 1px solid var(--bd-1);
  border-radius: 16px;
  padding: 36px 28px 24px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.13), 0 2px 8px rgba(0,0,0,0.06);
}
[data-theme="dark"] .welcome-card {
  background: #1e2130;
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 12px 48px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.25);
}

.welcome-logo {
  height: 34px;
  width: auto;
  margin-bottom: 24px;
  user-select: none;
  -webkit-user-drag: none;
}

.welcome-tagline {
  margin: 0 0 28px;
  font-size: 13px;
  color: #8c93a6;
  text-align: center;
  line-height: 1.6;
  max-width: 300px;
}
[data-theme="dark"] .welcome-tagline {
  color: rgba(255,255,255,0.4);
}

.welcome-actions {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 2px;
}

.welcome-action {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--fg-1, #0A0E1F);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s;
  text-align: left;
}
[data-theme="dark"] .welcome-action {
  color: #e8eaf0;
}
.welcome-action:hover {
  background: rgba(0,0,0,0.05);
}
[data-theme="dark"] .welcome-action:hover {
  background: rgba(255,255,255,0.08);
}
.welcome-action svg {
  flex-shrink: 0;
  color: inherit;
  opacity: 0.65;
}
.welcome-action-label {
  flex: 1;
}
.welcome-shortcut {
  font-size: 11px;
  color: var(--fg-muted);
  opacity: 0.55;
  font-weight: 400;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  padding: 2px 6px;
  background: rgba(0,0,0,0.06);
  border-radius: 5px;
}
[data-theme="dark"] .welcome-shortcut {
  background: rgba(255,255,255,0.08);
  opacity: 0.7;
  color: #b0b8cc;
}

.welcome-divider {
  width: 100%;
  height: 1px;
  background: var(--bd-1);
  margin: 6px 0;
  opacity: 0.6;
}
