/* ============================================
   BLIX - NEXT-GEN SMART FEED
   Pioneer-grade mobile-first design
   Animated mesh · 3D cards · Glassmorphism 2.0
   ============================================ */

/* ─── DESIGN TOKENS ─── */
:root {
  --primary: #FF3D54;
  --primary-glow: rgba(255,61,84,0.35);
  --primary-light: #FF6A7A;
  --primary-dark: #E02A3F;
  --accent: #10B981;
  --accent-glow: rgba(16,185,129,0.3);
  --purple: #7C3AED;
  --blue: #3B82F6;
  --orange: #FF6B35;

  --bg: #F0F2F8;
  --bg-card: rgba(255,255,255,0.82);
  --bg-card-solid: #FFFFFF;
  --glass: rgba(255,255,255,0.55);
  --glass-border: rgba(255,255,255,0.35);
  --glass-heavy: rgba(255,255,255,0.72);

  --text: #0B0F1A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --border: rgba(15,23,42,0.06);

  --shadow-xs: 0 1px 3px rgba(15,23,42,0.04);
  --shadow-sm: 0 2px 8px rgba(15,23,42,0.06);
  --shadow-md: 0 8px 30px rgba(15,23,42,0.08);
  --shadow-lg: 0 20px 50px rgba(15,23,42,0.12);
  --shadow-xl: 0 32px 80px rgba(15,23,42,0.16);
  --shadow-glow: 0 0 40px var(--primary-glow);

  --radius-sm: 14px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 100px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ─── RESET ─── */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ═══════════════════════════════════════════
   LOADING SCREEN
   ═══════════════════════════════════════════ */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(135deg, #0B0F1A, #1E1B4B, #0B0F1A);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}
body:not(.loading) .loading-screen {
  opacity: 0;
  transform: scale(1.1);
  pointer-events: none;
}
.loading-logo {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loading-glow {
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,61,84,0.25) 0%, rgba(255,60,172,0.12) 40%, transparent 70%);
  animation: glow-breathe 3s ease-in-out infinite;
  filter: blur(20px);
}
@keyframes glow-breathe {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.6); opacity: 1; }
}
.loading-icon-svg { overflow: visible; }
.icon-stroke {
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  animation: icon-draw 1.8s cubic-bezier(0.65, 0, 0.35, 1) 0.2s forwards;
}
@keyframes icon-draw {
  to { stroke-dashoffset: 0; }
}
.icon-fill {
  opacity: 0;
  animation: icon-reveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) 1.4s forwards;
}
@keyframes icon-reveal {
  from { opacity: 0; filter: blur(4px); }
  to { opacity: 1; filter: blur(0); }
}
.ring-1 {
  animation: ring-draw 1.5s cubic-bezier(0.65, 0, 0.35, 1) forwards, ring-spin 10s linear 1.5s infinite;
  transform-origin: center;
}
@keyframes ring-draw { to { stroke-dashoffset: 0; } }
@keyframes ring-spin { to { transform: rotate(360deg); } }
.loading-text {
  color: rgba(255,255,255,0.5);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.5px;
}
.loading-bar {
  width: 160px;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 100px;
  overflow: hidden;
}
.loading-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--orange), var(--primary));
  background-size: 200% 100%;
  border-radius: 100px;
  animation: loading-fill 1.8s var(--ease-out-expo) forwards, loading-shimmer 1s linear infinite;
}
@keyframes loading-fill { to { width: 100%; } }
@keyframes loading-shimmer { to { background-position: -200% 0; } }

/* ═══════════════════════════════════════════
   ANIMATED MESH BACKGROUND
   ═══════════════════════════════════════════ */
.mesh-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.mesh-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  will-change: transform;
}
.blob-1 {
  width: 400px; height: 400px;
  top: -15%; left: -10%;
  background: radial-gradient(circle, rgba(255,61,84,0.5), transparent 70%);
  animation: blob-float-1 18s ease-in-out infinite;
}
.blob-2 {
  width: 350px; height: 350px;
  top: 10%; right: -15%;
  background: radial-gradient(circle, rgba(59,130,246,0.45), transparent 70%);
  animation: blob-float-2 22s ease-in-out infinite;
}
.blob-3 {
  width: 300px; height: 300px;
  bottom: 20%; left: 20%;
  background: radial-gradient(circle, rgba(124,58,237,0.35), transparent 70%);
  animation: blob-float-3 20s ease-in-out infinite;
}
.blob-4 {
  width: 250px; height: 250px;
  bottom: -10%; right: 10%;
  background: radial-gradient(circle, rgba(16,185,129,0.35), transparent 70%);
  animation: blob-float-4 16s ease-in-out infinite;
}
@keyframes blob-float-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(60px, 40px) scale(1.1); }
  50% { transform: translate(30px, 80px) scale(0.95); }
  75% { transform: translate(-30px, 20px) scale(1.05); }
}
@keyframes blob-float-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-50px, 60px) scale(1.15); }
  66% { transform: translate(-20px, -30px) scale(0.9); }
}
@keyframes blob-float-3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  30% { transform: translate(40px, -50px) scale(1.1); }
  60% { transform: translate(-60px, 30px) scale(0.95); }
}
@keyframes blob-float-4 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  40% { transform: translate(-40px, -40px) scale(1.2); }
  80% { transform: translate(50px, 20px) scale(0.9); }
}
.mesh-noise {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  opacity: 0.4;
}

/* Particle canvas */
.particle-canvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.5;
}

/* ═══════ SCROLL PROGRESS ═══════ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--orange), var(--purple));
  z-index: 10000;
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 12px var(--primary-glow);
}

/* ═══════ STATUS BAR ═══════ */
.status-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1001;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.status-icons { display: flex; gap: 6px; align-items: center; }

/* ═══════ APP HEADER ═══════ */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(60px + var(--safe-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--safe-top) 20px 0;
  z-index: 999;
  background: var(--glass-heavy);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  transition: background 0.3s ease, box-shadow 0.3s ease;
  will-change: transform;
  transform: translateZ(0);
}
.app-header.scrolled {
  background: var(--glass-heavy);
  box-shadow: 0 4px 30px rgba(0,0,0,0.06);
}
.header-left { display: flex; align-items: center; }
.header-right { display: flex; gap: 10px; align-items: center; }

/* Logo */
.blix-logo {
  display: flex;
  align-items: center;
  gap: 5px;
  position: relative;
  padding-right: 2px;
  animation: logo-float 6s ease-in-out infinite;
}
@keyframes logo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1.5px); }
}
.logo-icon {
  flex-shrink: 0;
  color: var(--text);
  transition: transform 0.4s var(--ease-spring), filter 0.4s ease;
}
.blix-logo:hover .logo-icon {
  transform: rotate(-8deg) scale(1.1);
  filter: drop-shadow(0 0 8px rgba(255,61,84,0.4));
}
.logo-wordmark {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1;
}
.logo-b {
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), #FF3CAC, var(--orange));
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: logo-color-shift 5s ease infinite;
}
@keyframes logo-color-shift {
  0%, 100% { background-position: 0% 50%; }
  25% { background-position: 100% 0%; }
  50% { background-position: 50% 100%; }
  75% { background-position: 0% 0%; }
}
.logo-glow-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(ellipse at center, rgba(255,61,84,0.2) 0%, rgba(255,60,172,0.12) 30%, rgba(255,107,53,0.06) 60%, transparent 80%);
  filter: blur(12px);
  animation: glow-pulse 4s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}
@keyframes glow-pulse {
  0%, 100% { opacity: 0; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}
.blix-logo:hover .logo-glow-ring {
  opacity: 1;
  animation: none;
  transform: scale(1.2);
  filter: blur(16px);
  transition: all 0.4s ease;
}
.logo-ai-badge {
  position: absolute;
  top: -4px;
  right: -22px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 2px 5px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  color: white;
  box-shadow: 0 2px 8px rgba(124,58,237,0.3);
}

/* Header buttons */
.header-btn {
  width: 42px; height: 42px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  position: relative;
  overflow: hidden;
  transition: all 0.3s var(--ease-spring);
}
.header-btn:active { transform: scale(0.88); }
.btn-ripple {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255,61,84,0.15), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}
.header-btn:active .btn-ripple { opacity: 1; }
.notif-dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  background: var(--primary);
  border-radius: 50%;
  border: 2px solid white;
  animation: pulse-dot 2s ease infinite;
}
.notif-count {
  position: absolute;
  top: 5px; right: 4px;
  min-width: 16px; height: 16px;
  background: var(--primary);
  color: white;
  border-radius: 100px;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 6px var(--primary-glow);
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 var(--primary-glow); }
  50% { transform: scale(1.2); box-shadow: 0 0 0 6px transparent; }
}
.header-avatar {
  width: 42px; height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--orange));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.3s var(--ease-spring);
  box-shadow: 0 4px 12px var(--primary-glow);
}
.header-avatar span {
  color: white;
  font-weight: 700;
  font-size: 16px;
}
.header-avatar:active { transform: scale(0.88); }
.avatar-status-dot {
  position: absolute;
  bottom: -1px; right: -1px;
  width: 12px; height: 12px;
  background: var(--accent);
  border-radius: 50%;
  border: 2.5px solid white;
  box-shadow: 0 1px 4px var(--accent-glow);
}

/* ═══════ SEARCH OVERLAY ═══════ */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(240,242,248,0.98);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  padding: 60px 20px 20px;
  transform: translateY(-100%);
  opacity: 0;
  transition: all 0.5s var(--ease-out-expo);
}
.search-overlay.active {
  transform: translateY(0);
  opacity: 1;
}
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card-solid);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--glass-border);
}
.search-input {
  flex: 1;
  border: none;
  background: none;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  outline: none;
}
.search-input::placeholder { color: var(--text-muted); }
.search-close {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
}
.search-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}
.search-tag {
  padding: 10px 18px;
  background: var(--bg-card-solid);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
  border: 1px solid var(--border);
}
.search-tag:active {
  transform: scale(0.93);
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ═══════════════════════════════════════════
   MAIN FEED
   ═══════════════════════════════════════════ */
.feed {
  position: relative;
  z-index: 2;
  padding-top: calc(80px + var(--safe-top));
  padding-bottom: 120px;
  min-height: 100vh;
}

/* ─── GRADIENT TEXT ─── */
.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--orange), var(--purple));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 4s ease infinite;
}
@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ═══════ REVEAL ANIMATIONS ═══════ */
.reveal-section {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s var(--ease-smooth), transform 0.8s var(--ease-smooth);
}
.reveal-section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ═══════ HERO ═══════ */
.hero-section {
  padding: 20px 20px 8px;
}
.hero-greeting {
  display: flex;
  align-items: center;
  gap: 14px;
}
.hero-wave {
  font-size: 36px;
  animation: wave-hand 2.5s ease-in-out infinite;
  transform-origin: 70% 70%;
  display: inline-block;
}
@keyframes wave-hand {
  0%, 100% { transform: rotate(0deg); }
  10% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  30% { transform: rotate(14deg); }
  40% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
  60%, 100% { transform: rotate(0deg); }
}
.hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.hero-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
}
.hero-subtitle strong {
  color: var(--primary);
  font-weight: 800;
}
.hero-chips {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.hero-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
}
.hero-chip.active {
  background: linear-gradient(135deg, var(--primary), var(--orange));
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 16px var(--primary-glow);
}
.hero-chip:active { transform: scale(0.93); }
.chip-icon { font-size: 15px; }
.chip-count {
  font-size: 11px;
  font-weight: 800;
  background: rgba(0,0,0,0.08);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}
.hero-chip.active .chip-count {
  background: rgba(255,255,255,0.2);
  color: white;
}
.pulse-badge {
  animation: badge-pulse 2s ease infinite;
}
@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--primary-glow); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

/* ═══════ STORIES ═══════ */
.stories-section {
  padding: 12px 0 8px;
}
.stories-scroll {
  display: flex;
  gap: 14px;
  padding: 0 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 20px;
}
.story-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform 0.3s var(--ease-spring);
}
.story-item:active { transform: scale(0.9); }
.story-ring {
  width: 74px; height: 74px;
  border-radius: 50%;
  padding: 3px;
  background: conic-gradient(from 0deg, var(--primary), var(--orange), var(--purple), var(--blue), var(--primary));
  position: relative;
  transition: transform 0.3s var(--ease-spring);
  overflow: visible;
}
.story-ring.seen {
  background: var(--border);
}
.story-ring.add {
  background: none;
  border: 2.5px dashed var(--text-muted);
}
.story-avatar {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: var(--bg-card-solid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  border: 3px solid var(--bg);
  overflow: visible;
  position: relative;
}
.story-avatar img {
  width: 100%; height: 100%;
  object-fit: contain;
  border-radius: 50%;
  padding: 6px;
}
.add-avatar { background: rgba(255,61,84,0.06); }
.story-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  max-width: 72px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.story-new-badge {
  position: absolute;
  bottom: 0; right: 0;
  width: 20px; height: 20px;
  background: var(--accent);
  border-radius: 50%;
  border: 2.5px solid var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: white;
  font-weight: 800;
  z-index: 5;
  box-shadow: 0 2px 6px var(--accent-glow);
}

/* ═══════ DYNAMIC ISLAND ═══════ */
.dynamic-island {
  margin: 12px 20px 0;
  border-radius: var(--radius-xl);
  position: relative;
  cursor: pointer;
  overflow: hidden;
  background: #0B0F1A;
  transition: all 0.5s var(--ease-spring);
  box-shadow: var(--shadow-xl), 0 0 60px rgba(16,185,129,0.15);
}
.dynamic-island:active { transform: scale(0.97); }
.island-glow {
  position: absolute;
  inset: -2px;
  border-radius: var(--radius-xl);
  background: conic-gradient(from 180deg, var(--accent), var(--blue), var(--accent));
  opacity: 0.6;
  animation: island-rotate 4s linear infinite;
  filter: blur(4px);
  z-index: 0;
}
@keyframes island-rotate {
  to { transform: rotate(360deg); }
}
.island-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: #0B0F1A;
  border-radius: calc(var(--radius-xl) - 2px);
  margin: 2px;
}
.island-pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(16,185,129,0.2);
  animation: island-pulse 2s ease infinite;
}
@keyframes island-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0; transform: scale(1.02); }
}
.island-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 16px var(--accent-glow);
  animation: island-icon-bounce 2s ease infinite;
}
@keyframes island-icon-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
.island-info { flex: 1; min-width: 0; }
.island-title {
  font-size: 13px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.island-detail {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.island-old {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  text-decoration: line-through;
}
.island-arrow {
  font-size: 12px;
  color: rgba(255,255,255,0.3);
}
.island-new {
  font-size: 15px;
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
}
.island-badge {
  font-size: 10px;
  font-weight: 800;
  background: rgba(16,185,129,0.15);
  color: var(--accent);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(16,185,129,0.2);
}
.island-action {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  flex-shrink: 0;
  transition: all 0.3s var(--ease-spring);
}
.island-action:active {
  transform: scale(0.85);
  background: rgba(255,255,255,0.15);
}

/* ═══════ SECTIONS ═══════ */
.section-block {
  margin-top: 32px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  margin-bottom: 16px;
}
.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-icon {
  font-size: 24px;
  width: 44px; height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass);
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
}
.fire-icon {
  animation: fire-dance 1s ease infinite;
}
@keyframes fire-dance {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.1) rotate(-3deg); }
  75% { transform: scale(1.05) rotate(3deg); }
}
.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.section-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--primary);
  border-radius: 50%;
  animation: live-blink 1.5s ease infinite;
}
@keyframes live-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.see-all-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  transition: all 0.3s var(--ease-spring);
}
.see-all-btn svg { transition: transform 0.3s var(--ease-spring); }
.see-all-btn:active { transform: scale(0.93); }
.see-all-btn:active svg { transform: translateX(3px); }

/* ═══════ PRODUCT CARDS ═══════ */
.products-scroll {
  display: flex;
  gap: 14px;
  padding: 0 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 20px;
}
.product-card {
  flex-shrink: 0;
  width: 175px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  scroll-snap-align: start;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  position: relative;
}
.product-card:active {
  transform: scale(0.95) translateY(2px);
  box-shadow: var(--shadow-sm);
}
.product-card-image {
  width: 100%; height: 150px;
  position: relative;
  overflow: hidden;
}
.product-card-image .product-bg {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.product-card-image .product-bg img {
  width: 100%; height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 1;
  transition: transform 0.5s var(--ease-out-expo);
}
.product-card:active .product-bg img {
  transform: scale(1.05);
}
.product-card-image::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 50%;
  background: linear-gradient(to top, rgba(0,0,0,0.15), transparent);
  pointer-events: none;
  z-index: 2;
}
.product-discount-badge {
  position: absolute;
  top: 10px; left: 10px;
  background: var(--primary);
  color: white;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 800;
  z-index: 5;
  box-shadow: 0 4px 16px var(--primary-glow);
  letter-spacing: 0.5px;
}
.product-save-btn {
  position: absolute;
  top: 10px; right: 10px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--bg-card);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease;
  color: var(--text-muted);
  z-index: 5;
}
.product-save-btn:active { transform: scale(0.8); }
.product-save-btn.saved {
  color: var(--primary);
  background: rgba(255,61,84,0.12);
}
.product-card-info {
  padding: 14px 16px 18px;
}
.product-brand {
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.product-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}
.product-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.product-price {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.product-old-price {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: line-through;
}
.product-store-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 5px 12px;
  background: var(--bg);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ═══════ BRANDS GRID ═══════ */
.brands-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px 12px;
  padding: 0 20px;
}
.brand-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.4s var(--ease-spring);
}
.brand-item:active { transform: scale(0.85); }
.brand-icon {
  width: 68px; height: 68px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: visible;
  transition: transform 0.3s ease;
}
.brand-icon:active {
  box-shadow: var(--shadow-lg);
}
.brand-icon-inner {
  width: 100%; height: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-icon img {
  width: 54px; height: 54px;
  object-fit: contain;
  position: relative;
  z-index: 1;
}
.brand-count {
  position: absolute;
  top: -7px; right: -7px;
  min-width: 22px; height: 22px;
  background: linear-gradient(135deg, var(--primary), var(--orange));
  color: white;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 2.5px solid var(--bg);
  z-index: 5;
  box-shadow: 0 2px 8px var(--primary-glow);
}
.brand-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ═══════ RECENTLY VIEWED LEAFLETS ═══════ */
.leaflets-scroll {
  display: flex;
  gap: 16px;
  padding: 0 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 20px;
}
.leaflet-card {
  flex-shrink: 0;
  width: 200px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  cursor: pointer;
  scroll-snap-align: start;
  position: relative;
  transition: all 0.4s var(--ease-spring);
  box-shadow: var(--shadow-lg);
  background: var(--card);
}
.leaflet-card:active { transform: scale(0.95); }
.leaflet-card-cover {
  width: 100%;
  height: 140px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
}
.leaflet-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out-expo);
}
.leaflet-card:active .leaflet-card-cover img {
  transform: scale(1.05);
}
/* Gradient overlay */
.leaflet-card-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
    rgba(0,0,0,0.4) 0%,
    transparent 60%
  );
  z-index: 1;
}
/* Store pill top-left */
.leaflet-store-pill {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-full);
  background: rgba(0,0,0,0.7);
  border: none;
}
.leaflet-store-pill img {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  object-fit: contain;
  background: white;
  padding: 2px;
}
.leaflet-store-pill span {
  font-size: 11px;
  font-weight: 700;
  color: white;
}
/* Progress ring - positioned top-right over cover */
.leaflet-progress-wrap {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.leaflet-progress-bg {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.75);
  border: none;
}
.leaflet-progress-svg {
  width: 52px;
  height: 52px;
  transform: rotate(-90deg);
  position: relative;
  z-index: 1;
}
.leaflet-progress-track {
  fill: none;
  stroke: rgba(255,255,255,0.15);
  stroke-width: 3.5;
}
.leaflet-progress-bar {
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 131.95; /* 2 * PI * 21 */
  stroke-dashoffset: 131.95;
  transition: stroke-dashoffset 1.5s var(--ease-out-expo);
}
.leaflet-progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: white;
  z-index: 2;
}
/* Info bar at bottom */
.leaflet-card-info {
  padding: 14px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.leaflet-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.leaflet-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.leaflet-pages {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}
.leaflet-time-left {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(255,61,84,0.2);
  color: #FF6A7A;
  border: 1px solid rgba(255,61,84,0.25);
}
.leaflet-time-left.ok {
  background: rgba(16,185,129,0.15);
  color: #34D399;
  border-color: rgba(16,185,129,0.25);
}
.leaflet-continue-btn {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 0;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.3s var(--ease-spring);
}
.leaflet-continue-btn:active {
  background: var(--primary);
  filter: brightness(0.85);
  transform: scale(0.95);
}
.leaflet-continue-btn svg {
  transition: transform 0.3s var(--ease-spring);
}
.leaflet-continue-btn:active svg {
  transform: translateX(3px);
}

/* ═══════ AI CARD ═══════ */
.ai-section { padding: 0 20px; }
.ai-card {
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #1E1B4B, #0F172A);
  box-shadow: var(--shadow-xl), 0 0 80px rgba(124,58,237,0.1);
}
.ai-card-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.ai-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
}
.ai-orb-1 {
  width: 200px; height: 200px;
  top: -30%; right: -10%;
  background: rgba(124,58,237,0.4);
  animation: ai-float-1 8s ease-in-out infinite;
}
.ai-orb-2 {
  width: 150px; height: 150px;
  bottom: -20%; left: -5%;
  background: rgba(59,130,246,0.35);
  animation: ai-float-2 10s ease-in-out infinite;
}
.ai-orb-3 {
  width: 100px; height: 100px;
  top: 20%; left: 40%;
  background: rgba(255,61,84,0.25);
  animation: ai-float-3 6s ease-in-out infinite;
}
@keyframes ai-float-1 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-30px, 20px); }
}
@keyframes ai-float-2 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(20px, -30px); }
}
@keyframes ai-float-3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-20px, 10px) scale(1.2); }
}
.ai-card-content {
  position: relative;
  z-index: 1;
  padding: 24px;
}
.ai-header-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.ai-icon-wrap {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  position: relative;
  overflow: hidden;
}
.ai-sparkle {
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
  background-size: 200% 200%;
  animation: ai-shimmer 3s ease-in-out infinite;
}
@keyframes ai-shimmer {
  0% { background-position: -100% -100%; }
  100% { background-position: 200% 200%; }
}
.ai-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: white;
}
.ai-desc {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}
.ai-products {
  display: flex;
  gap: 12px;
  overflow-x: auto;
}
.ai-product-card {
  flex-shrink: 0;
  width: 130px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform 0.3s ease;
  cursor: pointer;
}
.ai-product-card:active { transform: scale(0.93); }
.ai-product-img {
  width: 100%; height: 90px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
}
.ai-product-img img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.ai-product-info {
  padding: 10px 12px 14px;
}
.ai-product-name {
  font-size: 12px;
  font-weight: 600;
  color: white;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ai-product-price {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 6px;
}
.ai-product-match {
  font-size: 10px;
  font-weight: 700;
  color: var(--purple);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ai-product-match::before {
  content: '✦';
  font-size: 8px;
}

/* ═══════ WATCHED PRODUCTS ═══════ */
.watched-count {
  min-width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--accent), #059669);
  color: white;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.watched-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 20px;
}
.watched-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.4s var(--ease-spring);
  position: relative;
  overflow: hidden;
  border-left: 4px solid transparent;
  opacity: 0;
  transform: translateX(-20px);
  animation: watched-slide-in 0.6s var(--ease-smooth) forwards;
}
.watched-card:nth-child(1) { animation-delay: 0.1s; }
.watched-card:nth-child(2) { animation-delay: 0.2s; }
.watched-card:nth-child(3) { animation-delay: 0.3s; }
.watched-card:nth-child(4) { animation-delay: 0.4s; }
.watched-card:nth-child(5) { animation-delay: 0.5s; }
@keyframes watched-slide-in {
  to { opacity: 1; transform: translateX(0); }
}
.watched-card:active { transform: scale(0.97) translateX(0); }
.watched-card.price-drop { border-left-color: var(--accent); }
.watched-card.price-up { border-left-color: #FF3B5C; }
.watched-card.new-offer { border-left-color: var(--orange); }
.watched-card.back-in-stock { border-left-color: var(--purple); }
.watched-product-image {
  width: 56px; height: 56px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 4px;
}
.watched-product-image img {
  width: 100%; height: 100%;
  object-fit: contain;
}
.watched-product-info { flex: 1; min-width: 0; }
.watched-product-alert {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 4px;
}
.watched-product-alert.drop { background: rgba(16,185,129,0.1); color: var(--accent); }
.watched-product-alert.up { background: rgba(255,59,92,0.1); color: #FF3B5C; }
.watched-product-alert.new { background: rgba(255,107,53,0.1); color: var(--orange); }
.watched-product-alert.stock { background: rgba(124,58,237,0.1); color: var(--purple); }
.watched-product-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.watched-product-store {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.watched-product-price { flex-shrink: 0; text-align: right; }
.watched-current-price {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.watched-old-price {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: line-through;
}

/* ═══════ LOYALTY CARDS ═══════ */
.loyalty-scroll {
  display: flex;
  gap: 14px;
  padding: 0 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 20px;
}
.loyalty-card {
  flex-shrink: 0;
  width: 290px;
  height: 175px;
  border-radius: var(--radius-xl);
  position: relative;
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform 0.3s ease;
  perspective: 1000px;
}
.loyalty-card:active { transform: scale(0.96); }
.loyalty-card-inner {
  width: 100%; height: 100%;
  position: relative;
  transition: transform 0.6s var(--ease-out-expo);
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}
.loyalty-card.flipped .loyalty-card-inner {
  transform: rotateY(180deg);
}
.loyalty-card.flipped .loyalty-front { opacity: 0; }
.loyalty-card.flipped .loyalty-back { opacity: 1; }
.loyalty-front, .loyalty-back {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  padding: 22px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.3s ease;
}
.loyalty-front {
  opacity: 1;
  z-index: 2;
  justify-content: space-between;
}
.loyalty-back {
  opacity: 0;
  z-index: 1;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.loyalty-front {
  justify-content: space-between;
}
.loyalty-front::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  border-radius: var(--radius-xl);
}
.loyalty-store-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: white;
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.loyalty-card-number {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  letter-spacing: 2px;
  position: relative;
  z-index: 1;
  font-variant-numeric: tabular-nums;
}
.loyalty-points-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}
.loyalty-points {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 30px;
  font-weight: 700;
  color: white;
  line-height: 1;
}
.loyalty-points-label {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  font-weight: 500;
}
.loyalty-tap-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  font-weight: 500;
}
.loyalty-barcode {
  width: 180px; height: 60px;
  background: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  gap: 1px;
}
.barcode-line {
  height: 48px;
  background: #000;
}
.loyalty-barcode-number {
  font-size: 13px;
  font-weight: 600;
  color: white;
  letter-spacing: 2px;
}
.loyalty-decorative {
  position: absolute;
  border-radius: 50%;
  opacity: 0.15;
  z-index: 0;
  background: white;
}
.loyalty-decorative.d1 { width: 130px; height: 130px; top: -35px; right: -25px; }
.loyalty-decorative.d2 { width: 90px; height: 90px; bottom: -40px; left: -20px; }

/* ═══════ SPENDING ═══════ */
.spending-section { margin-bottom: 20px; }
.period-toggle {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-full);
  padding: 3px;
  position: relative;
}
.period-btn {
  padding: 7px 18px;
  border: none;
  background: none;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.3s var(--ease-spring);
  position: relative;
  z-index: 1;
}
.period-btn.active {
  color: white;
}
.period-slider {
  position: absolute;
  top: 3px; bottom: 3px; left: 3px;
  width: calc(50% - 3px);
  background: linear-gradient(135deg, var(--primary), var(--orange));
  border-radius: var(--radius-full);
  transition: transform 0.4s var(--ease-spring);
  box-shadow: 0 2px 10px var(--primary-glow);
}
.period-toggle .period-btn:last-of-type.active ~ .period-slider,
.period-toggle:has(.period-btn:last-of-type.active) .period-slider {
  transform: translateX(100%);
}
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
}
.spending-card {
  margin: 0 20px;
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  box-shadow: var(--shadow-md);
}
.spending-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}
.spending-total { display: flex; flex-direction: column; gap: 4px; }
.spending-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.spending-amount {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--text);
}
.spending-change {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
}
.spending-change.positive { color: var(--accent); }
.spending-change.negative { color: #FF3B5C; }
.spending-saved {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.saved-circle {
  width: 84px; height: 84px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.saved-ring-svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}
.saved-ring-bg {
  fill: none;
  stroke: var(--bg);
  stroke-width: 7;
}
.saved-ring-fill {
  fill: none;
  stroke: url(#savedGrad);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 264;
  stroke-dashoffset: 264;
  transition: stroke-dashoffset 1.8s var(--ease-out-expo);
  filter: drop-shadow(0 0 8px var(--accent-glow));
}
.saved-inner {
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.saved-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}
.saved-unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}
.saved-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}
.spending-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 110px;
  gap: 8px;
  margin-bottom: 20px;
  padding: 0 4px;
}
.chart-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
}
.chart-bar-container {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.chart-bar {
  width: 100%;
  max-width: 34px;
  border-radius: 10px 10px 4px 4px;
  transition: height 1.2s var(--ease-out-expo);
  position: relative;
  cursor: pointer;
}
.chart-bar:hover::after, .chart-bar:active::after {
  content: attr(data-value);
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  background: var(--bg-card-solid);
  padding: 3px 10px;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}
.chart-bar.today {
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  box-shadow: 0 4px 16px var(--primary-glow);
}
.chart-bar.normal {
  background: linear-gradient(180deg, #E0E4EC, #CBD0DC);
}
.chart-day {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}
.chart-day.today {
  color: var(--primary);
  font-weight: 700;
}
.spending-categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.category-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
}
.category-pill:active { transform: scale(0.93); }
.category-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.category-amount {
  font-weight: 700;
  color: var(--text);
}

/* ═══════ STORY VIEWER ═══════ */
.story-viewer {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-out-expo);
}
.story-viewer.active { opacity: 1; pointer-events: auto; }
.story-viewer-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 50px 16px 16px;
  z-index: 10;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
}
.story-progress-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}
.progress-segment {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.3);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-segment .progress-fill {
  height: 100%;
  background: white;
  border-radius: var(--radius-full);
  width: 0;
  transition: width 0.1s linear;
}
.progress-segment.completed .progress-fill { width: 100%; }
.story-viewer-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.story-viewer-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: white;
  border: 2px solid white;
}
.story-viewer-name { font-size: 14px; font-weight: 700; color: white; }
.story-viewer-time { font-size: 12px; color: rgba(255,255,255,0.6); }
.story-viewer-close {
  position: absolute;
  top: 50px; right: 16px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.story-viewer-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.story-slide { text-align: center; color: white; }
.story-slide-image {
  width: 200px; height: 200px;
  object-fit: contain;
  margin: 0 auto 20px;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.3));
  animation: story-pop 0.4s var(--ease-spring);
}
@keyframes story-pop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.story-slide-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
}
.story-slide-desc {
  font-size: 15px;
  color: rgba(255,255,255,0.7);
  line-height: 1.5;
}
.story-slide-price {
  margin-top: 16px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 38px;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 30px var(--accent-glow);
}
.story-slide-cta {
  margin-top: 20px;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--primary), var(--orange));
  border: none;
  border-radius: var(--radius-full);
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 20px var(--primary-glow);
  transition: transform 0.3s var(--ease-spring);
}
.story-slide-cta:active { transform: scale(0.93); }
.story-viewer-actions {
  position: absolute;
  bottom: 40px; left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 24px;
}
.story-action-btn {
  width: 50px; height: 50px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
}
.story-action-btn:active {
  transform: scale(0.85);
  background: rgba(255,255,255,0.2);
}

/* ═══════ SECTION HIGHLIGHT ON NAV CLICK ═══════ */
.section-highlight {
  animation: sectionFlash 1.2s ease-out;
}
@keyframes sectionFlash {
  0%   { box-shadow: 0 0 0 0 rgba(255,61,84,0.3); }
  30%  { box-shadow: 0 0 0 6px rgba(255,61,84,0.15); }
  100% { box-shadow: 0 0 0 0 rgba(255,61,84,0); }
}

/* ═══════ BOTTOM NAVIGATION ═══════ */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 1000;
  padding-bottom: var(--safe-bottom);
  will-change: transform;
  transform: translateZ(0);
}
.nav-bg-blur {
  position: absolute;
  inset: 0;
  background: var(--glass-heavy);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
}
.nav-items {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding: 8px 0 8px;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 2px 8px;
  font-family: inherit;
  transition: all 0.3s var(--ease-spring);
  flex: 1;
  position: relative;
}
.nav-item span {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1;
  transition: all 0.3s;
}
.nav-item.active span { color: var(--primary); font-weight: 700; }
.nav-icon-wrap {
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.3s var(--ease-spring);
}
.nav-item.active .nav-icon-wrap { color: var(--primary); transform: translateY(-2px); }
.nav-indicator {
  position: absolute;
  top: -1px;
  width: 20px; height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--primary);
  opacity: 0;
  transform: scaleX(0);
  transition: all 0.3s var(--ease-spring);
}
.nav-item.active .nav-indicator {
  opacity: 1;
  transform: scaleX(1);
}
.nav-center-btn {
  width: 58px; height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--orange));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px var(--primary-glow);
  margin-top: -24px;
  transition: all 0.3s var(--ease-spring);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.nav-center-ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  animation: center-ring-pulse 2s ease infinite;
}
@keyframes center-ring-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0; }
}
.nav-item.nav-center:active .nav-center-btn {
  transform: scale(0.88);
}

.bottom-spacer { height: 100px; }

/* ═══════ MAGNETIC BTN (handled by JS) ═══════ */
.magnetic-btn {
  transition: transform 0.25s var(--ease-spring);
}

/* ═══════ RESPONSIVE ═══════ */
@media (min-width: 430px) {
  body {
    max-width: 430px;
    margin: 0 auto;
    box-shadow: -1px 0 0 var(--border), 1px 0 0 var(--border);
    position: relative;
  }
  .status-bar, .app-header, .bottom-nav, .search-overlay, .story-viewer {
    width: 430px;
    max-width: 430px;
    margin: 0 auto;
    left: 50%; right: auto;
    transform: translateX(-50%);
  }
  .search-overlay.active { transform: translateX(-50%) translateY(0); }
  .search-overlay { transform: translateX(-50%) translateY(-100%); }
  .scroll-progress { max-width: 430px; left: 50%; transform: translateX(-50%); }
}

/* ═══════ iOS PERFORMANCE ═══════ */
@supports (-webkit-touch-callout: none) {
  .mesh-blob { animation-duration: 30s !important; }
  .app-header { -webkit-transform: translateZ(0); }
  .bottom-nav { -webkit-transform: translateZ(0); }
}
@media (max-width: 768px) {
  .mesh-blob { opacity: 0.25; }
  .mesh-noise { display: none; }
}

/* ═══════ DARK THEME ═══════ */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #08090E;
    --bg-card: rgba(22,25,35,0.82);
    --bg-card-solid: #161923;
    --glass: rgba(22,25,35,0.55);
    --glass-border: rgba(255,255,255,0.06);
    --glass-heavy: rgba(12,14,20,0.85);
    --text: #F0F1F5;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    --border: rgba(255,255,255,0.06);
  }
  .status-bar { color: white; }
  .app-header.scrolled {
    background: rgba(12,14,20,0.95);
  }
  .chart-bar.normal {
    background: linear-gradient(180deg, #2A2D3A, #1F2230);
  }
  .brand-count, .story-new-badge {
    border-color: var(--bg);
  }
  .story-avatar {
    border-color: var(--bg);
  }
  .notif-dot { border-color: var(--bg-card-solid); }
  .avatar-status-dot { border-color: var(--bg-card-solid); }
  .search-overlay { background: rgba(8,9,14,0.97); }
  .nav-bg-blur { background: rgba(12,14,20,0.88); border-top-color: rgba(255,255,255,0.06); }
}
