/* ============================================================
   ADVENTURE OF CLAIR — ONBOARDING CSS
   Covers: intro, session gate, profile setup, restore, sync
   ============================================================ */

/* ── CINEMATIC INTRO ────────────────────────────────────── */
#screen-intro {
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  overflow: hidden;
}

.intro-scene {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-lg);
  gap: var(--space-xl);
  position: relative;
}

/* Animated starfield background */
.intro-scene::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1px 1px at 20% 30%, rgba(255,215,0,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 10%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 50% 60%, rgba(255,215,0,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 10% 80%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 70%, rgba(255,215,0,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 35% 15%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 65% 85%, rgba(255,215,0,0.5) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 45% 45%, rgba(255,215,0,0.3) 0%, transparent 100%);
  pointer-events: none;
  animation: stars-twinkle 4s ease-in-out infinite alternate;
}

@keyframes stars-twinkle {
  0%   { opacity: 0.5; }
  100% { opacity: 1; }
}

.intro-image-wrap {
  width: 100%;
  max-width: 340px;
  aspect-ratio: 4/3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-bg-2);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  animation: intro-image-float 4s ease-in-out infinite;
}

@keyframes intro-image-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.intro-image-wrap svg {
  width: 100%;
  height: 100%;
}

.intro-text-wrap {
  max-width: 500px;
  width: 100%;
}

.intro-text {
  font-family: var(--font-display);
  font-size: clamp(1rem, 3.5vw, 1.3rem);
  color: var(--text-primary);
  text-align: center;
  line-height: 1.7;
  min-height: 80px;
  letter-spacing: 0.01em;
}

.intro-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--gold);
  margin-left: 2px;
  vertical-align: middle;
  animation: cursor-blink 0.8s step-end infinite;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.intro-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg) var(--space-xl);
}

.intro-dots {
  display: flex;
  gap: var(--space-sm);
}

.intro-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  transition: all var(--transition-normal);
}

.intro-dot.active {
  background: var(--gold);
  width: 24px;
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(255,215,0,0.5);
}

.btn-intro-next {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 14px 32px;
  background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(255,215,0,0.08));
  border: 1.5px solid var(--color-border-hover);
  border-radius: var(--radius-full);
  color: var(--gold);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: all var(--transition-fast);
}
.btn-intro-next:hover {
  background: rgba(255,215,0,0.2);
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

.btn-intro-skip {
  background: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 8px;
  transition: color var(--transition-fast);
}
.btn-intro-skip:hover { color: var(--text-secondary); }

/* ── SESSION GATE ────────────────────────────────────────── */
#screen-gate {
  background: radial-gradient(ellipse at top, #141B2E 0%, #0A0E1A 70%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-2xl) var(--space-lg);
  max-width: 420px;
  width: 100%;
}

.gate-emblem {
  width: 80px;
  height: 80px;
  animation: emblem-pulse 2.5s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(255,215,0,0.5));
}

.gate-title {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 5vw, 1.8rem);
  color: var(--gold);
  text-align: center;
  text-shadow: 0 0 30px rgba(255,215,0,0.3);
}

.gate-subtitle {
  color: var(--text-secondary);
  text-align: center;
  font-size: 0.9rem;
  margin-top: -var(--space-sm);
}

.gate-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  width: 100%;
}

.btn-gate {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  width: 100%;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.btn-gate i {
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.btn-gate span {
  font-size: 1rem;
  font-weight: 700;
  display: block;
}

.btn-gate small {
  font-size: 0.78rem;
  opacity: 0.75;
  display: block;
}

.btn-gate-primary {
  background: linear-gradient(135deg, rgba(255,215,0,0.18) 0%, rgba(255,215,0,0.06) 100%);
  border: 1.5px solid rgba(255,215,0,0.4);
  color: var(--gold);
}
.btn-gate-primary:hover {
  background: linear-gradient(135deg, rgba(255,215,0,0.28) 0%, rgba(255,215,0,0.12) 100%);
  box-shadow: var(--shadow-gold);
  transform: translateY(-2px);
}

.btn-gate-secondary {
  background: var(--color-bg-elevated);
  border: 1.5px solid var(--color-border);
  color: var(--text-primary);
}
.btn-gate-secondary:hover {
  border-color: var(--color-border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ── PROFILE SETUP ───────────────────────────────────────── */
#screen-setup {
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at top, #0F1628 0%, #0A0E1A 100%);
  overflow-y: auto;
}

.setup-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-lg) var(--space-2xl);
  min-height: 100vh;
  min-height: 100dvh;
  flex: 1;
}

/* Progress Steps */
.setup-progress {
  display: flex;
  align-items: center;
  gap: 0;
  padding: var(--space-lg) 0;
  width: 100%;
  justify-content: center;
}

.setup-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.setup-step span {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-bg-elevated);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all var(--transition-normal);
}

.step-circle.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--text-inverse);
  box-shadow: 0 0 16px rgba(255,215,0,0.5);
}

.step-circle.done {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: white;
}

.setup-step-line {
  width: 60px;
  height: 2px;
  background: var(--color-border);
  margin: 0 var(--space-xs);
  margin-bottom: 22px;
  transition: background var(--transition-normal);
}

.setup-step-line.done { background: var(--gold); }

/* Step content */
.setup-step-content {
  width: 100%;
  animation: step-fade-in 0.35s ease;
}

@keyframes step-fade-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.setup-header {
  margin-bottom: var(--space-xl);
}

.setup-header h2 {
  font-size: clamp(1.2rem, 4vw, 1.6rem);
  color: var(--gold);
  margin-bottom: var(--space-xs);
}

.setup-header p {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.setup-form {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
}

/* Education Type Grid */
.edu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.edu-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-md);
  background: var(--color-bg-elevated);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.edu-card i {
  font-size: 1.4rem;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.edu-card:hover {
  border-color: var(--color-border-hover);
  color: var(--text-primary);
}
.edu-card:hover i { color: var(--gold); }

.edu-card.selected {
  border-color: var(--gold);
  background: rgba(255,215,0,0.08);
  color: var(--gold);
}
.edu-card.selected i { color: var(--gold); }

/* ── PIN DIAL PAD ────────────────────────────────────────── */
.pin-display {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: var(--space-md) 0;
}

.pin-dot {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-border);
  background: transparent;
  transition: all var(--transition-fast);
}

.pin-dot.filled {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(255,215,0,0.5);
  transform: scale(1.15);
}

.pin-dot.error {
  background: var(--accent-red);
  border-color: var(--accent-red);
  animation: pin-shake 0.4s ease;
}

.pin-dot.success {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

@keyframes pin-shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-4px); }
  75%       { transform: translateX(4px); }
}

.dialpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 340px;
  width: 100%;
  margin: 0 auto var(--space-md);
}

.dial-key {
  height: 68px;
  border-radius: var(--radius-lg);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  color: var(--text-primary);
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--font-body);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.dial-key small {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  line-height: 1;
}

.dial-key:active,
.dial-key.pressed {
  background: rgba(255,215,0,0.15);
  border-color: var(--gold);
  transform: scale(0.92);
}

.dial-key.dial-empty { background: none; border-color: transparent; cursor: default; }
.dial-key.dial-back  { font-size: 1.1rem; color: var(--text-secondary); }
.dial-key.dial-back:hover { color: var(--accent-red); }

.pin-match-msg {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: var(--space-sm);
  min-height: 20px;
}
.pin-match-msg.success { color: var(--accent-green); }
.pin-match-msg.error   { color: var(--accent-red); }

.pin-hint {
  text-align: center;
  font-size: 0.78rem;
  color: var(--accent-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: var(--space-sm);
}

/* ── RESTORE SESSION ─────────────────────────────────────── */
#screen-restore {
  background: radial-gradient(ellipse at top, #0F1628 0%, #0A0E1A 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.restore-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 420px;
  padding: var(--space-2xl) var(--space-lg) var(--space-2xl);
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
}

.restore-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
  text-align: center;
}

.restore-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: rgba(255,215,0,0.1);
  border: 2px solid rgba(255,215,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--gold);
  margin-bottom: var(--space-sm);
  box-shadow: 0 0 30px rgba(255,215,0,0.15);
}

.restore-header h2 { color: var(--gold); }

/* ── SYNC SCREEN ─────────────────────────────────────────── */
#screen-sync {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
}

.sync-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-xl);
  max-width: 360px;
  width: 100%;
}

.sync-animation {
  width: 120px;
  height: 120px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sync-orb {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-full);
  background: radial-gradient(circle, var(--gold-light), var(--gold-mid));
  box-shadow: 0 0 30px rgba(255,215,0,0.6);
  animation: orb-pulse 1.5s ease-in-out infinite;
  z-index: 2;
}

@keyframes orb-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 30px rgba(255,215,0,0.6); }
  50%       { transform: scale(1.1); box-shadow: 0 0 50px rgba(255,215,0,0.9); }
}

.sync-rings {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sync-ring {
  position: absolute;
  border-radius: var(--radius-full);
  border: 1.5px solid rgba(255,215,0,0.3);
  animation: ring-expand 2s ease-out infinite;
}
.sync-ring:nth-child(1) { width: 70px;  height: 70px;  animation-delay: 0s; }
.sync-ring:nth-child(2) { width: 95px;  height: 95px;  animation-delay: 0.5s; }
.sync-ring:nth-child(3) { width: 120px; height: 120px; animation-delay: 1s; }

@keyframes ring-expand {
  0%   { opacity: 0.6; transform: scale(0.8); }
  100% { opacity: 0;   transform: scale(1); }
}

.sync-title {
  font-size: 1.3rem;
  color: var(--gold);
  text-align: center;
}

.sync-message {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.sync-progress-wrap {
  width: 100%;
  height: 6px;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.sync-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-light));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.sync-step {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── SUCCESS SCREEN ──────────────────────────────────────── */
#screen-success {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at top, #141B2E 0%, #0A0E1A 70%);
}

.success-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-xl) var(--space-lg);
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.success-animation {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.success-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--gold);
  animation: particle-burst 0.8s ease-out forwards;
}

@keyframes particle-burst {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(1); opacity: 0; }
}

.success-emblem {
  width: 80px;
  height: 80px;
  animation: success-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes success-pop {
  0%   { transform: scale(0); }
  100% { transform: scale(1); }
}

.success-title {
  font-size: clamp(1.5rem, 5vw, 2rem);
  color: var(--gold);
  text-shadow: 0 0 30px rgba(255,215,0,0.4);
  animation: success-title-in 0.6s 0.3s both;
}

@keyframes success-title-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.success-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  animation: success-title-in 0.6s 0.5s both;
}

.success-stats {
  display: flex;
  gap: var(--space-lg);
  justify-content: center;
  flex-wrap: wrap;
  animation: success-title-in 0.6s 0.7s both;
}

.success-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.success-stat i { color: var(--gold); font-size: 1.2rem; }

/* ── DESKTOP ADJUSTMENTS ─────────────────────────────────── */
@media (min-width: 768px) {
  .intro-scene {
    flex-direction: row-reverse;
    justify-content: center;
    gap: var(--space-2xl);
    padding: var(--space-2xl);
  }

  .intro-image-wrap {
    max-width: 440px;
    flex-shrink: 0;
  }

  .intro-text-wrap { max-width: 400px; }
  .intro-text { text-align: left; font-size: 1.2rem; }

  .setup-wrap { padding-top: var(--space-2xl); justify-content: center; }
  .restore-wrap { justify-content: center; padding-top: var(--space-2xl); }

  .dialpad { max-width: 280px; }
}

/* ── LANDSCAPE PHONE ─────────────────────────────────────── */
@media (max-height: 600px) and (orientation: landscape) {
  .intro-scene { padding: var(--space-md) var(--space-lg); }
  .intro-image-wrap { max-width: 200px; }
  .setup-wrap { min-height: auto; overflow-y: auto; }
  .dialpad { gap: var(--space-xs); }
  .dial-key { font-size: 1rem; }
}