/* ============================================================
 * Gopnik Wallet — Onboarding, Empty, Error, Celebration · M4
 *
 * The personality layer.  Where the design system stops being
 * a UI kit and starts having a voice.
 *
 *   §1  Onboarding flow shell + slide
 *   §2  Empty states (the friendly nothing)
 *   §3  Error states (when something went wrong, with grace)
 *   §4  Celebration overlay (the moments worth a screenshot)
 *   §5  Toast notifications (calmer than the cosmic-toast.css default)
 *   §6  Light-theme + reduced-motion overrides
 *
 * Loaded after mobile-pages.css.  All rules respect
 * --gn-* tokens and the existing motion guards from perf-motion.css.
 * (Mobile redesign — Iter-M4, 2026-04-25.)
 * ============================================================ */

@media (max-width: 991.98px) {

/* ─── §1  ONBOARDING ───────────────────────────────────────── */
/* The flow:
 *   Step 1 — Welcome (brand, tagline, "Get started" CTA)
 *   Step 2 — Choose path (Create wallet vs. Import existing)
 *   Step 3 — Permissions (notifications, biometrics)
 *   Step 4 — Done (lands on Home)
 *
 * The shell takes over the whole viewport (no header, no bottom
 * nav), keeps the user focused on a single decision per screen,
 * and finishes with a celebration handoff to Home.
 */

.gn-onboard {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--gn-bg, #070714);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Cosmic backdrop — keeps the brand front-and-centre during onboarding. */
  background-image:
    radial-gradient(ellipse at 30% 15%, rgba(139, 92, 246, 0.35) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 75%, rgba(34, 211, 238, 0.25) 0%, transparent 70%),
    radial-gradient(ellipse at 50% 95%, rgba(244, 114, 182, 0.18) 0%, transparent 60%);
}
.gn-onboard__progress {
  display: flex;
  gap: 6px;
  padding: 16px 22px 0;
  padding-top: calc(16px + var(--gn-safe-top, 0px));
  flex-shrink: 0;
}
.gn-onboard__progress-dot {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(139, 92, 246, 0.18);
  transition: background var(--gn-dur-base, 260ms) var(--gn-ease-snap, cubic-bezier(.4,0,.2,1));
}
.gn-onboard__progress-dot.completed { background: var(--gn-accent-2, #22d3ee); }
.gn-onboard__progress-dot.active {
  background: var(--gn-grad, linear-gradient(135deg, #8b5cf6, #22d3ee, #f472b6));
}

.gn-onboard__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px 28px;
  text-align: center;
}
.gn-onboard__art {
  width: 200px;
  height: 200px;
  margin-bottom: 32px;
  position: relative;
  display: grid;
  place-items: center;
}
.gn-onboard__art-mark {
  width: 120px;
  height: 120px;
  border-radius: 28px;
  background: var(--gn-grad, linear-gradient(135deg, #8b5cf6, #22d3ee, #f472b6));
  display: grid;
  place-items: center;
  color: white;
  font-size: 56px;
  font-weight: 900;
  letter-spacing: -0.04em;
  box-shadow:
    0 30px 60px -20px rgba(139, 92, 246, 0.6),
    0 0 0 8px rgba(139, 92, 246, 0.12);
  position: relative;
  z-index: 2;
  animation: gnOnboardMark 1.4s var(--gn-ease-spring, cubic-bezier(0.34, 1.56, 0.64, 1)) both;
}
.gn-onboard__art-orbit {
  position: absolute;
  inset: 0;
  border: 1px dashed rgba(139, 92, 246, 0.28);
  border-radius: 50%;
  animation: gnOnboardOrbit 18s linear infinite;
}
.gn-onboard__art-orbit::before,
.gn-onboard__art-orbit::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gn-accent-2, #22d3ee);
  box-shadow: 0 0 16px var(--gn-accent-2, #22d3ee);
}
.gn-onboard__art-orbit::before {
  top: -7px; left: 50%; transform: translateX(-50%);
}
.gn-onboard__art-orbit::after {
  bottom: -7px; left: 50%; transform: translateX(-50%);
  background: var(--gn-accent-3, #f472b6);
  box-shadow: 0 0 16px var(--gn-accent-3, #f472b6);
}
@keyframes gnOnboardMark {
  0%   { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}
@keyframes gnOnboardOrbit {
  to { transform: rotate(360deg); }
}

.gn-onboard__title {
  font-size: clamp(28px, 8vw, 36px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin: 0 0 14px;
  color: var(--gn-text, #e8e8f4);
}
.gn-onboard__title b {
  background: var(--gn-grad, linear-gradient(135deg, #8b5cf6, #22d3ee, #f472b6));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}
.gn-onboard__subtitle {
  font-size: 15px;
  line-height: 1.55;
  color: var(--gn-text-dim, #cfcfe6);
  margin: 0 0 32px;
  max-width: 320px;
}

/* Two-up choice cards (Create wallet / Import existing) */
.gn-onboard__choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  margin-top: 8px;
}
.gn-onboard-choice {
  padding: 18px;
  border-radius: 16px;
  background: var(--gn-panel, #111128);
  border: 1px solid rgba(139, 92, 246, 0.22);
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  cursor: pointer;
  transition: transform var(--gn-dur-quick, 180ms) var(--gn-ease-snap, cubic-bezier(.4,0,.2,1)),
              border-color var(--gn-dur-quick, 180ms) var(--gn-ease-snap, cubic-bezier(.4,0,.2,1));
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  color: inherit;
  width: 100%;
}
.gn-onboard-choice:active {
  transform: scale(0.98);
  border-color: var(--gn-accent-2, #22d3ee);
}
.gn-onboard-choice__icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--gn-grad-soft, linear-gradient(135deg, rgba(139,92,246,.18), rgba(34,211,238,.08)));
  display: grid;
  place-items: center;
  color: var(--gn-accent-2, #22d3ee);
  flex-shrink: 0;
}
.gn-onboard-choice__icon svg { width: 22px; height: 22px; }
.gn-onboard-choice__icon--gold {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(244, 114, 182, 0.1));
  color: var(--gn-gold, #fbbf24);
}
.gn-onboard-choice__text { flex: 1; }
.gn-onboard-choice__title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 2px;
}
.gn-onboard-choice__sub {
  font-size: 12px;
  color: var(--gn-muted, #8a8aa8);
  line-height: 1.4;
}
.gn-onboard-choice__chevron {
  color: var(--gn-muted-2, #6a6a8a);
  flex-shrink: 0;
}

.gn-onboard__footer {
  flex-shrink: 0;
  padding: 18px 28px;
  padding-bottom: calc(18px + var(--gn-safe-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gn-onboard__cta {
  width: 100%;
  height: var(--gn-touch-lg, 56px);
  border-radius: 18px;
  background: var(--gn-grad, linear-gradient(135deg, #8b5cf6, #22d3ee, #f472b6));
  color: white;
  font-size: 16px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 20px 40px -25px rgba(0, 0, 0, .8),
              0 0 0 1px rgba(139, 92, 246, 0.18);
  transition: transform var(--gn-dur-quick, 180ms) var(--gn-ease-snap, cubic-bezier(.4,0,.2,1));
  -webkit-tap-highlight-color: transparent;
}
.gn-onboard__cta:active { transform: scale(0.98); }
.gn-onboard__skip {
  background: none;
  border: none;
  color: var(--gn-muted, #8a8aa8);
  font-size: 13px;
  font-weight: 600;
  padding: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  text-align: center;
}


/* ─── §2  EMPTY STATES ─────────────────────────────────────── */
/* The "friendly nothing" — every list that could be empty
 * deserves a state that explains what will appear here and gives
 * the user a single next action.
 */

.gn-empty {
  margin: 24px var(--gn-pad-screen, 22px);
  padding: 40px 24px;
  border-radius: 20px;
  background: var(--gn-grad-soft, linear-gradient(135deg, rgba(139,92,246,.12), rgba(34,211,238,.06)));
  border: 1px solid rgba(139, 92, 246, 0.18);
  text-align: center;
  position: relative;
  overflow: hidden;
}
/* Subtle background star-glints — only the empty state gets them */
.gn-empty::before,
.gn-empty::after {
  content: '';
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(34, 211, 238, 0.6);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.6);
}
.gn-empty::before { top: 22px; left: 28px; }
.gn-empty::after  {
  bottom: 30px; right: 36px;
  background: rgba(244, 114, 182, 0.55);
  box-shadow: 0 0 10px rgba(244, 114, 182, 0.55);
  width: 4px; height: 4px;
}
.gn-empty__art {
  width: 88px; height: 88px;
  margin: 0 auto 18px;
  border-radius: 28px;
  background: var(--gn-panel, #111128);
  border: 1px solid rgba(139, 92, 246, 0.28);
  display: grid;
  place-items: center;
  color: var(--gn-accent-2, #22d3ee);
  font-size: 38px;
  position: relative;
  box-shadow: 0 0 32px rgba(139, 92, 246, 0.25);
}
.gn-empty__art svg { width: 38px; height: 38px; }
.gn-empty__art--gold {
  color: var(--gn-gold, #fbbf24);
  box-shadow: 0 0 32px rgba(251, 191, 36, 0.3);
}
.gn-empty__art--pink {
  color: var(--gn-accent-3, #f472b6);
  box-shadow: 0 0 32px rgba(244, 114, 182, 0.3);
}
.gn-empty__title {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 8px;
  color: var(--gn-text, #e8e8f4);
  letter-spacing: -0.01em;
}
.gn-empty__text {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--gn-text-dim, #cfcfe6);
  margin: 0 0 22px;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}
.gn-empty__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.gn-empty__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--gn-grad, linear-gradient(135deg, #8b5cf6, #22d3ee, #f472b6));
  color: white;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  min-height: var(--gn-touch-md, 48px);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.gn-empty__cta--ghost {
  background: transparent;
  color: var(--gn-text-dim, #cfcfe6);
  border: 1px solid rgba(139, 92, 246, 0.28);
}


/* ─── §3  ERROR STATES ─────────────────────────────────────── */
/* When something went wrong, with grace.  The error never
 * dominates — it explains, suggests a fix, gives a way out.
 */

.gn-error {
  margin: 16px var(--gn-pad-screen, 22px);
  padding: 16px;
  border-radius: 14px;
  background: rgba(248, 113, 113, 0.06);
  border: 1px solid rgba(248, 113, 113, 0.22);
  display: flex;
  gap: 12px;
}
.gn-error__icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 12px;
  background: rgba(248, 113, 113, 0.14);
  display: grid;
  place-items: center;
  color: var(--gn-red, #f87171);
}
.gn-error__icon svg { width: 18px; height: 18px; }
.gn-error__body { flex: 1; min-width: 0; }
.gn-error__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gn-text, #e8e8f4);
  margin: 0 0 4px;
}
.gn-error__text {
  font-size: 12.5px;
  color: var(--gn-text-dim, #cfcfe6);
  margin: 0 0 10px;
  line-height: 1.5;
}
.gn-error__actions {
  display: flex;
  gap: 8px;
}
.gn-error__btn {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.1);
  color: var(--gn-red, #f87171);
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}
.gn-error__btn--retry {
  background: rgba(248, 113, 113, 0.2);
}
.gn-error__btn--ghost {
  background: transparent;
  border-color: rgba(139, 92, 246, 0.22);
  color: var(--gn-text-dim, #cfcfe6);
}

/* Full-screen error variant — for "Connection lost" / "Page failed" */
.gn-error-full {
  padding: 80px 28px 40px;
  text-align: center;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.gn-error-full__art {
  width: 96px; height: 96px;
  border-radius: 28px;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.3);
  display: grid;
  place-items: center;
  color: var(--gn-red, #f87171);
  margin-bottom: 22px;
}
.gn-error-full__art svg { width: 42px; height: 42px; }
.gn-error-full__title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  color: var(--gn-text, #e8e8f4);
}
.gn-error-full__text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--gn-text-dim, #cfcfe6);
  margin: 0 0 22px;
  max-width: 300px;
}


/* ─── §4  CELEBRATION OVERLAY ──────────────────────────────── */
/* The screenshot moment.  Triggered by gnCelebrate(type, payload)
 * after a successful swap, mint, battle win, or achievement.  The
 * overlay covers the whole viewport, fires a one-shot burst of
 * confetti, then fades.  The user can tap-to-dismiss or wait.
 */

.gn-celebrate {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(7, 7, 20, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--gn-dur-base, 260ms) var(--gn-ease-smooth, cubic-bezier(0.22, 0.61, 0.36, 1));
}
.gn-celebrate[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
}
.gn-celebrate__card {
  width: 88%;
  max-width: 340px;
  padding: 32px 24px 24px;
  border-radius: 28px;
  background: var(--gn-bg-2, #0d0d22);
  border: 1px solid rgba(139, 92, 246, 0.32);
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 64px rgba(139, 92, 246, 0.45);
  transform: translateY(20px) scale(0.92);
  transition: transform var(--gn-dur-base, 260ms) var(--gn-ease-spring, cubic-bezier(0.34, 1.56, 0.64, 1));
}
.gn-celebrate[data-open="true"] .gn-celebrate__card {
  transform: translateY(0) scale(1);
}
.gn-celebrate__card::before {
  /* Cosmic burst behind the icon */
  content: '';
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, transparent 60%);
  pointer-events: none;
}
.gn-celebrate__icon {
  width: 96px; height: 96px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--gn-grad, linear-gradient(135deg, #8b5cf6, #22d3ee, #f472b6));
  display: grid;
  place-items: center;
  color: white;
  position: relative;
  z-index: 2;
  box-shadow:
    0 20px 60px rgba(139, 92, 246, 0.55),
    0 0 0 6px rgba(139, 92, 246, 0.18);
}
.gn-celebrate__icon svg { width: 48px; height: 48px; }
.gn-celebrate__icon--gold {
  background: linear-gradient(135deg, #fbbf24, #f97316, #f472b6);
  box-shadow: 0 20px 60px rgba(251, 191, 36, 0.55), 0 0 0 6px rgba(251, 191, 36, 0.18);
}

.gn-celebrate__title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  color: var(--gn-text, #e8e8f4);
  position: relative;
  z-index: 2;
}
.gn-celebrate__text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--gn-text-dim, #cfcfe6);
  margin: 0 0 22px;
  position: relative;
  z-index: 2;
}
.gn-celebrate__detail {
  margin: 0 0 22px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.18);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  position: relative;
  z-index: 2;
}
.gn-celebrate__detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}
.gn-celebrate__detail-label { color: var(--gn-muted, #8a8aa8); font-weight: 500; }
.gn-celebrate__detail-value { color: var(--gn-text, #e8e8f4); font-weight: 700; }
.gn-celebrate__detail-value--green { color: var(--gn-green, #34d399); }
.gn-celebrate__detail-value--mono {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
}

.gn-celebrate__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 2;
}
.gn-celebrate__cta {
  height: var(--gn-touch-lg, 56px);
  border-radius: 16px;
  background: var(--gn-grad, linear-gradient(135deg, #8b5cf6, #22d3ee, #f472b6));
  color: white;
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.gn-celebrate__cta--ghost {
  background: transparent;
  color: var(--gn-text-dim, #cfcfe6);
  border: 1px solid rgba(139, 92, 246, 0.28);
}

/* Confetti — five particles fired by JS as positioned spans */
.gn-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}
.gn-confetti__piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  animation: gnConfettiFly 1.6s var(--gn-ease-smooth, cubic-bezier(0.22, 0.61, 0.36, 1)) forwards;
}
@keyframes gnConfettiFly {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0deg) scale(0.5);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx, 100px), var(--dy, -100px)) rotate(var(--rot, 540deg)) scale(1);
  }
}


/* ─── §5  TOAST ────────────────────────────────────────────── */
/* Calm, dismissible, never blocks.  Triggered by gnToast(message). */

.gn-toast-stack {
  position: fixed;
  top: calc(60px + var(--gn-safe-top, 0px));
  left: 0; right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 9700;
  pointer-events: none;
  padding: 0 16px;
}
.gn-toast {
  pointer-events: auto;
  min-width: 220px;
  max-width: 380px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--gn-bg-2, #0d0d22);
  border: 1px solid rgba(139, 92, 246, 0.32);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gn-text, #e8e8f4);
  transform: translateY(-12px);
  opacity: 0;
  transition: transform var(--gn-dur-base, 260ms) var(--gn-ease-spring, cubic-bezier(0.34, 1.56, 0.64, 1)),
              opacity var(--gn-dur-base, 260ms) var(--gn-ease-snap, cubic-bezier(.4,0,.2,1));
}
.gn-toast[data-visible="true"] {
  transform: translateY(0);
  opacity: 1;
}
.gn-toast__icon {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--gn-bg, #070714);
  font-size: 14px;
}
.gn-toast--success .gn-toast__icon { background: var(--gn-green, #34d399); }
.gn-toast--error .gn-toast__icon   { background: var(--gn-red, #f87171); }
.gn-toast--info .gn-toast__icon    { background: var(--gn-accent-2, #22d3ee); }


}  /* end @media (max-width: 991.98px) */


/* ─── §6  REDUCED MOTION + LIGHT THEME ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .gn-onboard__art-mark,
  .gn-onboard__art-orbit,
  .gn-confetti__piece {
    animation: none;
  }
  .gn-celebrate__card { transition: none; }
}

.light-theme .gn-onboard {
  background: #ffffff;
  background-image:
    radial-gradient(ellipse at 30% 15%, rgba(139, 92, 246, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 75%, rgba(34, 211, 238, 0.14) 0%, transparent 70%);
}
.light-theme .gn-onboard__title,
.light-theme .gn-empty__title,
.light-theme .gn-error__title,
.light-theme .gn-error-full__title,
.light-theme .gn-celebrate__title { color: #1f2937; }
.light-theme .gn-onboard-choice,
.light-theme .gn-celebrate__card,
.light-theme .gn-toast { background: #ffffff; border-color: rgba(0, 0, 0, 0.08); }
.light-theme .gn-empty {
  background: linear-gradient(135deg, rgba(139,92,246,.06), rgba(34,211,238,.04));
}
