/* ============================================================================
   VEYA — base tokens, layout, phone frame, splash, onboarding, tab bar
   ============================================================================ */
:root {
  --void:    #000000;
  --void-1:  #06080F;
  --void-2:  #0A0E1A;
  --void-3:  #11162A;
  --line:    rgba(255,255,255,0.06);
  --line-2:  rgba(255,255,255,0.10);
  --ink:     #FFFFFF;
  --ink-d:   #E4E8F2;
  --ink-q:   #A8B0C4;
  --cyan:    #19D2D2;
  --violet:  #8B5CF6;
  --aqua:    #3DE1B5;
  --amber:   #F5B454;
  --red:     #F45A6E;
  --rose:    #F45A6E;
  --grad:    linear-gradient(135deg, #19D2D2 0%, #8B5CF6 50%, #3DE1B5 100%);
  --grad-soft: linear-gradient(135deg, rgba(25,210,210,.18), rgba(139,92,246,.16), rgba(61,225,181,.14));
  --display: 'Fraunces', 'New York', Georgia, serif;
  --body:    'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --r-sm: 10px; --r:   16px; --r-lg: 22px; --r-xl: 28px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--void); color: var(--ink); font-family: var(--body); font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  background: radial-gradient(1200px 800px at 20% 0%, #0E1230 0%, transparent 60%),
              radial-gradient(900px 700px at 100% 100%, #1A0B30 0%, transparent 55%),
              var(--void);
  min-height: 100vh; overflow: hidden;
}
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
img { display: block; max-width: 100%; }

/* ---- ambient atmosphere (canvas behind everything) -------------------- */
#atmos { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.bloom {
  position: fixed; border-radius: 50%; filter: blur(120px); pointer-events: none; z-index: 0;
  opacity: 0.45; animation: drift 38s ease-in-out infinite;
}
.bloom.b1 { top: -150px; left: -100px; width: 520px; height: 520px; background: #19D2D2; }
.bloom.b2 { bottom: -200px; right: -100px; width: 600px; height: 600px; background: #8B5CF6; animation-duration: 46s; animation-delay: -8s; }
.bloom.b3 { top: 40%; right: 10%; width: 380px; height: 380px; background: #3DE1B5; opacity: 0.3; animation-duration: 54s; animation-delay: -16s; }
@keyframes drift {
  0%, 100% { transform: translate(0,0) scale(1); }
  50%      { transform: translate(40px, 30px) scale(1.08); }
}

/* ---- phone frame (mobile-first, framed on desktop) -------------------- */
.app-shell {
  position: relative; z-index: 1;
  width: 100%; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--void);
}
@media (min-width: 640px) {
  .app-shell {
    width: 420px; height: 880px; max-height: 92vh;
    margin: 4vh auto; border-radius: 42px;
    border: 1px solid var(--line-2);
    box-shadow: 0 60px 120px rgba(0,0,0,0.55),
                0 0 0 8px rgba(255,255,255,0.02),
                0 0 80px rgba(139,92,246,0.12);
  }
}

/* ---- splash screen ---------------------------------------------------- */
.splash {
  position: absolute; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--void);
  transition: opacity 0.8s ease-out, visibility 0.8s;
}
.splash.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-logo {
  width: 60%; max-width: 240px; aspect-ratio: 1; opacity: 0; animation: splashIn 1.2s 0.2s forwards;
  filter: drop-shadow(0 0 40px rgba(25,210,210,0.4)) drop-shadow(0 0 80px rgba(139,92,246,0.3));
}
.splash-logo img { width: 100%; height: 100%; object-fit: contain; animation: splashBreathe 5s ease-in-out infinite; }
@keyframes splashIn  { from { opacity: 0; transform: scale(0.85); filter: blur(20px); } to { opacity: 1; transform: scale(1); filter: blur(0); } }
@keyframes splashBreathe { 0%,100% { opacity: 1; } 50% { opacity: 0.88; } }
.splash-tag { margin-top: 24px; font-family: var(--display); font-size: 15px; letter-spacing: 0.25em; color: var(--ink-d); text-transform: uppercase; opacity: 0; animation: fadeUp 0.8s 1.4s forwards; }

/* ---- onboarding ------------------------------------------------------- */
.onboard {
  position: absolute; inset: 0; z-index: 40;
  display: flex; flex-direction: column;
  padding: 80px 32px 40px;
  background: var(--void);
  transition: opacity 0.6s, transform 0.6s;
}
.onboard.gone { opacity: 0; transform: translateY(-20px); pointer-events: none; }
.onboard-step { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.onboard-step.hidden { display: none; }
.onboard-icon {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--grad-soft);
  border: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 44px; margin-bottom: 32px;
  animation: pulseGlow 3s ease-in-out infinite;
}
@keyframes pulseGlow {
  0%,100% { box-shadow: 0 0 40px rgba(25,210,210,0.2); }
  50%     { box-shadow: 0 0 60px rgba(139,92,246,0.35); }
}
.onboard-title {
  font-family: var(--display); font-size: 32px; line-height: 1.15; font-weight: 500;
  letter-spacing: -0.02em; margin: 0 0 16px;
}
.onboard-title em { font-style: italic; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.onboard-body { font-size: 17px; line-height: 1.55; color: var(--ink-d); max-width: 320px; margin: 0; }
.onboard-dots { display: flex; gap: 8px; justify-content: center; margin: 24px 0; }
.onboard-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); transition: all 0.3s; }
.onboard-dot.active { width: 24px; background: var(--grad); border-radius: 3px; }
.onboard-cta { width: 100%; padding: 16px 24px; border-radius: 999px; background: var(--ink); color: var(--void); font-weight: 600; font-size: 16px; letter-spacing: 0.01em; transition: all 0.2s; }
.onboard-cta:hover { background: var(--grad); color: var(--ink); transform: translateY(-1px); }
.onboard-skip { background: none; color: var(--ink-q); padding: 12px; font-size: 14px; margin-top: 8px; }
.onboard-skip:hover { color: var(--ink-d); }

/* ---- bottom tab bar --------------------------------------------------- */
.tabbar {
  display: flex; justify-content: space-around; align-items: center;
  padding: 8px 4px 12px;
  background: rgba(6,8,15,0.85);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
  z-index: 30; flex-shrink: 0;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 8px; min-width: 50px; border-radius: 12px;
  color: var(--ink-q); transition: color 0.2s;
  position: relative;
}
.tab-icon { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
.tab-icon svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tab-label { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.tab.active { color: var(--ink); }
.tab.active .tab-icon { color: var(--cyan); }
.tab.active::before {
  content: ''; position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  width: 24px; height: 2px; border-radius: 2px; background: var(--grad);
}

/* ---- surface container ------------------------------------------------ */
.surfaces { flex: 1; position: relative; overflow: hidden; }
.surface {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s ease;
  overflow: hidden;
}
.surface.active { opacity: 1; pointer-events: auto; }
.surface-head {
  padding: 20px 20px 12px; display: flex; align-items: flex-end; justify-content: space-between;
  flex-shrink: 0;
}
.surface-title { font-family: var(--display); font-size: 30px; font-weight: 500; letter-spacing: -0.02em; line-height: 1; margin: 0; }
.surface-sub { font-size: 14px; color: var(--ink-d); margin: 4px 0 0; letter-spacing: 0.02em; }
.surface-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.surface-body::-webkit-scrollbar { display: none; }

/* ---- universal avatar ------------------------------------------------- */
.avatar { position: relative; flex-shrink: 0; border-radius: 50%; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initial { display: flex; align-items: center; justify-content: center; background: var(--grad); }
.avatar-initial span { color: white; font-weight: 600; font-size: 0.45em; font-family: var(--display); }
.avatar::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid transparent; pointer-events: none;
  animation: ringBreathe 3.5s ease-in-out infinite;
}
.ring-safe::after    { border-color: var(--aqua);   }
.ring-travel::after  { border-color: var(--cyan);   }
.ring-work::after    { border-color: var(--amber);  }
.ring-help::after    { border-color: var(--red);    }
.ring-offline::after { border-color: transparent;   }
@keyframes ringBreathe { 0%,100% { opacity: 0.7; } 50% { opacity: 1; } }

/* ---- toast ------------------------------------------------------------ */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(20px);
  padding: 12px 20px; background: rgba(17,22,42,0.95); border: 1px solid var(--line-2);
  border-radius: 999px; font-size: 13px; color: var(--ink); z-index: 100;
  opacity: 0; transition: opacity 0.3s, transform 0.3s;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeUp 0.5s ease-out both; }
