/* ============================================
   TAP DESIGN TOKENS v3.0
   Single source of truth for all TAP styling.
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* ============ BACKGROUNDS ============ */
  --bg-base:        #050508;
  --bg-surface:     #0A0A0F;
  --bg-elevated:    #11121A;
  --bg-overlay:     #1A1B26;
  --bg-hover:       #22232E;

  /* ============ BRAND & STATUS ============ */
  --green-primary:  #4ADE80;
  --green-glow:     #22C55E;
  --green-soft:     rgba(74, 222, 128, 0.08);
  --green-border:   rgba(74, 222, 128, 0.22);
  --green-bright:   #6EE7A0;

  --blue-info:      #60A5FA;
  --blue-glow:      #3B82F6;
  --blue-soft:      rgba(96, 165, 250, 0.08);
  --blue-border:    rgba(96, 165, 250, 0.22);

  --red-danger:     #F87171;
  --red-glow:       #EF4444;
  --red-soft:       rgba(248, 113, 113, 0.08);
  --red-border:     rgba(248, 113, 113, 0.22);

  --amber-warn:     #FBBF24;
  --amber-glow:     #F59E0B;
  --amber-soft:     rgba(251, 191, 36, 0.08);
  --amber-border:   rgba(251, 191, 36, 0.22);

  /* ============ METAL — POLISHED SILVER ============ */
  /* Used for neutral premium zones, not as status color */
  --metal-light:    #F5F7FA;
  --metal-mid:      #C0C5CE;
  --metal-dark:     #6B7280;
  --metal-shadow:   #9CA3AF;
  --metal-soft:     rgba(192, 197, 206, 0.06);
  --metal-border:   rgba(200, 210, 220, 0.18);
  --metal-glow:     rgba(200, 210, 220, 0.20);

  /* ============ TEXT ============ */
  --text-primary:   #F0F0F5;
  --text-secondary: #9CA0AE;
  --text-tertiary:  #6B7080;
  --text-muted:     #4A4E5A;

  /* ============ BORDERS ============ */
  --border-subtle:  rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.10);
  --border-strong:  rgba(255, 255, 255, 0.18);

  /* ============ LIQUID GLASS ============ */
  --glass-blur:        24px;
  --glass-saturate:    180%;
  --glass-edge-light:  rgba(255, 255, 255, 0.15);
  --glass-edge-dark:   rgba(0, 0, 0, 0.2);
  --glass-highlight:   rgba(255, 255, 255, 0.04);
  --glass-bg-gradient: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.02) 50%, rgba(0,0,0,0.1) 100%);

  /* ============ TYPOGRAPHY ============ */
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Sora', 'Inter', sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', Menlo, monospace;
  --font-numbers: 'Manrope', 'Inter', sans-serif;

  --text-xs:      11px;
  --text-sm:      13px;
  --text-base:    14px;
  --text-md:      16px;
  --text-lg:      20px;
  --text-xl:      28px;
  --text-2xl:     40px;
  --text-hero:    64px;

  --leading-tight:   1.2;
  --leading-normal:  1.5;
  --leading-relaxed: 1.6;

  --tracking-tight:   -0.04em;
  --tracking-normal:  0;
  --tracking-wide:    0.06em;
  --tracking-wider:   0.10em;
  --tracking-widest:  0.16em;

  /* ============ SPACING ============ */
  --space-1:   4px;
  --space-2:   8px;
  --space-3:   12px;
  --space-4:   16px;
  --space-5:   20px;
  --space-6:   24px;
  --space-8:   32px;
  --space-10:  40px;
  --space-12:  48px;
  --space-16:  64px;
  --space-20:  80px;

  /* ============ RADIUS ============ */
  --radius-sm:    6px;
  --radius-md:    10px;
  --radius-lg:    14px;
  --radius-xl:    20px;
  --radius-2xl:   28px;
  --radius-full:  9999px;

  /* ============ SHADOWS ============ */
  --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg:  0 12px 32px rgba(0, 0, 0, 0.6);
  --shadow-xl:  0 24px 48px rgba(0, 0, 0, 0.7);

  /* ============ GLOW ============ */
  --glow-green: 0 0 24px rgba(74, 222, 128, 0.25), 0 0 48px rgba(74, 222, 128, 0.10);
  --glow-blue:  0 0 24px rgba(96, 165, 250, 0.25), 0 0 48px rgba(96, 165, 250, 0.10);
  --glow-red:   0 0 24px rgba(248, 113, 113, 0.25), 0 0 48px rgba(248, 113, 113, 0.10);
  --glow-amber: 0 0 24px rgba(251, 191, 36, 0.20);

  /* HERO NUMBER GLOW */
  --hero-glow-green: drop-shadow(0 0 32px rgba(74,222,128,0.45)) drop-shadow(0 0 64px rgba(74,222,128,0.2));
  --hero-glow-red:   drop-shadow(0 0 32px rgba(248,113,113,0.45)) drop-shadow(0 0 64px rgba(248,113,113,0.2));
  --hero-glow-amber: drop-shadow(0 0 32px rgba(251,191,36,0.45)) drop-shadow(0 0 64px rgba(251,191,36,0.2));

  /* ============ MOTION ============ */
  --ease-out:    cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in:     cubic-bezier(0.4, 0, 1, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --duration-fast:    150ms;
  --duration-normal:  250ms;
  --duration-slow:    400ms;
  --duration-slower:  600ms;

  /* ============ Z-INDEX ============ */
  --z-base:     1;
  --z-elevated: 10;
  --z-sticky:   100;
  --z-overlay:  1000;
  --z-modal:    2000;
  --z-toast:    3000;
}

/* ============================================
   BASE STYLES
   ============================================ */

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}

.tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

/* ============================================
   LIQUID GLASS — TAP SIGNATURE
   ============================================ */

.tap-liquid-glass {
  position: relative;
  background: var(--glass-bg-gradient);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow:
    inset 0 1px 0 var(--glass-edge-light),
    inset 0 -1px 0 var(--glass-edge-dark),
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.tap-liquid-glass::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, var(--glass-highlight) 0%, transparent 100%);
  pointer-events: none;
  z-index: 1;
}

.tap-liquid-glass > * {
  position: relative;
  z-index: 2;
}

.tap-liquid-glass-green {
  position: relative;
  background: var(--glass-bg-gradient);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--green-border);
  border-radius: var(--radius-xl);
  box-shadow:
    inset 0 1px 0 var(--glass-edge-light),
    inset 0 0 32px rgba(74, 222, 128, 0.06),
    inset 0 -1px 0 var(--glass-edge-dark),
    0 0 32px rgba(74, 222, 128, 0.12),
    0 8px 32px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.tap-liquid-glass-green::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, var(--glass-highlight) 0%, transparent 100%);
  pointer-events: none;
  z-index: 1;
}

.tap-liquid-glass-green > * {
  position: relative;
  z-index: 2;
}

.tap-liquid-glass-blue {
  position: relative;
  background: var(--glass-bg-gradient);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--blue-border);
  border-radius: var(--radius-xl);
  box-shadow:
    inset 0 1px 0 var(--glass-edge-light),
    inset 0 0 32px rgba(96, 165, 250, 0.06),
    inset 0 -1px 0 var(--glass-edge-dark),
    0 0 32px rgba(96, 165, 250, 0.12),
    0 8px 32px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.tap-liquid-glass-blue::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, var(--glass-highlight) 0%, transparent 100%);
  pointer-events: none;
  z-index: 1;
}

.tap-liquid-glass-blue > * {
  position: relative;
  z-index: 2;
}

.tap-liquid-glass-red {
  position: relative;
  background: var(--glass-bg-gradient);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--red-border);
  border-radius: var(--radius-xl);
  box-shadow:
    inset 0 1px 0 var(--glass-edge-light),
    inset 0 0 32px rgba(248, 113, 113, 0.06),
    inset 0 -1px 0 var(--glass-edge-dark),
    0 0 32px rgba(248, 113, 113, 0.12),
    0 8px 32px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.tap-liquid-glass-red::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, var(--glass-highlight) 0%, transparent 100%);
  pointer-events: none;
  z-index: 1;
}

.tap-liquid-glass-red > * {
  position: relative;
  z-index: 2;
}

.tap-liquid-glass-amber {
  position: relative;
  background: var(--glass-bg-gradient);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--amber-border);
  border-radius: var(--radius-xl);
  box-shadow:
    inset 0 1px 0 var(--glass-edge-light),
    inset 0 0 32px rgba(251, 191, 36, 0.06),
    inset 0 -1px 0 var(--glass-edge-dark),
    0 0 32px rgba(251, 191, 36, 0.12),
    0 8px 32px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.tap-liquid-glass-amber::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, var(--glass-highlight) 0%, transparent 100%);
  pointer-events: none;
  z-index: 1;
}

.tap-liquid-glass-amber > * {
  position: relative;
  z-index: 2;
}

/* METAL — polished silver liquid glass
   Premium neutral surface. Used for: settings, profile, achievements,
   subscription tiers, premium-tier cards.
   Has a slow shimmer animation across the surface (10s cycle). */
.tap-liquid-glass-metal {
  position: relative;
  background: linear-gradient(
    135deg,
    rgba(220, 225, 235, 0.08) 0%,
    rgba(180, 185, 195, 0.04) 50%,
    rgba(100, 105, 115, 0.06) 100%
  );
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--metal-border);
  border-radius: var(--radius-xl);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 0 32px rgba(200, 210, 220, 0.05),
    inset 0 -1px 0 var(--glass-edge-dark),
    0 0 32px rgba(200, 210, 220, 0.10),
    0 8px 32px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.tap-liquid-glass-metal::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06) 0%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 1;
}

/* Shimmer sweep across metal surface */
.tap-liquid-glass-metal::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 50%,
    transparent 100%
  );
  transform: skewX(-20deg);
  animation: tap-metal-sweep 10s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes tap-metal-sweep {
  0%, 100% { left: -100%; }
  50%      { left: 200%; }
}

.tap-liquid-glass-metal > * {
  position: relative;
  z-index: 2;
}

/* ============================================
   HERO NUMBERS — SIGNATURE TYPOGRAPHY
   JetBrains Mono Bold — premium financial terminal feel
   ============================================ */

.tap-hero-number {
  font-family: var(--font-numbers);
  font-weight: 800;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 0.95;
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

.tap-hero-number-green {
  font-family: var(--font-numbers);
  font-weight: 800;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 0.95;
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  background: linear-gradient(180deg, #6EE7A0 0%, #22C55E 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: var(--hero-glow-green);
}

.tap-hero-number-red {
  font-family: var(--font-numbers);
  font-weight: 800;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 0.95;
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  background: linear-gradient(180deg, #FCA5A5 0%, #EF4444 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: var(--hero-glow-red);
}

.tap-hero-number-amber {
  font-family: var(--font-numbers);
  font-weight: 800;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 0.95;
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  background: linear-gradient(180deg, #FCD34D 0%, #F59E0B 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: var(--hero-glow-amber);
}

.tap-hero-number-white {
  font-family: var(--font-numbers);
  font-weight: 800;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 0.95;
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  background: linear-gradient(180deg, #FFFFFF 0%, #C8CDD7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* METAL — polished silver hero numbers
   For neutral premium metrics (Equity, Balance, Volume).
   Use this when number is important but emotionally neutral. */
.tap-hero-number-metal {
  font-family: var(--font-numbers);
  font-weight: 800;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 0.95;
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  background: linear-gradient(
    180deg,
    var(--metal-light) 0%,
    var(--metal-mid) 45%,
    var(--metal-dark) 70%,
    var(--metal-shadow) 100%
  );
  background-size: 100% 200%;
  background-position: 0% 0%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 24px rgba(200, 210, 220, 0.20));
  animation: tap-metal-shimmer 6s ease-in-out infinite;
}

@keyframes tap-metal-shimmer {
  0%, 100% { background-position: 0% 0%; }
  50%      { background-position: 0% 100%; }
}

.tap-display-number {
  font-family: var(--font-numbers);
  font-weight: 700;
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
  font-variant-numeric: tabular-nums;
}

.tap-metric-number {
  font-family: var(--font-numbers);
  font-weight: 600;
  font-size: var(--text-xl);
  line-height: var(--leading-tight);
  font-variant-numeric: tabular-nums;
}

.tap-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* ============================================
   PULSE GLOW — LIVE DATA
   ============================================ */

@keyframes tap-pulse-glow-green {
  0%, 100% {
    box-shadow:
      inset 0 1px 0 var(--glass-edge-light),
      inset 0 0 32px rgba(74, 222, 128, 0.06),
      0 0 32px rgba(74, 222, 128, 0.12),
      0 8px 32px rgba(0, 0, 0, 0.4);
  }
  50% {
    box-shadow:
      inset 0 1px 0 var(--glass-edge-light),
      inset 0 0 48px rgba(74, 222, 128, 0.12),
      0 0 48px rgba(74, 222, 128, 0.25),
      0 8px 32px rgba(0, 0, 0, 0.4);
  }
}

@keyframes tap-pulse-glow-red {
  0%, 100% {
    box-shadow:
      inset 0 1px 0 var(--glass-edge-light),
      inset 0 0 32px rgba(248, 113, 113, 0.06),
      0 0 32px rgba(248, 113, 113, 0.12),
      0 8px 32px rgba(0, 0, 0, 0.4);
  }
  50% {
    box-shadow:
      inset 0 1px 0 var(--glass-edge-light),
      inset 0 0 48px rgba(248, 113, 113, 0.12),
      0 0 48px rgba(248, 113, 113, 0.25),
      0 8px 32px rgba(0, 0, 0, 0.4);
  }
}

.tap-pulse-green {
  animation: tap-pulse-glow-green 2.4s var(--ease-out) infinite;
}

.tap-pulse-red {
  animation: tap-pulse-glow-red 1.8s var(--ease-out) infinite;
}

/* ============================================
   LIGHT STREAK — APPLE-STYLE PREMIUM
   ============================================ */

.tap-light-streak {
  position: relative;
  overflow: hidden;
}

.tap-light-streak::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.06),
    transparent
  );
  transform: skewX(-20deg);
  animation: tap-streak 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes tap-streak {
  0%, 100% { left: -100%; }
  50% { left: 200%; }
}

/* ============================================
   AURORA BACKGROUND — ANIMATED GRADIENTS
   ============================================ */

.tap-aurora {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.tap-aurora::before,
.tap-aurora::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: tap-aurora-drift 18s ease-in-out infinite;
}

.tap-aurora::before {
  top: -20%;
  left: -10%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(74, 222, 128, 0.18), transparent 70%);
}

.tap-aurora::after {
  bottom: -20%;
  right: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.14), transparent 70%);
  animation-delay: -9s;
}

@keyframes tap-aurora-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(15%, -10%) scale(1.1); }
  66% { transform: translate(-10%, 15%) scale(0.95); }
}

/* ============================================
   HOVER LIFT
   ============================================ */

.tap-lift {
  transition: transform var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
}

.tap-lift:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

/* ============================================
   SCROLLBAR & SELECTION
   ============================================ */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

::selection {
  background: rgba(74, 222, 128, 0.25);
  color: var(--text-primary);
}

/* ============================================
   MOBILE — GPU OPTIMIZATIONS
   ============================================ */

@media (max-width: 640px) {
  /* Reduce aurora cost on mobile */
  .tap-aurora::before,
  .tap-aurora::after {
    filter: blur(40px);
    opacity: 0.35;
  }
  .tap-aurora::after {
    /* hide second orb on mobile to save GPU */
    display: none;
  }

  /* Reduce backdrop-filter cost */
  .tap-liquid-glass,
  .tap-liquid-glass-green,
  .tap-liquid-glass-blue,
  .tap-liquid-glass-red,
  .tap-liquid-glass-amber {
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
  }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
