/* Polaris — map feedback and first-visit onboarding. */

.map-toasts {
  position: absolute;
  z-index: 1200;
  bottom: max(96px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  max-width: 100%;
  padding: 10px 12px 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--shadow-2);
  font-size: 13px;
  pointer-events: auto;
  animation: toast-in 180ms var(--ease);
}

.toast-message { min-width: 0; overflow-wrap: anywhere; }
#status { color: var(--text-muted); }
#status:not(.is-busy) .toast-spinner { display: none; }

.toast-spinner {
  flex: 0 0 16px;
  height: 16px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: toast-spin 900ms linear infinite;
}

#error {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
  background: linear-gradient(var(--danger-soft), var(--danger-soft)), var(--surface-2);
}

.toast-icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.toast-dismiss, .toast-action {
  flex-shrink: 0;
  min-height: 36px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.toast-dismiss { width: 36px; font-size: 22px; }
.toast-action { padding: 0 10px; color: var(--accent-text); font-weight: 600; }
.toast-dismiss:hover { background: var(--danger-soft); }
.toast-action:hover { background: var(--accent-soft); }

/* Hide stale summary/actions while the new route cards are placeholders. */
#results.calculating > :not(.stops-head):not(#route-cards),
#results.calculating .result-actions { display: none; }

.route-skeleton {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: var(--s-4);
  margin-top: var(--s-3);
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.route-skeleton span { height: 12px; border-radius: var(--r-sm); background: var(--surface-3); }
.route-skeleton .skeleton-title { width: 42%; height: 16px; }
.route-skeleton .skeleton-stats { height: 46px; }
.route-skeleton .skeleton-line { width: 75%; }
.route-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 25%, rgba(232, 236, 248, 0.04) 50%, transparent 75%);
  transform: translateX(-100%);
  animation: skeleton-shimmer 1.8s ease-in-out infinite;
}

.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: var(--s-5);
  overflow-y: auto;
  background: rgba(2, 4, 11, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: welcome-fade 180ms ease-out;
}

.welcome-dialog {
  position: relative;
  width: min(480px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: 36px;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: radial-gradient(circle at 50% 0, var(--accent-soft), transparent 45%), var(--surface-1);
  box-shadow: var(--shadow-2);
  text-align: center;
  animation: welcome-rise 220ms var(--ease);
}

.welcome-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-muted);
  font: 24px/1 var(--font-ui);
  cursor: pointer;
}
.welcome-close:hover { background: var(--surface-3); color: var(--text); }

.welcome-star {
  width: 44px;
  height: 44px;
  margin-bottom: var(--s-4);
  fill: var(--star);
  filter: drop-shadow(0 0 14px var(--star-glow));
}

#welcome-title { color: var(--text); font-size: 26px; letter-spacing: -0.025em; text-transform: none; }
#welcome-copy { margin-top: var(--s-2); color: var(--text-muted); font-size: 14px; line-height: 1.6; }

.welcome-steps {
  display: grid;
  gap: var(--s-4);
  margin: var(--s-5) 0;
  padding: var(--s-5) 0;
  border-block: 1px solid var(--border);
  list-style: none;
  text-align: left;
}
.welcome-steps li { display: flex; align-items: center; gap: var(--s-3); }
.welcome-step-number {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  height: 32px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--accent-text);
  font: 13px var(--font-mono);
}
.welcome-steps h3 { color: var(--text); font-size: 14px; font-weight: 600; }
.welcome-steps p { margin-top: 2px; color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.welcome-actions { display: grid; gap: var(--s-2); }
.welcome-actions button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font: 600 14px var(--font-ui);
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
#welcome-start { background: var(--accent); color: var(--bg); border-color: var(--accent); }
#welcome-start:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
#welcome-demo { background: var(--surface-2); color: var(--text); }
#welcome-demo:hover { background: var(--surface-hover); }
.welcome-shortcut { margin-top: var(--s-4); color: var(--text-muted); font-size: 11px; }
.welcome-shortcut kbd { font: 11px var(--font-mono); color: var(--text); }

@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes toast-spin { to { transform: rotate(360deg); } }
@keyframes skeleton-shimmer { to { transform: translateX(100%); } }
@keyframes welcome-fade { from { opacity: 0; } }
@keyframes welcome-rise { from { opacity: 0; transform: translateY(10px) scale(0.985); } }
