/**
 * Onboarding — Splash, role select, signup, welcome tour.
 * Polished, responsive, desktop + mobile.
 */
@keyframes prepriga-shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.onboarding-layer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--app-bg);
  overflow: hidden;
}
.onboarding-layer [aria-hidden="true"] {
  display: none !important;
}

/* ----- Splash ----- */
.splash {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--app-gradient-mesh);
  background-color: var(--app-bg);
}
.splash.active {
  display: flex;
}
.splash-inner {
  text-align: center;
  padding: 24px;
}
.splash-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: var(--app-radius-lg);
  margin-bottom: 16px;
  box-shadow: var(--app-shadow-card);
}
.splash-title {
  font-size: 1.85rem;
  font-weight: 800;
  margin-bottom: 4px;
  letter-spacing: 0.03em;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #4f46e5 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: prepriga-shimmer 3s ease-in-out infinite;
}
.splash-tagline {
  font-size: 0.875rem;
  color: var(--app-text-secondary);
  letter-spacing: 0.03em;
}

/* ----- Role select: Who are you? ----- */
.role-select {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.role-select-bg {
  position: absolute;
  inset: 0;
  background: var(--app-gradient-mesh);
  background-color: #f0f4ff;
  pointer-events: none;
}
.role-select-inner {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: max(20px, var(--app-safe-top)) 20px max(20px, var(--app-safe-bottom));
  overflow-y: auto;
}
.role-select-kicker {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--app-primary);
  margin: 0 0 6px;
  text-align: center;
}
.role-select-heading {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--app-text);
  text-align: center;
  margin: 0 0 8px;
  line-height: 1.2;
}
.role-select-sub {
  font-size: 0.9375rem;
  color: var(--app-text-secondary);
  text-align: center;
  margin: 0 0 28px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.45;
}

.role-carousel {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  align-content: start;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}
@media (min-width: 640px) {
  .role-carousel {
    grid-template-columns: repeat(4, 1fr);
    max-width: 900px;
    gap: 18px;
  }
}

.role-card {
  position: relative;
  scroll-snap-align: center;
  background: var(--app-surface);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--app-radius-xl);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 4px 24px -6px rgba(0, 0, 0, 0.08), 0 2px 8px -2px rgba(0, 0, 0, 0.04);
  transition: transform var(--app-duration) var(--app-ease), box-shadow var(--app-duration) var(--app-ease), border-color var(--app-duration) var(--app-ease);
  overflow: hidden;
}
.role-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px -8px rgba(99, 102, 241, 0.2), 0 4px 16px -4px rgba(0, 0, 0, 0.06);
  border-color: rgba(99, 102, 241, 0.25);
}
.role-card:active {
  transform: translateY(-2px);
}
.role-card-glow {
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 120%;
  height: 80%;
  border-radius: 50%;
  opacity: 0.35;
  pointer-events: none;
}
.role-card-student .role-card-glow { background: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.4) 0%, transparent 70%); }
.role-card-school .role-card-glow { background: radial-gradient(ellipse at center, rgba(16, 185, 129, 0.35) 0%, transparent 70%); }
.role-card-parent .role-card-glow { background: radial-gradient(ellipse at center, rgba(245, 158, 11, 0.35) 0%, transparent 70%); }
.role-card-mentor .role-card-glow { background: radial-gradient(ellipse at center, rgba(139, 92, 246, 0.4) 0%, transparent 70%); }

.role-icon {
  position: relative;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  border-radius: var(--app-radius-md);
  background: var(--app-bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.role-icon img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}
@media (min-width: 640px) {
  .role-icon {
    width: 56px;
    height: 56px;
  }
  .role-icon img {
    width: 36px;
    height: 36px;
  }
}
.role-card h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--app-text);
  margin: 0 0 6px;
  line-height: 1.25;
}
@media (min-width: 640px) {
  .role-card h3 {
    font-size: 1rem;
  }
}
.role-card p {
  font-size: 0.8125rem;
  color: var(--app-text-secondary);
  margin: 0 0 16px;
  flex: 1;
  line-height: 1.4;
  min-height: 2.8em;
}
.btn-select-role {
  width: 100%;
  padding: 12px 16px;
  background: var(--app-gradient-primary);
  color: #fff;
  border: none;
  border-radius: var(--app-radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.35);
  transition: transform var(--app-duration-fast) var(--app-ease), box-shadow var(--app-duration-fast) var(--app-ease);
}
.btn-select-role:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}
.btn-select-role:active {
  transform: translateY(0);
}
.role-dots {
  display: none; /* Grid layout: no scroll, so dots not used */
  justify-content: center;
  gap: 8px;
  padding: 20px 0 0;
}
.role-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--app-border);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background var(--app-duration-fast), transform var(--app-duration-fast);
}
.role-dot:hover {
  background: var(--app-text-muted);
}
.role-dot.active {
  background: var(--app-primary);
  transform: scale(1.25);
}

/* ----- Signup step: Almost there ----- */
.signup-step {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.signup-step-bg {
  position: fixed;
  inset: 0;
  background: var(--app-gradient-mesh);
  background-color: #f5f7ff;
  pointer-events: none;
  z-index: 0;
}
.signup-step-inner {
  position: relative;
  z-index: 1;
  flex: 1;
  padding: max(16px, var(--app-safe-top)) 20px max(24px, var(--app-safe-bottom));
  max-width: 440px;
  margin: 0 auto;
  width: 100%;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 10px 8px;
  margin: 0 0 20px -8px;
  background: transparent;
  border: none;
  border-radius: var(--app-radius-md);
  color: var(--app-primary);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--app-duration-fast), color var(--app-duration-fast);
}
.back-btn:hover {
  background: var(--app-primary-soft);
  color: var(--app-primary-hover);
}
.back-btn svg {
  flex-shrink: 0;
}

.signup-header {
  margin-bottom: 28px;
}
.signup-heading {
  font-size: 1.625rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--app-text);
  margin: 0 0 6px;
  line-height: 1.2;
}
.signup-sub {
  font-size: 0.9375rem;
  color: var(--app-text-secondary);
  margin: 0;
  line-height: 1.4;
}

.signup-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.signup-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.signup-field-slider {
  gap: 12px;
}
.signup-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--app-text);
}
.signup-input,
.signup-select {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-md);
  font-size: 1rem;
  font-family: inherit;
  background: var(--app-surface);
  color: var(--app-text);
  transition: border-color var(--app-duration-fast), box-shadow var(--app-duration-fast);
}
.signup-input::placeholder {
  color: var(--app-text-muted);
}
.signup-input:focus,
.signup-select:focus {
  outline: none;
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px var(--app-primary-soft);
}
.signup-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
  padding-right: 44px;
}
.signup-hint {
  font-size: 0.8125rem;
  color: var(--app-text-muted);
  margin-top: 2px;
}

.signup-slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.signup-goal-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--app-primary);
}

/* Custom range slider */
.signup-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  border-radius: var(--app-radius-full);
  background: var(--app-border-soft);
  outline: none;
}
.signup-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--app-gradient-primary);
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.45);
  border: 3px solid #fff;
  transition: transform var(--app-duration-fast);
}
.signup-range::-webkit-slider-thumb:hover {
  transform: scale(1.08);
}
.signup-range::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--app-gradient-primary);
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.45);
  border: 3px solid #fff;
}
.signup-range::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: var(--app-radius-full);
  background: linear-gradient(to right, var(--app-primary) 0%, var(--app-primary) var(--value, 80%), var(--app-border-soft) var(--value, 80%));
}
/* Track fill via JS or use accent-color fallback */
.signup-range {
  accent-color: var(--app-primary);
}

.signup-submit {
  width: 100%;
  margin-top: 8px;
  padding: 16px 24px;
  background: var(--app-gradient-primary);
  color: #fff;
  border: none;
  border-radius: var(--app-radius-md);
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  transition: transform var(--app-duration-fast) var(--app-ease), box-shadow var(--app-duration-fast) var(--app-ease);
}
.signup-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
}
.signup-submit:active {
  transform: translateY(0);
}

.signup-auth-footer {
  margin: 24px 0 0;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--app-text-muted);
}
.signup-auth-footer a {
  color: var(--app-primary);
  font-weight: 600;
  text-decoration: none;
}
.signup-auth-footer a:hover {
  text-decoration: underline;
}

@media (min-width: 640px) {
  .signup-step-inner {
    padding-top: 32px;
    padding-bottom: 40px;
  }
  .signup-step-inner {
    background: var(--app-surface);
    border-radius: var(--app-radius-xl);
    box-shadow: 0 8px 40px -12px rgba(0, 0, 0, 0.12);
    border: 1px solid var(--app-border-soft);
    padding: 32px 40px 40px;
    margin: 40px auto;
  }
}

/* ----- Welcome tour ----- */
.welcome-tour {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--app-bg);
}
.tour-carousel {
  flex: 1;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.tour-carousel::-webkit-scrollbar {
  display: none;
}
.tour-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}
.tour-slide h2 {
  font-size: 1.5rem;
  margin-bottom: 12px;
}
.tour-slide p {
  font-size: 0.9375rem;
  color: var(--app-text-secondary);
  margin-bottom: 24px;
  max-width: 320px;
}
.tour-slide-cta .btn-primary-block {
  max-width: 280px;
  padding: 14px 28px;
  background: var(--app-gradient-primary);
  color: #fff;
  border: none;
  border-radius: var(--app-radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
  transition: transform var(--app-duration-fast), box-shadow var(--app-duration-fast);
}
.tour-slide-cta .btn-primary-block:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}
.tour-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 20px;
}
.tour-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--app-border);
  border: none;
  padding: 0;
}
.tour-dot.active {
  background: var(--app-primary);
}
