/* Interactive first-run guidance. Kept separate so it can be loaded lazily. */

.tutorial-spotlight {
  position: fixed;
  inset: 0;
  z-index: 190;
  pointer-events: none;
}

.tutorial-shade {
  position: fixed;
  z-index: 190;
  pointer-events: auto;
  background: rgba(2, 6, 10, 0.76);
  backdrop-filter: blur(2px);
  animation: tutorial-shade-in 220ms ease both;
}

.tutorial-highlight {
  position: fixed;
  z-index: 191;
  border: 2px solid var(--accent);
  border-radius: 13px;
  pointer-events: none;
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent),
    0 0 32px color-mix(in srgb, var(--accent) 30%, transparent);
  transition:
    left 220ms var(--ease-standard),
    top 220ms var(--ease-standard),
    width 220ms var(--ease-standard),
    height 220ms var(--ease-standard);
  animation: tutorial-highlight-pulse 2s ease-in-out infinite;
}

.tutorial-coachmark {
  position: fixed;
  z-index: 192;
  width: min(23rem, calc(100vw - 1.5rem));
  max-height: calc(100vh - 1.5rem);
  padding: 1.1rem;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  pointer-events: auto;
  color: var(--text);
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--accent) 13%, transparent), transparent 42%),
    var(--panel);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.38);
  transition: left 220ms var(--ease-standard), top 220ms var(--ease-standard);
  animation: tutorial-coachmark-in 260ms var(--ease-standard) both;
}

.tutorial-coachmark-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted-2);
  font-size: 0.75rem;
  font-weight: 700;
}

.tutorial-exit {
  padding: 0.25rem 0.42rem;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.75rem;
}

.tutorial-exit:hover,
.tutorial-exit:focus-visible {
  color: var(--text);
  background: var(--accent-soft);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tutorial-progress-track {
  height: 4px;
  margin: 0.75rem 0 1rem;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
}

.tutorial-progress-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 240ms var(--ease-standard);
}

.tutorial-coachmark h2 {
  margin: 0.45rem 0 0.55rem;
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 720;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

.tutorial-coachmark > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.7;
}

.tutorial-click-hint {
  margin-top: 0.8rem !important;
  color: var(--accent) !important;
  font-weight: 700;
}

.tutorial-click-hint span {
  display: inline-block;
  margin-right: 0.3rem;
  animation: tutorial-point 1.15s ease-in-out infinite;
}

.tutorial-actions {
  margin-top: 1rem;
  padding-top: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-top: 1px solid var(--line);
}

.tutorial-action-spacer {
  flex: 1;
}

.tutorial-target-fallback {
  display: none;
}

.tutorial-target-missing .tutorial-shade {
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
}

.tutorial-target-missing .tutorial-highlight {
  display: none;
}

.tutorial-target-missing .tutorial-target-fallback {
  display: inline-flex;
}

@keyframes tutorial-shade-in {
  from { opacity: 0; }
}

@keyframes tutorial-coachmark-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
}

@keyframes tutorial-highlight-pulse {
  50% {
    box-shadow:
      0 0 0 7px color-mix(in srgb, var(--accent) 12%, transparent),
      0 0 40px color-mix(in srgb, var(--accent) 38%, transparent);
  }
}

@keyframes tutorial-point {
  50% { transform: translate(-3px, -2px); }
}

@media (max-width: 600px) {
  .tutorial-coachmark {
    width: calc(100vw - 1rem);
    padding: 0.95rem;
  }

  .tutorial-coachmark h2 {
    font-size: 1.12rem;
  }

  .tutorial-actions .btn {
    min-height: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tutorial-shade,
  .tutorial-highlight,
  .tutorial-coachmark,
  .tutorial-progress-track > span,
  .tutorial-click-hint span {
    animation: none;
    transition: none;
  }
}
